Message ID | 20241024144845.43504-1-sreejith.ravi087@gmail.com |
---|---|
State | New |
Headers | show |
Series | packagedata.py : Fix RDEPENDS Version issue with AUTOINC | expand |
On Thu, 2024-10-24 at 15:48 +0100, Sreejith Ravi via lists.openembedded.org wrote: > 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 > ---------------------------------- > > Signed-off-by: Sreejith Ravi <sreejith.ravi087@gmail.com> > --- > meta/classes-global/package.bbclass | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/meta/classes-global/package.bbclass b/meta/classes-global/package.bbclass > index 6cd8c0140f..066a7ff835 100644 > --- a/meta/classes-global/package.bbclass > +++ b/meta/classes-global/package.bbclass > @@ -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}")) > } > 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
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 On Mon, Oct 28, 2024 at 11:04 AM Richard Purdie < richard.purdie@linuxfoundation.org> wrote: > On Thu, 2024-10-24 at 15:48 +0100, Sreejith Ravi via > lists.openembedded.org wrote: > > 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 > > ---------------------------------- > > > > Signed-off-by: Sreejith Ravi <sreejith.ravi087@gmail.com> > > --- > > meta/classes-global/package.bbclass | 9 +++++++++ > > 1 file changed, 9 insertions(+) > > > > diff --git a/meta/classes-global/package.bbclass > b/meta/classes-global/package.bbclass > > index 6cd8c0140f..066a7ff835 100644 > > --- a/meta/classes-global/package.bbclass > > +++ b/meta/classes-global/package.bbclass > > @@ -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}")) > > } > > > > 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 > > > > > > >
On Mon, 2024-11-11 at 10:23 +0000, Sreejith Ravi wrote: > 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
diff --git a/meta/classes-global/package.bbclass b/meta/classes-global/package.bbclass index 6cd8c0140f..066a7ff835 100644 --- a/meta/classes-global/package.bbclass +++ b/meta/classes-global/package.bbclass @@ -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}")) }
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 ---------------------------------- Signed-off-by: Sreejith Ravi <sreejith.ravi087@gmail.com> --- meta/classes-global/package.bbclass | 9 +++++++++ 1 file changed, 9 insertions(+)