Skip to contentSkip to conversation

packagedata.py : Fix RDEPENDS Version issue with AUTOINC

PATCH In review Sreejith Ravi 2 participants 3 messages Oct 24, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 packagedata.py : Fix RDEPENDS Version issue with AUTOINC

Currently, RDEPENDS for -staticdev and -dev is set using EXTENDPKGV in meta/conf/bitbake.conf:
----------------------------------
EXTENDPKGV ?= "${EXTENDPKGEVER}${PKGV}-${PKGR}" DEV_PKG_DEPENDENCY = "${PN} (= ${EXTENDPKGV})" RDEPENDS:${PN}-staticdev = "${PN}-dev (= ${EXTENDPKGV})"
----------------------------------

During the do_package task, AUTOINC is replaced in PKGV
(via package_setup_pkgv), which is used for creating the package name. However, Yocto sets RDEPENDS with PKGV during the recipe parsing stage, resulting in the RDEPENDS field in the IPK control data containing AUTOINC.

As the IPK name is generated with the updated PKGV, but the version in RDEPENDS still uses AUTOINC, this mismatch leads to installation failures.

Example: libnsl
install libnsl-staticdev throws the error, nothing provides libnsl-dev = 1.2.0+gitAUTOINC+4a062cf418-r0
----------------------------------
IPKs available:
libnsl2_1.2.0+git0+4a062cf418-r0_armv7at2hf-neon.ipk libnsl-src_1.2.0+git0+4a062cf418-r0_armv7at2hf-neon.ipk libnsl-dbg_1.2.0+git0+4a062cf418-r0_armv7at2hf-neon.ipk libnsl-staticdev_1.2.0+git0+4a062cf418-r0_armv7at2hf-neon.ipk libnsl-dev_1.2.0+git0+4a062cf418-r0_armv7at2hf-neon.ipk

control data: libnsl-staticdev
Package: libnsl-staticdev
Version: 1.2.0+git0+4a062cf418-r0
----
----
Depends: libnsl-dev (= 1.2.0+gitAUTOINC+4a062cf418-r0)
Provides: libnsl2-staticdev
Source: libnsl2_git.bb

control data: libnsl-dev
Package: libnsl-dev
Version: 1.2.0+git0+4a062cf418-r0
----
----
Depends: libnsl2 (= 1.2.0+gitAUTOINC+4a062cf418-r0), libtirpc-dev
Recommends: gcc-runtime-dev, glibc-dev, libtirpc-dev
Provides: libnsl2-dev
Source: libnsl2_git.bb
----------------------------------

This patch fixes the RDEPENDS versions set using EXTENDPKGV in the -dev and -staticdev packages. It replaces AUTOINC before generating the package control data.

Updated control data:
----------------------------------
Package: libnsl-dev
Version: 1.2.0+git0+4a062cf418-r0
----
----
Depends: libnsl2 (= 1.2.0+git0+4a062cf418-r0), libtirpc-dev
Recommends: gcc-runtime-dev, glibc-dev, libtirpc-dev
Provides: libnsl2-dev
Source: libnsl2_git.bb

Package: libnsl-staticdev
Version: 1.2.0+git0+4a062cf418-r0
----
----
Depends: libnsl-dev (= 1.2.0+git0+4a062cf418-r0)
Provides: libnsl2-staticdev
Source: libnsl2_git.bb
----------------------------------

---
 meta/lib/oe/packagedata.py | 3 +++
 1 file changed, 3 insertions(+)
meta/lib/oe/packagedata.py +3 -0
index 2d1d6ddeb7..332681d3ec 100644
@@ -171,8 +171,11 @@ def runtime_mapping_rename(varname, pkg, d):
     #bb.note("%s before: %s" % (varname, d.getVar(varname)))
 
     new_depends = {}
+    bb.build.exec_func("package_get_auto_pr", d)
     deps = bb.utils.explode_dep_versions2(d.getVar(varname) or "")
     for depend, depversions in deps.items():
+        if varname == "RDEPENDS":
+            deps[depend] = [ver.replace("AUTOINC", "%s"%d.getVar("PRSERV_PV_AUTOINC")) for ver in deps[depend]]
         new_depend = get_package_mapping(depend, pkg, d, depversions)
         if depend != new_depend:
             bb.note("package name mapping done: %s -> %s" % (depend, new_depend))
Signature · 1 line
2.43.0
#1 lore raw
Quoted 83 lines · Sreejith Ravi via lists.openembedded.org

Currently, RDEPENDS for -staticdev and -dev is set using EXTENDPKGV in meta/conf/bitbake.conf:
----------------------------------
EXTENDPKGV ?= "${EXTENDPKGEVER}${PKGV}-${PKGR}" DEV_PKG_DEPENDENCY = "${PN} (= ${EXTENDPKGV})" RDEPENDS:${PN}-staticdev = "${PN}-dev (= ${EXTENDPKGV})"
----------------------------------

During the do_package task, AUTOINC is replaced in PKGV
(via package_setup_pkgv), which is used for creating the package name. However, Yocto sets RDEPENDS with PKGV during the recipe parsing stage, resulting in the RDEPENDS field in the IPK control data containing AUTOINC.

As the IPK name is generated with the updated PKGV, but the version in RDEPENDS still uses AUTOINC, this mismatch leads to installation failures.

Example: libnsl
install libnsl-staticdev throws the error,  nothing provides libnsl-dev = 1.2.0+gitAUTOINC+4a062cf418-r0
----------------------------------
IPKs available:
libnsl2_1.2.0+git0+4a062cf418-r0_armv7at2hf-neon.ipk libnsl-src_1.2.0+git0+4a062cf418-r0_armv7at2hf-neon.ipk libnsl-dbg_1.2.0+git0+4a062cf418-r0_armv7at2hf-neon.ipk libnsl-staticdev_1.2.0+git0+4a062cf418-r0_armv7at2hf-neon.ipk libnsl-dev_1.2.0+git0+4a062cf418-r0_armv7at2hf-neon.ipk

control data: libnsl-staticdev
Package: libnsl-staticdev
Version: 1.2.0+git0+4a062cf418-r0
----
----
Depends: libnsl-dev (= 1.2.0+gitAUTOINC+4a062cf418-r0)
Provides: libnsl2-staticdev
Source: libnsl2_git.bb

control data: libnsl-dev
Package: libnsl-dev
Version: 1.2.0+git0+4a062cf418-r0
----
----
Depends: libnsl2 (= 1.2.0+gitAUTOINC+4a062cf418-r0), libtirpc-dev
Recommends: gcc-runtime-dev, glibc-dev, libtirpc-dev
Provides: libnsl2-dev
Source: libnsl2_git.bb
----------------------------------

This patch fixes the RDEPENDS versions set using EXTENDPKGV in the -dev and -staticdev packages. It replaces AUTOINC before generating the package control data.

Updated control data:
----------------------------------
Package: libnsl-dev
Version: 1.2.0+git0+4a062cf418-r0
----
----
Depends: libnsl2 (= 1.2.0+git0+4a062cf418-r0), libtirpc-dev
Recommends: gcc-runtime-dev, glibc-dev, libtirpc-dev
Provides: libnsl2-dev
Source: libnsl2_git.bb

Package: libnsl-staticdev
Version: 1.2.0+git0+4a062cf418-r0
----
----
Depends: libnsl-dev (= 1.2.0+git0+4a062cf418-r0)
Provides: libnsl2-staticdev
Source: libnsl2_git.bb
----------------------------------

---
 meta/lib/oe/packagedata.py | 3 +++

 1 file changed, 3 insertions(+)
meta/lib/oe/packagedata.py +0 -0
index 2d1d6ddeb7..332681d3ec 100644
@@ -171,8 +171,11 @@ def runtime_mapping_rename(varname, pkg, d):
      #bb.note("%s before: %s" % (varname, d.getVar(varname)))


     new_depends = {}

Quoted 9 lines

+    bb.build.exec_func("package_get_auto_pr", d)
     deps = bb.utils.explode_dep_versions2(d.getVar(varname) or "")
     for depend, depversions in deps.items():
+        if varname == "RDEPENDS":
+            deps[depend] = [ver.replace("AUTOINC", "%s"%d.getVar("PRSERV_PV_AUTOINC")) for ver in deps[depend]] new_depend = get_package_mapping(depend, pkg, d, depversions)
         if depend != new_depend:
             bb.note("package name mapping done: %s -> %s" % (depend, new_depend))

This is a good start at debugging the issue which is clearly there but it doesn't feel like the right fix to me. The question is why the code in package.bbclass isn't replacing the values and writing them into the data which forms packagedatav. We really need to fix this at the source of the issue rather than working around it with special case handling of RDEPENDS.

Do you have any idea why the code in do_package doesn't catch these?

Cheers,

Richard

#2 lore raw

The issue seems to be that RDEPENDS is set with the value from PKGV (from configuration) at the recipe parsing stage. In do_package, it is only replacing AUTOINC in the PKGV variable. This is why the changes are not reflected in the RDEPENDS field in the package data. I will try to make it a more generic change instead of being specific to RDEPENDS.

Cheers,
Sreejith

Quoted 116 lines · Richard Purdie
Quoted 8 lines · Sreejith Ravi via lists.openembedded.org

Currently, RDEPENDS for -staticdev and -dev is set using EXTENDPKGV in meta/conf/bitbake.conf:
----------------------------------
EXTENDPKGV ?= "${EXTENDPKGEVER}${PKGV}-${PKGR}" DEV_PKG_DEPENDENCY = "${PN} (= ${EXTENDPKGV})" RDEPENDS:${PN}-staticdev = "${PN}-dev (= ${EXTENDPKGV})"
----------------------------------

Quoted 4 lines

During the do_package task, AUTOINC is replaced in PKGV
(via package_setup_pkgv), which is used for creating the package name. However, Yocto sets RDEPENDS with PKGV during the recipe parsing stage, resulting in the RDEPENDS field in the IPK control data containing

AUTOINC.

Quoted 3 lines

As the IPK name is generated with the updated PKGV, but the version in RDEPENDS still uses AUTOINC, this mismatch leads to installation

failures.

Quoted 32 lines

Example: libnsl
install libnsl-staticdev throws the error, nothing provides libnsl-dev = 1.2.0+gitAUTOINC+4a062cf418-r0
----------------------------------
IPKs available:
libnsl2_1.2.0+git0+4a062cf418-r0_armv7at2hf-neon.ipk libnsl-src_1.2.0+git0+4a062cf418-r0_armv7at2hf-neon.ipk libnsl-dbg_1.2.0+git0+4a062cf418-r0_armv7at2hf-neon.ipk libnsl-staticdev_1.2.0+git0+4a062cf418-r0_armv7at2hf-neon.ipk libnsl-dev_1.2.0+git0+4a062cf418-r0_armv7at2hf-neon.ipk

control data: libnsl-staticdev
Package: libnsl-staticdev
Version: 1.2.0+git0+4a062cf418-r0
----
----
Depends: libnsl-dev (= 1.2.0+gitAUTOINC+4a062cf418-r0)
Provides: libnsl2-staticdev
Source: libnsl2_git.bb

control data: libnsl-dev
Package: libnsl-dev
Version: 1.2.0+git0+4a062cf418-r0
----
----
Depends: libnsl2 (= 1.2.0+gitAUTOINC+4a062cf418-r0), libtirpc-dev
Recommends: gcc-runtime-dev, glibc-dev, libtirpc-dev
Provides: libnsl2-dev
Source: libnsl2_git.bb
----------------------------------

Quoted 1 line

This patch fixes the RDEPENDS versions set using EXTENDPKGV in the -dev

and

Quoted 1 line

-staticdev packages. It replaces AUTOINC before generating the package

control data.

Quoted 31 lines

Updated control data:
----------------------------------
Package: libnsl-dev
Version: 1.2.0+git0+4a062cf418-r0
----
----
Depends: libnsl2 (= 1.2.0+git0+4a062cf418-r0), libtirpc-dev
Recommends: gcc-runtime-dev, glibc-dev, libtirpc-dev
Provides: libnsl2-dev
Source: libnsl2_git.bb

Package: libnsl-staticdev
Version: 1.2.0+git0+4a062cf418-r0
----
----
Depends: libnsl-dev (= 1.2.0+git0+4a062cf418-r0)
Provides: libnsl2-staticdev
Source: libnsl2_git.bb
----------------------------------

---
 meta/lib/oe/packagedata.py | 3 +++
 1 file changed, 3 insertions(+)
meta/lib/oe/packagedata.py +0 -0
index 2d1d6ddeb7..332681d3ec 100644

meta/lib/oe/packagedata.py def runtime_mapping_rename(varname, pkg, d): · line 178

Quoted 8 lines
meta/lib/oe/packagedata.py +3 -0
@@ -171,8 +171,11 @@ def runtime_mapping_rename(varname, pkg, d):
     #bb.note("%s before: %s" % (varname, d.getVar(varname)))
 
     new_depends = {}
+    bb.build.exec_func("package_get_auto_pr", d)
     deps = bb.utils.explode_dep_versions2(d.getVar(varname) or "")
     for depend, depversions in deps.items():
+        if varname == "RDEPENDS":
+            deps[depend] = [ver.replace("AUTOINC",

"%s"%d.getVar("PRSERV_PV_AUTOINC")) for ver in deps[depend]]

meta/lib/oe/packagedata.py def runtime_mapping_rename(varname, pkg, d):

Quoted 3 lines
meta/lib/oe/packagedata.py +0 -0
         new_depend = get_package_mapping(depend, pkg, d, depversions)
         if depend != new_depend:
             bb.note("package name mapping done: %s -> %s" % (depend,

new_depend))

Quoted 1 line

This is a good start at debugging the issue which is clearly there but it doesn't feel like the right fix to me. The question is why the code in package.bbclass isn't replacing the values and writing them into the data which forms packagedatav. We really need to fix this at the source of the issue rather than working around it with special case handling of RDEPENDS.

Do you have any idea why the code in do_package doesn't catch these?

Cheers,

Richard