コード例 #1
0
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
コード例 #2
0
ファイル: emerge.py プロジェクト: TheOneRing/emerge
def main( ):
    parser = argparse.ArgumentParser( prog = "emerge",
                                      description = "Emerge is a tool for building KDE-related software under Windows. emerge automates it, looks for the dependencies and fetches them automatically.\
                                      Some options should be used with extreme caution since they will make your kde installation unusable in 999 out of 1000 cases.",
                                      epilog = """More information see the README or http://windows.kde.org/.
    Send feedback to <*****@*****.**>.""" )

    parser.add_argument( "-p", "--probe", action = "store_true",
                         help = "probing: emerge will only look which files it has to build according to the list of installed files and according to the dependencies of the package." )
    parser.add_argument( "--list-file", action = "store",
                         help = "Build all packages from the csv file provided" )
    _def = emergeSettings.get( "General", "EMERGE_OPTIONS", "" )
    if _def == "": _def = []
    else: _def = _def.split( ";" )
    parser.add_argument( "--options", action = "append",
                         default = _def,
                         help = "Set emerge property from string <OPTIONS>. An example for is \"cmake.openIDE=1\" see options.py for more informations." )
    parser.add_argument( "-z", "--outDateVCS", action = "store_true",
                         help = "if packages from version control system sources are installed, it marks them as out of date and rebuilds them (tags are not marked as out of date)." )
    parser.add_argument( "-sz", "--outDatePackage", action = "store_true",
                         help = "similar to -z, only that it acts only on the last package, and works as normal on the rest." )
    parser.add_argument( "-q", "--stayquiet", action = "store_true",
                         dest = "stayQuiet",
                         help = "quiet: there should be no output - The verbose level should be 0" )
    parser.add_argument( "-t", "--buildtests", action = "store_true", dest = "buildTests",
                         default = emergeSettings.getboolean( "General", "EMERGE_BUILDTESTS", False ) )
    parser.add_argument( "-c", "--continue", action = "store_true", dest = "doContinue" )
    parser.add_argument( "--offline", action = "store_true",
                         default = emergeSettings.getboolean( "General", "WorkOffline", False ),
                         help = "do not try to connect to the internet: KDE packages will try to use an existing source tree and other packages would try to use existing packages in the download directory.\
                          If that doesn't work, the build will fail." )
    parser.add_argument( "-f", "--force", action = "store_true", dest = "forced",
                         default = emergeSettings.getboolean( "General", "EMERGE_FORCED", False ) )
    parser.add_argument( "--buildtype", choices = [ "Release", "RelWithDebInfo", "MinSizeRel", "Debug" ],
                         dest = "buildType",
                         default = emergeSettings.get( "General", "EMERGE_BUILDTYPE", "RelWithDebInfo" ),
                         help = "This will override the build type set by the environment option EMERGE_BUILDTYPE ." )
    parser.add_argument( "-v", "--verbose", action = "count",
                         default = int( emergeSettings.get( "EmergeDebug", "Verbose", "0" ) ),
                         help = " verbose: increases the verbose level of emerge. Default is 1. verbose level 1 contains some notes from emerge, all output of cmake, make and other programs that are used.\
                          verbose level 2a dds an option VERBOSE=1 to make and emerge is more verbose highest level is verbose level 3." )
    parser.add_argument( "--trace", action = "store",
                         default = int( emergeSettings.get( "General", "EMERGE_TRACE", "0" ) ), type = int )
    parser.add_argument( "-i", "--ignoreInstalled", action = "store_true",
                         help = "ignore install: using this option will install a package over an existing install. This can be useful if you want to check some new code and your last build isn't that old." )
    parser.add_argument( "-ia", "--ignoreAllInstalled", action = "store_true",
                         help = "ignore all install: using this option will install all package over an existing install. This can be useful if you want to check some new code and your last build isn't that old." )

    parser.add_argument( "--target", action = "store",
                         help = "This will override the build of the default target. The default Target is marked with a star in the printout of --print-targets" )
    parser.add_argument( "--search", action = "store_true",
                         help = "This will search for a package or a description matching or similar to the search term." )
    parser.add_argument( "--nocopy", action = "store_true",
                         default = emergeSettings.getboolean( "General", "EMERGE_NOCOPY", False ),
                         help = "this option is deprecated. In older releases emerge would have copied everything from the SVN source tree to a source directory under KDEROOT\\tmp - currently nocopy is applied\
                          by default if EMERGE_NOCOPY is not set to \"False\". Be aware that setting EMERGE_NOCOPY to \"False\" might slow down the build process, irritate you and increase the disk space roughly\
                           by the size of SVN source tree." )
    parser.add_argument( "--noclean", action = "store_true",
                         default = emergeSettings.getboolean( "General", "EMERGE_NOCLEAN", False ),
                         help = "this option will try to use an existing build directory. Please handle this option with care - it will possibly break if the directory isn't existing." )
    parser.add_argument( "--clean", action = "store_false", dest = "noclean",
                         help = "oposite of --noclean" )
    parser.add_argument( "--patchlevel", action = "store",
                         default = emergeSettings.get( "General", "EMERGE_PKGPATCHLVL", "" ),
                         help = "This will add a patch level when used together with --package" )
    parser.add_argument( "--log-dir", action = "store",
                         default = emergeSettings.get( "General", "EMERGE_LOG_DIR", "" ),
                         help = "This will log the build output to a logfile in LOG_DIR for each package. Logging information is appended to existing logs." )
    parser.add_argument( "--dt", action = "store", choices = [ "both", "runtime", "buildtime" ], default = "both",
                         dest = "dependencyType" )
    parser.add_argument( "--update-fast", action = "store_true",
                         help = "If the package is installed from svn/git and the revision did not change all steps after fetch are skipped" )
    parser.add_argument( "-d", "--dependencydepth", action = "store", type = int, default = -1,
                         help = "By default emerge resolves the whole dependency graph, this option limits the depth of the graph, so a value of 1 would mean only dependencies defined in that package" )

    actionHandler = ActionHandler(parser)
    for x in sorted( [ "fetch", "unpack", "configure", "compile", "make",
                       "install", "install-deps", "qmerge", "manifest", "package", "unmerge", "test",
                       "checkdigest", "dumpdeps",
                       "full-package", "cleanimage", "cleanbuild", "createpatch", "geturls"] ):
        actionHandler.addAction( x )
    actionHandler.addAction( "update", help = "Update a single package" )

    # read-only actions
    actionHandler.addAction( "print-source-version" )
    actionHandler.addAction( "print-package-version" )
    actionHandler.addAction( "print-targets",
                             help = "This will show a list of available targets for the package" )
    actionHandler.addAction( "print-installed",
                             help = "This will show a list of all packages that are installed currently." )
    actionHandler.addAction( "print-installable",
                             help = "This will give you a list of packages that can be installed. Currently you don't need to enter the category and package: only the package will be enough." )
    actionHandler.addAction( "print-revision", help = "Print the revision of the package and exit" )
    actionHandler.addAction( "print-files", help = "Print the files installed by the package and exit" )
    actionHandler.addActionWithArg( "search-file", help = "Print packages owning the file" )

    # other actions
    actionHandler.addActionWithArg( "dump-deps-file", dest = "dumpDepsFile",
                                    help = "Output the dependencies of this package as a csv file suitable for emerge server." )
    actionHandler.addAction( "generate-jenkins-job")

    parser.add_argument( "packageNames", nargs = argparse.REMAINDER )

    args = parser.parse_args( )

    action, error = actionHandler.parseFinalAction(args, "all")
    if not action:
        EmergeDebug.error("Failed to parse arguments: %s" % error)
        return False

    if args.stayQuiet:
        EmergeDebug.setVerbose(-1)
    elif args.verbose:
        EmergeDebug.setVerbose(args.verbose)

    emergeSettings.set( "General", "WorkOffline", args.offline )
    emergeSettings.set( "General", "EMERGE_NOCOPY", args.nocopy )
    emergeSettings.set( "General", "EMERGE_NOCLEAN", args.noclean )
    emergeSettings.set( "General", "EMERGE_FORCED", args.forced )
    emergeSettings.set( "General", "EMERGE_BUILDTESTS", args.buildTests )
    emergeSettings.set( "General", "EMERGE_BUILDTYPE", args.buildType )
    emergeSettings.set( "PortageVersions", "DefaultTarget", args.target )
    emergeSettings.set( "General", "EMERGE_OPTIONS", ";".join( args.options ) )
    emergeSettings.set( "General", "EMERGE_LOG_DIR", args.log_dir )
    emergeSettings.set( "General", "EMERGE_TRACE", args.trace )
    emergeSettings.set( "General", "EMERGE_PKGPATCHLVL", args.patchlevel )

    portage.PortageInstance.options = args.options
    if args.search:
        for package in args.packageNames:
            category = ""
            if not package.find( "/" ) == -1:
                (category, package) = package.split( "/" )
            portageSearch.printSearch( category, package )
        return True

    if action in [ "install-deps", "update", "update-all", "package" ] or args.update_fast:
        args.ignoreInstalled = True

    if action in [ "update", "update-all" ]:
        args.noclean = True

    EmergeDebug.debug("buildAction: %s" % action)
    EmergeDebug.debug("doPretend: %s" % args.probe, 1)
    EmergeDebug.debug("packageName: %s" % args.packageNames)
    EmergeDebug.debug("buildType: %s" % args.buildType)
    EmergeDebug.debug("buildTests: %s" % args.buildTests)
    EmergeDebug.debug("verbose: %d" % EmergeDebug.verbose(), 1)
    EmergeDebug.debug("trace: %s" % args.trace, 1)
    EmergeDebug.debug("KDEROOT: %s" % EmergeStandardDirs.emergeRoot(), 1)
    EmergeDebug.debug_line()

    if args.print_installed:
        InstallDB.printInstalled( )
    elif args.print_installable:
        portage.printInstallables( )
    elif args.search_file:
        portage.printPackagesForFileSearch(args.search_file)
    elif args.list_file:
        handleSinglePackage( "", action, args )
    else:
        for packageName in args.packageNames:
            if not handleSinglePackage( packageName, action, args ):
                return False
    return True
コード例 #3
0
def main():
    parser = argparse.ArgumentParser(
        prog="emerge",
        description=
        "Emerge is a tool for building KDE-related software under Windows. emerge automates it, looks for the dependencies and fetches them automatically.\
                                      Some options should be used with extreme caution since they will make your kde installation unusable in 999 out of 1000 cases.",
        epilog="""More information see the README or http://windows.kde.org/.
    Send feedback to <*****@*****.**>.""")

    parser.add_argument(
        "-p",
        "--probe",
        action="store_true",
        help=
        "probing: emerge will only look which files it has to build according to the list of installed files and according to the dependencies of the package."
    )
    parser.add_argument("--list-file",
                        action="store",
                        help="Build all packages from the csv file provided")
    _def = emergeSettings.get("General", "EMERGE_OPTIONS", "")
    if _def == "": _def = []
    else: _def = _def.split(";")
    parser.add_argument(
        "--options",
        action="append",
        default=_def,
        help=
        "Set emerge property from string <OPTIONS>. An example for is \"cmake.openIDE=1\" see options.py for more informations."
    )
    parser.add_argument(
        "-z",
        "--outDateVCS",
        action="store_true",
        help=
        "if packages from version control system sources are installed, it marks them as out of date and rebuilds them (tags are not marked as out of date)."
    )
    parser.add_argument(
        "-sz",
        "--outDatePackage",
        action="store_true",
        help=
        "similar to -z, only that it acts only on the last package, and works as normal on the rest."
    )
    parser.add_argument(
        "-q",
        "--stayquiet",
        action="store_true",
        dest="stayQuiet",
        help="quiet: there should be no output - The verbose level should be 0"
    )
    parser.add_argument("-t",
                        "--buildtests",
                        action="store_true",
                        dest="buildTests",
                        default=emergeSettings.getboolean(
                            "Compile", "BuildTests", False))
    parser.add_argument("-c",
                        "--continue",
                        action="store_true",
                        dest="doContinue")
    parser.add_argument(
        "--offline",
        action="store_true",
        default=emergeSettings.getboolean("General", "WorkOffline", False),
        help=
        "do not try to connect to the internet: KDE packages will try to use an existing source tree and other packages would try to use existing packages in the download directory.\
                          If that doesn't work, the build will fail.")
    parser.add_argument("-f",
                        "--force",
                        action="store_true",
                        dest="forced",
                        default=emergeSettings.getboolean(
                            "General", "EMERGE_FORCED", False))
    parser.add_argument(
        "--buildtype",
        choices=["Release", "RelWithDebInfo", "MinSizeRel", "Debug"],
        dest="buildType",
        default=emergeSettings.get("Compile", "BuildType", "RelWithDebInfo"),
        help="This will override the build type set in your kdesettings.ini.")
    parser.add_argument(
        "-v",
        "--verbose",
        action="count",
        default=int(emergeSettings.get("EmergeDebug", "Verbose", "0")),
        help=
        " verbose: increases the verbose level of emerge. Default is 1. verbose level 1 contains some notes from emerge, all output of cmake, make and other programs that are used.\
                          verbose level 2a dds an option VERBOSE=1 to make and emerge is more verbose highest level is verbose level 3."
    )
    parser.add_argument("--trace",
                        action="store",
                        default=int(
                            emergeSettings.get("General", "EMERGE_TRACE",
                                               "0")),
                        type=int)
    parser.add_argument(
        "-i",
        "--ignoreInstalled",
        action="store_true",
        help=
        "ignore install: using this option will install a package over an existing install. This can be useful if you want to check some new code and your last build isn't that old."
    )
    parser.add_argument(
        "-ia",
        "--ignoreAllInstalled",
        action="store_true",
        help=
        "ignore all install: using this option will install all package over an existing install. This can be useful if you want to check some new code and your last build isn't that old."
    )

    parser.add_argument(
        "--target",
        action="store",
        help=
        "This will override the build of the default target. The default Target is marked with a star in the printout of --print-targets"
    )
    parser.add_argument(
        "--search",
        action="store_true",
        help=
        "This will search for a package or a description matching or similar to the search term."
    )
    parser.add_argument(
        "--noclean",
        action="store_true",
        default=emergeSettings.getboolean("General", "EMERGE_NOCLEAN", False),
        help=
        "this option will try to use an existing build directory. Please handle this option with care - it will possibly break if the directory isn't existing."
    )
    parser.add_argument("--clean",
                        action="store_false",
                        dest="noclean",
                        help="oposite of --noclean")
    parser.add_argument(
        "--patchlevel",
        action="store",
        default=emergeSettings.get("General", "EMERGE_PKGPATCHLVL", ""),
        help="This will add a patch level when used together with --package")
    parser.add_argument(
        "--log-dir",
        action="store",
        default=emergeSettings.get("General", "EMERGE_LOG_DIR", ""),
        help=
        "This will log the build output to a logfile in LOG_DIR for each package. Logging information is appended to existing logs."
    )
    parser.add_argument("--dt",
                        action="store",
                        choices=["both", "runtime", "buildtime"],
                        default="both",
                        dest="dependencyType")
    parser.add_argument(
        "--update-fast",
        action="store_true",
        help=
        "If the package is installed from svn/git and the revision did not change all steps after fetch are skipped"
    )
    parser.add_argument(
        "-d",
        "--dependencydepth",
        action="store",
        type=int,
        default=-1,
        help=
        "By default emerge resolves the whole dependency graph, this option limits the depth of the graph, so a value of 1 would mean only dependencies defined in that package"
    )

    actionHandler = ActionHandler(parser)
    for x in sorted([
            "fetch", "unpack", "configure", "compile", "make", "install",
            "install-deps", "qmerge", "manifest", "package", "unmerge", "test",
            "checkdigest", "dumpdeps", "full-package", "cleanimage",
            "cleanbuild", "createpatch", "geturls"
    ]):
        actionHandler.addAction(x)
    actionHandler.addAction("update", help="Update a single package")

    # read-only actions
    actionHandler.addAction("print-source-version")
    actionHandler.addAction("print-package-version")
    actionHandler.addAction(
        "print-targets",
        help="This will show a list of available targets for the package")
    actionHandler.addAction(
        "print-installed",
        help=
        "This will show a list of all packages that are installed currently.")
    actionHandler.addAction(
        "print-installable",
        help=
        "This will give you a list of packages that can be installed. Currently you don't need to enter the category and package: only the package will be enough."
    )
    actionHandler.addAction("print-revision",
                            help="Print the revision of the package and exit")
    actionHandler.addAction(
        "print-files",
        help="Print the files installed by the package and exit")
    actionHandler.addActionWithArg("search-file",
                                   help="Print packages owning the file")

    # other actions
    actionHandler.addActionWithArg(
        "dump-deps-file",
        dest="dumpDepsFile",
        help=
        "Output the dependencies of this package as a csv file suitable for emerge server."
    )

    parser.add_argument("packageNames", nargs=argparse.REMAINDER)

    args = parser.parse_args()

    if args.stayQuiet:
        EmergeDebug.setVerbose(-1)
    elif args.verbose:
        EmergeDebug.setVerbose(args.verbose)

    emergeSettings.set("General", "WorkOffline", args.offline)
    emergeSettings.set("General", "EMERGE_NOCLEAN", args.noclean)
    emergeSettings.set("General", "EMERGE_FORCED", args.forced)
    emergeSettings.set("Compile", "BuildTests", args.buildTests)
    emergeSettings.set("Compile", "BuildType", args.buildType)
    emergeSettings.set("PortageVersions", "DefaultTarget", args.target)
    emergeSettings.set("General", "EMERGE_OPTIONS", ";".join(args.options))
    emergeSettings.set("General", "EMERGE_LOG_DIR", args.log_dir)
    emergeSettings.set("General", "EMERGE_TRACE", args.trace)
    emergeSettings.set("General", "EMERGE_PKGPATCHLVL", args.patchlevel)

    portage.PortageInstance.options = args.options
    if args.search:
        for package in args.packageNames:
            category = ""
            if not package.find("/") == -1:
                (category, package) = package.split("/")
            portageSearch.printSearch(category, package)
        return True

    for action in actionHandler.parseFinalAction(args, "all"):
        tempArgs = copy.deepcopy(args)

        if action in ["install-deps", "update", "update-all", "package"
                      ] or tempArgs.update_fast:
            tempArgs.ignoreInstalled = True

        if action in ["update", "update-all"]:
            tempArgs.noclean = True

        EmergeDebug.debug("buildAction: %s" % action)
        EmergeDebug.debug("doPretend: %s" % tempArgs.probe, 1)
        EmergeDebug.debug("packageName: %s" % tempArgs.packageNames)
        EmergeDebug.debug("buildType: %s" % tempArgs.buildType)
        EmergeDebug.debug("buildTests: %s" % tempArgs.buildTests)
        EmergeDebug.debug("verbose: %d" % EmergeDebug.verbose(), 1)
        EmergeDebug.debug("trace: %s" % tempArgs.trace, 1)
        EmergeDebug.debug("KDEROOT: %s" % EmergeStandardDirs.emergeRoot(), 1)
        EmergeDebug.debug_line()

        if action == "print-installed":
            InstallDB.printInstalled()
        elif action == "print-installable":
            portage.printInstallables()
        elif action == "search-file":
            portage.printPackagesForFileSearch(tempArgs.search_file)
        elif tempArgs.list_file:
            handleSinglePackage("", action, tempArgs)
        else:
            for packageName in tempArgs.packageNames:
                if not handleSinglePackage(packageName, action, tempArgs):
                    return False
    return True
コード例 #4
0
ファイル: args.py プロジェクト: KDE/emerge-history
 def execArg(self):
     portage.printInstallables()