osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40946?usp=email )
Change subject: testenv: check value of --distro early ......................................................................
testenv: check value of --distro early
Make sure that the value for --distro is supported early on, instead of only checking it if --binary-repo is set while trying to add the binary repository.
Change-Id: I37493f26d71e70a19f4a19b3bbda972c03c84905 --- M _testenv/testenv/__init__.py M _testenv/testenv/podman.py 2 files changed, 10 insertions(+), 7 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/46/40946/1
diff --git a/_testenv/testenv/__init__.py b/_testenv/testenv/__init__.py index 3a92ff0..f0d6629 100644 --- a/_testenv/testenv/__init__.py +++ b/_testenv/testenv/__init__.py @@ -21,6 +21,12 @@
log_prefix = "[testenv]"
+# Mapping of supported distros (docker/podman image names) and repository dirs +# from the binary repository +distros_repodirs = { + "debian:bookworm": "Debian_12", +} +
def resolve_testsuite_name_alias(name): mapping = { @@ -252,6 +258,9 @@ if args.distro and not args.podman: raise NoTraceException("--distro requires --podman")
+ if args.distro and args.distro not in distros_repodirs: + raise NoTraceException(f"--distro must be one of {', '.join(distros_repodirs)}") + if args.kernel == "debian" and not args.podman: raise NoTraceException("--kernel-debian requires --podman")
diff --git a/_testenv/testenv/podman.py b/_testenv/testenv/podman.py index 8ce6766..bc45b3a 100644 --- a/_testenv/testenv/podman.py +++ b/_testenv/testenv/podman.py @@ -300,18 +300,12 @@ sys.exit(1)
-def distro_to_repo_dir(distro): - if distro == "debian:bookworm": - return "Debian_12" - raise RuntimeError(f"Can't translate distro {distro} to repo_dir!") - - def enable_binary_repo(): config = "deb [signed-by=/obs.key]" config += " https://downloads.osmocom.org/packages/" config += testenv.args.binary_repo.replace(":", ":/") config += "/" - config += distro_to_repo_dir(distro) + config += testenv.distros_repodirs[distro] config += "/ ./"
path = "/etc/apt/sources.list.d/osmocom.list"