diff mbox series

packagedata.py : Fix RDEPENDS Version issue with AUTOINC

Message ID 20241024103906.41742-1-sreejith.ravi087@gmail.com
State New
Headers show
Series packagedata.py : Fix RDEPENDS Version issue with AUTOINC | expand

Commit Message

Sreejith Ravi Oct. 24, 2024, 10:39 a.m. UTC
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/lib/oe/packagedata.py | 3 +++
 1 file changed, 3 insertions(+)

Comments

Richard Purdie Oct. 24, 2024, 10:45 a.m. UTC | #1
On Thu, 2024-10-24 at 11:39 +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/lib/oe/packagedata.py | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/meta/lib/oe/packagedata.py b/meta/lib/oe/packagedata.py
> index 2d1d6ddeb7..332681d3ec 100644
> --- a/meta/lib/oe/packagedata.py
> +++ b/meta/lib/oe/packagedata.py
> @@ -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))
> 


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
Sreejith Ravi Oct. 24, 2024, 12:43 p.m. UTC | #2
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

On Thu, Oct 24, 2024 at 11:45 AM Richard Purdie <
richard.purdie@linuxfoundation.org> wrote:

> On Thu, 2024-10-24 at 11:39 +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/lib/oe/packagedata.py | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/meta/lib/oe/packagedata.py b/meta/lib/oe/packagedata.py
> > index 2d1d6ddeb7..332681d3ec 100644
> > --- a/meta/lib/oe/packagedata.py
> > +++ b/meta/lib/oe/packagedata.py
> > @@ -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))
> >
>
>
> 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
>
>
diff mbox series

Patch

diff --git a/meta/lib/oe/packagedata.py b/meta/lib/oe/packagedata.py
index 2d1d6ddeb7..332681d3ec 100644
--- a/meta/lib/oe/packagedata.py
+++ b/meta/lib/oe/packagedata.py
@@ -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))