[autobuilder-helper,thud,01/40] config.json/utils: Allow buildhistory to be configurable and disable for oe-selftest in qemu-arch

Submitted by Richard Purdie on Sept. 10, 2020, 1:29 p.m. | Patch ID: 176323

Details

Message ID 20200910133035.2044355-1-richard.purdie@linuxfoundation.org
State New
Headers show

Commit Message

Richard Purdie Sept. 10, 2020, 1:29 p.m.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 config.json          | 4 +++-
 scripts/run-config   | 2 +-
 scripts/setup-config | 2 +-
 scripts/utils.py     | 6 +++---
 4 files changed, 8 insertions(+), 6 deletions(-)

Patch hide | download patch | download mbox

diff --git a/config.json b/config.json
index 7515cd9..3a0d195 100644
--- a/config.json
+++ b/config.json
@@ -3,7 +3,6 @@ 
     "BASE_SHAREDDIR" : "/srv/autobuilder/autobuilder.yoctoproject.org",
     "BASE_PUBLISHDIR" : "/srv/autobuilder/downloads.yoctoproject.org",
 
-    "build-history-targets" : ["qemuarm64", "qemuarm", "qemuarm-alt", "qemumips64", "qemumips", "qemumips-alt", "qemuppc", "qemuppc-alt", "qemux86-64", "qemux86-64-alt", "qemux86", "qemux86-alt"],
     "BUILD_HISTORY_DIR" : "buildhistory",
     "BUILD_HISTORY_REPO" : "ssh://git@push.yoctoproject.org/poky-buildhistory",
     "BUILD_HISTORY_DIRECTPUSH" : ["poky:morty", "poky:pyro", "poky:rocko", "poky:sumo", "poky:thud", "poky:master"],
@@ -31,6 +30,7 @@ 
         "SSTATEDIR_RELEASE" : ["SSTATE_MIRRORS += 'file://.* file://${BASE_SHAREDDIR}/pub/sstate/PATH'", "SSTATE_DIR ?= '${BASE_PUBLISHDIR}/sstate/@RELEASENUM@'"],
         "SDKEXTRAS" : ["SSTATE_MIRRORS += '\\", "file://.* http://sstate.yoctoproject.org/dev/@RELEASENUM@PATH;downloadfilename=PATH'"],
         "BUILDINFO" : false,
+        "BUILDHISTORY" : false,
         "BUILDINFOVARS" : ["INHERIT += 'image-buildinfo'", "IMAGE_BUILDINFO_VARS_append = ' IMAGE_BASENAME IMAGE_NAME'"],
         "WRITECONFIG" : true,
         "SENDERRORS" : true,
@@ -56,6 +56,7 @@ 
     "templates" : {
         "arch-qemu" : {
             "BUILDINFO" : true,
+            "BUILDHISTORY" : true,
             "step1" : {
                 "BBTARGETS" : "core-image-sato core-image-sato-dev core-image-sato-sdk core-image-minimal core-image-minimal-dev core-image-sato:do_populate_sdk",
                 "SANITYTARGETS" : "core-image-minimal:do_testimage core-image-sato:do_testimage core-image-sato-sdk:do_testimage core-image-sato:do_testsdk"
@@ -69,6 +70,7 @@ 
         "lsb-qemu" : {
             "DISTRO" : "poky-lsb",
             "BUILDINFO" : true,
+            "BUILDHISTORY" : true,
             "step1" : {
                 "BBTARGETS" : "core-image-lsb core-image-lsb-dev core-image-lsb-sdk",
                 "SANITYTARGETS" : "core-image-lsb:do_testimage core-image-lsb-sdk:do_testimage"
diff --git a/scripts/run-config b/scripts/run-config
index f20707e..e56050f 100755
--- a/scripts/run-config
+++ b/scripts/run-config
@@ -151,7 +151,7 @@  def runcmd(cmd, *args, **kwargs):
     except subprocess.CalledProcessError:
         print("ERROR: Command %s failed" % cmd)
 
-bh_path, remoterepo, remotebranch, baseremotebranch = utils.getbuildhistoryconfig(ourconfig, args.builddir, args.target, args.reponame, args.branchname)
+bh_path, remoterepo, remotebranch, baseremotebranch = utils.getbuildhistoryconfig(ourconfig, args.builddir, args.target, args.reponame, args.branchname, stepnum)
 if bh_path:
     runcmd([os.path.join(scriptsdir, "buildhistory-init"), bh_path, remoterepo, remotebranch, baseremotebranch])
 
diff --git a/scripts/setup-config b/scripts/setup-config
index 10383eb..3c8862a 100755
--- a/scripts/setup-config
+++ b/scripts/setup-config
@@ -92,7 +92,7 @@  extravars = utils.getconfiglistfilter("extravars", ourconfig, args.target, stepn
 if extravars:
     variables.extend(extravars)
 
-bh_path, remoterepo, remotebranch, baseremotebranch = utils.getbuildhistoryconfig(ourconfig, args.builddir, args.target, args.reponame, args.branchname)
+bh_path, remoterepo, remotebranch, baseremotebranch = utils.getbuildhistoryconfig(ourconfig, args.builddir, args.target, args.reponame, args.branchname, stepnum)
 if bh_path:
     variables.append('INHERIT += "buildhistory"')
     variables.append('BUILDHISTORY_DIR = "%s"' % bh_path)
diff --git a/scripts/utils.py b/scripts/utils.py
index e1f5628..45d3f93 100644
--- a/scripts/utils.py
+++ b/scripts/utils.py
@@ -194,9 +194,9 @@  def loadconfig():
 #
 # Common function to determine if buildhistory is enabled and what the parameters are
 #
-def getbuildhistoryconfig(ourconfig, builddir, target, reponame, branchname):
-    if contains(["BUILD_HISTORY_DIR", "build-history-targets", "BUILD_HISTORY_REPO"], ourconfig):
-        if target in getconfig("build-history-targets", ourconfig):
+def getbuildhistoryconfig(ourconfig, builddir, target, reponame, branchname, stepnum):
+    if contains(["BUILD_HISTORY_DIR", "BUILD_HISTORY_REPO"], ourconfig):
+        if utils.getconfigvar("BUILDHISTORY", ourconfig, target, stepnum):
             base = None
             if "/" in reponame:
                 reponame = reponame.rsplit("/", 1)[1]