mirror of
https://git.rtems.org/rtems-source-builder
synced 2024-10-09 07:15:10 +08:00
Clean up build set configuration reporting.
This commit is contained in:
parent
c18c4b6d33
commit
864e8ff9fa
@ -266,30 +266,21 @@ class report:
|
|||||||
self.config_end(name)
|
self.config_end(name)
|
||||||
|
|
||||||
def buildset(self, name):
|
def buildset(self, name):
|
||||||
try_config = False
|
self.bset_nesting += 1
|
||||||
try:
|
self.buildset_start(name)
|
||||||
self.bset_nesting += 1
|
bset = setbuilder.buildset(name,
|
||||||
self.buildset_start(name)
|
_configs = self.configs,
|
||||||
bset = setbuilder.buildset(name,
|
_defaults = self.defaults,
|
||||||
_configs = self.configs,
|
opts = self.opts)
|
||||||
_defaults = self.defaults,
|
for c in bset.load():
|
||||||
opts = self.opts)
|
if c.endswith('.bset'):
|
||||||
for c in bset.load():
|
self.buildset(c)
|
||||||
if c.endswith('.bset'):
|
elif c.endswith('.cfg'):
|
||||||
self.buildset(c)
|
self.config(c)
|
||||||
elif c.endswith('.cfg'):
|
|
||||||
self.config(c)
|
|
||||||
else:
|
|
||||||
raise error.general('invalid config type: %s' % (c))
|
|
||||||
self.buildset_end(name)
|
|
||||||
self.bset_nesting -= 1
|
|
||||||
except error.general, gerr:
|
|
||||||
if gerr.msg.startswith('no build set file found'):
|
|
||||||
try_config = True
|
|
||||||
else:
|
else:
|
||||||
raise
|
raise error.general('invalid config type: %s' % (c))
|
||||||
if try_config:
|
self.buildset_end(name)
|
||||||
self.config(name)
|
self.bset_nesting -= 1
|
||||||
|
|
||||||
def generate(self, name):
|
def generate(self, name):
|
||||||
if self.format == 'html':
|
if self.format == 'html':
|
||||||
@ -313,7 +304,15 @@ class report:
|
|||||||
def make(self, inname, outname, intro_text = None):
|
def make(self, inname, outname, intro_text = None):
|
||||||
self.setup()
|
self.setup()
|
||||||
self.introduction(inname, intro_text)
|
self.introduction(inname, intro_text)
|
||||||
self.buildset(inname)
|
config = setbuilder.find_config(inname, self.configs)
|
||||||
|
if config is None:
|
||||||
|
raise error.general('config file not found: %s' % (inname))
|
||||||
|
if config.endswith('.bset'):
|
||||||
|
self.buildset(config)
|
||||||
|
elif config.endswith('.cfg'):
|
||||||
|
self.config(config)
|
||||||
|
else:
|
||||||
|
raise error.general('invalid config type: %s' % (config))
|
||||||
self.generate(outname)
|
self.generate(outname)
|
||||||
|
|
||||||
def run(args):
|
def run(args):
|
||||||
|
@ -58,6 +58,18 @@ def _notice(opts, text):
|
|||||||
log.output(text)
|
log.output(text)
|
||||||
log.flush()
|
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:
|
class buildset:
|
||||||
"""Build a set builds a set of packages."""
|
"""Build a set builds a set of packages."""
|
||||||
|
|
||||||
@ -74,18 +86,6 @@ class buildset:
|
|||||||
if not self.opts.quiet():
|
if not self.opts.quiet():
|
||||||
log.output(text)
|
log.output(text)
|
||||||
|
|
||||||
def find_config(self, config):
|
|
||||||
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 self.configs['files']:
|
|
||||||
if path.basename(c) in names:
|
|
||||||
if path.dirname(c).endswith(path.dirname(config)):
|
|
||||||
return c
|
|
||||||
return None
|
|
||||||
|
|
||||||
def copy(self, src, dst):
|
def copy(self, src, dst):
|
||||||
if not os.path.isdir(path.host(src)):
|
if not os.path.isdir(path.host(src)):
|
||||||
raise error.general('copying tree: no source directory: %s' % (path.host(src)))
|
raise error.general('copying tree: no source directory: %s' % (path.host(src)))
|
||||||
@ -100,7 +100,7 @@ class buildset:
|
|||||||
except distutils.errors.DistutilsFileError, err:
|
except distutils.errors.DistutilsFileError, err:
|
||||||
raise error.general('copying tree: %s' % (str(err)))
|
raise error.general('copying tree: %s' % (str(err)))
|
||||||
|
|
||||||
def report(self, _config, tmproot):
|
def report(self, _config, _build):
|
||||||
if not self.opts.get_arg('--no-report'):
|
if not self.opts.get_arg('--no-report'):
|
||||||
format = self.opts.get_arg('--report-format')
|
format = self.opts.get_arg('--report-format')
|
||||||
if format is None:
|
if format is None:
|
||||||
@ -120,11 +120,13 @@ class buildset:
|
|||||||
ext = '.html'
|
ext = '.html'
|
||||||
else:
|
else:
|
||||||
raise error.general('invalid report format: %s' % (format[1]))
|
raise error.general('invalid report format: %s' % (format[1]))
|
||||||
|
buildroot = _build.config.abspath('%{buildroot}')
|
||||||
prefix = self.opts.expand('%{_prefix}', self.defaults)
|
prefix = self.opts.expand('%{_prefix}', self.defaults)
|
||||||
outname = path.host(path.join(tmproot, prefix, path.splitext(path.basename(_config))[0] + ext))
|
name = path.splitext(path.basename(_config))[0] + ext
|
||||||
_notice(self.opts, 'reporting: %s -> %s' % (_config, outname))
|
outname = path.host(path.join(buildroot, prefix, name))
|
||||||
|
_notice(self.opts, 'reporting: %s -> %s' % (_config, name))
|
||||||
if not self.opts.dry_run():
|
if not self.opts.dry_run():
|
||||||
r = report.report(format, self.configs, self.defaults)
|
r = reports.report(format, self.configs, self.defaults, self.opts)
|
||||||
r.make(_config, outname)
|
r.make(_config, outname)
|
||||||
del r
|
del r
|
||||||
|
|
||||||
@ -230,7 +232,7 @@ class buildset:
|
|||||||
raise error.general('invalid directive in build set files: %s' % (l))
|
raise error.general('invalid directive in build set files: %s' % (l))
|
||||||
else:
|
else:
|
||||||
l = l.strip()
|
l = l.strip()
|
||||||
c = self.find_config(l)
|
c = find_config(l, self.configs)
|
||||||
if c is None:
|
if c is None:
|
||||||
raise error.general('cannot find file: %s' % (l))
|
raise error.general('cannot find file: %s' % (l))
|
||||||
configs += [c]
|
configs += [c]
|
||||||
@ -289,8 +291,8 @@ class buildset:
|
|||||||
if s == 0:
|
if s == 0:
|
||||||
tmproot = self.first_package(b)
|
tmproot = self.first_package(b)
|
||||||
b.make()
|
b.make()
|
||||||
|
self.report(configs[s], b)
|
||||||
self.every_package(b, tmproot)
|
self.every_package(b, tmproot)
|
||||||
self.report(configs[s], tmproot)
|
|
||||||
if s == len(configs) - 1:
|
if s == len(configs) - 1:
|
||||||
self.last_package(b, tmproot)
|
self.last_package(b, tmproot)
|
||||||
builds += [b]
|
builds += [b]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user