forked from Mirror/pmbootstrap
Rename deviceinfo variable flash_methods to flash_method (#1030)
* Rename deviceinfo variable flash_methods to flash_method * Update pmb.config.deviceinfo_attributes / add sanity check * Add test case that parses all deviceinfo files
This commit is contained in:
parent
d34e8d172e
commit
c6eb56c200
91 changed files with 188 additions and 132 deletions
|
@ -144,7 +144,7 @@ def generate_deviceinfo(args, pkgname, name, manufacturer, arch, has_keyboard,
|
|||
deviceinfo_dev_keyboard=""
|
||||
|
||||
# Bootloader related
|
||||
deviceinfo_flash_methods=\"""" + flash_method + """\"
|
||||
deviceinfo_flash_method=\"""" + flash_method + """\"
|
||||
"""
|
||||
|
||||
content_heimdall_bootimg = """\
|
||||
|
|
|
@ -217,7 +217,7 @@ deviceinfo_attributes = [
|
|||
"modules_initfs",
|
||||
"external_disk",
|
||||
"external_disk_install",
|
||||
"flash_methods",
|
||||
"flash_method",
|
||||
"arch",
|
||||
|
||||
# flash
|
||||
|
|
|
@ -34,7 +34,7 @@ def odin(args, flavor, folder):
|
|||
suffix = "rootfs_" + args.device
|
||||
|
||||
# Validate method
|
||||
method = args.deviceinfo["flash_methods"]
|
||||
method = args.deviceinfo["flash_method"]
|
||||
if not method.startswith("heimdall-"):
|
||||
raise RuntimeError("An odin flashable tar is not supported for the flash"
|
||||
" method '" + method + "' specified in the current configuration."
|
||||
|
|
|
@ -68,7 +68,7 @@ def system(args):
|
|||
" please run 'pmbootstrap install' first.")
|
||||
|
||||
# Do not flash if using fastboot & image is too large
|
||||
method = args.flash_method or args.deviceinfo["flash_methods"]
|
||||
method = args.flash_method or args.deviceinfo["flash_method"]
|
||||
if method == "fastboot" and args.deviceinfo["flash_fastboot_max_size"]:
|
||||
img_size = os.path.getsize(args.work + "/chroot_native" + img_path) / 1024**2
|
||||
max_size = int(args.deviceinfo["flash_fastboot_max_size"])
|
||||
|
@ -86,7 +86,7 @@ def list_devices(args):
|
|||
|
||||
|
||||
def sideload(args):
|
||||
method = args.flash_method or args.deviceinfo["flash_methods"]
|
||||
method = args.flash_method or args.deviceinfo["flash_method"]
|
||||
cfg = pmb.config.flashers[method]
|
||||
|
||||
# Install depends
|
||||
|
@ -112,7 +112,7 @@ def sideload(args):
|
|||
|
||||
def frontend(args):
|
||||
action = args.action_flasher
|
||||
method = args.flash_method or args.deviceinfo["flash_methods"]
|
||||
method = args.flash_method or args.deviceinfo["flash_method"]
|
||||
|
||||
if method == "none" and action in ["boot", "flash_kernel", "flash_system"]:
|
||||
logging.info("This device doesn't support any flash method.")
|
||||
|
|
|
@ -23,7 +23,7 @@ import pmb.helpers.mount
|
|||
|
||||
def init(args):
|
||||
# Validate method
|
||||
method = args.deviceinfo["flash_methods"]
|
||||
method = args.deviceinfo["flash_method"]
|
||||
if method not in pmb.config.flashers:
|
||||
raise RuntimeError("Flash method " + method + " is not supported by the"
|
||||
" current configuration. However, adding a new flash method is "
|
||||
|
|
|
@ -24,7 +24,7 @@ def run(args, action, flavor=None):
|
|||
pmb.flasher.init(args)
|
||||
|
||||
# Verify action
|
||||
method = args.flash_method or args.deviceinfo["flash_methods"]
|
||||
method = args.flash_method or args.deviceinfo["flash_method"]
|
||||
cfg = pmb.config.flashers[method]
|
||||
if action not in cfg["actions"]:
|
||||
raise RuntimeError("action " + action + " is not"
|
||||
|
|
|
@ -236,7 +236,7 @@ def install_system_image(args):
|
|||
logging.info(" Flashes the kernel + initramfs to your device:")
|
||||
logging.info(" " + args.work + "/chroot_rootfs_" + args.device +
|
||||
"/boot")
|
||||
method = args.deviceinfo["flash_methods"]
|
||||
method = args.deviceinfo["flash_method"]
|
||||
if (method in pmb.config.flashers and "boot" in
|
||||
pmb.config.flashers[method]["actions"]):
|
||||
logging.info(" (NOTE: " + method + " also supports booting"
|
||||
|
|
|
@ -30,7 +30,7 @@ def create_zip(args, suffix):
|
|||
zip_root = "/var/lib/postmarketos-android-recovery-installer/"
|
||||
rootfs = "/mnt/rootfs_" + args.device
|
||||
flavor = pmb.helpers.frontend._parse_flavor(args)
|
||||
method = args.deviceinfo["flash_methods"]
|
||||
method = args.deviceinfo["flash_method"]
|
||||
vars = pmb.flasher.variables(args, flavor, method)
|
||||
|
||||
# Install recovery installer package in buildroot
|
||||
|
|
|
@ -60,4 +60,10 @@ def deviceinfo(args, device=None):
|
|||
if key not in ret:
|
||||
ret[key] = ""
|
||||
|
||||
# Sanity check: "flash_methods" is legacy
|
||||
if "flash_methods" in ret:
|
||||
raise RuntimeError("deviceinfo_flash_methods has been renamed to"
|
||||
" deviceinfo_flash_method. Please adjust your"
|
||||
" deviceinfo file: " + path)
|
||||
|
||||
return ret
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue