why does oe-buildenv-internal check for -z "$BDIR"?
perusing the OE init scripts, and noticed this in
oe-buildenv-internal, line 42:
if [ -z "$BDIR" ]; then
if [ -z "$1" ]; then
BDIR="build"
else
BDIR="$1"
... snip ... i'm curious ... under what circumstances would BDIR *not* be unset
(or not be the empty string) at that point? i'm just puzzled as to a possible flow of control that gets to that point where BDIR has a non-empty value, since i've never seen any mention in the docs about such a possibility.
doesn't hurt, of course, just not sure what that test is trying to
accomplish.
rday
Quoted 10 lines · Robert P. J. Day
perusing the OE init scripts, and noticed this in
oe-buildenv-internal, line 42:if [ -z "$BDIR" ]; then
if [ -z "$1" ]; then BDIR="build" else BDIR="$1" ... snip ...
Quoted 8 lines
i'm curious ... under what circumstances would BDIR *not* be unset
(or not be the empty string) at that point? i'm just puzzled as to a possible flow of control that gets to that point where BDIR has a non-empty value, since i've never seen any mention in the docs about such a possibility.doesn't hurt, of course, just not sure what that test is trying to
accomplish.
You can do:
$ source oe-init-build-env build2
and if your shell supports it, build becomes build2?
Cheers,
Richard
Quoted 17 lines · Richard Purdie
Quoted 16 lines · Robert P. J. Day
perusing the OE init scripts, and noticed this in
oe-buildenv-internal, line 42:if [ -z "$BDIR" ]; then
if [ -z "$1" ]; then BDIR="build" else BDIR="$1" ... snip ...i'm curious ... under what circumstances would BDIR *not* be unset
(or not be the empty string) at that point? i'm just puzzled as to a possible flow of control that gets to that point where BDIR has a non-empty value, since i've never seen any mention in the docs about such a possibility.
Quoted 8 lines
Quoted 2 lines
doesn't hurt, of course, just not sure what that test is trying to
accomplish.You can do:
$ source oe-init-build-env build2and if your shell supports it, build becomes build2?
i know that -- in fact, it's the only way i use it -- the question
is the purpose for checking if $BDIR is zero length first. that is, under what circumstances could it *not* be? even invoking the way you demonstrate, that variable is empty when tested, and i see nothing that could cause it to have a value before that test.
rday
Quoted 5 lines
i know that -- in fact, it's the only way i use it -- the question
is the purpose for checking if $BDIR is zero length first. that is, under what circumstances could it *not* be? even invoking the way you demonstrate, that variable is empty when tested, and i see nothing that could cause it to have a value before that test.
FWIW I was curious/bored and looked to see if 'BDIR' was ever used in poky (outside of the script of course), and I found no results.
git rev-list --all | xargs git grep -w BDIR -- './*' ':!scripts/oe-buildenv-internal'
Chris
Quoted 10 lines · On Sat, 18 Apr 2020, [email protected] wrote:
Quoted 5 lines
i know that -- in fact, it's the only way i use it -- the question
is the purpose for checking if $BDIR is zero length first. that is, under what circumstances could it *not* be? even invoking the way you demonstrate, that variable is empty when tested, and i see nothing that could cause it to have a value before that test.FWIW I was curious/bored and looked to see if 'BDIR' was ever used in poky (outside of the script of course), and I found no results.
git rev-list --all | xargs git grep -w BDIR -- './*' ':!scripts/oe-buildenv-internal'
that's kind of the point i was making ... that variable appeared out
of nowhere, clearly seemed like a local variable, and is even "unset" after it's used in that script. i poked around, trying to figure if there was some other flow of control that got you into that script from another direction, but i didn't find one.
and, yes, it seems trivial to obsess over it, but it's just those
sorts of things that make me wonder, "hmmmmm ... maybe i *don't* really understand how this script can be used."
anyway, moving on ...
rday
Quoted 30 lines
-----Original Message-----
From: [email protected] <openembedded- [email protected]> On Behalf Of Robert P. J. Day
Sent: den 18 april 2020 19:24
To: [email protected]
Cc: Richard Purdie <[email protected]>; OE Core mailing list <[email protected]>
Subject: Re: [OE-core] why does oe-buildenv-internal check for -z "$BDIR"?Quoted 10 lines · On Sat, 18 Apr 2020, [email protected] wrote:
Quoted 5 lines
i know that -- in fact, it's the only way i use it -- the question
is the purpose for checking if $BDIR is zero length first. that is, under what circumstances could it *not* be? even invoking the way you demonstrate, that variable is empty when tested, and i see nothing that could cause it to have a value before that test.FWIW I was curious/bored and looked to see if 'BDIR' was ever used in poky (outside of the script of course), and I found no results.
git rev-list --all | xargs git grep -w BDIR -- './*' ':!scripts/oe-
buildenv-internal'
that's kind of the point i was making ... that variable appeared out
of nowhere, clearly seemed like a local variable, and is even "unset" after it's used in that script. i poked around, trying to figure if there was some other flow of control that got you into that script from another direction, but i didn't find one.
Quoted 7 lines
and, yes, it seems trivial to obsess over it, but it's just those
sorts of things that make me wonder, "hmmmmm ... maybe i *don't* really understand how this script can be used."anyway, moving on ...
rday
When it comes to understanding why the code looks like it does in a case like this, it is often better to look at the history than the current state.
If you go back to when the test was introduced (commit 5d5fab77cf9616bf62023c202b38f309f8bbf189 in Poky), you will see that BDIR could be set in a script called poky-autobuild at that time. The poky-autobuild script was removed 12 years ago, but the test in oe-buildenv-internal remained.
//Peter
Quoted 42 lines · Peter Kjellerstedt
Quoted 30 lines
-----Original Message-----
From: [email protected] <openembedded- [email protected]> On Behalf Of Robert P. J. Day
Sent: den 18 april 2020 19:24
To: [email protected]
Cc: Richard Purdie <[email protected]>; OE Core mailing list <[email protected]>
Subject: Re: [OE-core] why does oe-buildenv-internal check for -z "$BDIR"?Quoted 10 lines · On Sat, 18 Apr 2020, [email protected] wrote:
Quoted 5 lines
i know that -- in fact, it's the only way i use it -- the question
is the purpose for checking if $BDIR is zero length first. that is, under what circumstances could it *not* be? even invoking the way you demonstrate, that variable is empty when tested, and i see nothing that could cause it to have a value before that test.FWIW I was curious/bored and looked to see if 'BDIR' was ever used in poky (outside of the script of course), and I found no results.
git rev-list --all | xargs git grep -w BDIR -- './*' ':!scripts/oe-
buildenv-internal'
that's kind of the point i was making ... that variable appeared out
of nowhere, clearly seemed like a local variable, and is even "unset" after it's used in that script. i poked around, trying to figure if there was some other flow of control that got you into that script from another direction, but i didn't find one.Quoted 7 lines
and, yes, it seems trivial to obsess over it, but it's just those
sorts of things that make me wonder, "hmmmmm ... maybe i *don't* really understand how this script can be used."anyway, moving on ...
rday
When it comes to understanding why the code looks like it does in a case like this, it is often better to look at the history than the current state.
Quoted 5 lines
If you go back to when the test was introduced (commit
5d5fab77cf9616bf62023c202b38f309f8bbf189in Poky), you will see that BDIR could be set in a script called poky-autobuild at that time. The poky-autobuild script was removed 12 years ago, but the test in oe-buildenv-internal remained.
i did a (cursory) check of history; obviously, i did not look
closely enough. my bad.
rday
Quoted 42 lines · Peter Kjellerstedt
Quoted 30 lines
-----Original Message-----
From: [email protected] <openembedded- [email protected]> On Behalf Of Robert P. J. Day
Sent: den 18 april 2020 19:24
To: [email protected]
Cc: Richard Purdie <[email protected]>; OE Core mailing list <[email protected]>
Subject: Re: [OE-core] why does oe-buildenv-internal check for -z "$BDIR"?Quoted 10 lines · On Sat, 18 Apr 2020, [email protected] wrote:
Quoted 5 lines
i know that -- in fact, it's the only way i use it -- the question
is the purpose for checking if $BDIR is zero length first. that is, under what circumstances could it *not* be? even invoking the way you demonstrate, that variable is empty when tested, and i see nothing that could cause it to have a value before that test.FWIW I was curious/bored and looked to see if 'BDIR' was ever used in poky (outside of the script of course), and I found no results.
git rev-list --all | xargs git grep -w BDIR -- './*' ':!scripts/oe-
buildenv-internal'
that's kind of the point i was making ... that variable appeared out
of nowhere, clearly seemed like a local variable, and is even "unset" after it's used in that script. i poked around, trying to figure if there was some other flow of control that got you into that script from another direction, but i didn't find one.Quoted 7 lines
and, yes, it seems trivial to obsess over it, but it's just those
sorts of things that make me wonder, "hmmmmm ... maybe i *don't* really understand how this script can be used."anyway, moving on ...
rday
When it comes to understanding why the code looks like it does in a case like this, it is often better to look at the history than the current state.
Quoted 5 lines
If you go back to when the test was introduced (commit
5d5fab77cf9616bf62023c202b38f309f8bbf189in Poky), you will see that BDIR could be set in a script called poky-autobuild at that time. The poky-autobuild script was removed 12 years ago, but the test in oe-buildenv-internal remained.
additional observation, but same script also contains:
if [ -n "$2" ]; then
BITBAKEDIR="$2"
ficlearly implying a second argument pointing at bitbake directory, which is nowhere documented, and is followed by:
if [ -z "$BITBAKEDIR" ]; then
BITBAKEDIR="$OEROOT/bitbake$BBEXTRA"
test -d "$BITBAKEDIR" || BITBAKEDIR="$OEROOT/../bitbake$BBEXTRA"fi
this also seems out of date, but i won't flog it any further.
rday
p.s. no mention in ref manual of "BBEXTRA" variable ... i'll leave it to those higher up the food chain to decide what's worth cleaning.
Quoted 59 lines · On Apr 18, 2020, 1:10 PM -0700, Robert P. J. Day <[email protected]>, wrote:
Quoted 42 lines · Peter Kjellerstedt
Quoted 30 lines
-----Original Message-----
From: [email protected] <openembedded- [email protected]> On Behalf Of Robert P. J. Day
Sent: den 18 april 2020 19:24
To: [email protected]
Cc: Richard Purdie <[email protected]>; OE Core mailing list <[email protected]>
Subject: Re: [OE-core] why does oe-buildenv-internal check for -z "$BDIR"?Quoted 10 lines · On Sat, 18 Apr 2020, [email protected] wrote:
Quoted 5 lines
i know that -- in fact, it's the only way i use it -- the question is the purpose for checking if $BDIR is zero length first. that is, under what circumstances could it *not* be? even invoking the way you demonstrate, that variable is empty when tested, and i see nothing that could cause it to have a value before that test.
FWIW I was curious/bored and looked to see if 'BDIR' was ever used in poky (outside of the script of course), and I found no results.
git rev-list --all | xargs git grep -w BDIR -- './*' ':!scripts/oe-
buildenv-internal'
that's kind of the point i was making ... that variable appeared out of nowhere, clearly seemed like a local variable, and is even "unset" after it's used in that script. i poked around, trying to figure if there was some other flow of control that got you into that script from another direction, but i didn't find one.
Quoted 7 lines
and, yes, it seems trivial to obsess over it, but it's just those sorts of things that make me wonder, "hmmmmm ... maybe i *don't* really understand how this script can be used."
anyway, moving on ...
rday
When it comes to understanding why the code looks like it does in a case like this, it is often better to look at the history than the current state.
Quoted 5 lines
If you go back to when the test was introduced (commit
5d5fab77cf9616bf62023c202b38f309f8bbf189in Poky), you will see that BDIR could be set in a script called poky-autobuild at that time. The poky-autobuild script was removed 12 years ago, but the test in oe-buildenv-internal remained.additional observation, but same script also contains:
if [ -n "$2" ]; then
BITBAKEDIR="$2"
ficlearly implying a second argument pointing at bitbake directory, which is nowhere documented, and is followed by:
Quoted 6 lines
if [ -z "$BITBAKEDIR" ]; then BITBAKEDIR="$OEROOT/bitbake$BBEXTRA"
test -d "$BITBAKEDIR" || BITBAKEDIR="$OEROOT/../bitbake$BBEXTRA" fithis also seems out of date, but i won't flog it any further.
I don’t think this is out of date. It’s allowing the user to specify the path to bitbake (which I’ve done in unusual layouts or just to be explicit), falling back to either under OEROOT (poky-style) or in its parent (more typical).
It’s also worth noting that oe-init-build-env and oe-buildenv-internal are not just used directly, but many other setup scripts build on top of them, so this particular flexibility is useful. BDIR still seems like it can be dropped regardless of the BITBAKEDIR logic.
-Chris
Quoted 86 lines · Christopher Larson
On Apr 18, 2020, 1:10 PM -0700, Robert P. J. Day <[email protected]>, wrote:
On Sat, 18 Apr 2020, Peter Kjellerstedt wrote:-----Original Message-----
From: [email protected] <openembedded- [email protected]> On Behalf Of Robert P. J. Day
Sent: den 18 april 2020 19:24
To: [email protected]
Cc: Richard Purdie <[email protected]>; OE Core mailing list <[email protected]>
Subject: Re: [OE-core] why does oe-buildenv-internal check for -z "$BDIR"?On Sat, 18 Apr 2020, [email protected] wrote:
i know that -- in fact, it's the only way i use it -- the question
is the purpose for checking if $BDIR is zero length first. that is,
under what circumstances could it *not* be? even invoking the way you
demonstrate, that variable is empty when tested, and i see nothing
that could cause it to have a value before that test.FWIW I was curious/bored and looked to see if 'BDIR' was ever used
in poky (outside of the script of course), and I found no results.git rev-list --all | xargs git grep -w BDIR -- './*' ':!scripts/oe-
buildenv-internal'
that's kind of the point i was making ... that variable appeared out of nowhere, clearly seemed like a local variable, and is even "unset" after it's used in that script. i poked around, trying to figure if there was some other flow of control that got you into that script from another direction, but i didn't find one.
and, yes, it seems trivial to obsess over it, but it's just those sorts of things that make me wonder, "hmmmmm ... maybe i *don't* really understand how this script can be used."
anyway, moving on ...
rday
When it comes to understanding why the code looks like it does in a case like this, it is often better to look at the history than the current state.
If you go back to when the test was introduced (commit
5d5fab77cf9616bf62023c202b38f309f8bbf189in Poky), you will see that BDIR could be set in a script called poky-autobuild at that time. The poky-autobuild script was removed 12 years ago, but the test in oe-buildenv-internal remained.additional observation, but same script also contains:
if [ -n "$2" ]; then
BITBAKEDIR="$2"
ficlearly implying a second argument pointing at bitbake directory, which is nowhere documented, and is followed by:
if [ -z "$BITBAKEDIR" ]; then BITBAKEDIR="$OEROOT/bitbake$BBEXTRA"
test -d "$BITBAKEDIR" || BITBAKEDIR="$OEROOT/../bitbake$BBEXTRA" fithis also seems out of date, but i won't flog it any further.
I don’t think this is out of date. It’s allowing the user to specify the path to bitbake (which I’ve done in unusual layouts or just to be explicit), falling back to either under OEROOT (poky-style) or in its parent (more typical).
Quoted 5 lines
It’s also worth noting that oe-init-build-env and oe-buildenv-internal are not just used directly, but many other setup scripts build on top of them, so this particular flexibility is useful. BDIR still seems like it can be dropped regardless of the BITBAKEDIR logic.
that actually matches with what i concluded -- BDIR is dead and
gone, but i realized that BITBAKEDIR could still be useful, even if it's currently undocumented. so i'll submit a patch to ditch BDIR, and leave all else as is. for now.
rday
Quoted 4 lines · Robert P. J. Day
that actually matches with what i concluded -- BDIR is dead and
gone, but i realized that BITBAKEDIR could still be useful, even if it's currently undocumented. so i'll submit a patch to ditch BDIR, and leave all else as is. for now.
BDIR allows the build directory to be set explicitly from a script without worrying about which shell is in use.
I'd note it is used by scripts/build-perf-test-wrapper in yocto- autobuilder-helper, probably for exactly this reason (I've not checked the history).
Cheers,
Richard
Quoted 8 lines · Richard Purdie
Quoted 4 lines · Robert P. J. Day
that actually matches with what i concluded -- BDIR is dead and
gone, but i realized that BITBAKEDIR could still be useful, even if it's currently undocumented. so i'll submit a patch to ditch BDIR, and leave all else as is. for now.BDIR allows the build directory to be set explicitly from a script without worrying about which shell is in use.
i believe you, and i actually went specifically *looking* for
something that did that, but didn't find it.
Quoted 3 lines
I'd note it is used by
scripts/build-perf-test-wrapperin yocto- autobuilder-helper, probably for exactly this reason (I've not checked the history).
and that's the snippet of info i was after ... that *something*
takes advantage of that feature. ok, i'm happy now. :-)
rday
Quoted 10 lines · Christopher Larson
I don’t think this is out of date. It’s allowing the user to specify the path to bitbake (which I’ve done in unusual layouts or just to be explicit), falling back to either under OEROOT (poky-style) or in its parent (more typical).
It’s also worth noting that oe-init-build-env and oe-buildenv-internal are not just used directly, but many other setup scripts build on top of them, so this particular flexibility is useful. BDIR still seems like it can be dropped regardless of the BITBAKEDIR logic.
so if BBEXTRA is still valid, should it be documented, perhaps in
the variable glossary?
rday