Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix phase2 failures and improve QA #26

Merged
merged 7 commits into from
Apr 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[flake8]
max-line-length = 140
per-file-ignores =
phase2/master.cfg: E101,E117,E128,E201,E202,E203,E221,E225,E251,E266,E302,E305,E501,W191
3 changes: 3 additions & 0 deletions .github/workflows/build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ jobs:
- name: Lint with ruff
run: ruff phase*/master.cfg

- name: Lint with flake8
run: flake8 phase*/master.cfg

- name: Stylecheck with black
run: black phase1/master.cfg

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ phase[12]/twistd.*
!.ruff.toml
!tests
!tests/**/*
!.flake8
44 changes: 31 additions & 13 deletions phase1/master.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ pb_port = inip1.get("port") or 9989
# a shorter alias to save typing.
c = BuildmasterConfig = {}

####### PROJECT IDENTITY
# PROJECT IDENTITY

# the 'title' string will appear at the top of this buildbot
# installation's html.WebStatus home page (linked to the
Expand All @@ -124,7 +124,7 @@ c["titleURL"] = ini["general"].get("title_url")

c["buildbotURL"] = inip1.get("buildbot_url")

####### BUILDWORKERS
# BUILDWORKERS

# The 'workers' list defines the set of recognized buildworkers. Each element is
# a Worker object, specifying a unique worker name and password. The same
Expand Down Expand Up @@ -266,7 +266,8 @@ def prioritizeBuilders(master, builders):
pos = 99
for name, prio in bldrNamePrio.items():
if bldr.name.startswith(name):
pos = prio + 50 - min(hiprio, 50) # higher priority (larger positive number) raises position
# higher priority (larger positive number) raises position
pos = prio + 50 - min(hiprio, 50)
break

# pos order: janitor/local (0), tag builds if any [1..50], !tag builds [51...]
Expand All @@ -292,7 +293,7 @@ def prioritizeBuilders(master, builders):

c["prioritizeBuilders"] = prioritizeBuilders

####### CHANGESOURCES
# CHANGESOURCES

# find targets
targets = dict()
Expand Down Expand Up @@ -358,7 +359,7 @@ c["change_source"].append(
)
)

####### SCHEDULERS
# SCHEDULERS

# Configure the Schedulers, which decide how to react to incoming changes.

Expand Down Expand Up @@ -541,7 +542,7 @@ c["schedulers"].append(
schedulers.Triggerable(name="trigger", builderNames=builderNames, priority=20)
)

####### BUILDERS
# BUILDERS

# The 'builders' list defines the Builders, which tell Buildbot how to perform a build:
# what steps, and which workers can execute them. Note that any particular build will
Expand Down Expand Up @@ -882,7 +883,11 @@ def prepareFactory(target):
name="gitverify",
description="Ensuring that Git HEAD is pointing to a branch or tag",
descriptionDone="Git HEAD is sane",
command='git rev-parse --abbrev-ref HEAD | grep -vxqF HEAD || git show-ref --tags --dereference 2>/dev/null | sed -ne "/^$(git rev-parse HEAD) / { s|^.*/||; s|\\^.*||; p }" | grep -qE "^v[0-9][0-9]\\."',
command=(
"git rev-parse --abbrev-ref HEAD | grep -vxqF HEAD || "
"git show-ref --tags --dereference 2>/dev/null | sed -ne "
'"/^$(git rev-parse HEAD) / { s|^.*/||; s|\\^.*||; p }" | grep -qE "^v[0-9][0-9]\\."'
),
haltOnFailure=True,
)
)
Expand Down Expand Up @@ -944,7 +949,9 @@ def prepareFactory(target):
name="newconfig",
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",
"printf 'CONFIG_TARGET_%(kw:target)s=y\\n"
"CONFIG_TARGET_%(kw:target)s_%(kw:subtarget)s=y\\n"
"CONFIG_SIGNED_PACKAGES=%(kw:usign:#?|y|n)s\\n' >> .config",
target=target,
subtarget=subtarget,
usign=GetUsignKey,
Expand Down Expand Up @@ -1145,7 +1152,11 @@ def prepareFactory(target):
name="kernelversion",
property="kernelversion",
description="Finding the effective Kernel version",
command="make --no-print-directory -C target/linux/ val.LINUX_VERSION val.LINUX_RELEASE val.LINUX_VERMAGIC | xargs printf '%s-%s-%s\\n'",
command=(
"make --no-print-directory -C target/linux/ "
"val.LINUX_VERSION val.LINUX_RELEASE val.LINUX_VERMAGIC | "
"xargs printf '%s-%s-%s\\n'"
),
env={"TOPDIR": Interpolate("%(prop:builddir)s/build")},
)
)
Expand Down Expand Up @@ -1341,7 +1352,10 @@ def prepareFactory(target):
description="Packing files to sign",
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",
"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=target,
subtarget=subtarget,
),
Expand Down Expand Up @@ -1674,7 +1688,11 @@ def prepareFactory(target):
name="sourcelist",
description="Finding source archives to upload",
descriptionDone="Source archives to upload found",
command="find dl/ -maxdepth 1 -type f -not -size 0 -not -name '.*' -not -name '*.hash' -not -name '*.dl' -newer .config -printf '%f\\n' > sourcelist",
command=(
"find dl/ -maxdepth 1 -type f -not -size 0 "
"-not -name '.*' -not -name '*.hash' -not -name "
"'*.dl' -newer .config -printf '%f\\n' > sourcelist"
),
haltOnFailure=True,
)
)
Expand Down Expand Up @@ -1775,7 +1793,7 @@ for brname in branchNames:
)


####### STATUS TARGETS
# STATUS TARGETS

# 'status' is a list of Status Targets. The results of each build will be
# pushed to these targets. buildbot/status/*.py has a variety to choose from,
Expand Down Expand Up @@ -1826,7 +1844,7 @@ c["revlink"] = util.RevlinkMatch(
r"https://git.openwrt.org/?p=openwrt/\1.git;a=commit;h=%s",
)

####### DB URL
# DB URL

c["db"] = {
# This specifies what database buildbot uses to store its state. You can leave
Expand Down
19 changes: 11 additions & 8 deletions phase2/master.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def IsArchitectureSelected(target):
def CheckArchitectureProperty(step):
try:
options = step.getProperty("options")
if type(options) is dict:
if isinstance(options, dict):
selected_arch = options.get("architecture", "all")
if selected_arch != "all" and selected_arch != target:
return False
Expand Down Expand Up @@ -572,7 +572,10 @@ for arch in arches:
description = "Calculating checksums",
descriptionDone="Checksums calculated",
workdir = "build/sdk",
command = "cd bin/packages/%s; " %(arch[0]) + "find . -type f -not -name 'sha256sums' -printf \"%P\n\" | sort | xargs -r ../../../staging_dir/host/bin/mkhash -n sha256 | sed -ne 's!^\(.*\) \(.*\)$!\1 *\2!p' > sha256sums)",
command = "cd bin/packages/%s; " %(arch[0])
+ "find . -type f -not -name 'sha256sums' -printf \"%P\n\" | "
+ "sort | xargs -r ../../../staging_dir/host/bin/mkhash -n sha256 | "
+ r"sed -ne 's!^\(.*\) \(.*\)$!\1 *\2!p' > sha256sums",
haltOnFailure = True
))

Expand Down Expand Up @@ -641,7 +644,7 @@ for arch in arches:

factory.addStep(FileDownload(
name = "dlsha2rsyncpl",
mastersrc = "sha2rsync.pl",
mastersrc = scripts_dir + "/sha2rsync.pl",
workerdest = "../sha2rsync.pl",
mode = 0o755,
))
Expand All @@ -650,7 +653,7 @@ for arch in arches:
name = "buildlist",
description = "Building list of files to upload",
workdir = "build/sdk",
command = ["../../../sha2rsync.pl", "../../arch-sha256sums", "bin/packages/%s/sha256sums" %(arch[0]), "rsynclist"],
command = ["../../sha2rsync.pl", "../arch-sha256sums", "bin/packages/%s/sha256sums" %(arch[0]), "rsynclist"],
haltOnFailure = True,
))

Expand All @@ -668,7 +671,7 @@ for arch in arches:
name = "packageupload",
description = "Uploading package files",
workdir = "build/sdk",
command = ["../../../rsync.sh"] + rsync_defopts + ["--files-from=rsynclist", "--delay-updates", "--partial-dir=.~tmp~%s" %(arch[0]), "-a", "bin/packages/%s/" %(arch[0]), Interpolate("%(kw:rsyncbinurl)s/packages%(kw:suffix)s/%(kw:archname)s/", rsyncbinurl=rsync_bin_url, suffix=GetDirectorySuffix, archname=arch[0])],
command = ["../../rsync.sh"] + rsync_defopts + ["--files-from=rsynclist", "--delay-updates", "--partial-dir=.~tmp~%s" %(arch[0]), "-a", "bin/packages/%s/" %(arch[0]), Interpolate("%(kw:rsyncbinurl)s/packages%(kw:suffix)s/%(kw:archname)s/", rsyncbinurl=rsync_bin_url, suffix=GetDirectorySuffix, archname=arch[0])],
env={'RSYNC_PASSWORD': rsync_bin_key},
haltOnFailure = True,
logEnviron = False
Expand All @@ -678,7 +681,7 @@ for arch in arches:
name = "packageprune",
description = "Pruning package files",
workdir = "build/sdk",
command = ["../../../rsync.sh"] + rsync_defopts + ["--delete", "--existing", "--ignore-existing", "--delay-updates", "--partial-dir=.~tmp~%s" %(arch[0]), "-a", "bin/packages/%s/" %(arch[0]), Interpolate("%(kw:rsyncbinurl)s/packages%(kw:suffix)s/%(kw:archname)s/", rsyncbinurl=rsync_bin_url, suffix=GetDirectorySuffix, archname=arch[0])],
command = ["../../rsync.sh"] + rsync_defopts + ["--delete", "--existing", "--ignore-existing", "--delay-updates", "--partial-dir=.~tmp~%s" %(arch[0]), "-a", "bin/packages/%s/" %(arch[0]), Interpolate("%(kw:rsyncbinurl)s/packages%(kw:suffix)s/%(kw:archname)s/", rsyncbinurl=rsync_bin_url, suffix=GetDirectorySuffix, archname=arch[0])],
env={'RSYNC_PASSWORD': rsync_bin_key},
haltOnFailure = True,
logEnviron = False
Expand Down Expand Up @@ -718,7 +721,7 @@ for arch in arches:
name = "logupload",
description = "Uploading failure logs",
workdir = "build/sdk",
command = ["../../../rsync.sh"] + rsync_defopts + ["--delete", "--delay-updates", "--partial-dir=.~tmp~%s" %(arch[0]), "-az", "faillogs/", Interpolate("%(kw:rsyncbinurl)s/faillogs%(kw:suffix)s/%(kw:archname)s/", rsyncbinurl=rsync_bin_url, suffix=GetDirectorySuffix, archname=arch[0])],
command = ["../../rsync.sh"] + rsync_defopts + ["--delete", "--delay-updates", "--partial-dir=.~tmp~%s" %(arch[0]), "-az", "faillogs/", Interpolate("%(kw:rsyncbinurl)s/faillogs%(kw:suffix)s/%(kw:archname)s/", rsyncbinurl=rsync_bin_url, suffix=GetDirectorySuffix, archname=arch[0])],
env={'RSYNC_PASSWORD': rsync_bin_key},
haltOnFailure = False,
flunkOnFailure = False,
Expand All @@ -739,7 +742,7 @@ for arch in arches:
name = "sourceupload",
description = "Uploading source archives",
workdir = "build/sdk",
command = ["../../../rsync.sh"] + rsync_defopts + ["--files-from=sourcelist", "--size-only", "--delay-updates",
command = ["../../rsync.sh"] + rsync_defopts + ["--files-from=sourcelist", "--size-only", "--delay-updates",
Interpolate("--partial-dir=.~tmp~%(kw:archname)s~%(prop:workername)s", archname=arch[0]), "-a", "dl/", "%s/" %(rsync_src_url)],
env={'RSYNC_PASSWORD': rsync_src_key},
haltOnFailure = False,
Expand Down
5 changes: 3 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
cram==0.7
black==23.3.0
ruff==0.0.267
black==23.12.1
ruff==0.1.9
flake8==6.1.0