ci: simplify local usage of generate_build_jobs
There's no need why we can't have a default value Signed-off-by: Pablo Correa Gómez <pabloyoyoista@postmarketos.org> Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7725>
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
# Copyright 2025 Pablo Correa Gomez
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
import argparse
|
||||
from functools import cached_property
|
||||
from pathlib import Path
|
||||
from typing import Self
|
||||
@@ -148,13 +149,12 @@ class ArchTagSet(set):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Needs input to output if we should create the jobs
|
||||
if len(sys.argv) != 3:
|
||||
print("usage: generate_build_jobs.py TEMPLATE CHILD_PIPELINE")
|
||||
print(sys.argv)
|
||||
sys.exit(1)
|
||||
template = sys.argv[1]
|
||||
child_pipeline = sys.argv[2]
|
||||
parser = argparse.ArgumentParser(
|
||||
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
|
||||
)
|
||||
parser.add_argument("--template", default=".ci/build-jobs.yaml.j2", help="Jinja2 input template")
|
||||
parser.add_argument("--output", default=".ci/build-jobs.yaml", help="output pipeline")
|
||||
args = parser.parse_args()
|
||||
|
||||
# pmb logging has to be initialized for later pmb commands to work, setting
|
||||
# to /dev/null since we don't care about the output. Later this could
|
||||
@@ -164,7 +164,7 @@ if __name__ == "__main__":
|
||||
|
||||
# Load context
|
||||
sys.argv = ["pmbootstrap.py", "chroot"]
|
||||
args = pmb.parse.arguments()
|
||||
_ = pmb.parse.arguments()
|
||||
|
||||
# Get the list of supported devices
|
||||
supported_devices = Device.supported_devices()
|
||||
@@ -208,7 +208,7 @@ if __name__ == "__main__":
|
||||
print(f"Architectures to build: {archs}")
|
||||
print(f"Devices under test: {devices_under_test}")
|
||||
|
||||
with open(template) as f:
|
||||
with open(args.template) as f:
|
||||
rendered = Template(f.read()).render(
|
||||
archs=archs,
|
||||
devices_under_test=devices_under_test,
|
||||
@@ -224,5 +224,5 @@ if __name__ == "__main__":
|
||||
Arch.loongarch64: "loongarch64",
|
||||
},
|
||||
)
|
||||
with open(child_pipeline, "w") as fw:
|
||||
with open(args.output, "w") as fw:
|
||||
fw.write(rendered)
|
||||
|
||||
Reference in New Issue
Block a user