Created
August 31, 2017 16:31
-
-
Save ollieparanoid/544b678c5cba007b210957eacaf9b158 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- a/pmb/config/__init__.py | |
+++ b/pmb/config/__init__.py | |
@@ -161,41 +161,44 @@ apkbuild_attributes = { | |
} | |
# Variables from deviceinfo. Reference: <https://postmarketos.org/deviceinfo> | |
-deviceinfo_attributes = [ | |
+# When the value is True, the variable is required. | |
+deviceinfo_attributes = { | |
# device | |
- "format_version", | |
- "name", | |
- "manufacturer", | |
- "date", | |
- "keyboard", | |
- "nonfree", | |
- "dtb", | |
- "modules_initfs", | |
- "external_disk", | |
- "external_disk_install", | |
- "flash_methods", | |
- "arch", | |
+ "dev_keyboard": False, | |
+ "dev_touchscreen": True, | |
+ "format_version": False, | |
+ "name": False, | |
+ "manufacturer": False, | |
+ "date": False, | |
+ "keyboard": False, | |
+ "nonfree": False, | |
+ "dtb": False, | |
+ "modules_initfs": False, | |
+ "external_disk": False, | |
+ "external_disk_install": False, | |
+ "flash_methods": False, | |
+ "arch": False, | |
# flash | |
- "generate_bootimg", | |
- "generate_legacy_uboot_initfs", | |
- "flash_heimdall_partition_initfs", | |
- "flash_heimdall_partition_kernel", | |
- "flash_offset_base", | |
- "flash_offset_kernel", | |
- "flash_offset_ramdisk", | |
- "flash_offset_second", | |
- "flash_offset_tags", | |
- "flash_pagesize", | |
- "flash_sparse", | |
- "kernel_cmdline", | |
+ "generate_bootimg": False, | |
+ "generate_legacy_uboot_initfs": False, | |
+ "flash_heimdall_partition_initfs": False, | |
+ "flash_heimdall_partition_kernel": False, | |
+ "flash_offset_base": False, | |
+ "flash_offset_kernel": False, | |
+ "flash_offset_ramdisk": False, | |
+ "flash_offset_second": False, | |
+ "flash_offset_tags": False, | |
+ "flash_pagesize": False, | |
+ "flash_sparse": False, | |
+ "kernel_cmdline": False, | |
# weston | |
- "weston_pixman_type", | |
+ "weston_pixman_type": False, | |
# keymaps | |
- "keymaps", | |
-] | |
+ "keymaps": False, | |
+} | |
# | |
# INITFS | |
diff --git a/pmb/parse/deviceinfo.py b/pmb/parse/deviceinfo.py | |
index 9b7c379..ec398c8 100644 | |
--- a/pmb/parse/deviceinfo.py | |
+++ b/pmb/parse/deviceinfo.py | |
@@ -50,9 +50,15 @@ def deviceinfo(args, device=None): | |
value = split[1].replace("\"", "").replace("\n", "") | |
ret[key] = value | |
- # Assign empty string as default | |
+ # Required keys check, default to empty string | |
for key in pmb.config.deviceinfo_attributes: | |
if key not in ret: | |
- ret[key] = "" | |
+ if pmb.config.deviceinfo_attributes[key]: | |
+ raise RuntimeError("Missing key 'deviceinfo_" + key + "' in " + | |
+ path + "! Please add it and try again. See" | |
+ " <https://postmarketos.org/deviceinfo> for" | |
+ " reference.") | |
+ else: | |
+ ret[key] = "" | |
return ret |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment