当前位置: 首页>>代码示例>>Python>>正文


Python EmergeDebug.debug_line方法代码示例

本文整理汇总了Python中EmergeDebug.debug_line方法的典型用法代码示例。如果您正苦于以下问题:Python EmergeDebug.debug_line方法的具体用法?Python EmergeDebug.debug_line怎么用?Python EmergeDebug.debug_line使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EmergeDebug的用法示例。

在下文中一共展示了EmergeDebug.debug_line方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: handlePackage

# 需要导入模块: import EmergeDebug [as 别名]
# 或者: from EmergeDebug import debug_line [as 别名]
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
开发者ID:TheOneRing,项目名称:emerge,代码行数:59,代码来源:emerge.py


示例2: main

# 需要导入模块: import EmergeDebug [as 别名]
# 或者: from EmergeDebug import debug_line [as 别名]
def main():
    """ Testing the class"""

    # add two databases
    tempdbpath1 = os.path.join( EmergeStandardDirs.emergeRoot(), "tmp", "temp1.db" )
    tempdbpath2 = os.path.join( EmergeStandardDirs.emergeRoot(), "tmp", "temp2.db" )

    if not os.path.exists( os.path.join( EmergeStandardDirs.emergeRoot(), "tmp" ) ):
        os.makedirs( os.path.join( EmergeStandardDirs.emergeRoot(), "tmp" ) )

    if os.path.exists( tempdbpath1 ):
        os.remove( tempdbpath1 )
    if os.path.exists( tempdbpath2 ):
        os.remove( tempdbpath2 )

    db_temp = InstallDB( tempdbpath1 )
    db = InstallDB( tempdbpath2 )

    EmergeDebug.debug('testing installation database')

    # in case the package is still installed, remove it first silently
    if db.isInstalled( 'win32libs', 'dbus-src', '1.4.0' ):
        packageList = db.getInstalledPackages( 'win32libs', 'dbus-src' )
        # really commit uninstall
        for package in packageList:
            package.uninstall()
    EmergeDebug.debug_line()

    EmergeDebug.new_line()
    # add a package
    EmergeDebug.debug('installing package win32libs/dbus-src-1.4.0 (release)')
    package = db.addInstalled( 'win32libs', 'dbus-src', '1.4.0', 'release' )
    package.addFiles( dict().fromkeys( [ 'test', 'test1', 'test2' ], 'empty hash' ) )
    # now really commit the package
    package.install()

    # add another package in a different prefix
    EmergeDebug.debug('installing package win32libs/dbus-src-1.4.0 (debug)')
    package = db.addInstalled( 'win32libs', 'dbus-src', '1.4.0', 'debug' )
    package.addFiles( dict().fromkeys( [ 'test', 'test1', 'test2' ], 'empty hash' ) )
    # now really commit the package
    package.install()
    EmergeDebug.debug_line()

    EmergeDebug.new_line()
    EmergeDebug.debug('checking installed packages')
    EmergeDebug.debug('get installed package (release): %s' % db.getInstalled('win32libs', 'dbus-src', 'release'))
    EmergeDebug.debug('get installed package (debug):   %s' % db.getInstalled('win32libs', 'dbus-src', 'debug'))

    EmergeDebug.new_line()
    EmergeDebug.debug('now trying to remove package & revert it again later')
    # remove the package again
    packageList = db.getInstalledPackages( 'win32libs', 'dbus-src' )
    for pac in packageList:
        for line in pac.getFiles(): # pylint: disable=W0612
            # we could remove the file here
            # print line
            pass
    EmergeDebug.debug_line()

    EmergeDebug.new_line()
    EmergeDebug.debug('checking installed packages')
    EmergeDebug.debug('get installed package (release): %s' % db.getInstalled('win32libs', 'dbus-src', 'release'))
    EmergeDebug.debug('get installed package (debug):   %s' % db.getInstalled('win32libs', 'dbus-src', 'debug'))
    EmergeDebug.debug_line()

    EmergeDebug.new_line()
    EmergeDebug.debug('reverting removal')
    # now instead of completing the removal, revert it
    for pac in packageList:
        pac.revert()

    EmergeDebug.debug('checking installed packages')
    EmergeDebug.debug('get installed package (release): %s' % db.getInstalled('win32libs', 'dbus-src', 'release'))
    EmergeDebug.debug('get installed package (debug):   %s' % db.getInstalled('win32libs', 'dbus-src', 'debug'))
    EmergeDebug.debug_line()

    db.getInstalled()
    db.getInstalled( category='win32libs', prefix='debug' )
    db.getInstalled( package='dbus-src' )

    EmergeDebug.new_line()
    EmergeDebug.debug('now really remove the package')
    packageList = db.getInstalledPackages( 'win32libs', 'dbus-src' )
    for pac in packageList:
        EmergeDebug.debug('removing %s files' % len(pac.getFilesWithHashes()))
        pac.uninstall()

    EmergeDebug.debug('get installed package (release): %s' % db.getInstalled('win32libs', 'dbus-src', 'release'))
    EmergeDebug.debug('get installed package (debug):   %s' % db.getInstalled('win32libs', 'dbus-src', 'debug'))
    EmergeDebug.debug_line()

    # test the import from the old style (manifest based) databases
    EmergeDebug.new_line()
    print("getInstalled:", db_temp.getInstalled())
开发者ID:TheOneRing,项目名称:emerge,代码行数:97,代码来源:InstallDB.py


示例3: main

# 需要导入模块: import EmergeDebug [as 别名]
# 或者: from EmergeDebug import debug_line [as 别名]

#.........这里部分代码省略.........
    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
开发者ID:TheOneRing,项目名称:emerge,代码行数:104,代码来源:emerge.py


示例4: handleSinglePackage

# 需要导入模块: import EmergeDebug [as 别名]
# 或者: from EmergeDebug import debug_line [as 别名]
def handleSinglePackage( packageName, action, args ):
    deplist = [ ]
    packageList = [ ]
    originalPackageList = [ ]
    categoryList = [ ]
    targetDict = dict( )

    if action == "update-all":
        installedPackages = portage.PortageInstance.getInstallables( )
        if portage.PortageInstance.isCategory( packageName ):
            EmergeDebug.debug("Updating installed packages from category " + packageName, 1)
        else:
            EmergeDebug.debug("Updating all installed packages", 1)
        packageList = [ ]
        for mainCategory, mainPackage in installedPackages:
            if portage.PortageInstance.isCategory( packageName ) and ( mainCategory != packageName ):
                continue
            if InstallDB.installdb.isInstalled( mainCategory, mainPackage, args.buildType ) \
                    and portage.isPackageUpdateable( mainCategory, mainPackage ):
                categoryList.append( mainCategory )
                packageList.append( mainPackage )
        EmergeDebug.debug("Will update packages: " + str(packageList), 1)
    elif args.list_file:
        listFileObject = open( args.list_file, 'r' )
        for line in listFileObject:
            if line.strip( ).startswith( '#' ): continue
            try:
                cat, pac, tar, _ = line.split( ',' )
            except:
                continue
            categoryList.append( cat )
            packageList.append( pac )
            originalPackageList.append( pac )
            targetDict[ cat + "/" + pac ] = tar
    elif packageName:
        packageList, categoryList = portage.getPackagesCategories( packageName )

    for entry in packageList:
        EmergeDebug.debug("Checking dependencies for: %s" % entry, 1)

    for mainCategory, entry in zip( categoryList, packageList ):
        deplist = portage.solveDependencies( mainCategory, entry, deplist, args.dependencyType,
                                              maxDepth = args.dependencydepth )
    # no package found
    if len( deplist ) == 0:
        category = ""
        if not packageName.find( "/" ) == -1:
            (category, package) = packageName.split( "/" )
        portageSearch.printSearch( category, packageName )
        return False

    for item in deplist:
        item.enabled = args.ignoreAllInstalled

        if args.ignoreInstalled and item.category in categoryList and item.package in packageList or packageIsOutdated(
                item.category, item.package ):
            item.enabled = True

        if item.category + "/" + item.package in targetDict:
            item.target = targetDict[ item.category + "/" + item.package ]

        if args.target in list(
                portage.PortageInstance.getAllTargets( item.category, item.package ).keys( ) ):
            # if no target or a wrong one is defined, simply set the default target here
            item.target = args.target

        EmergeDebug.debug("dependency: %s" % item, 1)
    if not deplist:
        EmergeDebug.debug("<none>", 1)

    EmergeDebug.debug_line(1)

    #for item in deplist:
    #    cat = item[ 0 ]
    #    pac = item[ 1 ]
    #    ver = item[ 2 ]

    #    if portage.isInstalled( cat, pac, ver, buildType) and updateAll and not portage.isPackageUpdateable( cat, pac, ver ):
    #        print "remove:", cat, pac, ver
    #        deplist.remove( item )

    if action == "install-deps":
        # the first dependency is the package itself - ignore it
        # TODO: why are we our own dependency?
        del deplist[ 0 ]
    elif action == "update-direct-deps":
        for item in deplist:
            item.enabled = True

    deplist.reverse( )

    # package[0] -> category
    # package[1] -> package
    # package[2] -> version

    info = deplist[ -1 ]
    if not portage.PortageInstance.isVirtualPackage( info.category, info.package ) and \
        not action in [ "all", "install-deps" ,"generate-jenkins-job"] and\
        not args.list_file or\
        action in ["print-targets"]:#not all commands should be executed on the deps if we are a virtual packages
#.........这里部分代码省略.........
开发者ID:TheOneRing,项目名称:emerge,代码行数:103,代码来源:emerge.py



注:本文中的EmergeDebug.debug_line方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。