aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bb/utils.py
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2022-01-20 22:52:55 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-02-01 07:31:37 +0000
commit4eafae7904bae6e5c6bc50356e8a9077f2e207fa (patch)
tree7b2e68aad0449ffd4bc17bd3280431fb0a595693 /lib/bb/utils.py
parent1f06f326fa8b47e2a4dce756d57a9369a2225201 (diff)
downloadbitbake-4eafae7904bae6e5c6bc50356e8a9077f2e207fa.tar.gz
bitbake: bitbake-worker: Preserve network non-local uid
The NIS can't work when network is dissable, so preserve network for it, the error is like: do_ypcall: clnt_call: RPC: Unable to send; errno = Network is unreachable Note, enable nscd on the build machine might be a solution, but that isn't reliable since it depends on whether the network function has been cached or not. Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/utils.py')
-rw-r--r--lib/bb/utils.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/bb/utils.py b/lib/bb/utils.py
index 031223193..128b3ab57 100644
--- a/lib/bb/utils.py
+++ b/lib/bb/utils.py
@@ -1735,3 +1735,19 @@ def environment(**envvars):
os.environ[var] = backup[var]
else:
del os.environ[var]
+
+def is_local_uid(uid=''):
+ """
+ Check whether uid is a local one or not.
+ Can't use pwd module since it gets all UIDs, not local ones only.
+ """
+ if not uid:
+ uid = os.getuid()
+ with open('/etc/passwd', 'r') as f:
+ for line in f:
+ line_split = line.split(':')
+ if len(line_split) < 3:
+ continue
+ if str(uid) == line_split[2]:
+ return True
+ return False