[yocto-autobuilder-helper] [PATCH] send_qa_email: Use bitbake-setup oecore directory rather than repos

Richard Purdie <[email protected]> Mon, 3 Aug 2026 15:11:45 +0100
Newsgroups org.yoctoproject.lists.yocto-patches
Message-ID <[email protected]>
bitbake-setup's layers and repos can be out of sync with each other since they
run in series. Prefer the layers directory if present since that is what the
build will have used.

[YOCTO #16216]

Signed-off-by: Richard Purdie <[email protected]>
---
 scripts/send_qa_email.py | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/scripts/send_qa_email.py b/scripts/send_qa_email.py
index e3de4b5..e02d47c 100755
--- a/scripts/send_qa_email.py
+++ b/scripts/send_qa_email.py
@@ -150,8 +150,9 @@ def send_qa_email():
 
     utils.filterrepojson(repos)
 
-    resulttool = os.path.dirname(args.repojson) + "/build/layers/openembedded-core/scripts/resulttool"
-    querytool = os.path.dirname(args.repojson) + "/build/layers/openembedded-core/scripts/yocto_testresults_query.py"
+    oecorerepodir = os.path.dirname(args.repojson) + "/build/layers/openembedded-core"
+    resulttool = oecorerepodir + "/scripts/resulttool"
+    querytool = oecorerepodir + "/scripts/yocto_testresults_query.py"
 
     buildtoolsdir = os.path.dirname(args.repojson) + "/build/buildtools"
     if os.path.exists(buildtoolsdir):
@@ -168,8 +169,7 @@ def send_qa_email():
     if 'oecore' in repos and os.path.exists(resulttool) and os.path.exists(querytool) and args.results_dir:
         utils.printheader("Processing test report")
         # Need the finalised revisions (not 'HEAD')
-        targetrepodir = "%s/oecore" % (repodir)
-        revision = subprocess.check_output(["git", "rev-parse", "HEAD"], cwd=targetrepodir).decode('utf-8').strip()
+        revision = subprocess.check_output(["git", "rev-parse", "HEAD"], cwd=oecorerepodir).decode('utf-8').strip()
         branch = repos['oecore']['branch']
         repo = repos['oecore']['url']
 
@@ -233,10 +233,10 @@ def send_qa_email():
 
             utils.printheader("Processing regression report")
             try:
-                regression_base, regression_target = get_regression_base_and_target(targetbranch, basebranch, args.release, targetrepodir, test_results_url, log)
+                regression_base, regression_target = get_regression_base_and_target(targetbranch, basebranch, args.release, oecorerepodir, test_results_url, log)
                 if regression_base and regression_target:
                     log.info(f"Generating regression report between {regression_base} and {regression_target}")
-                    generate_regression_report(querytool, targetrepodir, regression_base, regression_target, tempdir, args.results_dir, log)
+                    generate_regression_report(querytool, oecorerepodir, regression_base, regression_target, tempdir, args.results_dir, log)
                 else:
                     log.info("Can not guess regression base and/or target, skip regression report")
             except subprocess.CalledProcessError as e:
@@ -257,13 +257,22 @@ def send_qa_email():
 
     utils.printheader("Generating QA email")
 
+    layersdir = os.path.dirname(args.repojson) + "/build/layers/"
     buildhashes = ""
     for repo in sorted(repos.keys()):
         # gplv2 is no longer built/tested in master
         if repo == "meta-gplv2":
             continue
+        layerdir = layersdir + repo "/"
+        if repo == "oecore":
+            layerdir = layersdir + "openembedded-core/"
+        # Try to use bitbake-setup layers, fall back to repos/
+        if os.path.exists(layerdir):
+            targetrepodir = layerdir
+        else:
+            targetrepodir = "%s/%s" % (repodir, repo)
+
         # Need the finalised revisions (not 'HEAD')
-        targetrepodir = "%s/%s" % (repodir, repo)
         revision = subprocess.check_output(["git", "rev-parse", "HEAD"], cwd=targetrepodir).decode('utf-8').strip()
         buildhashes += "%s: %s\n" % (repo, revision)