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
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
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())
def _getFlavorArch(self, flavor): flavor = self._getFlavor(flavor) return deps.getMajorArch(flavor)