From e9af46024965a12a8be64554d3458d084a7af527 Mon Sep 17 00:00:00 2001 From: Chris Johns Date: Mon, 5 Nov 2012 15:28:36 +1100 Subject: [PATCH] Move the build sets to .bset naming. --- .../{gnu-tools-4.6.cfg => gnu-tools-4.6.bset} | 0 sb/build.py | 8 ++++---- sb/setbuilder.py | 17 ++++++++++------- 3 files changed, 14 insertions(+), 11 deletions(-) rename config/{gnu-tools-4.6.cfg => gnu-tools-4.6.bset} (100%) diff --git a/config/gnu-tools-4.6.cfg b/config/gnu-tools-4.6.bset similarity index 100% rename from config/gnu-tools-4.6.cfg rename to config/gnu-tools-4.6.bset diff --git a/sb/build.py b/sb/build.py index 3ab6085..b4f91de 100644 --- a/sb/build.py +++ b/sb/build.py @@ -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): diff --git a/sb/setbuilder.py b/sb/setbuilder.py index 0d47b32..eca60e4 100644 --- a/sb/setbuilder.py +++ b/sb/setbuilder.py @@ -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)