1
0
Fork 1
mirror of https://gitlab.postmarketos.org/postmarketOS/pmbootstrap.git synced 2025-07-12 19:09:56 +03:00

pmb.aportgen: Match aportgen prefixes explicitly

Instead of using getattr with an arbitrary prefix, just match the couple
of cases explicitly.

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2610
This commit is contained in:
Luca Weiss 2025-05-23 11:45:25 +02:00 committed by Newbyte
parent f1a6f0034b
commit ed57b3dac3
No known key found for this signature in database
GPG key ID: ACD854892B38D898

View file

@ -90,9 +90,21 @@ def generate(pkgname: str, fork_alpine: bool, fork_alpine_retain_branch: bool =
pkgname, replace_simple={"# Contributor:*": None, "# Maintainer:*": None}
)
else:
# Run pmb.aportgen.PREFIX.generate()
# FIXME: this is really bad and hacky let's not do this please
getattr(pmb.aportgen, prefix.replace("-", "_")).generate(pkgname)
match prefix:
case "busybox-static":
pmb.aportgen.busybox_static.generate(pkgname)
case "device":
pmb.aportgen.device.generate(pkgname)
case "gcc":
pmb.aportgen.gcc.generate(pkgname)
case "grub-efi":
pmb.aportgen.grub_efi.generate(pkgname)
case "linux":
pmb.aportgen.linux.generate(pkgname)
case "musl":
pmb.aportgen.musl.generate(pkgname)
case _:
raise ValueError(f"Unexpected prefix {prefix}")
# Move to the aports folder
if os.path.exists(path_target):