Hi Paddy,

On Tue, Sep 22, 2026 at 10:20 AM Paddy Chiu <[email protected]>
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.
>

Please use about 72 chars per line on the commit message
and also add you Signed-off-by (git commit -s--amend)

Jose


> ---
>  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:
> --
> 2.34.1
>
>
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#246413): 
https://lists.openembedded.org/g/openembedded-core/message/246413
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