def make(self, try_again=False): """ Build this recipe. If try_again is set, it will assume the build failed before and we're trying to run it again. In this case, reduce the makewidth to 1 and show the build output. """ v.print_v(v.PDEBUG, "make") mkchdir(topdir + "/src/" + self.name + "/" + self.installdir) if v.VERBOSITY_LEVEL >= v.DEBUG or try_again: o_proc = None else: o_proc = output_proc.OutputProcessorMake(preamble="Building: ") # Stash the makewidth so we can set it back later makewidth = self.scanner.lvars['makewidth'] if try_again: self.scanner.lvars['makewidth'] = '1' st = bashexec(self.scanner.var_replace_all(self.scr_make), o_proc) self.scanner.lvars['makewidth'] = makewidth if st == 0: return # If build fails, try again with more output: if try_again == False: v.print_v( v.ERROR, "Build failed. Re-trying with reduced makewidth and higher verbosity." ) self.make(try_again=True) else: v.print_v(v.ERROR, "Build failed. See output above for error messages.") raise PBRecipeException("Build failed.")
def configure(self, try_again=False): """ Run the configuration step for this recipe. If try_again is set, it will assume the configuration failed before and we're trying to run it again. """ v.print_v(v.PDEBUG, "configure") mkchdir(topdir + "/src/" + self.name + "/" + self.installdir) if v.VERBOSITY_LEVEL >= v.DEBUG or try_again: o_proc = None else: o_proc = output_proc.OutputProcessorMake(preamble="Configuring: ") st = bashexec(self.scanner.var_replace_all(self.scr_configure), o_proc) if (st == 0): return # If configuration fails: if try_again == False: v.print_v( v.ERROR, "Configuration failed. Re-trying with higher verbosity.") self.make(try_again=True) else: v.print_v( v.ERROR, "Configuration failed. See output above for error messages.") raise PBRecipeException("Configuration failed")
def installed(self): # perform installation, file copy v.print_v(v.PDEBUG, "installed") mkchdir(topdir + "/src/" + self.name + "/" + self.installdir) if v.VERBOSITY_LEVEL >= v.DEBUG: o_proc = None else: o_proc = output_proc.OutputProcessorMake(preamble="Installing: ") st = bashexec(self.scanner.var_replace_all(self.scr_install), o_proc) if (st != 0): raise PBRecipeException("Installation failed.")