def handlePackage( category, packageName, buildAction, continueFlag, skipUpToDateVcs ): EmergeDebug.debug_line() EmergeDebug.info("Handling package: %s, action: %s" % (packageName, buildAction)) success = True package = portage.getPackageInstance( category, packageName ) if package is None: raise portage.PortageException( "Package not found", category, packageName ) if buildAction in [ "all", "full-package", "update", "update-all" ]: success = success and doExec( package, "fetch", continueFlag ) if success and skipUpToDateVcs and package.subinfo.hasSvnTarget( ): revision = package.sourceVersion( ) for p in InstallDB.installdb.getInstalledPackages( category, packageName ): if p.getRevision( ) == revision: EmergeDebug.info("Skipping further actions, package is up-to-date") return True success = success and doExec( package, "unpack", continueFlag ) success = success and doExec( package, "compile" ) success = success and doExec( package, "cleanimage" ) success = success and doExec( package, "install" ) if buildAction in [ "all", "update", "update-all" ]: success = success and doExec( package, "qmerge" ) if buildAction == "full-package": success = success and doExec( package, "package" ) success = success or continueFlag elif buildAction in [ "fetch", "unpack", "configure", "compile", "make", "checkdigest", "dumpdeps", "test", "package", "unmerge", "cleanimage", "cleanbuild", "createpatch", "geturls", "print-revision", "print-files" ]: success = doExec( package, buildAction, continueFlag ) elif buildAction == "install": success = doExec( package, "cleanimage" ) success = success and doExec( package, "install", continueFlag ) elif buildAction == "qmerge": #success = doExec( package, "cleanimage" ) #success = success and doExec( package, "install") success = success and doExec( package, "qmerge" ) elif buildAction == "generate-jenkins-job": success = jenkins.generateJob(package) elif buildAction == "print-source-version": print( "%s-%s" % ( packageName, package.sourceVersion( ) ) ) success = True elif buildAction == "print-package-version": print( "%s-%s-%s" % ( packageName, compiler.getCompilerName( ), package.sourceVersion( ) ) ) success = True elif buildAction == "print-targets": portage.printTargets( category, packageName ) success = True else: success = EmergeDebug.error("could not understand this buildAction: %s" % buildAction) return success
def handlePackage( category, package, version, buildAction, opts ): utils.debug( "emerge handlePackage called: %s %s %s %s" % (category, package, version, buildAction), 2 ) success = True if continueFlag: actionList = ['fetch', 'unpack', 'configure', 'make', 'cleanimage', 'install', 'manifest', 'qmerge'] found = None for action in actionList: if not found and action != buildAction: continue found = True success = success and doExec( category, package, version, action, opts ) elif ( buildAction == "all" or buildAction == "full-package" ): os.putenv( "EMERGE_BUILD_STEP", "" ) success = doExec( category, package, version, "fetch", opts ) success = success and doExec( category, package, version, "unpack", opts ) if emergePlatform.isCrossCompilingEnabled(): if not disableHostBuild: os.putenv( "EMERGE_BUILD_STEP", "host" ) success = success and doExec( category, package, version, "compile", opts ) success = success and doExec( category, package, version, "cleanimage", opts ) success = success and doExec( category, package, version, "install", opts ) if ( buildAction == "all" ): success = success and doExec( category, package, version, "manifest", opts ) if ( buildAction == "all" ): success = success and doExec( category, package, version, "qmerge", opts ) if( buildAction == "full-package" ): success = success and doExec( category, package, version, "package", opts ) if disableTargetBuild: return success os.putenv( "EMERGE_BUILD_STEP", "target" ) success = success and doExec( category, package, version, "compile", opts ) success = success and doExec( category, package, version, "cleanimage", opts ) success = success and doExec( category, package, version, "install", opts ) if ( buildAction == "all" ): success = success and doExec( category, package, version, "manifest", opts ) if ( buildAction == "all" ): success = success and doExec( category, package, version, "qmerge", opts ) if( buildAction == "full-package" ): success = success and doExec( category, package, version, "package", opts ) elif ( buildAction in [ "fetch", "unpack", "preconfigure", "configure", "compile", "make", "qmerge", "checkdigest", "dumpdeps", "package", "manifest", "unmerge", "test", "cleanimage", "cleanbuild", "createpatch", "geturls", "printrev"] and category and package and version ): os.putenv( "EMERGE_BUILD_STEP", "" ) success = True if emergePlatform.isCrossCompilingEnabled(): if not disableHostBuild: os.putenv( "EMERGE_BUILD_STEP", "host" ) success = doExec( category, package, version, buildAction, opts ) if disableTargetBuild: return success os.putenv( "EMERGE_BUILD_STEP", "target" ) success = success and doExec( category, package, version, buildAction, opts ) elif ( buildAction == "install" ): os.putenv( "EMERGE_BUILD_STEP", "" ) success = True if emergePlatform.isCrossCompilingEnabled(): if not disableHostBuild: os.putenv( "EMERGE_BUILD_STEP", "host" ) success = doExec( category, package, version, "cleanimage", opts ) success = success and doExec( category, package, version, "install", opts ) if disableTargetBuild: return success os.putenv( "EMERGE_BUILD_STEP", "target" ) success = success and doExec( category, package, version, "cleanimage", opts ) success = success and doExec( category, package, version, "install", opts ) elif ( buildAction == "version-dir" ): print "%s-%s" % ( package, version ) success = True elif ( buildAction == "version-package" ): print "%s-%s-%s" % ( package, os.getenv( "KDECOMPILER" ), version ) success = True elif ( buildAction == "print-installable" ): portage.printInstallables() success = True elif ( buildAction == "print-installed" ): if isDBEnabled(): printInstalled() else: portage.printInstalled() success = True elif ( buildAction == "print-targets" ): portage.printTargets( category, package, version ) success = True elif ( buildAction == "install-deps" ): success = True else: success = utils.error( "could not understand this buildAction: %s" % buildAction ) return success
def handlePackage(category, packageName, buildAction, continueFlag, skipUpToDateVcs): with EmergeTimer.Timer("HandlePackage %s/%s" % (category, packageName), 3) as timer: EmergeDebug.debug_line() EmergeDebug.info("Handling package: %s, action: %s" % (packageName, buildAction)) success = True package = portage.getPackageInstance(category, packageName) if package is None: raise portage.PortageException("Package not found", category, packageName) if buildAction in ["all", "full-package", "update", "update-all"]: success = success and doExec(package, "fetch", continueFlag) skip = False if success and skipUpToDateVcs and package.subinfo.hasSvnTarget(): revision = package.sourceVersion() for p in InstallDB.installdb.getInstalledPackages( category, packageName): if p.getRevision() == revision: EmergeDebug.info( "Skipping further actions, package is up-to-date") skip = True if not skip: success = success and doExec(package, "unpack", continueFlag) success = success and doExec(package, "compile") success = success and doExec(package, "cleanimage") success = success and doExec(package, "install") if buildAction in ["all", "update", "update-all"]: success = success and doExec(package, "qmerge") if buildAction == "full-package": success = success and doExec(package, "package") success = success or continueFlag elif buildAction in [ "fetch", "unpack", "configure", "compile", "make", "checkdigest", "dumpdeps", "test", "package", "unmerge", "cleanimage", "cleanbuild", "createpatch", "geturls", "print-revision", "print-files" ]: success = doExec(package, buildAction, continueFlag) elif buildAction == "install": success = doExec(package, "cleanimage") success = success and doExec(package, "install", continueFlag) elif buildAction == "qmerge": #success = doExec( package, "cleanimage" ) #success = success and doExec( package, "install") success = success and doExec(package, "qmerge") elif buildAction == "print-source-version": print("%s-%s" % (packageName, package.sourceVersion())) success = True elif buildAction == "print-package-version": print("%s-%s-%s" % (packageName, compiler.getCompilerName(), package.sourceVersion())) success = True elif buildAction == "print-targets": portage.printTargets(category, packageName) success = True else: success = EmergeDebug.error( "could not understand this buildAction: %s" % buildAction) timer.stop() utils.notify( "Emerge %s %s" % (buildAction, "succeeded" if success else "failed"), "%s of %s/%s %s after %s" % (buildAction, category, packageName, "succeeded" if success else "failed", timer), buildAction) return success