Difference between revisions of "Iso prepare"
From SME Server
Jump to navigationJump to search(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{Level|Developer}} | {{Level|Developer}} | ||
− | iso_prepare the mock plugin needed for | + | iso_prepare the mock plugin needed for building an offical Iso see http://bugs.contribs.org/attachment.cgi?id=4059 and [[bugzilla:7675]] |
# vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=python:textwidth=0: | # vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=python:textwidth=0: | ||
Line 32: | Line 32: | ||
for l in glob.glob("/dev/loop*"): | for l in glob.glob("/dev/loop*"): | ||
rootObj.mounts.add(BindMountPoint(srcpath=l, bindpath=rootObj.makeChrootPath(l))) | rootObj.mounts.add(BindMountPoint(srcpath=l, bindpath=rootObj.makeChrootPath(l))) | ||
− | + | ||
decorate(traceLog()) | decorate(traceLog()) | ||
def _isoPreparePostInitHook(self): | def _isoPreparePostInitHook(self): | ||
Line 41: | Line 41: | ||
fullPath = os.path.join(dirpath, filename) | fullPath = os.path.join(dirpath, filename) | ||
os.unlink(fullPath) | os.unlink(fullPath) | ||
− | + | ||
# update sudoers file | # update sudoers file | ||
sudoers_out = self.rootObj.makeChrootPath('/etc/sudoers') | sudoers_out = self.rootObj.makeChrootPath('/etc/sudoers') |
Latest revision as of 10:54, 28 December 2014
iso_prepare the mock plugin needed for building an offical Iso see http://bugs.contribs.org/attachment.cgi?id=4059 and bugzilla:7675
# vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=python:textwidth=0: # python library imports import os import stat import glob # our imports from mockbuild.trace_decorator import decorate, traceLog, getLog import mockbuild.util from mockbuild.mounts import BindMountPoint requires_api_version = "1.0" # plugin entry point decorate(traceLog()) def init(rootObj, conf): IsoPrepare(rootObj, conf) # classes class IsoPrepare(object): """fixes chroot do be able to build ISO's""" decorate(traceLog()) def __init__(self, rootObj, conf): self.rootObj = rootObj self.isoPrepare_opts = conf rootObj.isoPrepareObj = self rootObj.addHook("postinit", self._isoPreparePostInitHook) for l in glob.glob("/dev/loop*"): rootObj.mounts.add(BindMountPoint(srcpath=l, bindpath=rootObj.makeChrootPath(l))) decorate(traceLog()) def _isoPreparePostInitHook(self): # remove incorrect rpm db files if os.path.exists(self.rootObj.makeChrootPath('/usr/lib/rpm/rpmi')): for (dirpath, dirnames, filenames) in os.walk(self.rootObj.makeChrootPath('/var/lib/rpm')): for filename in filenames: fullPath = os.path.join(dirpath, filename) os.unlink(fullPath) # update sudoers file sudoers_out = self.rootObj.makeChrootPath('/etc/sudoers') sudoers = open(sudoers_out, 'a') sudoers.write( "%s ALL=(ALL) NOPASSWD: ALL\n" % self.rootObj.chrootuser ) sudoers.write( "Defaults:mockbuild !requiretty\n" ) sudoers.close()