Example #1
0
def loadRecipe(repos, name, version, flavor, trv,
               defaultFlavor=None, loadInstalledSource=None,
               installLabelPath=None, buildLabel=None, groupRecipeSource=None,
               cfg=None):
    name = name.split(':')[0]
    try:
        if defaultFlavor is not None:
            fullFlavor = deps.overrideFlavor(defaultFlavor, flavor)
        else:
            fullFlavor = flavor
        # set up necessary flavors and track used flags before
        # calling loadRecipe, since even loading the class
        # may check some flags that may never be checked inside
        # the recipe
        recipeObj, loader = getRecipeObj(repos, name,
                                       version, fullFlavor, trv,
                                       loadInstalledSource=loadInstalledSource,
                                       installLabelPath=installLabelPath,
                                       buildLabel=buildLabel,
                                       cfg=cfg)
        relevantFlavor = use.usedFlagsToFlavor(recipeObj.name)
        relevantFlavor = flavorutil.removeInstructionSetFlavor(relevantFlavor)
        # always add in the entire arch flavor.  We need to ensure the
        # relevant flavor is unique per architecture, also, arch flavors
        # can affect the macros used.
        if defaultFlavor is not None:
            relevantFlavor.union(flavor)
        relevantFlavor.union(flavorutil.getArchFlags(fullFlavor))
        relevantFlags = flavorutil.getFlavorUseFlags(relevantFlavor)
        flags = flavorutil.getFlavorUseFlags(fullFlavor)
        use.track(False)

        for flagSet in ('Use',):
        # allow local flags not to be used -- they are set to their default
            if flagSet not in relevantFlags:
                continue
            for flag in relevantFlags[flagSet]:
                if flag not in flags[flagSet]:
                    raise (RuntimeError,
                            "Recipe %s uses Flavor %s but value not known" %(name, flag))
        if 'Arch' in relevantFlags:
            for majarch in relevantFlags['Arch'].keys():
                for subarch in relevantFlags['Arch'][majarch]:
                    if not use.Arch[majarch][subarch]:
                        #negative values for subarches are assumed
                        continue
                    if subarch not in flags['Arch'][majarch]:
                        log.error("arch %s.%s used but not specified" % (
                                                         majarch, subarch))
                        raise RuntimeError, (
                                "arch %s.%s used but not specified" % (
                                                         majarch, subarch))
            use.resetUsed()
    except:
        log.error('Error Loading Recipe (%s, %s, %s):\n%s' %
                                    (name, version, fullFlavor,
                                     ''.join(traceback.format_exc())))
        raise
    return loader, recipeObj, relevantFlavor
Example #2
0
 def formatNode(node):
     name, version, flavor, context = node.getNameVersionFlavor(True)
     name = name.split(':')[0]
     versionStr = '%s' % (version.trailingRevision())
     archFlavor = flavorutil.getArchFlags(flavor, withFlags=False)
     restFlavor = flavorutil.removeInstructionSetFlavor(flavor)
     archFlavor.union(restFlavor)
     if context:
         contextStr = '{%s}' % context
     else:
         contextStr = ''
     return '%s=%s[%s]%s' % (name, versionStr, archFlavor, contextStr)
Example #3
0
 def formatNode(node):
     name, version, flavor, context = node.getNameVersionFlavor(True)
     name = name.split(':')[0]
     versionStr = '%s' % (version.trailingRevision())
     archFlavor = flavorutil.getArchFlags(flavor, withFlags=False)
     restFlavor = flavorutil.removeInstructionSetFlavor(flavor)
     archFlavor.union(restFlavor)
     if context:
         contextStr = '{%s}' % context
     else:
         contextStr = ''
     return '%s=%s[%s]%s' % (name, versionStr, archFlavor, contextStr)
Example #4
0
def loadRecipe(repos,
               name,
               version,
               flavor,
               trv,
               defaultFlavor=None,
               loadInstalledSource=None,
               installLabelPath=None,
               buildLabel=None,
               groupRecipeSource=None,
               cfg=None):
    name = name.split(':')[0]
    try:
        if defaultFlavor is not None:
            fullFlavor = deps.overrideFlavor(defaultFlavor, flavor)
        else:
            fullFlavor = flavor
        # set up necessary flavors and track used flags before
        # calling loadRecipe, since even loading the class
        # may check some flags that may never be checked inside
        # the recipe
        recipeObj, loader = getRecipeObj(
            repos,
            name,
            version,
            fullFlavor,
            trv,
            loadInstalledSource=loadInstalledSource,
            installLabelPath=installLabelPath,
            buildLabel=buildLabel,
            cfg=cfg)
        relevantFlavor = use.usedFlagsToFlavor(recipeObj.name)
        relevantFlavor = flavorutil.removeInstructionSetFlavor(relevantFlavor)
        # always add in the entire arch flavor.  We need to ensure the
        # relevant flavor is unique per architecture, also, arch flavors
        # can affect the macros used.
        if defaultFlavor is not None:
            relevantFlavor.union(flavor)
        relevantFlavor.union(flavorutil.getArchFlags(fullFlavor))
        relevantFlags = flavorutil.getFlavorUseFlags(relevantFlavor)
        flags = flavorutil.getFlavorUseFlags(fullFlavor)
        use.track(False)

        for flagSet in ('Use', ):
            # allow local flags not to be used -- they are set to their default
            if flagSet not in relevantFlags:
                continue
            for flag in relevantFlags[flagSet]:
                if flag not in flags[flagSet]:
                    raise (RuntimeError,
                           "Recipe %s uses Flavor %s but value not known" %
                           (name, flag))
        if 'Arch' in relevantFlags:
            for majarch in relevantFlags['Arch'].keys():
                for subarch in relevantFlags['Arch'][majarch]:
                    if not use.Arch[majarch][subarch]:
                        #negative values for subarches are assumed
                        continue
                    if subarch not in flags['Arch'][majarch]:
                        log.error("arch %s.%s used but not specified" %
                                  (majarch, subarch))
                        raise RuntimeError, (
                            "arch %s.%s used but not specified" %
                            (majarch, subarch))
            use.resetUsed()
    except:
        log.error('Error Loading Recipe (%s, %s, %s):\n%s' %
                  (name, version, fullFlavor, ''.join(traceback.format_exc())))
        raise
    return loader, recipeObj, relevantFlavor