Skip to contentSkip to conversation

packagedata.py : Fix RDEPENDS Version issue with AUTOINC

PATCH In review Sreejith Ravi 2 participants 4 messages Oct 24, 2024 – Nov 11, 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/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
#1 lore raw
Quoted 85 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/classes-global/package.bbclass | 9 +++++++++

 1 file changed, 9 insertions(+)
meta/classes-global/package.bbclass +0 -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

Quoted 9 lines

+    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}")) }

Something isn't adding up here. With master, if I set:

DISABLE_STATIC:pn-libnsl2 = ""

and put PV = "2.0.1+git${SRCPV}" into the recipe, then bitbake libnsl2, I see:

dpkg --info libnsl-staticdev_2.0.1+git0+d4b22e54b5-r0_amd64.deb

Package: libnsl-staticdev
Version: 2.0.1+git0+d4b22e54b5-r0
Architecture: amd64
OE: libnsl2
PackageArch: core2-64
Depends: libnsl-dev (= 2.0.1+git0+d4b22e54b5-r0)
Provides: libnsl2-staticdev (= 2.0.1+git0+d4b22e54b5)

which looks right to me. Similarly, the ipk looks correct.

cat kgdata/runtime/libnsl2-staticdev

PN: libnsl2
PV: 2.0.1+git
PR: r0
PKGV: 2.0.1+git@PRSERV_PV_AUTOINC@+d4b22e54b5
PKGR: r0@EXTENDPRAUTO@
LICENSE: LGPL-2.1-only
RDEPENDS:libnsl2-staticdev: libnsl2-dev (= 2.0.1+git@PRSERV_PV_AUTOINC@+d4b22e54b5-r0@EXTENDPRAUTO@) RPROVIDES:libnsl2-staticdev: libnsl2-staticdev (=2.0.1+git@PRSERV_PV_AUTOINC@+d4b22e54b5) SECTION:libnsl2-staticdev: devel

which again, looks ok.

So which release are you seeing the issue on as I suspect it isn't master?

Cheers,

Richard

#2 lore raw

That was my mistake.

I modified RDEPENDS without using expand=False before the do_package task, which caused the issue. The PKGV value is updated with AUTOINC only during the do_package task. Since we modified RDEPENDS before do_package, it was already set with the expanded PKGV, preventing it from updating with AUTOINC.

Is there another way to handle AUTOINC? It seems that if the variable is expanded before the do_package task, it will not reflect the updated value during do_package.

Thanks
Sreejith

Quoted 153 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 21 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
----------------------------------

Review

Quoted 6 lines
---
 meta/classes-global/package.bbclass | 9 +++++++++
 1 file changed, 9 insertions(+)
(quoted diff) +0 -0

b/meta/classes-global/package.bbclass

meta/classes-global/package.bbclass python package_setup_pkgv() { · line 327

Quoted 7 lines

index 6cd8c0140f..066a7ff835 100644

meta/classes-global/package.bbclass +0 -0
@@ -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}"))

meta/classes-global/package.bbclass python package_setup_pkgv() {

Quoted 3 lines
meta/classes-global/package.bbclass +3 -0
+
+    # Adjust dependencies that are statically set with EXTENDPKGV
+    vars =

["RDEPENDS","RPROVIDES","RRECOMMENDS","RSUGGESTS","RREPLACES","RCONFLICTS"]

meta/classes-global/package.bbclass python package_setup_pkgv() {

Quoted 6 lines
meta/classes-global/package.bbclass +6 -0
+    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}"))

meta/classes-global/package.bbclass python package_setup_pkgv() { · line 338

Quoted 2 lines
meta/classes-global/package.bbclass +0 -0
 }
 

Something isn't adding up here. With master, if I set:

DISABLE_STATIC:pn-libnsl2 = ""

and put PV = "2.0.1+git${SRCPV}" into the recipe, then bitbake libnsl2, I see:

dpkg --info libnsl-staticdev_2.0.1+git0+d4b22e54b5-r0_amd64.deb

Package: libnsl-staticdev
Version: 2.0.1+git0+d4b22e54b5-r0
Architecture: amd64
OE: libnsl2
PackageArch: core2-64
Depends: libnsl-dev (= 2.0.1+git0+d4b22e54b5-r0)
Provides: libnsl2-staticdev (= 2.0.1+git0+d4b22e54b5)

which looks right to me. Similarly, the ipk looks correct.

cat kgdata/runtime/libnsl2-staticdev

PN: libnsl2
PV: 2.0.1+git
PR: r0
PKGV: 2.0.1+git@PRSERV_PV_AUTOINC@+d4b22e54b5
PKGR: r0@EXTENDPRAUTO@
LICENSE: LGPL-2.1-only
RDEPENDS:libnsl2-staticdev: libnsl2-dev (= 2.0.1+git@PRSERV_PV_AUTOINC @+d4b22e54b5-r0@EXTENDPRAUTO@)
RPROVIDES:libnsl2-staticdev: libnsl2-staticdev (=2.0.1+git@PRSERV_PV_AUTOINC@+d4b22e54b5) SECTION:libnsl2-staticdev: devel

which again, looks ok.

So which release are you seeing the issue on as I suspect it isn't master?

Cheers,

Richard

#3 lore raw
Quoted 11 lines · Sreejith Ravi

That was my mistake.

I modified RDEPENDS without using expand=False before the do_package task, which caused the issue. The PKGV value is updated with AUTOINC only during the do_package task. Since we modified RDEPENDS before do_package, it was already set with the expanded PKGV, preventing it from updating with AUTOINC.

Is there another way to handle AUTOINC? It seems that if the variable is expanded before the do_package task, it will not reflect the updated value during do_package.

There isn't another way, that is the way it is designed to work.

Cheers,

Richard