pmb.parse.deviceinfo.sanity_check: verify chassis (MR 1933)

This commit is contained in:
Oliver Smith 2020-05-24 08:32:48 +02:00
parent 1356707e9a
commit 0aa1dd7145
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
1 changed files with 14 additions and 0 deletions

View File

@ -50,6 +50,20 @@ def sanity_check(info, path):
raise RuntimeError("Please add 'deviceinfo_codename=\"" + codename +
"\"' to: " + path)
# "chassis" is required
chassis_types = pmb.config.deviceinfo_chassis_types
if "chassis" not in info or not info["chassis"]:
logging.info("NOTE: the most commonly used chassis types in"
" postmarketOS are 'handset' (for phones) and 'tablet'.")
raise RuntimeError(f"Please add 'deviceinfo_chassis' to: {path}")
# "chassis" validation
chassis_type = info["chassis"]
if chassis_type not in chassis_types:
raise RuntimeError(f"Unknown chassis type '{chassis_type}', should"
f" be one of {', '.join(chassis_types)}. Fix this"
f" and try again: {path}")
def deviceinfo(args, device=None):
"""