summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2023-12-07 08:13:58 +1100
committerChris Johns <chrisj@rtems.org>2023-12-07 10:31:59 +1100
commit5e4b3b90981d67d48f1996cf77340dd953015cd0 (patch)
treea877fbaba65d3b286b7f7a568d27a7d414d39b08
parentsb: Allow _ in downloaded file names (diff)
downloadrtems-source-builder-5e4b3b90981d67d48f1996cf77340dd953015cd0.tar.bz2
sb: Set the uid and gid on POSIX systems
This improves performance because it avoids an exec each time the _uid macro is referenced and that can be a number of times for each config parsed.
-rw-r--r--source-builder/sb/options.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/source-builder/sb/options.py b/source-builder/sb/options.py
index d554097..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):