def __init__(self, neuron_path): self.env = Environment() self.shell = Shell() self.neuron_path = neuron_path job_name = 'job_{0}'.format(self.env.get_env()) self.build_generator = BuildGenerator() self.job_generator = JobGenerator(job_name)
def checkifexist(self, repo="", option=""): """ Method to check whether given repo is a svn repo """ repo = self._check_repo(repo) command = ["svn info", repo, option, self.svn_option] if Shell().execute(" ".join(command)): return True return False
def setup(self): self.shell = Shell() self.temp_dir = mkdtemp(prefix="mubench-checkout-local_") self.local_url = join(self.temp_dir, "origin") os.makedirs(self.local_url) open(join(self.local_url, "some.file"), "w").close() self.checkouts_dir = join(self.temp_dir, "checkouts")
def package(self): self.extract_7zfiles() if Shell().execute("source .property && make linsup.core -j24"): self.logger.info("Successfully package with bitbake result") self.bitbake_content_check() else: self.logger.error("Error to package with bitbake result, command is make linsup.core") self.is_recovered_bitbake = False self.mail_content_recover.write("Error to package with bitbake result for package {}\n".format(self.baseline)) self.mail_content_recover.write("Package command is make linsup.core")
def bitbake_content_check(self): self.is_bitbake_content_fine = True self.mail_content_bitbake_content = StringIO() if self.config.get("bitbakeContentCheck", False): package_path = self.config.get("packagePath", "") if package_path == "": self.logger.warning("packagePath not configed, ignore bitbake content check for {}".format(self.baseline)) return official_hashContainer = os.path.join(package_path, "HashContainer_{}.txt".format(self.baseline)) self.copy_official_hashContainer_to_current_folder(official_hashContainer) self.remove_ignore_lines("HashContainer_{}.txt".format(self.baseline)) current_hashContainer = "lteDo/package/btssm/bts_sw/HashContainer_{}.txt".format(self.baseline) self.remove_ignore_lines(current_hashContainer) result = Shell().execute("diff {} {}".format("HashContainer_{}.txt".format(self.baseline), current_hashContainer), errorOuput=True) if isinstance(result, list) and result[0] != 0: self.is_bitbake_content_fine = False self.mail_content_bitbake_content.write(result[1])
def externals(self, file, option=""): file = self._check_repo(file) command = ["svn pg svn:externals", file, option, self.svn_option] result = Shell().execute(" ".join(command)) return result
def export(self, file, option=""): file = self._check_repo(file) command = ["svn export", file, option, self.svn_option] result = Shell().execute(" ".join(command)) return result
def __init__(self): self.shell = Shell()
def extract_7zfiles(self): for file in self.all_7zfiles: Shell().execute("7za x {} -yo'{}'".format(file, "lteDo")) self.logger.info("Extract {} done".format(file))
def remove_ignore_lines(self, file): Shell().execute("sed -i '/TargetBD/d' {}".format(file))
def copy_official_hashContainer_to_current_folder(self, official_path): Shell().execute("cp {} .".format(official_path))
def __init__(self, src, opts, env): self.src = src self.opts = opts self.env = env self.shell = Shell(self.src, self.env)