Example #1
0
def getProductDefinition(cfg, version='1.0', upstream=None, buildFlavors=None):
    p = proddef.ProductDefinition()
    p.setBaseFlavor(str(cfg.buildFlavor))
    p.setProductName('foo')
    p.setProductDescription('foo')
    p.setProductShortname('foo')
    p.setProductVersion(version)
    p.setProductVersionDescription('version description')
    p.setConaryRepositoryHostname('localhost')
    p.setConaryNamespace('foo')
    p.setImageGroup('group-os')
    p.addStage(name='devel', labelSuffix='-devel')
    p.addStage(name='qa', labelSuffix='-qa')
    p.addStage(name='stable', labelSuffix='')
    if upstream:
        if not isinstance(upstream, list):
            upstream = [upstream]
        for item in upstream:
            upstreamName, upstreamLabel = item.split('=', 1)
            p.addSearchPath(upstreamName, upstreamLabel)
    if not buildFlavors:
        buildFlavors = ['']
    arch = deps.getMajorArch(cfg.buildFlavor)
    for idx, buildFlavor in enumerate(buildFlavors):
        buildFlavor = buildFlavor.strip()
        if buildFlavor:
            buildFlavor += ' '
        buildFlavor += 'is: ' + arch
        p.addBuildDefinition(name='build%s' % idx,
                             image=p.imageType('applianceIsoImage'),
                             stages=['devel', 'qa', 'stable'],
                             imageGroup='group-dist',
                             flavor=buildFlavor)

    xmlsubs = p.xmlFactory()
    platformClassifier = xmlsubs.platformClassifierTypeSub(tags='linux')

    if platform_information is None:
        platformInformation = xmlsubs.platformInformationTypeSub(
            originLabel=str(cfg.buildLabel), )
        platformInformation.set_platformClassifier(platformClassifier)
        platformInformation.set_bootstrapTrove([])
        platformInformation.set_rpmRequirement([])
    else:
        platformInformation = platform_information.PlatformInformation(
            str(cfg.buildLabel),
            platformClassifier=platformClassifier,
            bootstrapTroves=[],
            rpmRequirements=[],
        )

        def export(*args, **kwargs):
            pass

        platformInformation.export = export

    p.setPlatformInformation(platformInformation)

    return p
Example #2
0
def getProductDefinition(cfg, version='1.0', upstream=None, buildFlavors=None):
    p = proddef.ProductDefinition()
    p.setBaseFlavor(str(cfg.buildFlavor))
    p.setProductName('foo')
    p.setProductDescription('foo')
    p.setProductShortname('foo')
    p.setProductVersion(version)
    p.setProductVersionDescription('version description')
    p.setConaryRepositoryHostname('localhost')
    p.setConaryNamespace('foo')
    p.setImageGroup('group-os')
    p.addStage(name='devel', labelSuffix='-devel')
    p.addStage(name='qa', labelSuffix='-qa')
    p.addStage(name='stable', labelSuffix='')
    if upstream:
        if not isinstance(upstream, list):
            upstream = [upstream]
        for item in upstream:
            upstreamName, upstreamLabel = item.split('=', 1)
            p.addSearchPath(upstreamName, upstreamLabel)
    if not buildFlavors:
        buildFlavors = ['']
    arch = deps.getMajorArch(cfg.buildFlavor)
    for idx, buildFlavor in enumerate(buildFlavors):
        buildFlavor = buildFlavor.strip()
        if buildFlavor:
            buildFlavor += ' '
        buildFlavor += 'is: ' + arch
        p.addBuildDefinition(name='build%s' % idx,
                             image=p.imageType('applianceIsoImage'),
                             stages=['devel', 'qa', 'stable'],
                             imageGroup='group-dist',
                             flavor=buildFlavor)

    xmlsubs = p.xmlFactory()
    platformClassifier = xmlsubs.platformClassifierTypeSub(tags='linux')

    if platform_information is None:
        platformInformation = xmlsubs.platformInformationTypeSub(
            originLabel=str(cfg.buildLabel),
        )
        platformInformation.set_platformClassifier(platformClassifier)
        platformInformation.set_bootstrapTrove([])
        platformInformation.set_rpmRequirement([])
    else:
        platformInformation = platform_information.PlatformInformation(
            str(cfg.buildLabel),
            platformClassifier=platformClassifier,
            bootstrapTroves=[],
            rpmRequirements=[],
        )
        def export(*args, **kwargs):
            pass
        platformInformation.export = export

    p.setPlatformInformation(platformInformation)

    return p
Example #3
0
def get_arch(flavor):
    '''Turn a Flavor into a string describing the arch

    Return value can be x86, x86_64 or None.
    '''
    ret = deps.getMajorArch(flavor)
    if ret is None:
        ret = ''
    return ret
Example #4
0
    def doFile(self, path):
        componentMap = self.recipe.autopkg.componentMap
        if path not in componentMap:
            return
        pkg = componentMap[path]
        f = pkg.getFile(path)

        # Only recompute the file's flavor if the file has changed
        if self.fileChanged(path):
            packagepolicy.Flavor.doFile(self, path)
        else:
            isnset = deps.getMajorArch(f.flavor())
            if isnset in self.allowableIsnSets:
                self.packageFlavor.union(f.flavor())
Example #5
0
 def _getFlavorArch(self, flavor):
     flavor = self._getFlavor(flavor)
     return deps.getMajorArch(flavor)
Example #6
0
 def _getFlavorArch(self, flavor):
     flavor = self._getFlavor(flavor)
     return deps.getMajorArch(flavor)