allow the base work directory to be configurable.

This commit is contained in:
Dennis Gilmore 2014-07-14 15:39:57 -05:00
parent fb3d4ca185
commit f57a4ac5ee
3 changed files with 14 additions and 2 deletions

View File

@ -62,6 +62,15 @@ def main():
else:
print >> sys.stdout, "Warning: Reusing existing destination directory."
if not os.path.exists(config.get('pungi', 'workdirbase')):
try:
os.makedirs(config.get('pungi', 'workdirbase'))
except OSError, e:
print >> sys.stderr, "Error: Cannot create working base dir %s" % config.get('pungi', 'workdirbase')
sys.exit(1)
else:
print >> sys.stdout, "Warning: Reusing existing working base directory."
cachedir = config.get('pungi', 'cachedir')
if not os.path.exists(cachedir):
@ -242,6 +251,9 @@ if __name__ == '__main__':
help='Multilib method; can be specified multiple times; recommended: devel, runtime')
parser.add_option("--lookaside-repo", action="append", dest="lookaside_repos", metavar="NAME",
help='Specify lookaside repo name(s) (packages will used for depsolving but not be included in the output)')
parser.add_option("--workdirbase", dest="workdirbase", type="string",
action="callback", callback=set_config, callback_args=(config, ),
help='base working directory (defaults to destdir + /work)')
parser.add_option("-c", "--config", dest="config",
help='Path to kickstart config file')

View File

@ -124,8 +124,7 @@ class PungiBase(object):
self.compatible_arches[i] = arch_module.get_compatible_arches(i)
self.doLoggerSetup()
self.workdir = os.path.join(self.config.get('pungi', 'destdir'),
'work',
self.workdir = os.path.join(self.config.get('pungi', 'workdirbase'),
self.config.get('pungi', 'flavor'),
self.tree_arch)

View File

@ -40,6 +40,7 @@ class Config(SafeConfigParser):
self.set('pungi', 'version', time.strftime('%Y%m%d', time.localtime()))
self.set('pungi', 'flavor', '')
self.set('pungi', 'destdir', os.getcwd())
self.set('pungi', 'workdirbase', "%s/work" % self.get('pungi', 'destdir'))
self.set('pungi', 'bugurl', 'https://bugzilla.redhat.com')
self.set('pungi', 'cdsize', '695.0')
self.set('pungi', 'debuginfo', "True")