diff options
Diffstat (limited to 'source-builder/sb/options.py')
-rw-r--r-- | source-builder/sb/options.py | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/source-builder/sb/options.py b/source-builder/sb/options.py index d6bffd0..05ad208 100644 --- a/source-builder/sb/options.py +++ b/source-builder/sb/options.py @@ -46,7 +46,7 @@ basepath = 'sb' # # Save the host and POSIX state. # -host_windows = False +host_windows = os.name == 'nt' host_posix = True class command_line: @@ -103,6 +103,10 @@ class command_line: self.defaults[self._long_opts[lo][0]] = ('none', 'none', self._long_opts[lo][3]) + # Set the _uid field, performance improvement on Unix + if not host_windows: + self.defaults['_uid'] = str(os.getuid()) + self.defaults['_gid'] = str(os.getgid()) def __str__(self): def _dict(dd): @@ -235,7 +239,7 @@ class command_line: print('--with-<label> : Add the --with-<label> to the build') print('--without-<label> : Add the --without-<label> to the build') print('--rtems-tools path : Path to an install RTEMS tool set') - print('--rtems-bsp arc/bsp : Standard RTEMS architecure and BSP specifier') + print('--rtems-bsp arch/bsp : Standard RTEMS architecure and BSP specifier') print('--rtems-version ver : The RTEMS major/minor version string') if self.optargs: for a in self.optargs: @@ -517,6 +521,15 @@ class command_line: return None return self.parse_args(arg) + def find_arg(self, arg): + if self.optargs is None or arg not in self.optargs: + raise error.internal('bad arg: %s' % (arg)) + for a in self.args: + sa = a.split('=') + if sa[0].startswith(arg): + return sa + return None + def with_arg(self, label, default = 'not-found'): # the default if there is no option for without. result = default @@ -582,7 +595,22 @@ class command_line: self.opts['no-install'] = '1' def info(self): - s = ' Command Line: %s%s' % (' '.join(self.argv), os.linesep) + # Filter potentially sensitive mail options out. + filtered_args = [ + arg for arg in self.argv + if all( + smtp_opt not in arg + for smtp_opt in [ + '--smtp-host', + '--mail-to', + '--mail-from', + '--smtp-user', + '--smtp-password', + '--smtp-port' + ] + ) + ] + s = ' Command Line: %s%s' % (' '.join(filtered_args), os.linesep) s += ' Python: %s' % (sys.version.replace('\n', '')) return s @@ -610,6 +638,7 @@ class command_line: if len(ab) != 2: raise error.general('invalid --rtems-bsp option') self.args.append('--target=%s-rtems%s' % (ab[0], rtems_version)) + self.args.append('--with-rtems-arch=%s' % (ab[0])) self.args.append('--with-rtems-bsp=%s' % (ab[1])) def load(args, optargs = None, defaults = '%{_sbdir}/defaults.mc', logfile = True): |