pmb: Warn users about downstream ports

And make the archived port detection more robust while at it.

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2549
This commit is contained in:
Newbyte 2025-05-25 14:21:47 +02:00 committed by Oliver Smith
parent cd672222c4
commit 548a1dfe2e
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB

View file

@ -524,6 +524,8 @@ def ask_for_device(context: Context) -> tuple[str, bool, str]:
device = f"{vendor}-{codename}" device = f"{vendor}-{codename}"
device_path = pmb.helpers.devices.find_path(device, "deviceinfo") device_path = pmb.helpers.devices.find_path(device, "deviceinfo")
if device_path is not None:
device_category = pmb.helpers.devices.get_device_category_by_apkbuild_path(device_path)
if device_path is None: if device_path is None:
if device == context.config.device: if device == context.config.device:
raise RuntimeError( raise RuntimeError(
@ -539,12 +541,18 @@ def ask_for_device(context: Context) -> tuple[str, bool, str]:
logging.info(f"Generating new aports for: {device}...") logging.info(f"Generating new aports for: {device}...")
pmb.aportgen.generate(f"device-{device}", False) pmb.aportgen.generate(f"device-{device}", False)
pmb.aportgen.generate(f"linux-{device}", False) pmb.aportgen.generate(f"linux-{device}", False)
elif any("archived" == x for x in device_path.parts): elif device_category == pmb.helpers.devices.DeviceCategory.ARCHIVED:
apkbuild = device_path.parent / "APKBUILD" apkbuild = device_path.parent / "APKBUILD"
archived = pmb.parse._apkbuild.archived(apkbuild) or "No reason given (this is a bug)" archived = pmb.parse._apkbuild.archived(apkbuild) or "No reason given (this is a bug)"
logging.info(f"WARNING: {device} is archived: {archived}") logging.info(f"WARNING: {device} is archived: {archived}")
if not pmb.helpers.cli.confirm(): if not pmb.helpers.cli.confirm():
continue continue
elif device_category == pmb.helpers.devices.DeviceCategory.DOWNSTREAM:
logging.info(
f"WARNING: {device} is a downstream port! Expect missing and broken features. See https://wiki.postmarketos.org/wiki/Downstream_kernel_specific_package"
)
if not pmb.helpers.cli.confirm():
continue
break break
kernel = ask_for_device_kernel(context.config, device) kernel = ask_for_device_kernel(context.config, device)