mirror of
https://gitlab.com/kupfer/kupferbootstrap.git
synced 2025-02-22 21:25:43 -05:00
devices/{device,deviceinfo}: tolerate device variants that live inside split packages
This commit is contained in:
parent
22bd6193dd
commit
3b7465dccb
2 changed files with 7 additions and 3 deletions
|
@ -128,7 +128,8 @@ def get_device(name: str, pkgbuilds: Optional[dict[str, Pkgbuild]] = None, lazy:
|
|||
if scan_all:
|
||||
devices = get_devices(pkgbuilds=pkgbuilds, lazy=lazy)
|
||||
if name not in devices:
|
||||
raise Exception(f'Unknown device {name}!')
|
||||
raise Exception(f'Unknown device {name}!\n'
|
||||
f'Available: {list(devices.keys())}')
|
||||
return devices[name]
|
||||
else:
|
||||
pkgname = f'device-{name}'
|
||||
|
@ -143,7 +144,8 @@ def get_device(name: str, pkgbuilds: Optional[dict[str, Pkgbuild]] = None, lazy:
|
|||
init_pkgbuilds()
|
||||
relative_path = os.path.join('device', pkgname)
|
||||
if not os.path.exists(os.path.join(config.get_path('pkgbuilds'), relative_path)):
|
||||
raise Exception(f'unknown device "{name}": pkgbuilds/{relative_path} doesn\'t exist.')
|
||||
logging.debug(f'Exact device pkgbuild path "pkgbuilds/{relative_path}" doesn\'t exist, scanning entire repo')
|
||||
return get_device(name, pkgbuilds=pkgbuilds, lazy=lazy, scan_all=True)
|
||||
pkgbuild = [p for p in get_pkgbuild_by_path(relative_path, lazy=lazy, _config=config) if p.name == pkgname][0]
|
||||
device = parse_device_pkg(pkgbuild)
|
||||
if lazy:
|
||||
|
|
|
@ -169,7 +169,9 @@ def _pmos_sanity_check(info: dict[str, str], device_name: str):
|
|||
codename = codename[7:]
|
||||
# kupfer prepends the SoC
|
||||
codename_alternative = codename.split('-', maxsplit=1)[1] if codename.count('-') > 1 else codename
|
||||
if "codename" not in info or (codename != info["codename"] and codename_alternative != info["codename"]):
|
||||
_codename = info.get('codename', None)
|
||||
if not _codename or not (_codename in [codename, codename_alternative] or codename.startswith(_codename) or
|
||||
codename_alternative.startswith(_codename)):
|
||||
raise RuntimeError(f"Please add 'deviceinfo_codename=\"{codename}\"' "
|
||||
f"to: {path}")
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue