Beispiel #1
0
 def __init__(self, cfg):
     recipe.Recipe.__init__(self, cfg)
     self.macros = macros.Macros()
     self.macros.update(recipe.loadMacros(cfg.defaultMacros))
     self.theMainDir = 'dummy-1.0'
     self.macros.builddir = tempfile.mkdtemp()
     self.macros.destdir = tempfile.mkdtemp()
     self.macros.maindir = self.theMainDir
     self.srcdirs = [ cfg.sourceSearchDir ]
     self.buildinfo = buildinfo.BuildInfo(self.macros.builddir)
     self.buildinfo.begin()
     self.laReposCache = lookaside.RepositoryCache(None, cfg=cfg)
     self.fileFinder = lookaside.FileFinder('dummy', self.laReposCache,
                                         self.srcdirs, {}, cfg.mirrorDirs)
     self.name = 'dummy'
     self.version = '1.0'
     self.explicitMainDir = False
     self._derivedFiles = {}
Beispiel #2
0
 def __init__(self, cfg):
     recipe.Recipe.__init__(self, cfg)
     self.macros = macros.Macros()
     self.macros.update(recipe.loadMacros(cfg.defaultMacros))
     self.theMainDir = 'dummy-1.0'
     self.macros.builddir = tempfile.mkdtemp()
     self.macros.destdir = tempfile.mkdtemp()
     self.macros.maindir = self.theMainDir
     self.srcdirs = [cfg.sourceSearchDir]
     self.buildinfo = buildinfo.BuildInfo(self.macros.builddir)
     self.buildinfo.begin()
     self.laReposCache = lookaside.RepositoryCache(None, cfg=cfg)
     self.fileFinder = lookaside.FileFinder('dummy', self.laReposCache,
                                            self.srcdirs, {},
                                            cfg.mirrorDirs)
     self.name = 'dummy'
     self.version = '1.0'
     self.explicitMainDir = False
     self._derivedFiles = {}
Beispiel #3
0
    def writeConf(self, kernels=()):
        if os.path.exists(util.joinPaths(self.image_root, 'etc', 'issue')):
            f = open(util.joinPaths(self.image_root, 'etc', 'issue'))
            name = f.readline().strip()
            if not name:
                name = self.jobData['project']['name']
            f.close()
        else:
            name = self.jobData['project']['name']
        bootDirFiles = os.listdir(util.joinPaths(self.image_root, 'boot'))
        xen = bool([x for x in bootDirFiles
            if re.match('vmlinuz-.*xen.*', x)])
        dom0 = bool([x for x in bootDirFiles
            if re.match('xen.gz-.*', x)])
        initrds = sorted([x for x in bootDirFiles
            if re.match('init(rd|ramfs)-.*.img', x)])
        hasInitrd = bool(initrds)

        # RH-alikes ship a combo dom0/domU kernel so we have to use the image
        # flavor to determine whether to use the dom0 bootloader configuration.
        if self.force_domU:
           dom0 = False

        clock = ""
        if self.jobData['buildType'] == buildtypes.VMWARE_IMAGE:
            if self.arch == 'x86':
                clock = "clock=pit"
            elif self.arch == 'x86_64':
                clock = "notsc"

        if self.jobData['buildType'] == buildtypes.AMI:
            ami = True
        else:
            ami = False
        if initrds:
            # initrds are called initramfs on e.g. RHEL 6, stay consistent.
            rdPrefix = initrds[0].split('-')[0]
        else:
            rdPrefix = 'initrd'

        grubConfMacros = None
        grubConfMacroPath = util.joinPaths(self.image_root, 'etc',
                'sysconfig', 'grubconfmacros')
        if os.path.exists(grubConfMacroPath):
            grubConfMacros = loadMacros([grubConfMacroPath, ])

        conf = getGrubConf(name, hasInitrd, xen, dom0, clock,
                includeTemplate=not is_SUSE(self.image_root, version=11),
                kversions=kernels, ami=ami, rdPrefix=rdPrefix,
                root_label=self.root_label, grubConfMacros=grubConfMacros,
                )

        cfgfile = self._get_grub_conf()
        if cfgfile == 'menu.lst' and is_SUSE(self.image_root):
            self._suse_sysconfig_bootloader()

        f = open(util.joinPaths(self.image_root, 'boot', 'grub', cfgfile), 'w')
        f.write(conf)
        f.close()

        os.chmod(util.joinPaths(self.image_root, 'boot', 'grub', cfgfile), 0600)