Skip to contentSkip to conversation

scripts/utils.py: Fix confusing naming of getcomparisonbranch() return value

PATCH In review Steve Sakoman 2 participants 3 messages Apr 23, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 scripts/utils.py: Fix confusing naming of getcomparisonbranch() return value

---
 scripts/utils.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
scripts/utils.py +3 -3
index 68652d9..25eba31 100644
@@ -358,9 +358,9 @@ def getcomparisonbranch(ourconfig, reponame, branchname):
     if (reponame + ":" + branchname) in getconfig("BUILD_HISTORY_FORKPUSH", ourconfig):
         base = getconfig("BUILD_HISTORY_FORKPUSH", ourconfig)[reponame + ":" + branchname]
         if base:
-            baserepo, basebranch = base.split(":")
-            print("Comparing to %s\n" % (basebranch))
-            return branchname, basebranch
+            baserepo, comparebranch = base.split(":")
+            print("Comparing to %s\n" % (comparebranch))
+            return branchname, comparebranch
     if (reponame + ":" + branchname) in getconfig("BUILD_HISTORY_DIRECTPUSH", ourconfig):
         return branchname, None
     return None, None
Signature · 1 line
2.17.1
#1 lore raw

PATCH 2/2 scripts/send-qa-email: fix bug in git push logic for yocto-testresults

We were mistakenly doing a force push if the branch was in either BUILD_HISTORY_FORKPUSH or BUILD_HISTORY_DIRECTPUSH.

Now we force push for branches in BUILD_HISTORY_FORKPUSH, regular push for branches in BUILD_HISTORY_DIRECTPUSH, and no push if the branch is in neither list.

---
 scripts/send-qa-email | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/send-qa-email +2 -2
index 205f6d1..b4d4cec 100755
@@ -80,10 +80,10 @@ if 'poky' in repos and os.path.exists(resulttool) and args.results_dir:
                 extraopts = None
 
         subprocess.check_call([resulttool, "store", args.results_dir, tempdir])
-        if basebranch:
+        if comparebranch:
             subprocess.check_call(["git", "push", "--all", "--force"], cwd=tempdir)
             subprocess.check_call(["git", "push", "--tags", "--force"], cwd=tempdir)
-        else:
+        elif basebranch:
             subprocess.check_call(["git", "push", "--all"], cwd=tempdir)
             subprocess.check_call(["git", "push", "--tags"], cwd=tempdir)
 
Signature · 1 line
2.17.1
#2 lore raw

Re: [yocto] [PATCH yocto-autobuilder-helper 2/2] scripts/send-qa-email: fix bug in git push logic for yocto-testresults

Quoted 19 lines · Steve Sakoman

We were mistakenly doing a force push if the branch was in either BUILD_HISTORY_FORKPUSH or BUILD_HISTORY_DIRECTPUSH.

Now we force push for branches in BUILD_HISTORY_FORKPUSH, regular push for branches in BUILD_HISTORY_DIRECTPUSH, and no push if the branch is in neither list.

---
 scripts/send-qa-email | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/send-qa-email +0 -0
index 205f6d1..b4d4cec 100755
@@ -80,10 +80,10 @@ if 'poky' in repos and os.path.exists(resulttool) and args.results_dir:
                 extraopts = None
 

scripts/send-qa-email if 'poky' in repos and os.path.exists(resulttool) and args.results_dir: · line 89

Quoted 10 lines
scripts/send-qa-email +2 -2
         subprocess.check_call([resulttool, "store", args.results_dir, tempdir])
-        if basebranch:
+        if comparebranch:
             subprocess.check_call(["git", "push", "--all", "--force"], cwd=tempdir)
             subprocess.check_call(["git", "push", "--tags", "--force"], cwd=tempdir)
-        else:
+        elif basebranch:
             subprocess.check_call(["git", "push", "--all"], cwd=tempdir)
             subprocess.check_call(["git", "push", "--tags"], cwd=tempdir)
 

Thanks, well found!

I tweaked the first patch to use comparerepo instead of baserepo. The confusion came from cut and paste from the buildhistory code.

Cheers,

Richard