''' Created on Dec 26, 2012 __author__ = "Elizabeth 'pidge' Flanagan" __copyright__ = "Copyright 2013, Intel Corp." __credits__ = ["Elizabeth Flanagan"] __license__ = "GPL" __version__ = "2.0" __maintainer__ = "Elizabeth Flanagan" __email__ = "elizabeth.flanagan@intel.com" ''' from buildbot.steps.shell import ShellCommand class CreateAutoConf(ShellCommand): haltOnFailure = False flunkOnFailure = True name = "Create Auto Configuration" def __init__(self, factory, argdict=None, **kwargs): self.machine="" self.distro="" self.buildhistory=False self.gplv3=True self.multilib=False self.swabber=False self.x32=False self.atext="" self.atextprepend="" self.atextappend="" self.factory = factory for k, v in argdict.iteritems(): setattr(self, k, v) self.description = "Create Auto Configuration" ShellCommand.__init__(self, **kwargs) def start(self): import os fout = "" #check to see if we have a prepend if self.atextprepend is not "": fout = fout + self.atextprepend #check to see if we have text override if self.atext is not "": fout = fout+self.atext else: fout = 'PACKAGE_CLASSES = "package_rpm package_deb package_ipk"\n' fout = fout + 'BB_NUMBER_THREADS = "10"\n' fout = fout + 'PARALLEL_MAKE = "-j 16"\n' fout = fout + 'SDKMACHINE ?= "i586"\n' fout = fout + 'DL_DIR = "' + os.environ.get('SOURCE_DL_DIR')+'"\n' if self.machine is "fri2" or self.machine is "crownbay": fout = fout + 'LICENSE_FLAGS_WHITELIST = "license_emgd-driver-bin_1.10" \n' if self.machine is "cedartrail" or self.machine is "sys940x": fout = fout + 'LICENSE_FLAGS_WHITELIST += "license_cdv-pvr-driver_1.0" \n' fout = fout + 'PVR_LICENSE = "yes" \n' if self.multilib is True: fout = fout + 'require conf/multilib.conf \n' fout = fout + 'MULTILIBS = "multilib:lib32" \n' fout = fout + 'DEFAULTTUNE_virtclass-multilib-lib32 = "x86" \n' fout = fout + 'SSTATE_DIR ?= "' + os.environ.get("SSTATE_PUBLISH_DIR") + '/multilib" \n' else: fout = fout + 'SSTATE_DIR ?= "' + os.environ.get("SSTATE_PUBLISH_DIR") + '/" \n' try: if self.gplv3 is False: fout = fout + 'INCOMPATIBLE_LICENSE = "GPLv3" \n' except: pass if self.x32 is True: fout = fout + 'baselib = \\042${@d.getVar(\\047BASE_LIB_tune-\\047 + (d.getVar(\\047DEFAULTTUNE\\047, True) or \\047INVALID\\047), True) or \\047lib\\047}\\042 \n' if self.distro == "poky-rt": fout = fout + 'PREFERRED_PROVIDER_virtual/kernel="linux-yocto-rt" \n' fout = fout + 'MACHINE = "' + self.machine + '"\n' fout = fout + 'PREMIRRORS = ""\n' try: if self.swabber == "True": fout = fout + 'USER_CLASSES += "image-prelink image-swab"\n' except: pass if os.environ.get("PUBLISH_SOURCE_MIRROR") == "True": fout = fout + 'BB_GENERATE_MIRROR_TARBALLS = "1"\n' try: if self.buildhistory is True and os.environ.get("BUILD_HISTORY_COLLECT") == "True" and self.getProperty("branch") == "master" and "nightly-" in self.getProperty("buildername"): fout = fout + 'INHERIT += "buildhistory"\n' fout = fout + 'BUILDHISTORY_COMMIT = "1"\n' fout = fout + 'BUILDHISTORY_DIR = "' + os.environ.get('BUILD_HISTORY_DIR') + '/' + self.getProperty("buildername") + '/poky-buildhistory"\n' fout = fout + 'BUILDHISTORY_PUSH_REPO = "' + os.environ.get('BUILD_HISTORY_REPO') + ' ' + self.getProperty("buildername") + ':' + self.getProperty("buildername") + '"\n' except: pass if self.atextappend is not "": fout = fout + self.atextappend self.command = "rm -rf ./build/conf/auto.conf; echo '" + fout + "'>> ./build/conf/auto.conf" ShellCommand.start(self) def describe(self, done=False): description = ShellCommand.describe(self,done) return description