1
0
Fork 1
mirror of https://gitlab.postmarketos.org/postmarketOS/pmbootstrap.git synced 2025-07-13 11:29:46 +03:00

flasher: variables: rename vars to fvars (MR 2252)

vars is a reserved keyword in python, use fvars instead.

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
Caleb Connolly 2024-06-08 00:18:15 +02:00 committed by Oliver Smith
parent 852ace63c4
commit b51d31acab
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
3 changed files with 14 additions and 14 deletions

View file

@ -38,10 +38,10 @@ def run(device: str, deviceinfo: Dict[str, str], action, flavor=None):
"Deviceinfo_flash_methods>") "Deviceinfo_flash_methods>")
# Variable setup # Variable setup
vars = pmb.flasher.variables(args, flavor, method) fvars = pmb.flasher.variables(args, flavor, method)
# vbmeta flasher requires vbmeta partition to be explicitly specified # vbmeta flasher requires vbmeta partition to be explicitly specified
if action == "flash_vbmeta" and not vars["$PARTITION_VBMETA"]: if action == "flash_vbmeta" and not fvars["$PARTITION_VBMETA"]:
raise RuntimeError("Your device does not have 'vbmeta' partition" raise RuntimeError("Your device does not have 'vbmeta' partition"
" specified; set" " specified; set"
" 'deviceinfo_flash_fastboot_partition_vbmeta'" " 'deviceinfo_flash_fastboot_partition_vbmeta'"
@ -51,7 +51,7 @@ def run(device: str, deviceinfo: Dict[str, str], action, flavor=None):
"Deviceinfo_reference>") "Deviceinfo_reference>")
# dtbo flasher requires dtbo partition to be explicitly specified # dtbo flasher requires dtbo partition to be explicitly specified
if action == "flash_dtbo" and not vars["$PARTITION_DTBO"]: if action == "flash_dtbo" and not fvars["$PARTITION_DTBO"]:
raise RuntimeError("Your device does not have 'dtbo' partition" raise RuntimeError("Your device does not have 'dtbo' partition"
" specified; set" " specified; set"
" 'deviceinfo_flash_fastboot_partition_dtbo'" " 'deviceinfo_flash_fastboot_partition_dtbo'"
@ -70,7 +70,7 @@ def run(device: str, deviceinfo: Dict[str, str], action, flavor=None):
# Run the commands of each action # Run the commands of each action
for command in cfg["actions"][action]: for command in cfg["actions"][action]:
# Variable replacement # Variable replacement
for key, value in vars.items(): for key, value in fvars.items():
for i in range(len(command)): for i in range(len(command)):
if key in command[i]: if key in command[i]:
if value is None: if value is None:

View file

@ -78,7 +78,7 @@ def variables(args: PmbArgs, flavor, method):
if getattr(args,'resume', False): if getattr(args,'resume', False):
_resume = "--resume" _resume = "--resume"
vars = { fvars = {
"$BOOT": "/mnt/rootfs_" + device + "/boot", "$BOOT": "/mnt/rootfs_" + device + "/boot",
"$DTB": _dtb, "$DTB": _dtb,
"$IMAGE_SPLIT_BOOT": "/home/pmos/rootfs/" + device + "-boot.img", "$IMAGE_SPLIT_BOOT": "/home/pmos/rootfs/" + device + "-boot.img",
@ -104,8 +104,8 @@ def variables(args: PmbArgs, flavor, method):
# Backwards compatibility with old mkinitfs (pma#660) # Backwards compatibility with old mkinitfs (pma#660)
pmaports_cfg = pmb.config.pmaports.read_config() pmaports_cfg = pmb.config.pmaports.read_config()
if pmaports_cfg.get("supported_mkinitfs_without_flavors", False): if pmaports_cfg.get("supported_mkinitfs_without_flavors", False):
vars["$FLAVOR"] = "" fvars["$FLAVOR"] = ""
else: else:
vars["$FLAVOR"] = f"-{flavor}" if flavor is not None else "-" fvars["$FLAVOR"] = f"-{flavor}" if flavor is not None else "-"
return vars return fvars

View file

@ -21,7 +21,7 @@ def create_zip(args: PmbArgs, chroot: Chroot, device: str):
flavor = pmb.helpers.frontend._parse_flavor(device) flavor = pmb.helpers.frontend._parse_flavor(device)
deviceinfo = pmb.parse.deviceinfo() deviceinfo = pmb.parse.deviceinfo()
method = deviceinfo["flash_method"] method = deviceinfo["flash_method"]
vars = pmb.flasher.variables(args, flavor, method) fvars = pmb.flasher.variables(args, flavor, method)
# Install recovery installer package in buildroot # Install recovery installer package in buildroot
pmb.chroot.apk.install(["postmarketos-android-recovery-installer"], pmb.chroot.apk.install(["postmarketos-android-recovery-installer"],
@ -29,18 +29,18 @@ def create_zip(args: PmbArgs, chroot: Chroot, device: str):
logging.info(f"({chroot}) create recovery zip") logging.info(f"({chroot}) create recovery zip")
for key in vars: for key in fvars:
pmb.flasher.check_partition_blacklist(args, deviceinfo, key, vars[key]) pmb.flasher.check_partition_blacklist(args, deviceinfo, key, fvars[key])
# Create config file for the recovery installer # Create config file for the recovery installer
options = { options = {
"DEVICE": device, "DEVICE": device,
"FLASH_KERNEL": args.recovery_flash_kernel, "FLASH_KERNEL": args.recovery_flash_kernel,
"ISOREC": method == "heimdall-isorec", "ISOREC": method == "heimdall-isorec",
"KERNEL_PARTLABEL": vars["$PARTITION_KERNEL"], "KERNEL_PARTLABEL": fvars["$PARTITION_KERNEL"],
"INITFS_PARTLABEL": vars["$PARTITION_INITFS"], "INITFS_PARTLABEL": fvars["$PARTITION_INITFS"],
# Name is still "SYSTEM", not "ROOTFS" in the recovery installer # Name is still "SYSTEM", not "ROOTFS" in the recovery installer
"SYSTEM_PARTLABEL": vars["$PARTITION_ROOTFS"], "SYSTEM_PARTLABEL": fvars["$PARTITION_ROOTFS"],
"INSTALL_PARTITION": args.recovery_install_partition, "INSTALL_PARTITION": args.recovery_install_partition,
"CIPHER": args.cipher, "CIPHER": args.cipher,
"FDE": args.full_disk_encryption, "FDE": args.full_disk_encryption,