[bitbake-devel] [PATCH] Add a variable to pass flags to fakeroot (pseudo)

Joshua Watt jpewhacker at gmail.com
Thu Dec 6 18:55:35 UTC 2018


It is occasionally useful to pass additional flags to fakeroot (pseudo)
either for debugging or for behavioral system changes. Add a variable
called "FAKEROOTARGS" that can be used for this purpose.

Signed-off-by: Joshua Watt <JPEWhacker at gmail.com>
---
 bitbake/lib/bb/build.py    | 2 +-
 bitbake/lib/bb/runqueue.py | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py
index 4631abdde57..20350319bf0 100644
--- a/bitbake/lib/bb/build.py
+++ b/bitbake/lib/bb/build.py
@@ -371,7 +371,7 @@ exit $ret
     if d.getVarFlag(func, 'fakeroot', False):
         fakerootcmd = d.getVar('FAKEROOT')
         if fakerootcmd:
-            cmd = [fakerootcmd, runfile]
+            cmd = [fakerootcmd] + (d.getVar('FAKEROOTARGS') or '').split() + ['--', runfile]
 
     if bb.msg.loggerDefaultVerbose:
         logfile = LogTee(logger, sys.stdout)
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
index f2e52cf758c..de04ccfcb91 100644
--- a/bitbake/lib/bb/runqueue.py
+++ b/bitbake/lib/bb/runqueue.py
@@ -1175,12 +1175,12 @@ class RunQueue:
         if fakeroot:
             magic = magic + "beef"
             mcdata = self.cooker.databuilder.mcdata[mc]
-            fakerootcmd = mcdata.getVar("FAKEROOTCMD")
+            fakerootcmd = [mcdata.getVar("FAKEROOTCMD")] + (mcdata.getVar("FAKEROOTARGS") or '').split() + ['--']
             fakerootenv = (mcdata.getVar("FAKEROOTBASEENV") or "").split()
             env = os.environ.copy()
             for key, value in (var.split('=') for var in fakerootenv):
                 env[key] = value
-            worker = subprocess.Popen([fakerootcmd, "bitbake-worker", magic], stdout=subprocess.PIPE, stdin=subprocess.PIPE, env=env)
+            worker = subprocess.Popen(fakerootcmd + ["bitbake-worker", magic], stdout=subprocess.PIPE, stdin=subprocess.PIPE, env=env)
         else:
             worker = subprocess.Popen(["bitbake-worker", magic], stdout=subprocess.PIPE, stdin=subprocess.PIPE)
         bb.utils.nonblockingfd(worker.stdout)
-- 
2.19.1



More information about the bitbake-devel mailing list