Skip to contentSkip to conversation

util-linux: Improve PACKAGES_DYNAMIC handling for util-linux-native

PATCH Superseded Richard Purdie 2 participants 6 messages Jan 6, 2025 – Jan 13, 2025

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 util-linux: Improve PACKAGES_DYNAMIC handling for util-linux-native

DEBUG: Assuming util-linux-swapon-native is a dynamic package, but it may not exist
DEBUG: Assuming util-linux-swapon-native is a dynamic package, but it may not exist
DEBUG: providers for util-linux-swapon-native are: ['util-linux', 'util-linux-native']
DEBUG: sorted runtime providers for util-linux-swapon-native are: ['recipes-core/util-linux/util-linux_2.40.2.bb', 'virtual:native:recipes-core/util-linux/util-linux_2.40.2.bb']
NOTE: Multiple providers are available for runtime util-linux-swapon-native (util-linux, util-linux-native)

The PACKAGES_DYANMIC line could match native and non-native packages so tweak to improve -native handling and avoid the above warnings in world builds.

---
 meta/recipes-core/util-linux/util-linux_2.40.2.bb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta/recipes-core/util-linux/util-linux_2.40.2.bb +2 -1
index 2c7dd154e19..5be35eabf82 100644
@@ -59,7 +59,8 @@ python util_linux_libpackages() {
 
 PACKAGESPLITFUNCS =+ "util_linux_libpackages"
 
-PACKAGES_DYNAMIC = "^${PN}-.*"
+PACKAGES_DYNAMIC = "^${MLPREFIX}${BPN}-.*"
+PACKAGES_DYNAMIC:class-native = "^${PN}-.*-native"
 
 UTIL_LINUX_LIBDIR = "${libdir}"
 UTIL_LINUX_LIBDIR:class-target = "${base_libdir}"
#1 lore raw

PATCH 2/4 coreutils: Improve core-utils-native dependency handling

bash-dev-native does not exist, nor should it. Tweak the recipe so that if/as/when we fix native ${PN}-XXX handling, this doesn't break. Use variable indirection as the least worse solution as an override directly will get overwritten with variable renaming, resulting in a warning.

---
 meta/recipes-core/coreutils/coreutils_9.5.bb | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
meta/recipes-core/coreutils/coreutils_9.5.bb +3 -1
index af0fcdcc4cf..ae07cba164a 100644
@@ -182,7 +182,9 @@ RDEPENDS:${PN}-ptest += "bash findutils gawk make perl perl-modules python3-core
 # may need tweaking if DEPENDS changes
 # Can't use ${PN}-dev here since flags with overrides and key expansion not supported
 RRECOMMENDS:coreutils-dev[nodeprrecs] = "1"
-RRECOMMENDS:${PN}-dev += "acl-dev attr-dev gmp-dev libcap-dev bash-dev findutils-dev gawk-dev shadow-dev"
+DEVDEPS = "acl-dev attr-dev gmp-dev libcap-dev bash-dev findutils-dev gawk-dev shadow-dev"
+DEVDEPS:class-native = ""
+RRECOMMENDS:${PN}-dev += "${DEVDEPS}"
 
 do_install_ptest () {
     install -d ${D}${PTEST_PATH}/tests
#2 lore raw

PATCH 3/4 bitbake.conf: Add bash-completion-native to ASSUME_PROVIDED

In reply to Richard Purdie

With some native dependency handling fixes under discussion, bash-completiion-native makes it into the dependency chain. Add this to ASSUME_PROVIDED since we don't want to build it rather than trying to remove all references in the native case (it comes from glib-2.0-native).

---
 meta/conf/bitbake.conf | 1 +
 1 file changed, 1 insertion(+)
meta/conf/bitbake.conf +1 -0
index 16e4f4429f8..8449b6bdcbe 100644
@@ -205,6 +205,7 @@ DATETIME = "${DATE}${TIME}"
 # its own in staging
 ASSUME_PROVIDED = "\
     bash-native \
+    bash-completion-native \
     bzip2-native \
     chrpath-native \
     diffstat-native \
#3 lore raw

PATCH 4/4 native: Improve ${PN}-XXX package name handling

In reply to Richard Purdie

If a recipe has something like:

RPROVIDES:${PN}-xxx = "yyy"

then the current code will turn this into:

RPROVIDES:${BPN}-native-xxx = "yyy-native"

which can lead to errors. Add in some handling for this special case in the class extension code.

The corresponding entry in PACAGES is correctly remapped, the variables aren't remapped to match though.

Note that merging this does trigger new dependencies to be exposed, some of which can't be met or are incorrect. These need to be fixed on a case by case basis.

---
 meta/classes-recipe/native.bbclass | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
meta/classes-recipe/native.bbclass +6 -1
index d9651a7f22d..0fad42a5a45 100644
@@ -158,7 +158,12 @@ python native_virtclass_handler () {
                 newdeps.append(dep.replace(pn, bpn) + "-native")
             else:
                 newdeps.append(dep)
-        d.setVar(varname, " ".join(newdeps))
+        output_varname = varname
+        # Handle ${PN}-xxx -> ${BPN}-xxx-native
+        if suffix != "${PN}" and "${PN}" in suffix:
+            output_varname = varname.replace("${PN}", "${BPN}") + "-native"
+            d.renameVar(varname, output_varname)
+        d.setVar(output_varname, " ".join(newdeps))
 
     map_dependencies("DEPENDS", e.data, selfref=False)
     for pkg in e.data.getVar("PACKAGES", False).split():
#4 lore raw

Re: [OE-core] [PATCH 4/4] native: Improve ${PN}-XXX package name handling

Cc docs

Quoted 28 lines · Richard Purdie via lists.openembedded.org

If a recipe has something like:

RPROVIDES:${PN}-xxx = "yyy"

then the current code will turn this into:

RPROVIDES:${BPN}-native-xxx = "yyy-native"

which can lead to errors. Add in some handling for this special case in the class extension code.

The corresponding entry in PACAGES is correctly remapped, the variables aren't remapped to match though.

Note that merging this does trigger new dependencies to be exposed, some of which can't be met or are incorrect. These need to be fixed on a case by case basis.

---
  meta/classes-recipe/native.bbclass | 7 ++++++-
  1 file changed, 6 insertions(+), 1 deletion(-)
meta/classes-recipe/native.bbclass +0 -0
index d9651a7f22d..0fad42a5a45 100644
@@ -158,7 +158,12 @@ python native_virtclass_handler () {
                  newdeps.append(dep.replace(pn, bpn) + "-native")

meta/classes-recipe/native.bbclass python native_virtclass_handler () { · line 167

Quoted 10 lines
meta/classes-recipe/native.bbclass +6 -1
              else:
                  newdeps.append(dep)
-        d.setVar(varname, " ".join(newdeps))
+        output_varname = varname
+        # Handle ${PN}-xxx -> ${BPN}-xxx-native
+        if suffix != "${PN}" and "${PN}" in suffix:
+            output_varname = varname.replace("${PN}", "${BPN}") + "-native"
+            d.renameVar(varname, output_varname)
+        d.setVar(output_varname, " ".join(newdeps))
 

This seems like a bug we should document in known issues in old release notes?

I assume we may patch currently supported releases so stable dot releases may receive the patch, but outdated releases would be unpatched forever.

I guess we can say that the fix is to have each of RDEPENDS, RRECOMMENDS, RSUGGESTS, RPROVIDES, RREPLACES, PACKAGES overrides and PACKAGES_DYNAMIC to have ${BPN}-xxx+${BPN}-xxx-native instead of just ${PN}-xxx? Is that an appropriate suggestion?

I'm bringing this up because we have a Known issues section in the migration guides which is pretty much empty right now. I don't know what we should actually put in there but this seems like a candidate? What do you think? Antonin?

Cheers,
Quentin

#5 lore raw

Re: [OE-core] [PATCH 4/4] native: Improve ${PN}-XXX package name handling

Quoted 45 lines · Quentin Schulz

Cc docs

Quoted 30 lines · Richard Purdie via lists.openembedded.org

If a recipe has something like:

RPROVIDES:${PN}-xxx = "yyy"

then the current code will turn this into:

RPROVIDES:${BPN}-native-xxx = "yyy-native"

which can lead to errors. Add in some handling for this special case in the class extension code.

The corresponding entry in PACAGES is correctly remapped, the variables aren't remapped to match though.

Note that merging this does trigger new dependencies to be exposed, some of which can't be met or are incorrect. These need to be fixed on a case by case basis.

---
  meta/classes-recipe/native.bbclass | 7 ++++++-

  1 file changed, 6 insertions(+), 1 deletion(-)
meta/classes-recipe/native.bbclass +0 -0
index d9651a7f22d..0fad42a5a45 100644
@@ -158,7 +158,12 @@ python native_virtclass_handler () {
                   newdeps.append(dep.replace(pn, bpn) + "-native")

              else:
                  newdeps.append(dep)

Quoted 8 lines

-        d.setVar(varname, " ".join(newdeps))
+        output_varname = varname
+        # Handle ${PN}-xxx -> ${BPN}-xxx-native
+        if suffix != "${PN}" and "${PN}" in suffix:
+            output_varname = varname.replace("${PN}", "${BPN}") + "-native" +            d.renameVar(varname, output_varname)
+        d.setVar(output_varname, " ".join(newdeps))

This seems like a bug we should document in known issues in old release notes?

Quoted 3 lines

I assume we may patch currently supported releases so stable dot releases may receive the patch, but outdated releases would be unpatched forever.

The change in behaviour is enough that I don't think we should be backporting this to stable releases. The issue is rare and seemingly not being run into by many people in the wild.

Quoted 4 lines

I guess we can say that the fix is to have each of RDEPENDS, RRECOMMENDS, RSUGGESTS, RPROVIDES, RREPLACES, PACKAGES overrides and PACKAGES_DYNAMIC to have ${BPN}-xxx+${BPN}-xxx-native instead of just ${PN}-xxx? Is that an appropriate suggestion?

We'd probably suggest that users "spell out" the native mappings explicitly for any problems encountered. I'd argue they should be mapped correctly rather than introducing the "bad" naming.

Quoted 4 lines

I'm bringing this up because we have a Known issues section in the migration guides which is pretty much empty right now. I don't know what we should actually put in there but this seems like a candidate? What do you think? Antonin?

That is something we should consider, yes.

Cheers,

Richard