From 0759d9862882d4f928ff189688fba8e12dc499af Mon Sep 17 00:00:00 2001 From: Chris Johns Date: Mon, 4 Mar 2013 10:14:57 +1100 Subject: [PATCH] Move find_configs to build and fix. Install reports to 'rtems-source-builder'. --- source-builder/sb/build.py | 12 ++++++++++++ source-builder/sb/reports.py | 2 +- source-builder/sb/setbuilder.py | 18 ++++-------------- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/source-builder/sb/build.py b/source-builder/sb/build.py index 52da459..97bae91 100644 --- a/source-builder/sb/build.py +++ b/source-builder/sb/build.py @@ -467,6 +467,18 @@ def get_configs(opts, _defaults): configs['files'] = sorted(configs['files']) return configs +def find_config(config, configs): + config_root, config_ext = path.splitext(config) + if config_ext not in ['', '.bset', '.cfg']: + config_root = config + config_ext = '' + for c in configs['files']: + r, e = path.splitext(c) + if config_root == r: + if config_ext == '' or config_ext == e: + return c + return None + def run(args): try: optargs = { '--list-configs': 'List available configurations' } diff --git a/source-builder/sb/reports.py b/source-builder/sb/reports.py index 6214493..08badd5 100644 --- a/source-builder/sb/reports.py +++ b/source-builder/sb/reports.py @@ -304,7 +304,7 @@ class report: def make(self, inname, outname, intro_text = None): self.setup() self.introduction(inname, intro_text) - config = setbuilder.find_config(inname, self.configs) + config = build.find_config(inname, self.configs) if config is None: raise error.general('config file not found: %s' % (inname)) if config.endswith('.bset'): diff --git a/source-builder/sb/setbuilder.py b/source-builder/sb/setbuilder.py index 801341e..1fbc9a0 100644 --- a/source-builder/sb/setbuilder.py +++ b/source-builder/sb/setbuilder.py @@ -58,18 +58,6 @@ def _notice(opts, text): log.output(text) log.flush() -def find_config(config, configs): - if config.endswith('.bset') or config.endswith('.cfg'): - names = [config] - else: - names = ['%s.cfg' % (path.basename(config)), - '%s.bset' % (path.basename(config))] - for c in configs['files']: - if path.basename(c) in names: - if path.dirname(c).endswith(path.dirname(config)): - return c - return None - class buildset: """Build a set builds a set of packages.""" @@ -123,9 +111,11 @@ class buildset: buildroot = _build.config.abspath('%{buildroot}') prefix = self.opts.expand('%{_prefix}', self.defaults) name = path.splitext(path.basename(_config))[0] + ext - outname = path.host(path.join(buildroot, prefix, name)) + outpath = path.host(path.join(buildroot, prefix, 'rtems-source-builder')) + outname = path.host(path.join(outpath, name)) _notice(self.opts, 'reporting: %s -> %s' % (_config, name)) if not self.opts.dry_run(): + _build.mkdir(outpath) r = reports.report(format, self.configs, self.defaults, self.opts) r.make(_config, outname) del r @@ -232,7 +222,7 @@ class buildset: raise error.general('invalid directive in build set files: %s' % (l)) else: l = l.strip() - c = find_config(l, self.configs) + c = build.find_config(l, self.configs) if c is None: raise error.general('cannot find file: %s' % (l)) configs += [c]