On Tue, 2026-09-22 at 02:20 -0700, Paddy Chiu via lists.openembedded.org wrote:
> Without this fix, PKGV will be the same as PV when using devtool build.
> Since SRC_URI is set to local_srcuri in externalsrc.bbclass and consequently 
> cause missing git commit hash in PKGV.
> This fix can prevent buildhistory package-version QA failures in devtool 
> build.
> ---
>  meta/classes-global/package.bbclass | 12 ++++++++++--
>  meta/classes/externalsrc.bbclass    |  4 ++++
>  2 files changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/meta/classes-global/package.bbclass 
> b/meta/classes-global/package.bbclass
> index 67148fc1ac..c5f8b2136f 100644
> --- a/meta/classes-global/package.bbclass
> +++ b/meta/classes-global/package.bbclass
> @@ -242,6 +242,14 @@ python () {
>          d.appendVarFlag('do_package', 'deptask', " do_packagedata")
>  }
>  
> +def package_get_srcdata(d):
> +    srcuri = d.getVar("EXTERNALSRC_ORIG_SRC_URI")
> +    if not srcuri:
> +        return d
> +
> +    srcdata = d.createCopy()
> +    srcdata.setVar("SRC_URI", srcuri)
> +    return srcdata
>  
>  PRSERV_ACTIVE = "${@bool(d.getVar("PRSERV_HOST"))}"
>  PRSERV_ACTIVE[vardepvalue] = "${PRSERV_ACTIVE}"
> @@ -299,7 +307,7 @@ python package_get_auto_pr() {
>                  pr = d.getVar('PR')
>                  # Strip PR to make AUTOINC can increase when SRCREV is 
> changed
>                  base_ver = "AUTOINC-%s" % version[:-len(pr)]
> -                srcpv = bb.fetch2.get_srcrev(d)
> +                srcpv = bb.fetch2.get_srcrev(package_get_srcdata(d))
>                  value = conn.getPR(base_ver, pkgarch, srcpv)
>                  d.setVar("PRSERV_PV_AUTOINC", str(value))
>  
> @@ -319,7 +327,7 @@ python package_get_auto_pr() {
>  python package_setup_pkgv() {
>      pkgv = d.getVar("PKGV")
>      # Expand SRCPV into PKGV if not present
> -    srcpv = bb.fetch.get_pkgv_string(d)
> +    srcpv = bb.fetch.get_pkgv_string(package_get_srcdata(d))
>      if srcpv and "+" in pkgv:
>          d.appendVar("PKGV", srcpv)
>          pkgv = d.getVar("PKGV")
> diff --git a/meta/classes/externalsrc.bbclass 
> b/meta/classes/externalsrc.bbclass
> index 902ff2604f..a1bb92a418 100644
> --- a/meta/classes/externalsrc.bbclass
> +++ b/meta/classes/externalsrc.bbclass
> @@ -78,6 +78,10 @@ python () {
>              d.setVar('B', '${WORKDIR}/${BPN}-${PV}')
>  
>          bb.fetch.get_hashvalue(d)
> +        # Keep the original URI available for packaging. SCM URLs are removed
> +        # below so externalsrc does not fetch or unpack the external source,
> +        # but package_setup_pkgv() still needs them to derive PKGV.
> +        d.setVar('EXTERNALSRC_ORIG_SRC_URI', d.getVar('SRC_URI'))
>          local_srcuri = []
>          fetch = bb.fetch2.Fetch((d.getVar('SRC_URI') or '').split(), d)
>          for url in fetch.urls:


We really need to find a different way to fix this. I don't doubt there
is an issue here but change the datastore and it's variables around mid
function like that is really a hacky workaround, not a proper fix.

If we did this each time we found a bug, the code would become
unmaintainable.

Cheers,

Richard
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#246522): 
https://lists.openembedded.org/g/openembedded-core/message/246522
Mute This Topic: https://lists.openembedded.org/mt/121372440/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to