Skip to contentSkip to conversation

Add a variable to pass flags to fakeroot (pseudo)

PATCH In review Joshua Watt 4 participants 7 messages Dec 6, 2018 – Dec 7, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add a variable to pass flags to fakeroot (pseudo)

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.

---
 bitbake/lib/bb/build.py    | 2 +-
 bitbake/lib/bb/runqueue.py | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
bitbake/lib/bb/build.py +1 -1
index 4631abdde57..20350319bf0 100644
@@ -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)
bitbake/lib/bb/runqueue.py +2 -2
index f2e52cf758c..de04ccfcb91 100644
@@ -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)
Signature · 1 line
2.19.1
#1 lore raw

(No objection to this patch......)

Would anyone be interested in a comment that changes aware from 'fakeroot' and to 'pseudo'?

Just curious, as I don't actually think 'fakeroot' would work anymore. (Ya, I know there would be compatibility issues, but those could likely be addressed by variables and/or 'or' statements.)

Just wondering if that kind of a change/cleanup makes sense or not just thinking of bitbake.

--Mark

Quoted 43 lines · Joshua Watt

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.

---
 bitbake/lib/bb/build.py    | 2 +-
 bitbake/lib/bb/runqueue.py | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
bitbake/lib/bb/build.py +1 -1
index 4631abdde57..20350319bf0 100644
@@ -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)
bitbake/lib/bb/runqueue.py +2 -2
index f2e52cf758c..de04ccfcb91 100644
@@ -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 lore raw
Quoted 6 lines · Mark Hatle

(No objection to this patch......)

Would anyone be interested in a comment that changes aware from 'fakeroot' and
to 'pseudo'?

Quoted 8 lines

Just curious, as I don't actually think 'fakeroot' would work anymore. (Ya, I
know there would be compatibility issues, but those could likely be addressed by
variables and/or 'or' statements.)

Just wondering if that kind of a change/cleanup makes sense or not just thinking of bitbake.

I've wondered but I think it would cause churn for little gain...

Cheers,

Richard

#3 lore raw
In reply to Joshua Watt
Quoted 4 lines · Joshua Watt

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.

Why wouldn't you just append to FAKEROOT/FAKEROOTCMD ?

Cheers,

Richard

#4 lore raw
Quoted 8 lines · Richard Purdie
Quoted 4 lines · Joshua Watt

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.

Why wouldn't you just append to FAKEROOT/FAKEROOTCMD ?

You can't currently add arguments to FAKEROOTCMD because it is passed as an array member to subprocess.Popen sort of like:

subprocess.Popen([d.getVar('FAKEROOTCMD'), 'blah', 'blah', ...

In order to pass arguments, it would probably have to have split into an array i.e. :

subprocess.Popen(d.getVar('FAKEROOTCMD').split() + ['blah', 'blah', ...

I wasn't sure if that was desirable or if it would break anything, so I went with the lower risk approach of adding a new variables. I can certainly make a change to modify the usage of FAKEROOTCMD as described above and simply append the flags to it if that is preferred.

Quoted 5 lines

Cheers,

Richard

#5 lore raw
Quoted 19 lines · Joshua Watt
Quoted 8 lines · Richard Purdie
Quoted 5 lines · Joshua Watt

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.

Why wouldn't you just append to FAKEROOT/FAKEROOTCMD ?

You can't currently add arguments to FAKEROOTCMD because it is passed as an array member to subprocess.Popen sort of like:

subprocess.Popen([d.getVar('FAKEROOTCMD'), 'blah', 'blah', ...

In order to pass arguments, it would probably have to have split into an array i.e. :

Quoted 8 lines

subprocess.Popen(d.getVar('FAKEROOTCMD').split() + ['blah', 'blah',
...

I wasn't sure if that was desirable or if it would break anything, so I went with the lower risk approach of adding a new variables. I can certainly make a change to modify the usage of FAKEROOTCMD as described above and simply append the flags to it if that is preferred.

I'd prefer to fix this to work than add more variables...

Cheers,

Richard

#6 lore raw

Using split() will break if the path contains a space if that is a concern.

Quoted 41 lines · On Fri, Dec 7, 2018 at 8:04 AM <[email protected]> wrote:
Quoted 19 lines · Joshua Watt
Quoted 8 lines · Richard Purdie
Quoted 5 lines · Joshua Watt

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.

Why wouldn't you just append to FAKEROOT/FAKEROOTCMD ?

You can't currently add arguments to FAKEROOTCMD because it is passed as an array member to subprocess.Popen sort of like:

subprocess.Popen([d.getVar('FAKEROOTCMD'), 'blah', 'blah', ...

In order to pass arguments, it would probably have to have split into an array i.e. :

Quoted 8 lines

subprocess.Popen(d.getVar('FAKEROOTCMD').split() + ['blah', 'blah',
...

I wasn't sure if that was desirable or if it would break anything, so I went with the lower risk approach of adding a new variables. I can certainly make a change to modify the usage of FAKEROOTCMD as described above and simply append the flags to it if that is preferred.

I'd prefer to fix this to work than add more variables...

Cheers,

Richard

--
_______________________________________________
bitbake-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/bitbake-devel