From: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
To: Robert Yang <liezhi.yang@windriver.com>,
"openembedded-core@lists.openembedded.org"
<openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH 1/1] base.bbclass: Check BuildStarted for HOSTTOOLS
Date: Thu, 14 Feb 2019 03:43:03 +0000 [thread overview]
Message-ID: <6144b418cab34c7189db037e0aa97a8c@XBOX04.axis.com> (raw)
In-Reply-To: <5323c75d-5a4a-42e0-af0d-f309d23ef15e@windriver.com>
> -----Original Message-----
> From: openembedded-core-bounces@lists.openembedded.org <openembedded-
> core-bounces@lists.openembedded.org> On Behalf Of Robert Yang
> Sent: den 14 februari 2019 04:22
> To: Peter Kjellerstedt <peter.kjellerstedt@axis.com>; openembedded-
> core@lists.openembedded.org
> Subject: Re: [OE-core] [PATCH 1/1] base.bbclass: Check BuildStarted for
> HOSTTOOLS
>
> On 2/14/19 11:05 AM, Peter Kjellerstedt wrote:
> >> -----Original Message-----
> >> From: openembedded-core-bounces@lists.openembedded.org
> <openembedded-
> >> core-bounces@lists.openembedded.org> On Behalf Of Robert Yang
> >> Sent: den 14 februari 2019 03:59
> >> To: openembedded-core@lists.openembedded.org
> >> Subject: [OE-core] [PATCH 1/1] base.bbclass: Check BuildStarted for
> >> HOSTTOOLS
> >>
> >> There might be no bb.event.ConfigParsed event bitbake server is
> >> running,
> >> so check bb.event.BuildStarted to make sure HOSTTOOLS_DIR existed
> when
> >> BuildStarted.
> >>
> >> Fixed:
> >> $ export BB_SERVER_TIMEOUT=-1
> >> $ bitbake quilt-native
> >> $ rm -fr tmp
> >> $ bitbake quilt-native
> >> ERROR: Error running gcc --version: /bin/sh: gcc: command not found
> >>
> >> This error is caused by enable_uninative(), it runs twice
> (ConfigParsed
> >> and
> >> BuildStarted), the error would happen when there is no ConfigParsed
> >> event
> >> (no hosttools is created), but BuildStarted. This patch can fix the
> >> problem.
> >>
> >> [YOCTO #13022]
> >>
> >> Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
> >> ---
> >> meta/classes/base.bbclass | 6 +++++-
> >> 1 file changed, 5 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
> >> index f1a3c0e..283cb0f 100644
> >> --- a/meta/classes/base.bbclass
> >> +++ b/meta/classes/base.bbclass
> >> @@ -224,7 +224,11 @@ base_eventhandler[eventmask] =
> >> "bb.event.ConfigParsed bb.event.MultiConfigParsed
> >> python base_eventhandler() {
> >> import bb.runqueue
> >>
> >> - if isinstance(e, bb.event.ConfigParsed):
> >> + # There might be no bb.event.ConfigParsed event bitbake server
> is running,
> >> + # so check bb.event.BuildStarted to make sure HOSTTOOLS_DIR
> existed when
> >> + # BuildStarted.
> >> + if isinstance(e, bb.event.ConfigParsed) or \
> >> + (isinstance(e, bb.event.BuildStarted) and not
> os.path.exists(d.getVar('HOSTTOOLS_DIR'))):
> >
> > I don't think you want to do this here since not all of this if
> statement
>
> That can make the code simple and avoid duplicated, the only code which
> may run twice is "d.setVar('BB_VERSION', bb.__version__)", I don't
> think it's a problem since it is very light.
Well, true, but I still don't think you should mix them. Have one case
for what only needs to be done for bb.event.ConfigParsed, one for only
bb.event.BuildStarted and one for either.
> > should be done for the BuildStarted event. I think it is better to
> add a
> > separate if statement just for the HOSTTOOLS part (see below). Also,
> I don't
> > think you should be checking if the HOSTTOOLS_DIR exists, because the
> > contents of ${HOSTTOOLS} and ${HOSTTOOLS_NONFATAL} may have changed,
> in
> > which case any new tools need to be added to the directory.
>
> You don't have to worry about this since bitbake server can handle it
> when HOSTTOOLS are changed in conf files, you can try this:
>
> $ export BB_SERVER_TIMEOUT=-1
> $ bitbake quilt-native
>
> Add HOSTTOOLS += "passwd" to conf/local.conf, and:
>
> $ bitbake quilt-native
> $ ls tmp/hosttools/ | grep passwd
> passwd
>
> The passwd will be created.
>
> >
> >> if not d.getVar("NATIVELSBSTRING", False):
> >> d.setVar("NATIVELSBSTRING", lsb_distro_identifier(d))
> >> d.setVar('BB_VERSION', bb.__version__)
> >> --
> >> 2.7.4
> >
> > This is my suggestion for how to split the current handling of
> > bb.event.ConfigParsed (also note that I corrected the comment before
> > the new if statement):
> >
> > if isinstance(e, bb.event.ConfigParsed):
> > if not d.getVar("NATIVELSBSTRING", False):
> > d.setVar("NATIVELSBSTRING", lsb_distro_identifier(d))
> > d.setVar('BB_VERSION', bb.__version__)
> >
> > # There might be no bb.event.ConfigParsed event if the bitbake server is
>
> Thanks for the correction.
>
> > # running, so check bb.event.BuildStarted too to make sure ${HOSTTOOLS_DIR}
> > # exists.
> > if isinstance(e, bb.event.ConfigParsed) or isinstance(e, bb.event.BuildStarted):
>
> I'm afraid that it doesn't work since it would make hosttools generate
> twice when bitbake sever is not running, which seems not a good idea.
I don't think that's a problem in practice since the generation of
${HOSTTOLS_DIR} should be pretty fast if it is already populated, but I
guess you could use your original if statement to avoid that:
if isinstance(e, bb.event.ConfigParsed) or \
(isinstance(e, bb.event.BuildStarted) and not os.path.exists(d.getVar('HOSTTOOLS_DIR'))):
> // Robert
>
> > # Works with the line in layer.conf which changes PATH to point here
> > setup_hosttools_dir(d.getVar('HOSTTOOLS_DIR'), 'HOSTTOOLS', d)
> > setup_hosttools_dir(d.getVar('HOSTTOOLS_DIR'), 'HOSTTOOLS_NONFATAL', d, fatal=False)
> >
> > //Peter
> >
> >
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
next prev parent reply other threads:[~2019-02-14 3:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-14 2:58 [PATCH 0/1] base.bbclass: Check BuildStarted for HOSTTOOLS Robert Yang
2019-02-14 2:58 ` [PATCH 1/1] " Robert Yang
2019-02-14 3:05 ` Peter Kjellerstedt
2019-02-14 3:22 ` Robert Yang
2019-02-14 3:43 ` Peter Kjellerstedt [this message]
2019-02-14 6:11 ` Robert Yang
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=6144b418cab34c7189db037e0aa97a8c@XBOX04.axis.com \
--to=peter.kjellerstedt@axis.com \
--cc=liezhi.yang@windriver.com \
--cc=openembedded-core@lists.openembedded.org \
/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