All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Add a variable to pass flags to fakeroot (pseudo)
@ 2018-12-06 18:55 Joshua Watt
  2018-12-06 19:08 ` Mark Hatle
  2018-12-06 22:05 ` Richard Purdie
  0 siblings, 2 replies; 7+ messages in thread
From: Joshua Watt @ 2018-12-06 18:55 UTC (permalink / raw)
  To: bitbake-devel

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@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



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] Add a variable to pass flags to fakeroot (pseudo)
  2018-12-06 18:55 [PATCH] Add a variable to pass flags to fakeroot (pseudo) Joshua Watt
@ 2018-12-06 19:08 ` Mark Hatle
  2018-12-06 22:05   ` Richard Purdie
  2018-12-06 22:05 ` Richard Purdie
  1 sibling, 1 reply; 7+ messages in thread
From: Mark Hatle @ 2018-12-06 19:08 UTC (permalink / raw)
  To: Joshua Watt, bitbake-devel

(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

On 12/6/18 12:55 PM, Joshua Watt wrote:
> 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@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)
> 



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Add a variable to pass flags to fakeroot (pseudo)
  2018-12-06 18:55 [PATCH] Add a variable to pass flags to fakeroot (pseudo) Joshua Watt
  2018-12-06 19:08 ` Mark Hatle
@ 2018-12-06 22:05 ` Richard Purdie
  2018-12-07  3:27   ` Joshua Watt
  1 sibling, 1 reply; 7+ messages in thread
From: Richard Purdie @ 2018-12-06 22:05 UTC (permalink / raw)
  To: Joshua Watt, bitbake-devel

On Thu, 2018-12-06 at 12:55 -0600, Joshua Watt wrote:
> 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



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Add a variable to pass flags to fakeroot (pseudo)
  2018-12-06 19:08 ` Mark Hatle
@ 2018-12-06 22:05   ` Richard Purdie
  0 siblings, 0 replies; 7+ messages in thread
From: Richard Purdie @ 2018-12-06 22:05 UTC (permalink / raw)
  To: Mark Hatle, Joshua Watt, bitbake-devel

On Thu, 2018-12-06 at 13:08 -0600, Mark Hatle wrote:
> (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.

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

Cheers,

Richard



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Add a variable to pass flags to fakeroot (pseudo)
  2018-12-06 22:05 ` Richard Purdie
@ 2018-12-07  3:27   ` Joshua Watt
  2018-12-07 13:04     ` richard.purdie
  0 siblings, 1 reply; 7+ messages in thread
From: Joshua Watt @ 2018-12-07  3:27 UTC (permalink / raw)
  To: Richard Purdie; +Cc: bitbake-devel

On Thu, Dec 6, 2018 at 4:05 PM Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
>
> On Thu, 2018-12-06 at 12:55 -0600, Joshua Watt wrote:
> > 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.

>
> Cheers,
>
> Richard
>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Add a variable to pass flags to fakeroot (pseudo)
  2018-12-07  3:27   ` Joshua Watt
@ 2018-12-07 13:04     ` richard.purdie
  2018-12-07 14:02       ` Aaron Cohen
  0 siblings, 1 reply; 7+ messages in thread
From: richard.purdie @ 2018-12-07 13:04 UTC (permalink / raw)
  To: Joshua Watt; +Cc: bitbake-devel

On Thu, 2018-12-06 at 21:27 -0600, Joshua Watt wrote:
> On Thu, Dec 6, 2018 at 4:05 PM Richard Purdie
> <richard.purdie@linuxfoundation.org> wrote:
> > On Thu, 2018-12-06 at 12:55 -0600, Joshua Watt wrote:
> > > 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.

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

Cheers,

Richard



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Add a variable to pass flags to fakeroot (pseudo)
  2018-12-07 13:04     ` richard.purdie
@ 2018-12-07 14:02       ` Aaron Cohen
  0 siblings, 0 replies; 7+ messages in thread
From: Aaron Cohen @ 2018-12-07 14:02 UTC (permalink / raw)
  To: richard.purdie; +Cc: bitbake-devel

[-- Attachment #1: Type: text/plain, Size: 1681 bytes --]

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

On Fri, Dec 7, 2018 at 8:04 AM <richard.purdie@linuxfoundation.org> wrote:

> On Thu, 2018-12-06 at 21:27 -0600, Joshua Watt wrote:
> > On Thu, Dec 6, 2018 at 4:05 PM Richard Purdie
> > <richard.purdie@linuxfoundation.org> wrote:
> > > On Thu, 2018-12-06 at 12:55 -0600, Joshua Watt wrote:
> > > > 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.
>
> I'd prefer to fix this to work than add more variables...
>
> Cheers,
>
> Richard
>
> --
> _______________________________________________
> bitbake-devel mailing list
> bitbake-devel@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/bitbake-devel
>

[-- Attachment #2: Type: text/html, Size: 2482 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-12-07 14:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-06 18:55 [PATCH] Add a variable to pass flags to fakeroot (pseudo) Joshua Watt
2018-12-06 19:08 ` Mark Hatle
2018-12-06 22:05   ` Richard Purdie
2018-12-06 22:05 ` Richard Purdie
2018-12-07  3:27   ` Joshua Watt
2018-12-07 13:04     ` richard.purdie
2018-12-07 14:02       ` Aaron Cohen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.