forked from Mirror/pmbootstrap
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:
parent
852ace63c4
commit
b51d31acab
3 changed files with 14 additions and 14 deletions
|
@ -38,10 +38,10 @@ def run(device: str, deviceinfo: Dict[str, str], action, flavor=None):
|
|||
"Deviceinfo_flash_methods>")
|
||||
|
||||
# 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
|
||||
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"
|
||||
" specified; set"
|
||||
" 'deviceinfo_flash_fastboot_partition_vbmeta'"
|
||||
|
@ -51,7 +51,7 @@ def run(device: str, deviceinfo: Dict[str, str], action, flavor=None):
|
|||
"Deviceinfo_reference>")
|
||||
|
||||
# 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"
|
||||
" specified; set"
|
||||
" '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
|
||||
for command in cfg["actions"][action]:
|
||||
# Variable replacement
|
||||
for key, value in vars.items():
|
||||
for key, value in fvars.items():
|
||||
for i in range(len(command)):
|
||||
if key in command[i]:
|
||||
if value is None:
|
||||
|
|
|
@ -78,7 +78,7 @@ def variables(args: PmbArgs, flavor, method):
|
|||
if getattr(args,'resume', False):
|
||||
_resume = "--resume"
|
||||
|
||||
vars = {
|
||||
fvars = {
|
||||
"$BOOT": "/mnt/rootfs_" + device + "/boot",
|
||||
"$DTB": _dtb,
|
||||
"$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)
|
||||
pmaports_cfg = pmb.config.pmaports.read_config()
|
||||
if pmaports_cfg.get("supported_mkinitfs_without_flavors", False):
|
||||
vars["$FLAVOR"] = ""
|
||||
fvars["$FLAVOR"] = ""
|
||||
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
|
||||
|
|
|
@ -21,7 +21,7 @@ def create_zip(args: PmbArgs, chroot: Chroot, device: str):
|
|||
flavor = pmb.helpers.frontend._parse_flavor(device)
|
||||
deviceinfo = pmb.parse.deviceinfo()
|
||||
method = deviceinfo["flash_method"]
|
||||
vars = pmb.flasher.variables(args, flavor, method)
|
||||
fvars = pmb.flasher.variables(args, flavor, method)
|
||||
|
||||
# Install recovery installer package in buildroot
|
||||
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")
|
||||
|
||||
for key in vars:
|
||||
pmb.flasher.check_partition_blacklist(args, deviceinfo, key, vars[key])
|
||||
for key in fvars:
|
||||
pmb.flasher.check_partition_blacklist(args, deviceinfo, key, fvars[key])
|
||||
|
||||
# Create config file for the recovery installer
|
||||
options = {
|
||||
"DEVICE": device,
|
||||
"FLASH_KERNEL": args.recovery_flash_kernel,
|
||||
"ISOREC": method == "heimdall-isorec",
|
||||
"KERNEL_PARTLABEL": vars["$PARTITION_KERNEL"],
|
||||
"INITFS_PARTLABEL": vars["$PARTITION_INITFS"],
|
||||
"KERNEL_PARTLABEL": fvars["$PARTITION_KERNEL"],
|
||||
"INITFS_PARTLABEL": fvars["$PARTITION_INITFS"],
|
||||
# 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,
|
||||
"CIPHER": args.cipher,
|
||||
"FDE": args.full_disk_encryption,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue