diff mbox series

[yocto-autobuilder-helper,1/3] scripts/utils.py: replace BUILD_HISTORY_DIRECTPUSH with hardcoded condition

Message ID 20230626080600.17359-2-alexis.lothore@bootlin.com
State New
Headers show
Series replace BUILD_HISTORY_DIRECTPUSH with hardcoded condition | expand

Commit Message

Alexis Lothoré June 26, 2023, 8:05 a.m. UTC
From: Alexis Lothoré <alexis.lothore@bootlin.com>

It has been observed that when a new release branch is created, it is quite
easy to forget to update the BUILD_HISTORY_DIRECTPUSH variable, which leads
to failures in autobuilder like test results not being pushed.
Replace the BUILD_HISTORY_DIRECTPUSH usage with a hardcoded condition which
validates any branch in poky representing a "main" branch, i.e all branches
not ending in "-next"

Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
---
 scripts/utils.py | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/scripts/utils.py b/scripts/utils.py
index 444b3ab55092..36b3e81bfc94 100644
--- a/scripts/utils.py
+++ b/scripts/utils.py
@@ -19,6 +19,15 @@  import fnmatch
 import glob
 import fcntl
 
+
+def is_a_main_branch(reponame, branchname):
+    """
+    Checks if target repo/branch combo represent a main branch. This
+    includes master and release branches in poky, while excluding "next"
+    branches
+    """
+    return reponame == "poky" and not branchname.endswith("-next")
+
 #
 # Check if config contains all the listed params
 #
@@ -212,7 +221,7 @@  def getbuildhistoryconfig(ourconfig, builddir, target, reponame, branchname, ste
                 reponame = reponame.rsplit("/", 1)[1]
             if reponame.endswith(".git"):
                 reponame = reponame[:-4]
-            if (reponame + ":" + branchname) in getconfig("BUILD_HISTORY_DIRECTPUSH", ourconfig):
+            if is_a_main_branch(reponame, branchname):
                 base = reponame + ":" + branchname
             if (reponame + ":" + branchname) in getconfig("BUILD_HISTORY_FORKPUSH", ourconfig):
                 base = getconfig("BUILD_HISTORY_FORKPUSH", ourconfig)[reponame + ":" + branchname]
@@ -392,7 +401,7 @@  def getcomparisonbranch(ourconfig, reponame, branchname):
             comparerepo, comparebranch = base.split(":")
             print("Comparing to %s\n" % (comparebranch))
             return branchname, comparebranch
-    if (reponame + ":" + branchname) in getconfig("BUILD_HISTORY_DIRECTPUSH", ourconfig):
+    if is_a_main_branch(reponame, branchname):
         return branchname, None
     return None, None