diff mbox series

externalsrc: fix PKGV for devtool build

Message ID 20260922092015.2428562-1-paddy.chiu@oss.qualcomm.com
State New
Headers show
Series externalsrc: fix PKGV for devtool build | expand

Commit Message

Paddy Chiu Sept. 22, 2026, 9:20 a.m. UTC
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(-)

Comments

patchtest@automation.yoctoproject.org Sept. 22, 2026, 11:01 a.m. UTC | #1
Thank you for your submission. Patchtest identified one
or more issues with the patch. Please see the log below for
more information:

---
Testing patch /home/patchtest/share/mboxes/externalsrc-fix-PKGV-for-devtool-build.patch

FAIL: test Signed-off-by presence: Mbox is missing Signed-off-by. Add it manually or with "git commit --amend -s" (test_mbox.TestMbox.test_signed_off_by_presence)

PASS: test auh changelog truncation notice (test_mbox.TestMbox.test_auh_changelog_truncation_notice)
PASS: test author valid (test_mbox.TestMbox.test_author_valid)
PASS: test commit message presence (test_mbox.TestMbox.test_commit_message_presence)
PASS: test commit message user tags (test_mbox.TestMbox.test_commit_message_user_tags)
PASS: test max line length (test_metadata.TestMetadata.test_max_line_length)
PASS: test mbox format (test_mbox.TestMbox.test_mbox_format)
PASS: test non-AUH upgrade (test_mbox.TestMbox.test_non_auh_upgrade)
PASS: test shortlog format (test_mbox.TestMbox.test_shortlog_format)
PASS: test shortlog length (test_mbox.TestMbox.test_shortlog_length)
PASS: test target mailing list (test_mbox.TestMbox.test_target_mailing_list)

SKIP: pretest pylint: No python related patches, skipping test (test_python_pylint.PyLint.pretest_pylint)
SKIP: pretest src uri left files: Patch cannot be merged (test_metadata.TestMetadata.pretest_src_uri_left_files)
SKIP: test CVE check ignore: No modified recipes or older target branch, skipping test (test_metadata.TestMetadata.test_cve_check_ignore)
SKIP: test CVE tag format: No new source patches introduced (test_patch.TestPatch.test_cve_tag_format)
SKIP: test Signed-off-by presence: No new source patches introduced (test_patch.TestPatch.test_signed_off_by_presence)
SKIP: test Upstream-Status presence: No new source patches introduced (test_patch.TestPatch.test_upstream_status_presence_format)
SKIP: test bugzilla entry format: No bug ID found (test_mbox.TestMbox.test_bugzilla_entry_format)
SKIP: test lic files chksum modified not mentioned: No modified recipes, skipping test (test_metadata.TestMetadata.test_lic_files_chksum_modified_not_mentioned)
SKIP: test lic files chksum presence: No added recipes, skipping test (test_metadata.TestMetadata.test_lic_files_chksum_presence)
SKIP: test license presence: No added recipes, skipping test (test_metadata.TestMetadata.test_license_presence)
SKIP: test pylint: No python related patches, skipping test (test_python_pylint.PyLint.test_pylint)
SKIP: test series merge on head: Merge test is disabled for now (test_mbox.TestMbox.test_series_merge_on_head)
SKIP: test src uri left files: Patch cannot be merged (test_metadata.TestMetadata.test_src_uri_left_files)
SKIP: test summary presence: No added recipes, skipping test (test_metadata.TestMetadata.test_summary_presence)

---

Please address the issues identified and
submit a new revision of the patch, or alternatively, reply to this
email with an explanation of why the patch should be accepted. If you
believe these results are due to an error in patchtest, please submit a
bug at https://bugzilla.yoctoproject.org/ (use the 'Patchtest' category
under 'Yocto Project Subprojects'). For more information on specific
failures, see: https://wiki.yoctoproject.org/wiki/Patchtest. Thank
you!
Jose Quaresma Sept. 22, 2026, 1:22 p.m. UTC | #2
Hi Paddy,

On Tue, Sep 22, 2026 at 10:20 AM Paddy Chiu <paddy.chiu@oss.qualcomm.com>
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
>
>
diff mbox series

Patch

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: