Clean _tmproot. Move config listing to the setbuilder module.

Add the mising _tmprool clean.

Move the list printing out of the build which now just returns a
list of config files to the location of the options.
This commit is contained in:
Chris Johns 2013-02-17 11:50:02 +11:00
parent ebc505ccf3
commit 8d7624e1d4
2 changed files with 29 additions and 13 deletions

View File

@ -428,10 +428,16 @@ class build:
if not self.opts.no_clean():
buildroot = self.config.abspath('buildroot')
builddir = self.config.abspath('_builddir')
_notice(self.opts, 'cleanup: %s' % (buildroot))
tmproot = self.config.abspath('_tmproot')
if self.opts.trace():
_notice(self.opts, 'cleanup: %s' % (buildroot))
self.rmdir(buildroot)
_notice(self.opts, 'cleanup: %s' % (builddir))
if self.opts.trace():
_notice(self.opts, 'cleanup: %s' % (builddir))
self.rmdir(builddir)
if self.opts.trace():
_notice(self.opts, 'cleanup: %s' % (tmproot))
self.rmdir(tmproot)
def make(self):
packages = self.config.packages()
@ -460,7 +466,7 @@ class build:
package = packages['main']
return package.name()
def list_configs(opts, _defaults, ext = '.cfg'):
def get_configs(opts, _defaults, ext = '.cfg'):
def _scan(_path, ext):
configs = []
@ -471,15 +477,18 @@ def list_configs(opts, _defaults, ext = '.cfg'):
configs += [path.join(prefix, file)]
return configs
paths = []
configs = []
files = []
for cp in opts.expand('%{_configdir}', _defaults).split(':'):
print 'Examining: %s' % (path.host(path.abspath(cp)))
configs += _scan(cp, ext)
for c in sorted(configs):
config = c # path.basename(c)
paths += [path.host(path.abspath(cp))]
files += _scan(cp, ext)
for f in sorted(files):
config = f
if config.endswith(ext):
config = config[:0 - len(ext)]
print ' ', config
configs += [config]
return paths, configs
def run(args):
try:

View File

@ -69,7 +69,8 @@ class buildset:
topdir = self.opts.expand('%{_topdir}', self.defaults)
what = '%s -> %s' % \
(path.host(src[len(topdir) + 1:]), path.host(dst[len(topdir) + 1:]))
_notice(self.opts, 'installing: %s' % (what))
if self.opts.trace():
_notice(self.opts, 'installing: %s' % (what))
if not self.opts.dry_run():
try:
files = distutils.dir_util.copy_tree(path.host(src),
@ -234,10 +235,16 @@ def run():
if not opts.force():
raise error.general('host build environment is not set up correctly (use --force to proceed)')
_notice(opts, 'warning: forcing build with known host setup problems')
if opts.get_arg('--list-configs'):
build.list_configs(opts, _defaults)
elif opts.get_arg('--list-bsets'):
build.list_configs(opts, _defaults, ext = '.bset')
if opts.get_arg('--list-configs') or opts.get_arg('--list-bsets'):
if opts.get_arg('--list-configs'):
ext = '.cfg'
else:
ext = '.bset'
paths, configs = build.get_configs(opts, _defaults, ext = ext)
for p in paths:
print 'Examining: %s' % (os.path.relpath(p))
for c in configs:
print ' %s' % (c)
else:
for bset in opts.params():
c = buildset(bset, _defaults = _defaults, opts = opts)