Move the build sets to .bset naming.

This commit is contained in:
Chris Johns 2012-11-05 15:28:36 +11:00
parent 4882ff3655
commit e9af460249
3 changed files with 14 additions and 11 deletions

View File

@ -431,15 +431,15 @@ class build:
package = packages['main']
return package.name()
def list_configs(opts, _defaults):
def list_configs(opts, _defaults, ext = '.cfg'):
configs = []
for cp in opts.expand('%{_configdir}', _defaults).split(':'):
print 'Examining: %s' % (os.path.abspath(cp))
configs += glob.glob(os.path.join(cp, '*.cfg'))
configs += glob.glob(os.path.join(cp, '*%s' % (ext)))
for c in sorted(configs):
config = os.path.basename(c)
if config.endswith('.cfg'):
config = config[:-4]
if config.endswith(ext):
config = config[:0 - len(ext)]
print ' ', config
def run(args):

View File

@ -125,22 +125,22 @@ class buildset:
root, ext = path.splitext(exbset)
if exbset.endswith('.cfg'):
bsetcfg = exbset
if exbset.endswith('.bset'):
bset = exbset
else:
bsetcfg = '%s.cfg' % (exbset)
bset = '%s.bset' % (exbset)
bsetname = bsetcfg
bsetname = bset
if not path.exists(bsetname):
for cp in self.opts.expand('%{_configdir}', self.defaults).split(':'):
configdir = path.abspath(cp)
bsetname = path.join(configdir, bsetcfg)
bsetname = path.join(configdir, bset)
if path.exists(bsetname):
break
bsetname = None
if bsetname is None:
raise error.general('no build set file found: %s' % (bsetcfg))
raise error.general('no build set file found: %s' % (bset))
try:
if self.opts.trace():
print '_bset:%s: open: %s' % (self.bset, bsetname)
@ -215,7 +215,8 @@ class buildset:
def run():
import sys
try:
optargs = { '--list-configs': 'List available configurations' }
optargs = { '--list-configs': 'List available configurations',
'--list-bsets': 'List available build sets'}
opts, _defaults = defaults.load(sys.argv, optargs)
log.default = log.log(opts.logfiles())
_notice(opts, 'Source Builder - Set Builder, v%s' % (version))
@ -225,6 +226,8 @@ def run():
_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')
else:
for bset in opts.params():
c = buildset(bset, _defaults = _defaults, opts = opts)