pmb.chroot.apk: Use unpacking operator to create command in install_run_apk() (MR 2525)

The unpacking operator can unpack any iterable of any type, unlike the +
operator which only works on some sequences and requires them to be of
the same type usually. Using it allows us to get rid of the line that
disables the "operator" error code for this function.
This commit is contained in:
Newbyte 2025-01-08 16:16:26 +01:00 committed by Oliver Smith
parent c3b7a5f39e
commit 077efe3623
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB

View file

@ -125,8 +125,6 @@ def packages_get_locally_built_apks(package_list: list[str], arch: Arch) -> list
return local return local
# FIXME: list[Sequence[PathString]] weirdness
# mypy: disable-error-code="operator"
def install_run_apk( def install_run_apk(
to_add: list[str], to_add_local: list[Path], to_del: list[str], chroot: Chroot to_add: list[str], to_add_local: list[Path], to_del: list[str], chroot: Chroot
) -> None: ) -> None:
@ -173,12 +171,12 @@ def install_run_apk(
pmb.chroot.init(chroot) pmb.chroot.init(chroot)
# FIXME: use /mnt/pmb… until MR 2351 is reverted (pmb#2388) # FIXME: use /mnt/pmb… until MR 2351 is reverted (pmb#2388)
user_repo = [] user_repo: list[PathString] = []
for channel in pmb.config.pmaports.all_channels(): for channel in pmb.config.pmaports.all_channels():
user_repo += ["--repository", context.config.work / "packages" / channel] user_repo += ["--repository", context.config.work / "packages" / channel]
for i, command in enumerate(commands): for i, command in enumerate(commands):
command = user_repo + command command = [*user_repo, *command]
# Ignore missing repos before initial build (bpo#137) # Ignore missing repos before initial build (bpo#137)
if os.getenv("PMB_APK_FORCE_MISSING_REPOSITORIES") == "1": if os.getenv("PMB_APK_FORCE_MISSING_REPOSITORIES") == "1":