]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
bitbake.conf: Add BB_TASK_NETWORK to enable task network globally rbt/network
authorRobert Yang <liezhi.yang@windriver.com>
Thu, 20 Jan 2022 06:29:04 +0000 (14:29 +0800)
committerRobert Yang <liezhi.yang@windriver.com>
Thu, 20 Jan 2022 07:01:22 +0000 (07:01 +0000)
The NIS or icecc can't work when task network is dissable, add BB_TASK_NETWORK
to enable network globally for such exceptions.

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>
meta/classes/icecc.bbclass
meta/conf/bitbake.conf
meta/lib/oe/utils.py

index 794e9930ad9a94655e0e831c97a82b5663baf63a..c39c86458a4bc3cb9823754d093eae07ac01bdc5 100644 (file)
@@ -41,6 +41,8 @@ ICECC_ENV_EXEC ?= "${STAGING_BINDIR_NATIVE}/icecc-create-env"
 
 HOSTTOOLS_NONFATAL += "icecc patchelf"
 
+BB_TASK_NETWORK ? = "1"
+
 # This version can be incremented when changes are made to the environment that
 # invalidate the version on the compile nodes. Changing it will cause a new
 # environment to be created.
index fba99e8f0cd980c385f27689c2f6cdd8a450f0ea..bf5bcd555193a08da75c0caa6b440ee5118b11bd 100644 (file)
@@ -946,3 +946,6 @@ MULTILIB_VARIANTS ??= ""
 # what it would be anyway if the signature generator (e.g. OEEquivHash) doesn't
 # support unihashes.
 BB_UNIHASH ?= "${BB_TASKHASH}"
+
+# Enable task network for remote user such as NIS.
+BB_TASK_NETWORK ??= "${@['1', '0'][oe.utils.is_local_uid()]}"
index 136650e6f740ee3da766bff6937a41f0d7282383..c21f034aafc333b80c690f226033eeedf50c7590 100644 (file)
@@ -595,3 +595,18 @@ def directory_size(root, blocksize=4096):
         total += sum(roundup(getsize(os.path.join(root, name))) for name in files)
         total += roundup(getsize(root))
     return total
+
+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()
+    local_uids = set()
+    with open('/etc/passwd', 'r') as f:
+        for line in f.readlines():
+            if not ':' in line:
+                continue
+            local_uids.add(line.split(':')[2])
+    return uid in local_uids