From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Olof Johansson <olof.johansson@axis.com>
Cc: bitbake-devel <bitbake-devel@lists.openembedded.org>
Subject: Re: Variable key replaces original warnings
Date: Fri, 31 Jul 2015 10:54:02 +0100 [thread overview]
Message-ID: <1438336442.22462.2.camel@linuxfoundation.org> (raw)
In-Reply-To: <1438266455-sup-7263@axis.com>
On Thu, 2015-07-30 at 17:03 +0200, Olof Johansson wrote:
> Hi all,
>
> We've started to see issues on master like
>
> WARNING:
> Variable key USERADD_PARAM_${PN} (; --system --home / --no-create-home --comment 'Storage manager daemon' --gid storage storage)
> replaces original key USERADD_PARAM_recording-indexer (--system --home / --no-create-home --comment 'apache httpd' --gid www www).
>
> (my alignment...)
>
> The warning happens when doing
>
> WWWUSER_PACKAGE ?= "${PN}"
> USERADD_PARAM_${WWWUSER_PACKAGE} := "--system --home / --no-create-home --gid www www"
>
> USERADD_PARAM_${PN}_append = "; --system --home / --no-create-home --gid username username"
>
> (in reality, the first two lines are inherited from a class, and the third in
> the recipe itself.)
>
> With bitbake -e I see what looks like the expected value, with both users being
> created. If I change USERADD_PARAM_${WWWUSER_PACKAGE} (second line) to
> USERADD_PARAM_${PN} no warning is printed, so this only seems to be a problem
> in cases where multiple unique non-expanded vars expand to the same expanded
> var.
>
> I made a unit test that should demonstrate the problem (I think), and it fails
> because of the warnings:
>
> diff --git a/bitbake/lib/bb/tests/data.py b/bitbake/lib/bb/tests/data.py
> index e9aab57..e7716cc 100644
> --- a/bitbake/lib/bb/tests/data.py
> +++ b/bitbake/lib/bb/tests/data.py
> @@ -386,6 +386,15 @@ class TestKeyExpansion(unittest.TestCase):
> self.assertTrue(logContains("Variable key VAL_${FOO} (A) replaces original key VAL_foo (B)", logs))
> self.assertEqual(self.d.getVar("VAL_foo", True), "A")
>
> + def test_append(self):
> + self.d.setVar("TEST_${BAR}", "Bar")
> + self.d.setVar("TEST_${FOO}_append", "Foo")
> + with LogRecord() as logs:
> + bb.data.expandKeys(self.d)
> + self.assertFalse(logContains("Variable key TEST_${FOO} (Foo) replaces original key TEST_foo (Bar)", logs))
> + self.assertEqual(self.d.getVar("TEST_${FOO}", True), "BarFoo")
>
>
> If you have any ideas on what this issue can be or how to fix it, please
> let me know :)
The data store changes recently caused a number of these to appear. The
issue has always been there, as has this warning, the new datastore code
just exposes it a bit more consistently than previously.
The reason we do this is that users with conflicting (different values)
of the same variable name usually have a metadata issue they're unaware
of.
The fix is to ensure you only set a variable in one canonical way.
OE-Core did show a few of these but I fixed them before merging the data
store changes.
Cheers,
Richard
next prev parent reply other threads:[~2015-07-31 9:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-30 15:03 Variable key replaces original warnings Olof Johansson
2015-07-31 9:54 ` Richard Purdie [this message]
2015-07-31 10:00 ` Richard Purdie
2015-07-31 11:48 ` Olof Johansson
2015-07-31 15:42 ` Richard Purdie
2015-07-31 11:42 ` Olof Johansson
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=1438336442.22462.2.camel@linuxfoundation.org \
--to=richard.purdie@linuxfoundation.org \
--cc=bitbake-devel@lists.openembedded.org \
--cc=olof.johansson@axis.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