Skip to contentSkip to conversation

config.json/scripts: Switch to use bitbake-setup

PATCH In review Richard Purdie 2 participants 5 messages Oct 14, 2025 – Oct 21, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 config.json/scripts: Switch to use bitbake-setup

With the addition of bitbake-setup to the master branch, we can switch from using the combo-layer built poky repository to using bitbake-setup instead.

This patch set changes the setup to use bitbake/oecore/meta-yocto/yocto-docs instead of poky. Most of the changes are due to the new layer layout, or using bitbake-setuip instead of scripts in helper. The existing scripts are still run for now to handle layers not in the core configuration json.

We continue to write extra settings to auto.conf.

This switches the code to use the distro/machine selection from fragments.

We need to use init-build-env instead of oe-init-build-env in most cases.

---
 config.json                     | 79 ++++++++++++++++++---------------
 scripts/bitbake-extra-tests     |  2 +-
 scripts/build-perf-test-wrapper |  8 ++--
 scripts/getproperties.py        |  2 +
 scripts/layer-config            | 22 +++------
 scripts/run-config              | 15 ++++---
 scripts/run-cvecheck            |  2 +-
 scripts/run-patchtest-selftest  |  6 +--
 scripts/setup-config            | 17 ++++++-
 scripts/shared-repo-unpack      | 43 +++++++++++++++---
 scripts/upload-error-reports    |  2 +-
 scripts/utils.py                | 12 +++--
 12 files changed, 128 insertions(+), 82 deletions(-)
config.json +42 -37
index 588a2f6..04358a9 100644
@@ -26,7 +26,10 @@
     "AUTOBUILDER_HASHSERV" : "wss://hashserv.yoctoproject.org/ws",
 
     "defaults" : {
-        "NEEDREPOS" : ["poky"],
+        "NEEDREPOS" : ["bitbake"],
+        "BBSETUP_DLDIR" : "${BASE_SHAREDDIR}/current_sources",
+        "BBSETUP_CONFIG" : ["poky-master", "poky"],
+        "BBSETUP_FRAGMENTS" : [],
         "DISTRO" : "poky",
         "MACHINE" : "qemux86-64",
         "SDKMACHINE" : "x86_64",
@@ -43,7 +46,8 @@
         "extravars" : [
             "SANITY_TESTED_DISTROS = ''",
             "BB_HASHSERVE = '${AUTOBUILDER_HASHSERV}'",
-            "OE_FRAGMENTS += 'core/yocto-autobuilder/autobuilder core/yocto-autobuilder/autobuilder-resource-constraints'"
+            "OE_FRAGMENTS += 'core/yocto-autobuilder/autobuilder core/yocto-autobuilder/autobuilder-resource-constraints'",
+            "EXTRA_IMAGE_FEATURES ?= 'allow-empty-password empty-root-password allow-root-login'"
         ]
     },
     "templates" : {
@@ -85,7 +89,7 @@
             "step1" : {
                 "shortname" : "Machine oe-selftest",
                 "EXTRACMDS" : ["${SCRIPTSDIR}/checkvnc; DISPLAY=:1 oe-selftest ${HELPERSTMACHTARGS} -j 15"],
-                "ADDLAYER" : ["${BUILDDIR}/../meta-selftest"]
+                "ADDLAYER" : ["${BUILDDIR}/../layers/openembedded-core/meta-selftest"]
             }
         },
         "altcfg-qemu" : {
@@ -221,7 +225,7 @@
                     "RPM_GPG_SIGN_CHUNK = '1'"
                 ],
                 "EXTRACMDS" : ["${SCRIPTSDIR}/checkvnc; DISPLAY=:1 oe-selftest -a --skip-tests distrodata.Distrodata.test_checkpkg -T yocto-mirrors -T machine -T toolchain-user -T toolchain-system -j 15"],
-                "ADDLAYER" : ["${BUILDDIR}/../meta-selftest"]
+                "ADDLAYER" : ["${BUILDDIR}/../layers/openembedded-core/meta-selftest"]
             }
         },
         "buildperf" : {
@@ -257,7 +261,7 @@
             "step2" : {
                 "shortname" : "OE Selftest",
                 "EXTRACMDS" : ["${SCRIPTSDIR}/checkvnc; OEQA_DEBUGGING_SAVED_OUTPUT=${BASE_SHAREDDIR}/pub/repro-fail/ DISPLAY=:1 oe-selftest -a --skip-tests distrodata.Distrodata.test_checkpkg reproducible -T yocto-mirrors -T machine -T toolchain-user -T toolchain-system -j 15"],
-                "ADDLAYER" : ["${BUILDDIR}/../meta-selftest"]
+                "ADDLAYER" : ["${BUILDDIR}/../layers/openembedded-core/meta-selftest"]
             },
             "step3" : {
                 "shortname" : "Python Linter Report",
@@ -277,16 +281,16 @@
             "step1" : {
                 "shortname" : "Reproducible Selftest",
                 "EXTRACMDS" : ["${SCRIPTSDIR}/checkvnc; OEQA_DEBUGGING_SAVED_OUTPUT=${BASE_SHAREDDIR}/pub/repro-fail/ DISPLAY=:1 oe-selftest -r reproducible"],
-                "ADDLAYER" : ["${BUILDDIR}/../meta-selftest"]
+                "ADDLAYER" : ["${BUILDDIR}/../layers/openembedded-core/meta-selftest"]
 
             }
         },
         "reproducible-meta-oe" : {
             "MACHINE" : "qemux86-64",
             "SDKMACHINE" : "x86_64",
-            "NEEDREPOS" : ["poky", "meta-openembedded"],
+            "NEEDREPOS" : ["bitbake", "meta-openembedded"],
             "ADDLAYER" : [
-                "${BUILDDIR}/../meta-selftest"
+                "${BUILDDIR}/../layers/openembedded-core/meta-selftest"
             ],
             "extravars" : [
                 "EXCLUDE_FROM_WORLD:layer-core = '1'",
@@ -462,7 +466,7 @@
             "step1" : {
                 "shortname" : "Sources pre-fetching",
                 "BBTARGETS" : "universe -c fetch -k",
-                "ADDLAYER" : ["${BUILDDIR}/../meta-selftest"],
+                "ADDLAYER" : ["${BUILDDIR}/../layers/openembedded-core/meta-selftest"],
                 "extravars" : [
                     "SOURCE_MIRROR_FETCH = '1'"
                 ]
@@ -478,16 +482,17 @@
             "step1" : {
                 "shortname" : "Source Mirror Selftest",
                 "EXTRACMDS" : ["${SCRIPTSDIR}/checkvnc; DISPLAY=:1 oe-selftest -a -t yocto-mirrors -j 15"],
-                "ADDLAYER" : ["${BUILDDIR}/../meta-selftest"]
+                "ADDLAYER" : ["${BUILDDIR}/../layers/openembedded-core/meta-selftest"]
             }
         }
 
     },
     "overrides" : {
         "qemuarm-oecore" : {
-            "NEEDREPOS" : ["oecore", "bitbake"],
+            "NEEDREPOS" : ["bitbake"],
             "MACHINE" : "qemuarm",
-            "DISTRO" : "None",
+            "DISTRO" : "",
+            "BBSETUP_CONFIG" : ["oe-nodistro", "nodistro"],
             "extravars" : [
                 "INHERIT += 'uninative'",
                 "require conf/distro/include/yocto-uninative.inc",
@@ -557,7 +562,7 @@
             "step1" : {
                 "shortname" : "Sources pre-fetching (arm specific)",
                 "BBTARGETS" : "universe -c fetch -k",
-                "ADDLAYER" : ["${BUILDDIR}/../meta-selftest"],
+                "ADDLAYER" : ["${BUILDDIR}/../layers/openembedded-core/meta-selftest"],
                 "extravars" : [
                     "SOURCE_MIRROR_FETCH = '1'"
                 ]
@@ -614,7 +619,7 @@
         },
 
         "meta-arm" : {
-            "NEEDREPOS" : ["poky", "meta-arm"],
+            "NEEDREPOS" : ["bitbake", "meta-arm"],
             "ADDLAYER" : [
                 "${BUILDDIR}/../meta-arm/meta-arm-toolchain",
                 "${BUILDDIR}/../meta-arm/meta-arm",
@@ -648,7 +653,7 @@
             }
         },
         "meta-agl-core" : {
-            "NEEDREPOS" : ["poky", "meta-agl"],
+            "NEEDREPOS" : ["bitbake", "meta-agl"],
             "ADDLAYER" : [
                 "${BUILDDIR}/../meta-agl/meta-agl-core"
             ],
@@ -665,7 +670,7 @@
             }
         },
         "meta-aws" : {
-            "NEEDREPOS" : ["poky", "meta-openembedded", "meta-aws"],
+            "NEEDREPOS" : ["bitbake", "meta-openembedded", "meta-aws"],
             "ADDLAYER" : [
                 "${BUILDDIR}/../meta-openembedded/meta-oe",
                 "${BUILDDIR}/../meta-openembedded/meta-python",
@@ -799,7 +804,7 @@
             }
         },
         "meta-intel" : {
-            "NEEDREPOS" : ["poky", "meta-intel"],
+            "NEEDREPOS" : ["bitbake", "meta-intel"],
             "ADDLAYER" : ["${BUILDDIR}/../meta-intel"],
             "MACHINE" : "intel-corei7-64",
             "TEMPLATE" : "arch-hw"
@@ -1050,7 +1055,7 @@
         },
         "buildtools-docs" : {
             "MACHINE" : "qemux86-64",
-            "NEEDREPOS" : ["poky", "meta-openembedded"],
+            "NEEDREPOS" : ["bitbake", "meta-openembedded"],
             "ADDLAYER" : [
                     "${BUILDDIR}/../meta-openembedded/meta-oe",
                     "${BUILDDIR}/../meta-openembedded/meta-python",
@@ -1188,20 +1193,20 @@
             "TEMPLATE" : "reproducible"
         },
         "check-layer" : {
-            "NEEDREPOS" : ["poky", "meta-mingw"],
+            "NEEDREPOS" : ["bitbake", "meta-mingw"],
             "DISTRO" : "nodistro",
             "step1" : {
-                "EXTRACMDS" : ["bitbake-layers remove-layer ../meta-poky; yocto-check-layer ../meta-poky"]
+                "EXTRACMDS" : ["yocto-check-layer ../layers/meta-yocto/meta-poky"]
             },
             "step2" : {
-                "EXTRACMDS" : ["bitbake-layers remove-layer ../meta-yocto-bsp; yocto-check-layer ../meta-yocto-bsp"]
+                "EXTRACMDS" : ["yocto-check-layer ../layers/meta-yocto/meta-yocto-bsp"]
             },
             "step3" : {
                 "EXTRACMDS" : ["yocto-check-layer-wrapper ../meta-mingw"]
             }
         },
         "check-layer-nightly" : {
-            "NEEDREPOS" : ["poky", "meta-agl", "meta-arm", "meta-aws", "meta-intel", "meta-ti", "meta-openembedded", "meta-virtualization", "meta-clang", "meta-exein", "meta-qcom"],
+            "NEEDREPOS" : ["bitbake", "meta-agl", "meta-arm", "meta-aws", "meta-intel", "meta-ti", "meta-openembedded", "meta-virtualization", "meta-clang", "meta-exein", "meta-qcom"],
             "step1" : {
                 "shortname" : "Test meta-agl YP Compatibility",
                 "EXTRACMDS" : ["yocto-check-layer-wrapper ../meta-agl/meta-agl-core ../meta-agl/meta-netboot --dependency ../meta-openembedded/meta-oe ../meta-openembedded/meta-networking ../meta-openembedded/meta-python --no-auto-dependency"]
@@ -1248,7 +1253,7 @@
             }
         },
         "metrics" : {
-            "NEEDREPOS" : ["poky", "meta-openembedded"],
+            "NEEDREPOS" : ["bitbake", "meta-openembedded"],
             "extravars" : [
                 "INHERIT += 'cve-check'",
                 "BB_DISKMON_DIRS = ''",
@@ -1299,7 +1304,7 @@
             }
         },
         "metrics-gitstats" : {
-            "NEEDEDREPOS" : [],
+            "NEEDREPOS" : [],
             "step1" : {
                 "shortname" : "Generate gitstats",
                 "EXTRACMDS" : ["${SCRIPTSDIR}/run-gitstats ${BUILDDIR}/../"]
@@ -1321,7 +1326,7 @@
             }
         },
         "meta-mingw" : {
-            "NEEDREPOS" : ["poky", "meta-mingw"],
+            "NEEDREPOS" : ["bitbake", "meta-mingw"],
             "MACHINE" : "qemux86-64",
             "BBTARGETS" : "core-image-mingw-sdktest:do_populate_sdk",
             "ADDLAYER" : ["${BUILDDIR}/../meta-mingw"],
@@ -1334,7 +1339,7 @@
             }
         },
         "meta-oe" : {
-            "NEEDREPOS" : ["poky", "meta-openembedded"],
+            "NEEDREPOS" : ["bitbake", "meta-openembedded"],
             "MACHINE" : "qemux86-64",
             "extravars" : [
                 "INHERIT += 'rm_work'"
@@ -1354,7 +1359,7 @@
             }
         },
         "meta-virt" : {
-            "NEEDREPOS" : ["poky", "meta-openembedded", "meta-virtualization"],
+            "NEEDREPOS" : ["bitbake", "meta-openembedded", "meta-virtualization"],
             "ADDLAYER" : [
                 "${BUILDDIR}/../meta-openembedded/meta-oe",
                 "${BUILDDIR}/../meta-openembedded/meta-python",
@@ -1459,7 +1464,7 @@
                     "IMAGE_INSTALL:append = ' service hello-mod'",
                     "TEST_SUITES:append = ' skeletoninit'"
                 ],
-                "ADDLAYER" : ["${BUILDDIR}/../meta-skeleton"]
+                "ADDLAYER" : ["${BUILDDIR}/../layers/openembedded-core/meta-skeleton"]
             },
             "step4" : {
                 "shortname" : "Systemd with sysvinit compat",
@@ -1515,7 +1520,7 @@
             "TEMPLATE" : "buildperf"
         },
         "auh" : {
-            "NEEDREPOS" : ["poky", "auto-upgrade-helper"],
+            "NEEDREPOS" : ["bitbake", "auto-upgrade-helper"],
             "extravars" :[
                 "DL_DIR = '${TOPDIR}/downloads'",
                 "INHERIT += 'buildhistory'",
@@ -1542,7 +1547,7 @@
             }
         },
         "auh-meta-oe": {
-            "NEEDREPOS": ["poky", "auto-upgrade-helper", "meta-openembedded"],
+            "NEEDREPOS": ["bitbake", "auto-upgrade-helper", "meta-openembedded"],
             "extravars": [
                 "DL_DIR = '${TOPDIR}/downloads'",
                 "INHERIT += 'buildhistory'",
@@ -1673,15 +1678,15 @@
             "step1" : {
                 "shortname" : "Yocto Mirror Selftest",
                 "EXTRACMDS" : ["${SCRIPTSDIR}/checkvnc; DISPLAY=:1 oe-selftest -r buildoptions.SourceMirroring.test_yocto_source_mirror"],
-                "ADDLAYER" : ["${BUILDDIR}/../meta-selftest"]
+                "ADDLAYER" : ["${BUILDDIR}/../layers/openembedded-core/meta-selftest"]
             }
         },
         "meta-oe-mirror" : {
             "SDKMACHINE" : "x86_64",
             "MACHINE" : "qemux86-64",
-            "NEEDREPOS" : ["poky", "meta-openembedded"],
+            "NEEDREPOS" : ["bitbake", "meta-openembedded"],
             "ADDLAYER" : [
-                "${BUILDDIR}/../meta-selftest",
+                "${BUILDDIR}/../layers/openembedded-core/meta-selftest",
 
                 "${BUILDDIR}/../meta-openembedded/meta-oe",
                 "${BUILDDIR}/../meta-openembedded/meta-python",
@@ -1713,7 +1718,7 @@
             }
         },
         "meta-webosose" : {
-            "NEEDREPOS" : ["poky", "meta-webosose", "meta-security", "meta-clang", "meta-openembedded", "meta-qt6"],
+            "NEEDREPOS" : ["bitbake", "meta-webosose", "meta-security", "meta-clang", "meta-openembedded", "meta-qt6"],
             "DISTRO": "webos",
             "MACHINE": "qemux86-64",
             "NOLAYERADD": ["meta-security", "meta-clang", "meta-qt6", "meta-webosose", "meta-openembedded"],
@@ -1751,7 +1756,7 @@
             "TEMPLATE" : "trigger-build-posttrigger"
         },
         "patchtest" : {
-            "NEEDREPOS" : ["poky", "meta-patchtest", "meta-openembedded"],
+            "NEEDREPOS" : ["bitbake", "meta-patchtest", "meta-openembedded"],
             "MACHINE" : "qemux86-64",
             "ADDLAYER" : [
                 "${BUILDDIR}/../meta-openembedded/meta-oe",
@@ -1763,10 +1768,10 @@
             }
         },
 	"patchtest-selftest" : {
-	    "NEEDREPOS" : ["poky"],
+	    "NEEDREPOS" : ["bitbake"],
 	    "EXTRACMDS" : ["${SCRIPTSDIR}/run-patchtest-selftest ${HELPERBUILDDIR}/.."],
 	    "ADDLAYER" : [
-	        "${BUILDDIR}/../meta-selftest"
+	        "${BUILDDIR}/../layers/openembedded-core/meta-selftest"
 	    ]
 	},
         "toaster" : {
scripts/bitbake-extra-tests +1 -1
index c8d6d83..1bc06fb 100755
@@ -1,5 +1,5 @@
 #!/bin/bash
-. ./oe-init-build-env
+source ./build/init-build-env
 TERM=xterm-256color
 TASK_EXP_UNIT_TEST=1 bitbake -g -u taskexp_ncurses zlib acl
 if [ $? -ne 0 ]; then
scripts/build-perf-test-wrapper +4 -4
index c236c60..9028463 100755
@@ -128,7 +128,7 @@ os.makedirs(build_dir + "/conf", exist_ok=True)
 subprocess.check_call("cp -r %s/build/conf/auto.conf %s/conf" % (gitdir, build_dir), shell=True)
 
 # Run actual test script
-ret = subprocess.call("BDIR=%s . ./oe-init-build-env >/dev/null; oe-build-perf-test --out-dir %s --globalres-file %s --lock-file %s/oe-build-perf.lock"
+ret = subprocess.call("BDIR=%s source ./build/init-build-env >/dev/null; oe-build-perf-test --out-dir %s --globalres-file %s --lock-file %s/oe-build-perf.lock"
  % (build_dir, results_tmpdir, globalres_log, args.work_dir), shell=True)
 
 if ret == 1:
@@ -147,7 +147,7 @@ if git_repo:
     print("\nArchiving results in " + git_repo)
 
     os.makedirs(git_repo, exist_ok=True)
-    subprocess.check_call("BDIR=%s . ./oe-init-build-env >/dev/null; oe-git-archive " % build_dir + \
+    subprocess.check_call("BDIR=%s source ./build/init-build-env >/dev/null; oe-git-archive " % build_dir + \
         "--git-dir " + git_repo + " " \
         "--branch-name '{hostname}/{branch}/{machine}' " \
         "--tag-name '{hostname}/{branch}/{machine}/{commit_count}-g{commit}/{tag_number}' " \
@@ -182,8 +182,8 @@ if git_repo:
         with open(report_txt, "w") as f:
             f.write("HTML Report/Graphs are available at:\n    %s\n\n" % url)
 
-    subprocess.check_call("BDIR=%s . ./oe-init-build-env >/dev/null; oe-build-perf-report -r %s %s >> %s" % (build_dir, git_repo, extraopts, report_txt), shell=True)
-    subprocess.check_call("BDIR=%s . ./oe-init-build-env >/dev/null; oe-build-perf-report -r %s %s --html > %s " % (build_dir, git_repo, extraopts, report_html), shell=True)
+    subprocess.check_call("BDIR=%s source ./build/init-build-env >/dev/null; oe-build-perf-report -r %s %s >> %s" % (build_dir, git_repo, extraopts, report_txt), shell=True)
+    subprocess.check_call("BDIR=%s source ./build/init-build-env >/dev/null; oe-build-perf-report -r %s %s --html > %s " % (build_dir, git_repo, extraopts, report_html), shell=True)
 
     subprocess.check_call("cp %s %s/%s.txt" % (report_txt, global_results, filename), shell=True)
     subprocess.check_call("cp %s %s/%s.html" % (report_html, global_results, filename), shell=True)
scripts/getproperties.py +2 -0
index 5f396a9..5ce6204 100755
@@ -6,6 +6,8 @@ import sys
 
 builddir = sys.argv[1]
 
+builddir = builddir + "/layers/openembedded-core/"
+
 jsonprops = {}
 jsonprops['yp_build_revision'] =  subprocess.check_output(["git", "rev-parse", "HEAD"], cwd=builddir).decode('utf-8').strip()
 jsonprops['yp_build_branch'] = subprocess.check_output(["git", "rev-parse", "--abbrev-ref", "HEAD"], cwd=builddir).decode('utf-8').strip()
scripts/layer-config +6 -16
index 93dc7e3..348f9df 100755
@@ -26,33 +26,23 @@ args = parser.parse_args()
 ourconfig = utils.loadconfig()
 
 def bitbakecmd(targetdir, cmd):
-    subprocess.check_call(". ./oe-init-build-env; %s" % cmd, shell=True, cwd=targetdir)
+    subprocess.check_call(". ./init-build-env; %s" % cmd, shell=True, cwd=targetdir)
 
 needrepos = utils.getconfigvar("NEEDREPOS", ourconfig, args.target, None)
 
-callinit = False
-
 repos = utils.getconfig("repo-defaults", ourconfig)
 
 for repo in needrepos:
     repo_basename = repo.split('/')[0]
-    checkdir = repo_basename
-    if repo_basename in repos:
-        if "call-init" in repos[repo_basename] and repos[repo_basename]["call-init"]:
-            callinit = True
-        if "checkout-dirname" in repos[repo_basename]:
-            checkdir = repos[repo_basename]["checkout-dirname"]
-
+    if repo_basename in ['bitbake', 'oecore']:
+        continue
     source = args.abworkdir + "/repos/" + repo_basename
-    destination = args.abworkdir + "/" + checkdir
-    if not os.path.isdir(destination) or callinit:
+    destination = args.abworkdir + "/" + repo_basename
+    if not os.path.isdir(destination):
         utils.mkdir(destination)
         for f in os.listdir(source):
             subprocess.check_call(['mv', source + "/" + f, destination + "/"])
 
-if callinit:
-    subprocess.check_call(". ./oe-init-build-env", shell=True, cwd=args.abworkdir)
-
 for repo in needrepos:
     repo_basename = repo.split('/')[0]
     if repo_basename in repos and "no-layer-add" in repos[repo_basename] and repos[repo_basename]["no-layer-add"]:
@@ -61,7 +51,7 @@ for repo in needrepos:
     if repo_basename in nolayeradd:
         continue
     try:
-        bitbakecmd(args.abworkdir, "bitbake-layers add-layer %s" % (args.abworkdir + "/" + repo))
+        bitbakecmd(args.abworkdir + "/build", "bitbake-layers add-layer %s" % (args.abworkdir + "/" + repo))
     except subprocess.CalledProcessError as e:
         utils.printheader("ERROR: Command %s failed with exit code %d, see errors above." % (e.cmd, e.returncode))
         sys.exit(e.returncode)
scripts/run-config +9 -6
index 98b48e5..17610ea 100755
@@ -157,7 +157,7 @@ elif extratools:
     if args.phase == "init" and args.stepname == "extratools":
         sys.exit(0)
 
-logconfig = args.builddir + "/../bitbake/contrib/autobuilderlog.json"
+logconfig = args.builddir + "/../layers/bitbake/contrib/autobuilderlog.json"
 print("Using BB_LOGCONFIG=%s" % logconfig)
 os.environ["BB_LOGCONFIG"] = logconfig
 
@@ -202,21 +202,23 @@ def bitbakecmd(builddir, cmd, report, stepnum, stepname, oeenv=True):
     except FileNotFoundError:
         numreports = 0
 
+    cmdpath = builddir
+
     def writelog(msg, a, b):
         a.write(msg)
         b.write(msg)
 
     if oeenv:
-        cmd = ". ./oe-init-build-env; %s" % cmd
+        cmd = ". ./init-build-env; %s" % cmd
 
     if testmode:
         print("Would run '%s'" % cmd)
         return
 
     with open(log, "a") as outf:
-        writelog("Running '%s' with output to %s\n" % (cmd, log), outf, sys.stdout)
+        writelog("Running '%s' with output to %s in %s\n" % (cmd, log, cmdpath), outf, sys.stdout)
 
-    with subprocess.Popen(cmd, shell=True, cwd=builddir + "/..", stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=0) as p, open(log, 'ab') as f:
+    with subprocess.Popen(["/bin/bash", "-c", cmd], cwd=cmdpath, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=0) as p, open(log, 'ab') as f:
         for line in p.stdout:
             writelog(line, f, sys.stdout.buffer)
             sys.stdout.flush()
@@ -370,9 +372,10 @@ elif args.phase == "finish" and args.stepname == "send-errors":
 
 if jcfg:
     addentry("builddir-cleanup", "Cleaning up build directory", "finish")
-elif args.phase == "finish" and args.stepname == "builddir-cleanup":
+# full/quick have a second phase in post-trigger
+elif args.phase == "finish" and args.stepname == "builddir-cleanup" and args.target not in ["a-full", "a-quick"]:
     if args.builddir and os.path.exists(args.builddir):
-        if os.path.exists("oe-init-build-env"):
+        if os.path.exists(args.builddir + "/build/init-build-env"):
             bitbakecmd(args.builddir, "bitbake -m", report, 99, args.stepname)
         runcmd(["mv", args.builddir, args.builddir + "-renamed"])
 
scripts/run-cvecheck +1 -1
index c6b0066..39ee5ba 100755
@@ -73,7 +73,7 @@ fi
 
 cd ..
 set +u
-. oe-init-build-env build
+source build/init-build-env build
 set -u
 bitbake world --runall cve_check -R conf/distro/include/cve-extra-exclusions.inc
 
scripts/run-patchtest-selftest +3 -3
index 58edb0e..197edf7 100755
@@ -9,10 +9,10 @@ set -u
 set -o pipefail
 set -x
 
-pokydir=$(realpath "$1")
+oecoredir=$(realpath "$1")/layers/openembedded-core/
 
 python3 -m venv venv --without-pip --system-site-packages
 source venv/bin/activate
-python3 -m pip install -r $pokydir/meta/lib/patchtest/requirements.txt
+python3 -m pip install -r $oecoredir/meta/lib/patchtest/requirements.txt
 
-$pokydir/meta/lib/patchtest/selftest/selftest
+$oecoredir/meta/lib/patchtest/selftest/selftest
scripts/setup-config +16 -1
index 594ff5e..c311d95 100755
@@ -56,13 +56,23 @@ sdkextraconf = os.path.join(args.builddir, "conf", "sdk-extra.conf")
 if os.path.exists(sdkextraconf):
     os.remove(sdkextraconf)
 
-for v in ["MACHINE", "DISTRO", "SDKMACHINE", "PACKAGE_CLASSES"]:
+for v in ["SDKMACHINE", "PACKAGE_CLASSES"]:
     value = utils.getconfigvar(v, ourconfig, args.target, stepnum)
     if value and value != "None":
         variables.append(v + ' = "%s"' % value)
 
+machine = utils.getconfigvar("MACHINE", ourconfig, args.target, stepnum) 
 distro = utils.getconfigvar("DISTRO", ourconfig, args.target, stepnum)
 
+def enable_fragment(fragment):
+    cmd = ". ./init-build-env; bitbake-config-build enable-fragment %s" % fragment
+    cmdpath = args.builddir
+
+    print("Running '%s' in %s\n" % (cmd, cmdpath))
+    utils.flush()
+    subprocess.check_call(["/bin/bash", "-c", cmd], cwd=cmdpath)
+
+
 for v in ["DLDIR", "PRSERV"]:
     value = utils.getconfigvar(v, ourconfig, args.target, stepnum)
     if value:
@@ -130,3 +140,8 @@ with open(sdkextraconf, "w") as f:
         print("  " + v)
         f.write(v + "\n")
 
+if machine:
+    enable_fragment("machine/" + machine)
+if distro:
+    enable_fragment("distro/" + distro)
+
scripts/shared-repo-unpack +38 -5

62 lines not on this page · raw message

scripts/upload-error-reports +1 -1
index 36d7820..74a0ac9 100755
@@ -22,7 +22,7 @@ if [ -d $BUILDDIR/tmp/log/error-report/ ]; then
     host=`hostname`
     echo "yp-ab-$host" > ~/.oe-send-error
 
-    . ./oe-init-build-env
+    source ./build/init-build-env
     for x in `ls $BUILDDIR/tmp/log/error-report/ | grep error_report_`; do
         send-error-report -y  -l $ERRORLINK tmp/log/error-report/$x
     done
scripts/utils.py +5 -7
index ea92e0d..efc7c99 100644
@@ -297,14 +297,12 @@ def publishrepo(clonedir, repo, publishdir):
     mkdir(publishdir)
     subprocess.check_call("rsync -av " + archive_name + "* " + publishdir, shell=True, cwd=sharedrepo)
 
-# The repo json needs to be filtered to allow builds with and without bitbake-setup
+# The repo json needs to be filtered for builds with bitbake-setup
 def filterrepojson(data, target=None):
-    # For a-full or a-quick, we want all repos. Otherwise we should use poky and ignore bitbake and friends
-    if target and target != "a-full" and target != "a-quick" and "poky" in data:
-        data.pop("bitbake", None)
-        data.pop("meta-yocto", None)
-        data.pop("yocto-docs", None)
-        data.pop("oecore", None)
+    if "poky" in data:
+        del data["poky"]
+    if "meta-gplv2" in data:
+        del data["meta-gplv2"]
     return
 
 def mkdir(path):
#1 lore raw

PATCH 2/2 scripts/getproperties: Update to return all revisions/branches and compute build_revision

Now that bitbake-setup is fetching the layers, we need to report back the revisions fetched back to buildbot. We can do this by sharing extra properties back to the controller from this script.

The buildbot UI needs a way to group the "same" builds together. Compute a dummy sha1 hash of the bitbake/oecore/helper revisions to do that which can be used in place of the poky hash there.

---
 scripts/getproperties.py | 66 +++++++++++++++++++++++++++++++++++++---
 1 file changed, 62 insertions(+), 4 deletions(-)
scripts/getproperties.py +62 -4
index 5ce6204..0d8eab2 100755
@@ -1,17 +1,75 @@
 #!/usr/bin/env python3
 
+import hashlib
 import json
+import os
 import subprocess
 import sys
 
+import utils
+
 builddir = sys.argv[1]
 
-builddir = builddir + "/layers/openembedded-core/"
+
+with open(builddir + "/../layerinfo.json") as f:
+    repos = json.load(f)
+
+utils.filterrepojson(repos)
+
+def get_revision(repopath):
+    return subprocess.check_output(["git", "rev-parse", "HEAD"], cwd=repopath).decode('utf-8').strip()
+
+def get_branch(repopath):
+   return subprocess.check_output(["git", "rev-parse", "--abbrev-ref", "HEAD"], cwd=repopath).decode('utf-8').strip()
 
 jsonprops = {}
-jsonprops['yp_build_revision'] =  subprocess.check_output(["git", "rev-parse", "HEAD"], cwd=builddir).decode('utf-8').strip()
-jsonprops['yp_build_branch'] = subprocess.check_output(["git", "rev-parse", "--abbrev-ref", "HEAD"], cwd=builddir).decode('utf-8').strip()
+jsonprops['commit_yocto-autobuilder-helper'] = get_revision(builddir + "/../yocto-autobuilder-helper/")
+jsonprops['branch_yocto-autobuilder-helper'] = get_branch(builddir + "/../yocto-autobuilder-helper/")
+#set below to a combined hash
+#jsonprops['yp_build_revision'] = get_revision(builddir + "/layers/openembedded-core/")
+jsonprops['yp_build_branch'] = get_branch(builddir + "/layers/openembedded-core/")
 
-print(json.dumps(jsonprops, indent=4, sort_keys=True))
+done = []
+
+def getrevs(jsonprops, layerpath, layername):
+    jsonprops['commit_' + layername] = get_revision(layerpath)
+    jsonprops['branch_' + layername ] = get_branch(layerpath)
 
+for layer in os.listdir(builddir + "/layers"):
+    layerpath = builddir + "/layers/" + layer
+    if layer == "logs" or os.path.islink(layerpath):
+        continue
+    if not os.path.isdir(layerpath):
+        continue
+
+    layername = layer
+    if layer == "openembedded-core":
+        layername = "oecore"
+    getrevs(jsonprops, layerpath, layername)
+    done.append(layername)
+
+for repo in sorted(repos.keys()):
+    if repo in done:
+        continue
+    layerpath = builddir + '/' + repo
+    if not os.path.exists(layerpath):
+        # layer may not be used by the build and hence not moved into final position
+        layerpath = builddir + '/repos/' + repo
+    #if not os.path.exists(layerpath):
+    #    # Repos is specified on the controller but not used in the helper config
+    #    continue
+    getrevs(jsonprops, layerpath, repo)
+
+# We need a way to match builds which are the same in the buildbot UI. Traditionally this was
+# done with an poky revision.
+# Compute a dummy sha1 of the combination of oecore, bitbake and the helper revisions
+buildid = ""
+for repo in ['oecore', 'bitbake', 'yocto-autobuilder-helper']:
+    if 'commit_' + repo in jsonprops:
+        buildid += jsonprops['commit_' + repo]
+buildid = hashlib.sha1(buildid.encode("utf-8")).hexdigest()
+
+jsonprops['yp_build_revision'] = buildid
+
+print(json.dumps(jsonprops, indent=4, sort_keys=True))
 
#2 lore raw
In reply to Richard Purdie
Quoted 1 line · Richard Purdie via lists.yoctoproject.org

+ "EXTRA_IMAGE_FEATURES ?= 'allow-empty-password empty-root-password allow-root-login'"

This should be in its own fragment, and testimage class should check that the features are in place, and print something helpful when they're not. Probably the poky login banner should mention the fragment too, so that people aren't baffled when they expect behavior from the old poky default template, and typing root without password isn't working.

I'll come up with a patchset. :)

Alex

#3 lore raw
Quoted 6 lines · Alexander Kanavin
Quoted 2 lines · Richard Purdie via lists.yoctoproject.org

+            "EXTRA_IMAGE_FEATURES ?= 'allow-empty-password empty- root-password allow-root-login'"

Quoted 8 lines

This should be in its own fragment, and testimage class should check that the features are in place, and print something helpful when they're not. Probably the poky login banner should mention the fragment too, so that people aren't baffled when they expect behavior from the old poky default template, and typing root without password isn't working.

I'll come up with a patchset. :)

I'm not 100% convinced that is the right solution.

a) We've wanted these things explicitly spelt out so the users clearly see "allow root login" for example, not hidden behind some "enable testing" fragment. This was why we removed "debug-tweaks" and I don't really want it to get hidden again for something this serious.

b) perhaps some of the testing should configure the images with a testing key and /or set a root password? It might not work for testimage but it could for oe-selftest for example. Even for testimage, we might want a "qemu" key? A local one could work, just a question of project release image testing artefacts and how to handle those.

Cheers,

Richard

#4 lore raw
Quoted 7 lines · Richard Purdie
Quoted 7 lines

This should be in its own fragment, and testimage class should check that the features are in place, and print something helpful when they're not. Probably the poky login banner should mention the fragment too, so that people aren't baffled when they expect behavior from the old poky default template, and typing root without password isn't working.

Quoted 8 lines
Quoted 1 line

I'll come up with a patchset. :)

I'm not 100% convinced that is the right solution.

a) We've wanted these things explicitly spelt out so the users clearly see "allow root login" for example, not hidden behind some "enable testing" fragment. This was why we removed "debug-tweaks" and I don't really want it to get hidden again for something this serious.

But it would not be hidden. The fragment would be called 'root-login-without-password', and it would always be opt-in, e.g. testimage and login banner would ask that the user run 'enable-fragment root-login-without-password' and explain the implications. This is actually better than poky and oe-core setting the insecure default in local.conf.template without consent.

Quoted 5 lines

b) perhaps some of the testing should configure the images with a testing key and /or set a root password? It might not work for testimage but it could for oe-selftest for example. Even for testimage, we might want a "qemu" key? A local one could work, just a question of project release image testing artefacts and how to handle those.

I agree that we need to implement something even better along these lines, and this is a good moment to figure it out, I'm just worried that in the meantime there is a serious user experience regression with bitbake-setup: testimage and root logins not working, without a clear way that users could fix it. The above fragment proposal could address that.

Alex