[buildbot] phase1: prepareFactory: use variables instead of list index
LEDE Commits
lede-commits at lists.infradead.org
Mon Jul 24 05:16:34 PDT 2023
ynezz pushed a commit to buildbot.git, annotated tag v8:
https://git.openwrt.org/651a5c2aa158ddb7ad2920851696a75df1f2a86f
commit 651a5c2aa158ddb7ad2920851696a75df1f2a86f
Author: Petr Štetiar <ynezz at true.cz>
AuthorDate: Sun Jun 18 07:32:22 2023 +0200
phase1: prepareFactory: use variables instead of list index
Thus make the code more readable.
Signed-off-by: Petr Štetiar <ynezz at true.cz>
---
phase1/master.cfg | 84 +++++++++++++++++++++++++++----------------------------
1 file changed, 42 insertions(+), 42 deletions(-)
diff --git a/phase1/master.cfg b/phase1/master.cfg
index d443811..3080421 100644
--- a/phase1/master.cfg
+++ b/phase1/master.cfg
@@ -738,7 +738,7 @@ c["builders"].append(
# NB the phase1 build factory assumes workers are single-build only
def prepareFactory(target):
- ts = target.split("/")
+ (target, subtarget) = target.split("/")
factory = BuildFactory()
@@ -938,8 +938,8 @@ def prepareFactory(target):
descriptionDone=".config seeded",
command=Interpolate(
"printf 'CONFIG_TARGET_%(kw:target)s=y\\nCONFIG_TARGET_%(kw:target)s_%(kw:subtarget)s=y\\nCONFIG_SIGNED_PACKAGES=%(kw:usign:#?|y|n)s\\n' >> .config",
- target=ts[0],
- subtarget=ts[1],
+ target=target,
+ subtarget=subtarget,
usign=GetUsignKey,
),
)
@@ -961,7 +961,7 @@ def prepareFactory(target):
description="Checking architecture",
descriptionDone="Architecture validated",
command='grep -sq CONFIG_TARGET_%s=y .config && grep -sq CONFIG_TARGET_SUBTARGET=\\"%s\\" .config'
- % (ts[0], ts[1]),
+ % (target, subtarget),
logEnviron=False,
want_stdout=False,
want_stderr=False,
@@ -1256,8 +1256,8 @@ def prepareFactory(target):
"-p",
Interpolate(
"bin/targets/%(kw:target)s/%(kw:subtarget)s%(prop:libc)s/kmods/%(prop:kernelversion)s",
- target=ts[0],
- subtarget=ts[1],
+ target=target,
+ subtarget=subtarget,
),
],
haltOnFailure=True,
@@ -1277,13 +1277,13 @@ def prepareFactory(target):
"-va",
Interpolate(
"bin/targets/%(kw:target)s/%(kw:subtarget)s%(prop:libc)s/packages/",
- target=ts[0],
- subtarget=ts[1],
+ target=target,
+ subtarget=subtarget,
),
Interpolate(
"bin/targets/%(kw:target)s/%(kw:subtarget)s%(prop:libc)s/kmods/%(prop:kernelversion)s/",
- target=ts[0],
- subtarget=ts[1],
+ target=target,
+ subtarget=subtarget,
),
],
haltOnFailure=True,
@@ -1304,8 +1304,8 @@ def prepareFactory(target):
"CONFIG_SIGNED_PACKAGES=",
Interpolate(
"PACKAGE_SUBDIRS=bin/targets/%(kw:target)s/%(kw:subtarget)s%(prop:libc)s/kmods/%(prop:kernelversion)s/",
- target=ts[0],
- subtarget=ts[1],
+ target=target,
+ subtarget=subtarget,
),
],
env=MakeEnv(),
@@ -1332,8 +1332,8 @@ def prepareFactory(target):
descriptionDone="Files to sign packed",
command=Interpolate(
"find bin/targets/%(kw:target)s/%(kw:subtarget)s%(prop:libc)s/ bin/targets/%(kw:target)s/%(kw:subtarget)s%(prop:libc)s/kmods/ -mindepth 1 -maxdepth 2 -type f -name sha256sums -print0 -or -name Packages -print0 | xargs -0 tar -czf sign.tar.gz",
- target=ts[0],
- subtarget=ts[1],
+ target=target,
+ subtarget=subtarget,
),
haltOnFailure=True,
doStepIf=IsSignEnabled,
@@ -1343,7 +1343,7 @@ def prepareFactory(target):
factory.addStep(
FileUpload(
workersrc="sign.tar.gz",
- masterdest="%s/signing/%s.%s.tar.gz" % (work_dir, ts[0], ts[1]),
+ masterdest="%s/signing/%s.%s.tar.gz" % (work_dir, target, subtarget),
haltOnFailure=True,
doStepIf=IsSignEnabled,
)
@@ -1356,7 +1356,7 @@ def prepareFactory(target):
descriptionDone="Files signed",
command=[
"%s/signall.sh" % (scripts_dir),
- "%s/signing/%s.%s.tar.gz" % (work_dir, ts[0], ts[1]),
+ "%s/signing/%s.%s.tar.gz" % (work_dir, target, subtarget),
Interpolate("%(prop:branch)s"),
],
env={"CONFIG_INI": os.getenv("BUILDMASTER_CONFIG", "./config.ini")},
@@ -1368,7 +1368,7 @@ def prepareFactory(target):
factory.addStep(
FileDownload(
name="dlsigntargz",
- mastersrc="%s/signing/%s.%s.tar.gz" % (work_dir, ts[0], ts[1]),
+ mastersrc="%s/signing/%s.%s.tar.gz" % (work_dir, target, subtarget),
workerdest="sign.tar.gz",
haltOnFailure=True,
doStepIf=IsSignEnabled,
@@ -1396,8 +1396,8 @@ def prepareFactory(target):
"-p",
Interpolate(
"tmp/upload/%(kw:prefix)stargets/%(kw:target)s/%(kw:subtarget)s",
- target=ts[0],
- subtarget=ts[1],
+ target=target,
+ subtarget=subtarget,
prefix=GetVersionPrefix,
),
],
@@ -1435,8 +1435,8 @@ def prepareFactory(target):
"-p",
Interpolate(
"tmp/upload/%(kw:prefix)stargets/%(kw:target)s/%(kw:subtarget)s/kmods/%(prop:kernelversion)s",
- target=ts[0],
- subtarget=ts[1],
+ target=target,
+ subtarget=subtarget,
prefix=GetVersionPrefix,
),
],
@@ -1480,8 +1480,8 @@ def prepareFactory(target):
Interpolate(
"%(kw:url)s/%(kw:prefix)stargets/%(kw:target)s/%(kw:subtarget)s/sha256sums",
url=GetRsyncParams.withArgs("bin", "url"),
- target=ts[0],
- subtarget=ts[1],
+ target=target,
+ subtarget=subtarget,
prefix=GetVersionPrefix,
),
"target-sha256sums",
@@ -1519,8 +1519,8 @@ def prepareFactory(target):
"target-sha256sums",
Interpolate(
"bin/targets/%(kw:target)s/%(kw:subtarget)s%(prop:libc)s/sha256sums",
- target=ts[0],
- subtarget=ts[1],
+ target=target,
+ subtarget=subtarget,
),
"rsynclist",
],
@@ -1548,21 +1548,21 @@ def prepareFactory(target):
"--exclude=/kmods/",
"--files-from=rsynclist",
"--delay-updates",
- "--partial-dir=.~tmp~%s~%s" % (ts[0], ts[1]),
+ "--partial-dir=.~tmp~%s~%s" % (target, subtarget),
]
+ rsync_defopts
+ [
Interpolate("-a%(prop:rsync_ipv4:+4)s"),
Interpolate(
"bin/targets/%(kw:target)s/%(kw:subtarget)s%(prop:libc)s/",
- target=ts[0],
- subtarget=ts[1],
+ target=target,
+ subtarget=subtarget,
),
Interpolate(
"%(kw:url)s/%(kw:prefix)stargets/%(kw:target)s/%(kw:subtarget)s/",
url=GetRsyncParams.withArgs("bin", "url"),
- target=ts[0],
- subtarget=ts[1],
+ target=target,
+ subtarget=subtarget,
prefix=GetVersionPrefix,
),
],
@@ -1590,21 +1590,21 @@ def prepareFactory(target):
"--existing",
"--ignore-existing",
"--delay-updates",
- "--partial-dir=.~tmp~%s~%s" % (ts[0], ts[1]),
+ "--partial-dir=.~tmp~%s~%s" % (target, subtarget),
]
+ rsync_defopts
+ [
Interpolate("-a%(prop:rsync_ipv4:+4)s"),
Interpolate(
"bin/targets/%(kw:target)s/%(kw:subtarget)s%(prop:libc)s/",
- target=ts[0],
- subtarget=ts[1],
+ target=target,
+ subtarget=subtarget,
),
Interpolate(
"%(kw:url)s/%(kw:prefix)stargets/%(kw:target)s/%(kw:subtarget)s/",
url=GetRsyncParams.withArgs("bin", "url"),
- target=ts[0],
- subtarget=ts[1],
+ target=target,
+ subtarget=subtarget,
prefix=GetVersionPrefix,
),
],
@@ -1629,21 +1629,21 @@ def prepareFactory(target):
"../rsync.sh",
"--delete",
"--delay-updates",
- "--partial-dir=.~tmp~%s~%s" % (ts[0], ts[1]),
+ "--partial-dir=.~tmp~%s~%s" % (target, subtarget),
]
+ rsync_defopts
+ [
Interpolate("-a%(prop:rsync_ipv4:+4)s"),
Interpolate(
"bin/targets/%(kw:target)s/%(kw:subtarget)s%(prop:libc)s/kmods/%(prop:kernelversion)s/",
- target=ts[0],
- subtarget=ts[1],
+ target=target,
+ subtarget=subtarget,
),
Interpolate(
"%(kw:url)s/%(kw:prefix)stargets/%(kw:target)s/%(kw:subtarget)s/kmods/%(prop:kernelversion)s/",
url=GetRsyncParams.withArgs("bin", "url"),
- target=ts[0],
- subtarget=ts[1],
+ target=target,
+ subtarget=subtarget,
prefix=GetVersionPrefix,
),
],
@@ -1684,8 +1684,8 @@ def prepareFactory(target):
+ [
Interpolate(
"--partial-dir=.~tmp~%(kw:target)s~%(kw:subtarget)s~%(prop:workername)s",
- target=ts[0],
- subtarget=ts[1],
+ target=target,
+ subtarget=subtarget,
),
Interpolate("-a%(prop:rsync_ipv4:+4)s"),
"dl/",
More information about the lede-commits
mailing list