def run(): import sys ec = 0 setbuilder_error = False try: optargs = { '--list-configs': 'List available configurations', '--list-bsets': 'List available build sets', '--list-deps': 'List the dependent files.', '--bset-tar-file': 'Create a build set tar file', '--pkg-tar-files': 'Create package tar files', '--no-report': 'Do not create a package report.', '--report-format': 'The report format (text, html, asciidoc).' } mailer.append_options(optargs) opts = options.load(sys.argv, optargs) log.notice('RTEMS Source Builder - Set Builder, %s' % (version.str())) opts.log_info() if not check.host_setup(opts): raise error.general('host build environment is not set up correctly') configs = build.get_configs(opts) if opts.get_arg('--list-deps'): deps = [] else: deps = None if not list_bset_cfg_files(opts, configs): prefix = opts.defaults.expand('%{_prefix}') if opts.canadian_cross(): opts.disable_install() if not opts.dry_run() and \ not opts.canadian_cross() and \ not opts.no_install() and \ not path.ispathwritable(prefix): raise error.general('prefix is not writable: %s' % (path.host(prefix))) for bset in opts.params(): setbuilder_error = True b = buildset(bset, configs, opts) b.build(deps) b = None setbuilder_error = False if deps is not None: c = 0 for d in sorted(set(deps)): c += 1 print('dep[%d]: %s' % (c, d)) except error.general as gerr: if not setbuilder_error: log.stderr(str(gerr)) log.stderr('Build FAILED') ec = 1 except error.internal as ierr: if not setbuilder_error: log.stderr(str(ierr)) log.stderr('Internal Build FAILED') ec = 1 except error.exit as eerr: pass except KeyboardInterrupt: log.notice('abort: user terminated') ec = 1 sys.exit(ec)
def run(args): try: optargs = { '--list-bsets': 'List available build sets', '--list-configs': 'List available configurations', '--format': 'Output format (text, html, asciidoc, ini, xml)', '--output': 'File name to output the report' } opts = options.load(args, optargs) if opts.get_arg('--output') and len(opts.params()) > 1: raise error.general( '--output can only be used with a single config') print 'RTEMS Source Builder, Reporter v%s' % (version.str()) opts.log_info() if not check.host_setup(opts): log.warning('forcing build with known host setup problems') configs = build.get_configs(opts) if not setbuilder.list_bset_cfg_files(opts, configs): output = opts.get_arg('--output') if output is not None: output = output[1] formatter = text_formatter() format_opt = opts.get_arg('--format') if format_opt: if len(format_opt) != 2: raise error.general('invalid format option: %s' % ('='.join(format_opt))) if format_opt[1] == 'text': pass elif format_opt[1] == 'asciidoc': formatter = asciidoc_formatter() elif format_opt[1] == 'html': formatter = html_formatter() elif format_opt[1] == 'ini': formatter = ini_formatter() elif format_opt[1] == 'xml': formatter = xml_formatter() else: raise error.general('invalid format: %s' % (format_opt[1])) r = report(formatter, configs, opts) for _config in opts.params(): if output is None: outname = path.splitext(_config)[0] + formatter.ext() outname = outname.replace('/', '-') else: outname = output config = build.find_config(_config, configs) if config is None: raise error.general('config file not found: %s' % (inname)) r.create(config, outname) del r else: raise error.general('invalid config type: %s' % (config)) except error.general, gerr: print gerr sys.exit(1)
def run(args): try: optargs = { '--list-bsets': 'List available build sets', '--list-configs': 'List available configurations', '--format': 'Output format (text, html, asciidoc, ini)', '--output': 'File name to output the report' } opts = options.load(args, optargs) if opts.get_arg('--output') and len(opts.params()) > 1: raise error.general('--output can only be used with a single config') print 'RTEMS Source Builder, Reporter v%s' % (version.str()) opts.log_info() if not check.host_setup(opts): log.warning('forcing build with known host setup problems') configs = build.get_configs(opts) if not setbuilder.list_bset_cfg_files(opts, configs): output = opts.get_arg('--output') if output is not None: output = output[1] format = 'text' ext = '.txt' format_opt = opts.get_arg('--format') if format_opt: if len(format_opt) != 2: raise error.general('invalid format option: %s' % ('='.join(format_opt))) if format_opt[1] == 'text': pass elif format_opt[1] == 'asciidoc': format = 'asciidoc' ext = '.txt' elif format_opt[1] == 'html': format = 'html' ext = '.html' elif format_opt[1] == 'ini': format = 'ini' ext = '.ini' else: raise error.general('invalid format: %s' % (format_opt[1])) r = report(format, configs, opts) for _config in opts.params(): if output is None: outname = path.splitext(_config)[0] + ext outname = outname.replace('/', '-') else: outname = output config = build.find_config(_config, configs) if config is None: raise error.general('config file not found: %s' % (inname)) r.create(config, outname) del r else: raise error.general('invalid config type: %s' % (config)) except error.general, gerr: print gerr sys.exit(1)
def run(): import sys ec = 0 setbuilder_error = False try: optargs = { "--list-configs": "List available configurations", "--list-bsets": "List available build sets", "--list-deps": "List the dependent files.", "--bset-tar-file": "Create a build set tar file", "--pkg-tar-files": "Create package tar files", "--no-report": "Do not create a package report.", "--report-format": "The report format (text, html, asciidoc).", } mailer.append_options(optargs) opts = options.load(sys.argv, optargs) log.notice("RTEMS Source Builder - Set Builder, %s" % (version.str())) opts.log_info() if not check.host_setup(opts): raise error.general("host build environment is not set up correctly") configs = build.get_configs(opts) if opts.get_arg("--list-deps"): deps = [] else: deps = None if not list_bset_cfg_files(opts, configs): prefix = opts.defaults.expand("%{_prefix}") if opts.canadian_cross(): opts.disable_install() if ( not opts.dry_run() and not opts.canadian_cross() and not opts.no_install() and not path.ispathwritable(prefix) ): raise error.general("prefix is not writable: %s" % (path.host(prefix))) for bset in opts.params(): setbuilder_error = True b = buildset(bset, configs, opts) b.build(deps) b = None setbuilder_error = False if deps is not None: c = 0 for d in sorted(set(deps)): c += 1 print "dep[%d]: %s" % (c, d) except error.general, gerr: if not setbuilder_error: log.stderr(str(gerr)) log.stderr("Build FAILED") ec = 1
def run(args): try: optargs = { "--list-bsets": "List available build sets", "--list-configs": "List available configurations", "--format": "Output format (text, html, asciidoc)", "--output": "File name to output the report", } opts = options.load(args, optargs) if opts.get_arg("--output") and len(opts.params()) > 1: raise error.general("--output can only be used with a single config") print "RTEMS Source Builder, Reporter v%s" % (version.str()) opts.log_info() if not check.host_setup(opts): log.warning("forcing build with known host setup problems") configs = build.get_configs(opts) if not setbuilder.list_bset_cfg_files(opts, configs): output = opts.get_arg("--output") if output is not None: output = output[1] format = "text" ext = ".txt" format_opt = opts.get_arg("--format") if format_opt: if len(format_opt) != 2: raise error.general("invalid format option: %s" % ("=".join(format_opt))) if format_opt[1] == "text": pass elif format_opt[1] == "asciidoc": format = "asciidoc" ext = ".txt" elif format_opt[1] == "html": format = "html" ext = ".html" else: raise error.general("invalid format: %s" % (format_opt[1])) r = report(format, configs, opts) for _config in opts.params(): if output is None: outname = path.splitext(_config)[0] + ext outname = outname.replace("/", "-") else: outname = output config = build.find_config(_config, configs) if config is None: raise error.general("config file not found: %s" % (inname)) r.create(config, outname) del r else: raise error.general("invalid config type: %s" % (config)) except error.general, gerr: print gerr sys.exit(1)
def run(): import sys try: optargs = { '--list-configs': 'List available configurations', '--list-bsets': 'List available build sets', '--list-deps': 'List the dependent files.', '--bset-tar-file': 'Create a build set tar file', '--pkg-tar-files': 'Create package tar files', '--no-report': 'Do not create a package report.', '--report-format': 'The report format (text, html, asciidoc).' } mailer.append_options(optargs) opts = options.load(sys.argv, optargs) log.notice('RTEMS Source Builder - Set Builder, v%s' % (version.str())) opts.log_info() if not check.host_setup(opts): raise error.general( 'host build environment is not set up correctly') configs = build.get_configs(opts) if opts.get_arg('--list-deps'): deps = [] else: deps = None if not list_bset_cfg_files(opts, configs): prefix = opts.defaults.expand('%{_prefix}') if not opts.dry_run() and not opts.no_install() and \ not path.ispathwritable(prefix): raise error.general('prefix is not writable: %s' % (path.host(prefix))) for bset in opts.params(): b = buildset(bset, configs, opts) b.build(deps) del b if deps is not None: c = 0 for d in sorted(set(deps)): c += 1 print 'dep[%d]: %s' % (c, d) except error.general, gerr: log.notice(str(gerr)) print >> sys.stderr, 'Build FAILED' sys.exit(1)
def run(): import sys try: optargs = { '--list-configs': 'List available configurations', '--list-bsets': 'List available build sets', '--list-deps': 'List the dependent files.', '--bset-tar-file': 'Create a build set tar file', '--pkg-tar-files': 'Create package tar files', '--no-report': 'Do not create a package report.', '--report-format': 'The report format (text, html, asciidoc).' } mailer.append_options(optargs) opts = options.load(sys.argv, optargs) log.notice('RTEMS Source Builder - Set Builder, v%s' % (version.str())) opts.log_info() if not check.host_setup(opts): raise error.general('host build environment is not set up correctly') configs = build.get_configs(opts) if opts.get_arg('--list-deps'): deps = [] else: deps = None if not list_bset_cfg_files(opts, configs): prefix = opts.defaults.expand('%{_prefix}') if not opts.dry_run() and not opts.no_install() and \ not path.ispathwritable(prefix): raise error.general('prefix is not writable: %s' % (path.host(prefix))) for bset in opts.params(): b = buildset(bset, configs, opts) b.build(deps) del b if deps is not None: c = 0 for d in sorted(set(deps)): c += 1 print 'dep[%d]: %s' % (c, d) except error.general, gerr: log.notice(str(gerr)) print >> sys.stderr, 'Build FAILED' sys.exit(1)
def run(args = sys.argv): ec = 0 get_sources_error = True try: # # The RSB options support cannot be used because it loads the defaults # for the host which we cannot do here. # description = 'RTEMS Get Sources downloads all the source a build set ' description += 'references for all hosts.' argsp = argparse.ArgumentParser(prog = 'rtems-get-sources', description = description) argsp.add_argument('--rtems-version', help = 'Set the RTEMS version.', type = str, default = version.version()) argsp.add_argument('--list-hosts', help = 'List the hosts.', action = 'store_true') argsp.add_argument('--list-bsets', help = 'List the hosts.', action = 'store_true') argsp.add_argument('--download-dir', help = 'Download directory.', type = str) argsp.add_argument('--clean', help = 'Clean the download directory.', action = 'store_true') argsp.add_argument('--tar', help = 'Create a tarball of all the source.', action = 'store_true') argsp.add_argument('--log', help = 'Log file.', type = str, default = log_default()) argsp.add_argument('--trace', help = 'Enable trace logging for debugging.', action = 'store_true') argsp.add_argument('bsets', nargs='*', help = 'Build sets.') argopts = argsp.parse_args(args[2:]) load_log(argopts.log) log.notice('RTEMS Source Builder - Get Sources, %s' % (version.str())) log.tracing = argopts.trace opts = load_options(args, argopts) configs = build.get_configs(opts) if argopts.list_bsets: list_bset_files(opts, configs) else: if argopts.clean: if argopts.download_dir is None: raise error.general('cleaning of the default download directories is not supported') if path.exists(argopts.download_dir): log.notice('Cleaning source directory: %s' % (argopts.download_dir)) path.removeall(argopts.download_dir) if len(argopts.bsets) == 0: raise error.general('no build sets provided on the command line') for bset in argopts.bsets: get_sources_error = True b = buildset(bset, configs, opts) get_sources_error = False for host in host_profiles: b.build(host) b = None except error.general as gerr: if get_sources_error: log.stderr(str(gerr)) log.stderr('Build FAILED') ec = 1 except error.internal as ierr: if get_sources_error: log.stderr(str(ierr)) log.stderr('Internal Build FAILED') ec = 1 except error.exit as eerr: pass except KeyboardInterrupt: log.notice('abort: user terminated') ec = 1 except: raise log.notice('abort: unknown error') ec = 1 sys.exit(ec)
def run(): import sys ec = 0 setbuilder_error = False mail = None try: optargs = { '--list-configs': 'List available configurations', '--list-bsets': 'List available build sets', '--list-configs': 'List available configuration files.', '--list-deps': 'List the dependent files.', '--bset-tar-file': 'Create a build set tar file', '--pkg-tar-files': 'Create package tar files', '--no-report': 'Do not create a package report.', '--report-format': 'The report format (text, html, asciidoc).' } mailer.append_options(optargs) opts = options.load(sys.argv, optargs) if opts.get_arg('--mail'): mail = {'mail': mailer.mail(opts), 'output': log_capture()} to_addr = opts.get_arg('--mail-to') if to_addr is not None: mail['to'] = to_addr[1] else: mail['to'] = opts.defaults.expand('%{_mail_tools_to}') mail['from'] = mail['mail'].from_address() log.notice('RTEMS Source Builder - Set Builder, %s' % (version.str())) opts.log_info() if not check.host_setup(opts): raise error.general( 'host build environment is not set up correctly') if mail: mail['header'] = os.linesep.join(mail['output'].get()) + os.linesep mail['header'] += os.linesep mail['header'] += 'Host: ' + reports.platform( 'compact') + os.linesep indent = ' ' for l in textwrap.wrap(reports.platform('extended'), width=80 - len(indent)): mail['header'] += indent + l + os.linesep configs = build.get_configs(opts) if opts.get_arg('--list-deps'): deps = [] else: deps = None if not list_bset_cfg_files(opts, configs): prefix = opts.defaults.expand('%{_prefix}') if opts.canadian_cross(): opts.disable_install() if not opts.dry_run() and \ not opts.canadian_cross() and \ not opts.no_install() and \ not path.ispathwritable(prefix): raise error.general('prefix is not writable: %s' % (path.host(prefix))) for bset in opts.params(): setbuilder_error = True b = buildset(bset, configs, opts) b.build(deps, mail=mail) b = None setbuilder_error = False if deps is not None: c = 0 for d in sorted(set(deps)): c += 1 print('dep[%d]: %s' % (c, d)) except error.general as gerr: if not setbuilder_error: log.stderr(str(gerr)) log.stderr('Build FAILED') ec = 1 except error.internal as ierr: if not setbuilder_error: log.stderr(str(ierr)) log.stderr('Internal Build FAILED') ec = 1 except error.exit as eerr: pass except KeyboardInterrupt: log.notice('abort: user terminated') ec = 1 except: raise log.notice('abort: unknown error') ec = 1 sys.exit(ec)
def run(args): try: optargs = { '--list-bsets': 'List available build sets', '--list-configs': 'List available configurations', '--format': 'Output format (text, html, markdown, ini, xml)', '--output': 'File name to output the report' } opts = options.load(args, optargs, logfile = False) if opts.get_arg('--output') and len(opts.params()) > 1: raise error.general('--output can only be used with a single config') print('RTEMS Source Builder, Reporter, %s' % (version.str())) opts.log_info() if not check.host_setup(opts): log.warning('forcing build with known host setup problems') configs = build.get_configs(opts) if not setbuilder.list_bset_cfg_files(opts, configs): output = opts.get_arg('--output') if output is not None: output = output[1] formatter = text_formatter() format_opt = opts.get_arg('--format') if format_opt: if len(format_opt) != 2: raise error.general('invalid format option: %s' % ('='.join(format_opt))) if format_opt[1] == 'text': pass elif format_opt[1] == 'markdown': formatter = markdown_formatter() elif format_opt[1] == 'html': formatter = html_formatter() elif format_opt[1] == 'ini': formatter = ini_formatter() elif format_opt[1] == 'xml': formatter = xml_formatter() else: raise error.general('invalid format: %s' % (format_opt[1])) r = report(formatter, configs, opts) for _config in opts.params(): if output is None: outname = path.splitext(_config)[0] + formatter.ext() outname = outname.replace('/', '-') else: outname = output config = build.find_config(_config, configs) if config is None: raise error.general('config file not found: %s' % (_config)) r.create(config, outname) del r else: raise error.general('invalid config type: %s' % (config)) except error.general as gerr: print(gerr) sys.exit(1) except error.internal as ierr: print(ierr) sys.exit(1) except error.exit as eerr: pass except KeyboardInterrupt: log.notice('abort: user terminated') sys.exit(1) sys.exit(0)
def run(args=sys.argv): ec = 0 get_sources_error = True try: # # The RSB options support cannot be used because it loads the defaults # for the host which we cannot do here. # description = 'RTEMS Get Sources downloads all the source a build set ' description += 'references for all hosts.' argsp = argparse.ArgumentParser(prog='rtems-get-sources', description=description) argsp.add_argument('--rtems-version', help='Set the RTEMS version.', type=str, default=version.version()) argsp.add_argument('--list-hosts', help='List the hosts.', action='store_true') argsp.add_argument('--list-bsets', help='List the hosts.', action='store_true') argsp.add_argument('--download-dir', help='Download directory.', type=str) argsp.add_argument('--clean', help='Clean the download directory.', action='store_true') argsp.add_argument('--tar', help='Create a tarball of all the source.', action='store_true') argsp.add_argument('--log', help='Log file.', type=str, default=log_default()) argsp.add_argument('--trace', help='Enable trace logging for debugging.', action='store_true') argsp.add_argument('bsets', nargs='*', help='Build sets.') argopts = argsp.parse_args(args[2:]) load_log(argopts.log) log.notice('RTEMS Source Builder - Get Sources, %s' % (version.str())) log.tracing = argopts.trace opts = load_options(args, argopts) configs = build.get_configs(opts) if argopts.list_bsets: list_bset_files(opts, configs) else: if argopts.clean: if argopts.download_dir is None: raise error.general( 'cleaning of the default download directories is not supported' ) if path.exists(argopts.download_dir): log.notice('Cleaning source directory: %s' % (argopts.download_dir)) path.removeall(argopts.download_dir) if len(argopts.bsets) == 0: raise error.general( 'no build sets provided on the command line') for bset in argopts.bsets: get_sources_error = True b = buildset(bset, configs, opts) get_sources_error = False for host in host_profiles: b.build(host) b = None except error.general as gerr: if get_sources_error: log.stderr(str(gerr)) log.stderr('Build FAILED') ec = 1 except error.internal as ierr: if get_sources_error: log.stderr(str(ierr)) log.stderr('Internal Build FAILED') ec = 1 except error.exit as eerr: pass except KeyboardInterrupt: log.notice('abort: user terminated') ec = 1 except: raise log.notice('abort: unknown error') ec = 1 sys.exit(ec)
def run(): import sys ec = 0 setbuilder_error = False mail = None try: optargs = { '--list-configs': 'List available configurations', '--list-bsets': 'List available build sets', '--list-configs': 'List available configuration files.', '--list-deps': 'List the dependent files.', '--bset-tar-file': 'Create a build set tar file', '--pkg-tar-files': 'Create package tar files', '--no-report': 'Do not create a package report.', '--report-format': 'The report format (text, html, asciidoc).' } mailer.append_options(optargs) opts = options.load(sys.argv, optargs) if opts.get_arg('--mail'): mail = { 'mail' : mailer.mail(opts), 'output': log_capture() } to_addr = opts.get_arg('--mail-to') if to_addr is not None: mail['to'] = to_addr[1] else: mail['to'] = opts.defaults.expand('%{_mail_tools_to}') mail['from'] = mail['mail'].from_address() log.notice('RTEMS Source Builder - Set Builder, %s' % (version.str())) opts.log_info() if not check.host_setup(opts): raise error.general('host build environment is not set up correctly') if mail: mail['header'] = os.linesep.join(mail['output'].get()) + os.linesep mail['header'] += os.linesep mail['header'] += 'Host: ' + reports.platform('compact') + os.linesep indent = ' ' for l in textwrap.wrap(reports.platform('extended'), width = 80 - len(indent)): mail['header'] += indent + l + os.linesep configs = build.get_configs(opts) if opts.get_arg('--list-deps'): deps = [] else: deps = None if not list_bset_cfg_files(opts, configs): prefix = opts.defaults.expand('%{_prefix}') if opts.canadian_cross(): opts.disable_install() if not opts.dry_run() and \ not opts.canadian_cross() and \ not opts.no_install() and \ not path.ispathwritable(prefix): raise error.general('prefix is not writable: %s' % (path.host(prefix))) for bset in opts.params(): setbuilder_error = True b = buildset(bset, configs, opts) b.build(deps, mail = mail) b = None setbuilder_error = False if deps is not None: c = 0 for d in sorted(set(deps)): c += 1 print('dep[%d]: %s' % (c, d)) except error.general as gerr: if not setbuilder_error: log.stderr(str(gerr)) log.stderr('Build FAILED') ec = 1 except error.internal as ierr: if not setbuilder_error: log.stderr(str(ierr)) log.stderr('Internal Build FAILED') ec = 1 except error.exit as eerr: pass except KeyboardInterrupt: log.notice('abort: user terminated') ec = 1 except: raise log.notice('abort: unknown error') ec = 1 sys.exit(ec)
def run(args): try: optargs = { '--list-bsets': 'List available build sets', '--list-configs': 'List available configurations', '--format': 'Output format (text, html, markdown, ini, xml)', '--output': 'File name to output the report', '--sanitize': 'Remove Remotes information from report' } opts = options.load(args, optargs, logfile=False) if opts.get_arg('--output') and len(opts.params()) > 1: raise error.general( '--output can only be used with a single config') print('RTEMS Source Builder, Reporter, %s' % (version.string())) opts.log_info() if not check.host_setup(opts): log.warning('forcing build with known host setup problems') configs = build.get_configs(opts) if not setbuilder.list_bset_cfg_files(opts, configs): output = opts.get_arg('--output') if output is not None: output = output[1] formatter = text_formatter() format_opt = opts.get_arg('--format') if format_opt: if len(format_opt) != 2: raise error.general('invalid format option: %s' % ('='.join(format_opt))) if format_opt[1] == 'text': pass elif format_opt[1] == 'markdown': formatter = markdown_formatter() elif format_opt[1] == 'html': formatter = html_formatter() elif format_opt[1] == 'ini': formatter = ini_formatter() elif format_opt[1] == 'xml': formatter = xml_formatter() else: raise error.general('invalid format: %s' % (format_opt[1])) sanitize = False if opts.get_arg('--sanitize'): sanitize = True r = report(formatter, sanitize, configs, opts) for _config in opts.params(): if output is None: outname = path.splitext(_config)[0] + formatter.ext() outname = outname.replace('/', '-') else: outname = output config = build.find_config(_config, configs) if config is None: raise error.general('config file not found: %s' % (_config)) r.create(config, outname) del r except error.general as gerr: print(gerr) sys.exit(1) except error.internal as ierr: print(ierr) sys.exit(1) except error.exit as eerr: pass except KeyboardInterrupt: log.notice('abort: user terminated') sys.exit(1) sys.exit(0)