Skip to contentSkip to conversation

ref-manual: clarify use of "PACKAGE_ARCH" in a packagegroup

PATCH Applied Robert P. J. Day 3 participants 7 messages Jun 16 – Jun 29

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ref-manual: clarify use of "PACKAGE_ARCH" in a packagegroup

Warn the developer that if they need to set "PACKAGE_ARCH" in a custom packagegroup file, that setting must precede the "inherit packagegroup" line in the packagegroup recipe file.

---

documentation/ref-manual/classes.rst +12 -0
index 95e07f85a..839a89d4b 100644
@@ -2130,6 +2130,18 @@ section in the Yocto Project Development Tasks Manual.
 
 Previously, this class was called the ``task`` class.
 
+.. note::
+
+   If you're defining a packagegroup and need to set::
+
+      PACKAGE_ARCH = ${MACHINE_ARCH}
+
+   for the packagegroup, you need to do that *before* the
+   ``inherit packagegroup`` line in the recipe file.
+   Setting it afterward can break BitBake parsing, result in
+   an "allarch" architecture mismatch error, or allow
+   architecture-independent defaults to override your intent.
+
 .. _ref-classes-patch:
 
 ``patch``
#1 lore raw

Hi Robert,

Quoted 14 lines · Robert P. J. Day via lists.yoctoproject.org

Warn the developer that if they need to set "PACKAGE_ARCH" in a custom packagegroup file, that setting must precede the "inherit packagegroup" line in the packagegroup recipe file.

---

documentation/ref-manual/classes.rst +0 -0
index 95e07f85a..839a89d4b 100644

documentation/ref-manual/classes.rst section in the Yocto Project Development Tasks Manual. · line 2138

Quoted 9 lines
documentation/ref-manual/classes.rst +6 -0
@@ -2130,6 +2130,18 @@ section in the Yocto Project Development Tasks Manual.
 
  Previously, this class was called the ``task`` class.
 
+.. note::
+
+   If you're defining a packagegroup and need to set::
+
+      PACKAGE_ARCH = ${MACHINE_ARCH}
+

OK so reading this I was like "but who would need to do this? packagegroups are only supposed to include other packages and not compile anything!

Then I looked in OE-Core, and there are as many packagegroups with PACKAGE_ARCH set than without. It seems that the need comes from using MACHINE_FEATURES or other knobs that depend on some configuration variable.

I think it'd be nice to document this (if not already, but since you're scouring the docs now maybe you'd come across something like that?).

I'm thinking this is a big enough footgun that we may want to document the order in the variable glossary as well.

Cheers,
Quentin

#2 lore raw
Quoted 36 lines · Quentin Schulz

Hi Robert,

Quoted 20 lines · Robert P. J. Day via lists.yoctoproject.org

Warn the developer that if they need to set "PACKAGE_ARCH" in a custom packagegroup file, that setting must precede the "inherit packagegroup" line in the packagegroup recipe file.

---

documentation/ref-manual/classes.rst +0 -0
index 95e07f85a..839a89d4b 100644
@@ -2130,6 +2130,18 @@ section in the Yocto Project Development Tasks

Manual.

Previously, this class was called the ``task`` class.

+.. note::

documentation/ref-manual/classes.rst section in the Yocto Project Development Tasks Manual. · line 2138

Quoted 5 lines
documentation/ref-manual/classes.rst +5 -0
+
+   If you're defining a packagegroup and need to set::
+
+      PACKAGE_ARCH = ${MACHINE_ARCH}
+

OK so reading this I was like "but who would need to do this? packagegroups are only supposed to include other packages and not compile anything!

Then I looked in OE-Core, and there are as many packagegroups with PACKAGE_ARCH set than without. It seems that the need comes from using MACHINE_FEATURES or other knobs that depend on some configuration variable.

Quoted 5 lines

I think it'd be nice to document this (if not already, but since you're scouring the docs now maybe you'd come across something like that?).

I'm thinking this is a big enough footgun that we may want to document the order in the variable glossary as well.

richard purdie explained this once upon a time:

https://lists.openembedded.org/g/openembedded-core/topic/patch_4_4_package_add/87011325

rday

#3 lore raw
Quoted 41 lines · Robert P. J. Day
Quoted 39 lines · Quentin Schulz

Hi Robert,

Quoted 20 lines · Robert P. J. Day via lists.yoctoproject.org

Warn the developer that if they need to set "PACKAGE_ARCH" in a custom packagegroup file, that setting must precede the "inherit packagegroup" line in the packagegroup recipe file.

---

documentation/ref-manual/classes.rst +0 -0
index 95e07f85a..839a89d4b 100644
@@ -2130,6 +2130,18 @@ section in the Yocto Project Development Tasks

Manual.

Previously, this class was called the ``task`` class.

+.. note::

documentation/ref-manual/classes.rst section in the Yocto Project Development Tasks Manual. · line 2138

Quoted 5 lines
documentation/ref-manual/classes.rst +5 -0
+
+   If you're defining a packagegroup and need to set::
+
+      PACKAGE_ARCH = ${MACHINE_ARCH}
+

OK so reading this I was like "but who would need to do this? packagegroups are only supposed to include other packages and not compile anything!

Then I looked in OE-Core, and there are as many packagegroups with PACKAGE_ARCH set than without. It seems that the need comes from using MACHINE_FEATURES or other knobs that depend on some configuration variable.

I think it'd be nice to document this (if not already, but since you're scouring the docs now maybe you'd come across something like that?).

Quoted 7 lines
Quoted 2 lines

I'm thinking this is a big enough footgun that we may want to document the order in the variable glossary as well.

richard purdie explained this once upon a time:

https://lists.openembedded.org/g/openembedded-core/topic/patch_4_4_package_add/87011325

That sounds like a great thing to add to the docs. Both here and in the variable glossary for PACKAGE_ARCH as well I think?

Do you agree? Would you mind sending a patch for this?

Cheers,
Quentin

#4 lore raw
Quoted 51 lines · Quentin Schulz
Quoted 48 lines · Robert P. J. Day
Quoted 38 lines · Quentin Schulz

Hi Robert,

Quoted 20 lines · Robert P. J. Day via lists.yoctoproject.org

Warn the developer that if they need to set "PACKAGE_ARCH" in a custom packagegroup file, that setting must precede the "inherit packagegroup" line in the packagegroup recipe file.

---

documentation/ref-manual/classes.rst +0 -0
index 95e07f85a..839a89d4b 100644
@@ -2130,6 +2130,18 @@ section in the Yocto Project Development Tasks

Manual.

Previously, this class was called the ``task`` class.

+.. note::

documentation/ref-manual/classes.rst section in the Yocto Project Development Tasks Manual. · line 2138

Quoted 5 lines
documentation/ref-manual/classes.rst +5 -0
+
+   If you're defining a packagegroup and need to set::
+
+      PACKAGE_ARCH = ${MACHINE_ARCH}
+

OK so reading this I was like "but who would need to do this? packagegroups
are only supposed to include other packages and not compile anything!

Then I looked in OE-Core, and there are as many packagegroups with PACKAGE_ARCH set than without. It seems that the need comes from using MACHINE_FEATURES or other knobs that depend on some configuration variable.

Quoted 5 lines

I think it'd be nice to document this (if not already, but since you're scouring the docs now maybe you'd come across something like that?).

I'm thinking this is a big enough footgun that we may want to document the order in the variable glossary as well.

richard purdie explained this once upon a time:

Quoted 7 lines
Quoted 2 lines

https://lists.openembedded.org/g/openembedded-core/topic/patch_4_4_package_add/87011325

That sounds like a great thing to add to the docs. Both here and in the variable glossary for PACKAGE_ARCH as well I think?

Do you agree? Would you mind sending a patch for this?

i don't think i'm the right person for that as i don't *fully*
understand what is going on under the hood, and here's why.

while richard's explanation involves using the variable
${TUNE_PKGARCH}, with a quick scan over all the layers i have checked out, there are even more packagegroups that are assigning ${MACHINE_ARCH}. and i'm sure i read somewhere that there were at least two reasons for setting MACHINE_ARCH in a packagegroup recipe file, one of which was package renaming but i don't remember the other one.

if all you're looking for is something like:

"For some packagegroups, it is sometimes necessary to set the MACHINE_ARCH variable to one of .... If that's the case, that assignment has to be placed above the 'inherit packagegroup' line."

but that sort of explanation is maddeningly uninformative, so
someone else who knows more about it should probably do that. but, yes, that definitely merits a ".. warning::" somewhere.

rday

#5 lore raw
In reply to Quentin Schulz
Quoted 36 lines · Quentin Schulz

Hi Robert,

Quoted 20 lines · Robert P. J. Day via lists.yoctoproject.org

Warn the developer that if they need to set "PACKAGE_ARCH" in a custom packagegroup file, that setting must precede the "inherit packagegroup" line in the packagegroup recipe file.

---

documentation/ref-manual/classes.rst +0 -0
index 95e07f85a..839a89d4b 100644
@@ -2130,6 +2130,18 @@ section in the Yocto Project Development Tasks

Manual.

Previously, this class was called the ``task`` class.

+.. note::

documentation/ref-manual/classes.rst section in the Yocto Project Development Tasks Manual. · line 2138

Quoted 5 lines
documentation/ref-manual/classes.rst +5 -0
+
+   If you're defining a packagegroup and need to set::
+
+      PACKAGE_ARCH = ${MACHINE_ARCH}
+

OK so reading this I was like "but who would need to do this? packagegroups are only supposed to include other packages and not compile anything!

Then I looked in OE-Core, and there are as many packagegroups with PACKAGE_ARCH set than without. It seems that the need comes from using MACHINE_FEATURES or other knobs that depend on some configuration variable.

Quoted 5 lines

I think it'd be nice to document this (if not already, but since you're scouring the docs now maybe you'd come across something like that?).

I'm thinking this is a big enough footgun that we may want to document the order in the variable glossary as well.

amusingly, the current packagegroup-core-base-utils.bb opens with
the duplication:

  PACKAGE_ARCH = "${MACHINE_ARCH}"

inherit packagegroup

VIRTUAL-RUNTIME_vim ?= "vim-tiny"

  PACKAGE_ARCH = "${MACHINE_ARCH}"       <==== ????

"git blame" shows that second line added 2019-07-23:

packagegroup-core-base-utils: Make it machine specific

Recipe makes use of the variable MACHINE_FEATURES, which is machine specific:

${@bb.utils.contains("MACHINE_FEATURES", "keyboard", "kbd", "", d)}

then two days later, from the same person, the first line being added with the same commit message.

i'm guessing that second assignment to PACKAGE_ARCH is unnecessary.

rday