phase1: satisfy getver.sh requirements v6
authorThibaut VARÈNE <hacks@slashdirt.org>
Tue, 23 May 2023 18:12:09 +0000 (20:12 +0200)
committerPetr Štetiar <ynezz@true.cz>
Tue, 23 May 2023 19:34:21 +0000 (21:34 +0200)
scripts/getver.sh requires upstream branch tracking to correctly compute
revision number. Buildbot Git() step does not set branch tracking as it
checks out individual commits and then reset the target branch to it, so
in order for getver.sh to work, this workaround forcefully sets the
upstream branch.

This fixes malformed version code in filenames as observed on
openwrt-23.05:

r23001+3-38c150612c
instead of:
r23004-7f0db09513

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
phase1/master.cfg

index bbd3734ac491db2292170d0f1d5bdc020fc423a3..4fb28b63ca9ad82bee5ef520a11125ed2b2ccad3 100644 (file)
@@ -744,6 +744,16 @@ for target in targets:
                haltOnFailure = True,
        ))
 
+       # getver.sh requires local branches to track upstream otherwise version computation fails.
+       # Git() does not set tracking branches when cloning or switching, so work around this here
+       factory.addStep(ShellCommand(
+               name = "trackupstream",
+               description = "Setting upstream branch",
+               descriptionDone = "getver.sh is happy now",
+               command = ["git", "branch", "-u", Interpolate("origin/%(prop:branch)s")],
+               haltOnFailure = True,
+       ))
+
        # Verify that Git HEAD points to a tag or branch
        # Ref: https://web.archive.org/web/20190729224316/http://lists.infradead.org/pipermail/openwrt-devel/2019-June/017809.html
        factory.addStep(ShellCommand(