helpers: args: validate arch in sanity_check() (MR 2252)

We did the arch check when building args for some reason. Move it to the
sanity checks.

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
Caleb Connolly 2024-06-05 02:54:11 +02:00 committed by Oliver Smith
parent 1f7e352278
commit 968cf81df4
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
2 changed files with 7 additions and 6 deletions

View file

@ -85,12 +85,6 @@ def check_pmaports_path(args: PmbArgs):
def add_deviceinfo(args: PmbArgs): def add_deviceinfo(args: PmbArgs):
"""Add and verify the deviceinfo (only after initialization)""" """Add and verify the deviceinfo (only after initialization)"""
setattr(args, "deviceinfo", pmb.parse.deviceinfo()) setattr(args, "deviceinfo", pmb.parse.deviceinfo())
arch = args.deviceinfo["arch"]
if (arch != pmb.config.arch_native and
arch not in pmb.config.build_device_architectures):
raise ValueError("Arch '" + arch + "' is not available in"
" postmarketOS. If you would like to add it, see:"
" <https://postmarketos.org/newarch>")
def init(args: PmbArgs) -> PmbArgs: def init(args: PmbArgs) -> PmbArgs:

View file

@ -65,6 +65,13 @@ def sanity_check(info, path):
if "arch" not in info or not info["arch"]: if "arch" not in info or not info["arch"]:
raise RuntimeError(f"Please add 'deviceinfo_arch' to: {path}") raise RuntimeError(f"Please add 'deviceinfo_arch' to: {path}")
arch = info["arch"]
if (arch != pmb.config.arch_native and
arch not in pmb.config.build_device_architectures):
raise ValueError("Arch '" + arch + "' is not available in"
" postmarketOS. If you would like to add it, see:"
" <https://postmarketos.org/newarch>")
# "chassis" validation # "chassis" validation
chassis_type = info["chassis"] chassis_type = info["chassis"]
if chassis_type not in chassis_types: if chassis_type not in chassis_types: