Openembedded Bitbake Development
 help / color / mirror / Atom feed
From: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
To: Robert Yang <liezhi.yang@windriver.com>,
	"bitbake-devel@lists.openembedded.org"
	<bitbake-devel@lists.openembedded.org>
Cc: "quaresma.jose@gmail.com" <quaresma.jose@gmail.com>
Subject: RE: [bitbake-devel] [PATCH 1/1] bitbake-worker: Check BB_TASK_NETWORK before disable network for task
Date: Fri, 21 Jan 2022 15:36:44 +0000	[thread overview]
Message-ID: <276b4301dac5442cae7a411c58f2db68@axis.com> (raw)
In-Reply-To: <1ee69861-28f1-dbd6-b26c-5f72894b01e4@windriver.com>

> -----Original Message-----
> From: Robert Yang <liezhi.yang@windriver.com>
> Sent: den 21 januari 2022 04:15
> To: Peter Kjellerstedt <peter.kjellerstedt@axis.com>; bitbake-
> devel@lists.openembedded.org
> Cc: quaresma.jose@gmail.com
> Subject: Re: [bitbake-devel] [PATCH 1/1] bitbake-worker: Check
> BB_TASK_NETWORK before disable network for task
> 
> Hi Peter,
> 
> On 1/20/22 9:50 PM, Peter Kjellerstedt wrote:
> >> -----Original Message-----
> >> From: bitbake-devel@lists.openembedded.org <bitbake-
> devel@lists.openembedded.org> On Behalf Of Robert Yang
> >> Sent: den 20 januari 2022 08:27
> >> To: bitbake-devel@lists.openembedded.org
> >> Cc: quaresma.jose@gmail.com
> >> Subject: [bitbake-devel] [PATCH 1/1] bitbake-worker: Check
> BB_TASK_NETWORK before disable network for task
> >>
> >> The NIS user can't work when task's network is disabled, so check
> >> BB_TASK_NETWORK before disable it, the conf files can set
> BB_TASK_NETWORK.
> >>
> >> Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
> >> ---
> >>   bitbake/bin/bitbake-worker | 3 ++-
> >>   1 file changed, 2 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/bitbake/bin/bitbake-worker b/bitbake/bin/bitbake-worker
> >> index 3aaf3c2444b..3d7a781d35c 100755
> >> --- a/bitbake/bin/bitbake-worker
> >> +++ b/bitbake/bin/bitbake-worker
> >> @@ -261,7 +261,8 @@ def fork_off_task(cfg, data, databuilder,
> workerdata,
> >> fn, task, taskname, taskha
> >>
> >>                   bb.utils.set_process_name("%s:%s" %
> (the_data.getVar("PN"), taskname.replace("do_", "")))
> >>
> >> -                if not the_data.getVarFlag(taskname, 'network',
> False):
> >> +                bb_task_network =
> bb.utils.to_boolean(the_data.getVar('BB_TASK_NETWORK'), False)
> >
> > Why use False to getVar() above?
> 
> The False is for bb.utils.to_boolean(), not getVar(), the getVar has only
> one argument:
> 
> the_data.getVar('BB_TASK_NETWORK')

Duh, of course. I guess I need new glasses...

> >
> >> +                if not (bb_task_network or
> the_data.getVarFlag(taskname, 'network', False)):
> >
> > I can't speak for others, but I find "not (foo or bar)" a lot harder to
> > parse than "not foo and not bar".
> 
> Technically, the "not (foo or bar)" is slightly faster than "not foo and
> not bar" since the latter one requires more logical evaluates.

Somehow, I think you will find it hard to actually measure that time 
difference... ;) I tried, and in my testing the time to execute either 
statement was 0.07-0.12 μs, i.e., it was impossible to declare either 
as faster than the other.

> // Robert
> 
> >
> >>                       logger.debug("Attempting to disable network")
> >>                       bb.utils.disable_network(uid, gid)
> >>
> >> --
> >> 2.31.1
> >
> > //Peter

//Peter



      reply	other threads:[~2022-01-21 15:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-20  7:27 [PATCH 0/1] bitbake-worker: Check BB_TASK_NETWORK before disable network for task Robert Yang
2022-01-20  7:27 ` [PATCH 1/1] " Robert Yang
2022-01-20 13:50   ` [bitbake-devel] " Peter Kjellerstedt
2022-01-21  3:15     ` Robert Yang
2022-01-21 15:36       ` Peter Kjellerstedt [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=276b4301dac5442cae7a411c58f2db68@axis.com \
    --to=peter.kjellerstedt@axis.com \
    --cc=bitbake-devel@lists.openembedded.org \
    --cc=liezhi.yang@windriver.com \
    --cc=quaresma.jose@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox