def run_install(self): utils.xterm_title("(%s/%s) lpms: installing %s/%s-%s from %s" % (self.environment.index, self.environment.count, self.environment.category, self.environment.name, self.environment.version, self.environment.repo)) out.normal("installing %s to %s" % (self.environment.fullname, self.environment.install_dir)) installed_file = os.path.join(os.path.dirname(os.path.dirname( self.environment.build_dir)), ".installed") if os.path.isfile(installed_file) and self.environment.resume_build: out.warn_notify("%s had been already installed." % self.environment.fullname) return True lpms.logger.info("installing to %s" % self.environment.build_dir) self.run_stage("install") if self.environment.docs is not None: for doc in self.environment.docs: if isinstance(doc, list) or isinstance(doc, tuple): source_file, target_file = doc namestr = self.environment.fullname if self.environment.slot != "0" else self.environment.name target = self.environment.fix_target_path("/usr/share/doc/%s/%s" % (namestr, target_file)) source = os.path.join(self.environment.build_dir, source_file) # self.environment.index, insfile(source, target) #else: # self.environment.index, insdoc(doc) out.notify("%s has been installed." % self.environment.fullname) if not os.path.isfile(installed_file): touch(installed_file) if self.environment.stage == "install": lpms.terminate()
def run_configure(self): utils.xterm_title("(%s/%s) lpms: configuring %s/%s-%s from %s" % (self.environment.index, self.environment.count, self.environment.category, self.environment.name, self.environment.version, self.environment.repo)) out.normal("configuring source in %s" % self.environment.build_dir) configured_file = os.path.join( os.path.dirname(os.path.dirname(self.environment.build_dir)), ".configured") if os.path.isfile(configured_file) and self.environment.resume_build: out.warn_notify("%s had been already configured." % self.environment.fullname) return True lpms.logger.info("configuring in %s" % self.environment.build_dir) self.run_stage("configure") out.notify("%s has been configured." % self.environment.fullname) if not os.path.isfile(configured_file): touch(configured_file) if self.environment.stage == "configure": lpms.terminate()
def run_extract(self): # if the environment has no extract_plan variable, doesn't run extract function if not hasattr(self.environment, "extract_nevertheless" ) or not self.environment.extract_nevertheless: if not hasattr(self.environment, "extract_plan"): return target = os.path.dirname(self.environment.build_dir) extracted_file = os.path.join(os.path.dirname(target), ".extracted") if os.path.isfile(extracted_file): if self.environment.force_extract: shelltools.remove_file(extracted_file) else: out.write("%s %s/%s-%s had been already extracted.\n" % (out.color(">>", "brightyellow"), \ self.environment.category, self.environment.name, self.environment.version)) return True utils.xterm_title("lpms: extracting %s/%s/%s-%s" % (self.environment.repo, self.environment.category, \ self.environment.name, self.environment.version)) out.notify("extracting archive(s) to %s" % os.path.dirname(self.environment.build_dir)) # now, extract the archives self.run_stage("extract") out.notify("%s has been extracted." % self.environment.fullname) shelltools.touch(extracted_file) if self.environment.stage == "extract": lpms.terminate()
def run_pre_merge(self): out.normal("preparing system for the package...") pre_merge_file = os.path.join(os.path.dirname(os.path.dirname(self.environment.build_dir)), ".pre_merge") if os.path.isfile(pre_merge_file): return True lpms.logger.info("running pre_merge function") # sandbox must be disabled self.environment.sandbox = False self.run_stage("pre_merge") if not os.path.isfile(pre_merge_file): touch(pre_merge_file)
def run_prepare(self): out.normal("preparing source...") prepared_file = os.path.join(os.path.dirname(os.path.dirname(self.environment.build_dir)), ".prepared") if os.path.isfile(prepared_file): out.warn_notify("%s had been already prepared." % self.environment.fullname) return True self.run_stage("prepare") out.notify("%s has been prepared." % self.environment.fullname) if not os.path.isfile(prepared_file): touch(prepared_file) if self.environment.stage == "prepare": lpms.terminate()
def run_pre_merge(self): out.normal("preparing system for the package...") pre_merge_file = os.path.join( os.path.dirname(os.path.dirname(self.environment.build_dir)), ".pre_merge") if os.path.isfile(pre_merge_file): return True lpms.logger.info("running pre_merge function") # sandbox must be disabled self.environment.sandbox = False self.run_stage("pre_merge") if not os.path.isfile(pre_merge_file): touch(pre_merge_file)
def run_prepare(self): out.normal("preparing source...") prepared_file = os.path.join( os.path.dirname(os.path.dirname(self.environment.build_dir)), ".prepared") if os.path.isfile(prepared_file): out.warn_notify("%s had been already prepared." % self.environment.fullname) return True self.run_stage("prepare") out.notify("%s has been prepared." % self.environment.fullname) if not os.path.isfile(prepared_file): touch(prepared_file) if self.environment.stage == "prepare": lpms.terminate()
def run_build(self): utils.xterm_title("(%s/%s) lpms: building %s/%s-%s from %s" % (self.environment.index, self.environment.count, self.environment.category, self.environment.name, self.environment.version, self.environment.repo)) out.normal("compiling source in %s" % self.environment.build_dir) built_file = os.path.join(os.path.dirname(os.path.dirname( self.environment.build_dir)), ".built") if os.path.isfile(built_file) and self.environment.resume_build: out.warn_notify("%s had been already built." % self.environment.fullname) return True lpms.logger.info("building in %s" % self.environment.build_dir) self.run_stage("build") out.notify("%s has been built." % self.environment.fullname) if not os.path.isfile(built_file): touch(built_file) if self.environment.stage == "build": lpms.terminate()
def run_install(self): utils.xterm_title("(%s/%s) lpms: installing %s/%s-%s from %s" % (self.environment.index, self.environment.count, self.environment.category, self.environment.name, self.environment.version, self.environment.repo)) out.normal("installing %s to %s" % (self.environment.fullname, self.environment.install_dir)) installed_file = os.path.join( os.path.dirname(os.path.dirname(self.environment.build_dir)), ".installed") if os.path.isfile(installed_file) and self.environment.resume_build: out.warn_notify("%s had been already installed." % self.environment.fullname) return True lpms.logger.info("installing to %s" % self.environment.build_dir) self.run_stage("install") if self.environment.docs is not None: for doc in self.environment.docs: if isinstance(doc, list) or isinstance(doc, tuple): source_file, target_file = doc namestr = self.environment.fullname if self.environment.slot != "0" else self.environment.name target = self.environment.fix_target_path( "/usr/share/doc/%s/%s" % (namestr, target_file)) source = os.path.join(self.environment.build_dir, source_file) # self.environment.index, insfile(source, target) #else: # self.environment.index, insdoc(doc) out.notify("%s has been installed." % self.environment.fullname) if not os.path.isfile(installed_file): touch(installed_file) if self.environment.stage == "install": lpms.terminate()
def run_extract(self): # if the environment has no extract_plan variable, doesn't run extract function if not hasattr(self.environment, "extract_nevertheless") or not self.environment.extract_nevertheless: if not hasattr(self.environment, "extract_plan"): return target = os.path.dirname(self.environment.build_dir) extracted_file = os.path.join(os.path.dirname(target), ".extracted") if os.path.isfile(extracted_file): if self.environment.force_extract: shelltools.remove_file(extracted_file) else: out.write("%s %s/%s-%s had been already extracted.\n" % (out.color(">>", "brightyellow"), \ self.environment.category, self.environment.name, self.environment.version)) return True utils.xterm_title("lpms: extracting %s/%s/%s-%s" % (self.environment.repo, self.environment.category, \ self.environment.name, self.environment.version)) out.notify("extracting archive(s) to %s" % os.path.dirname(self.environment.build_dir)) # now, extract the archives self.run_stage("extract") out.notify("%s has been extracted." % self.environment.fullname) shelltools.touch(extracted_file) if self.environment.stage == "extract": lpms.terminate()
def touch(path): shelltools.touch(fix_target_path(path))