Skip to contentSkip to conversation

package.bbclass : Fix AUTOINC version issue in pkgdata

PATCH New Sreejith Ravi 1 participant 1 message Oct 25, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package.bbclass : Fix AUTOINC version issue in pkgdata

Currently, pkgdata fields (RDEPENDS, RRECOMMENDS ..) are created with AUTOINC due to the static setting of its values in recipes/configurations. Eg : RDEPENDS for -staticdev and -dev is set using EXTENDPKGV in meta/conf/bitbake.conf:
----------------------------------
DEV_PKG_DEPENDENCY = "${PN} (= ${EXTENDPKGV})" RDEPENDS:${PN}-staticdev = "${PN}-dev (= ${EXTENDPKGV})" EXTENDPKGV ?= "${EXTENDPKGEVER}${PKGV}-${PKGR}"
PKGV ?= "${PV}"

If SRCPV is set for PV in any packages and revisions are not incremental, SRCPV is updated with AUTOINC during the recipe parsig stage. In base.bbclass --> d.setVar("SRCPV", "${@bb.fetch2.get_srcrev(d)}")

----------------------------------

During the do_package task, AUTOINC is replaced in PKGV (via package_setup_pkgv), which is used for creating the package name. However, the fields set with PKGV during the recipe parsing stage will not be updated with this change, resulting in a mismatch between the package version used in those fields.

As the IPK name is generated with the updated PKGV, but the version in the fields (Eg: 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 pkgdata with correct version.
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/classes-global/package.bbclass | 9 +++++++++
 1 file changed, 9 insertions(+)
meta/classes-global/package.bbclass +9 -0
index 6cd8c0140f..066a7ff835 100644
@@ -325,6 +325,15 @@ python package_setup_pkgv() {
     # Adjust pkgv as necessary...
     if 'AUTOINC' in pkgv:
         d.setVar("PKGV", pkgv.replace("AUTOINC", "${PRSERV_PV_AUTOINC}"))
+
+    # Adjust dependencies that are statically set with EXTENDPKGV
+    vars = ["RDEPENDS","RPROVIDES","RRECOMMENDS","RSUGGESTS","RREPLACES","RCONFLICTS"]
+    packages = d.getVar('PACKAGES').split()
+    for var in vars:
+        for pkg in packages:
+            val = d.getVar("%s_%s"%(var,pkg))
+            if val and 'AUTOINC' in val:
+                d.setVar("%s_%s"%(var,pkg), val.replace("AUTOINC", "${PRSERV_PV_AUTOINC}"))
 }
 
 
Signature · 1 line
2.43.0