From d7b12d98e67d6eb9b5813cb9e8f15578317e490f Mon Sep 17 00:00:00 2001 From: Anri Dellal Date: Wed, 23 Apr 2025 20:43:36 +0300 Subject: [PATCH] pmb: Rename pmb:gpu-accel and deviceinfo_gpu_accelerated pmb:gpu-accel -> pmb:drm deviceinfo_gpu_accelerated -> deviceinfo_drm Allow deviceinfo_gpu_accelerated as deprecated property Keep pmb:gpu-accel as valid option to avoid failures for older branches of pmaports. Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2591 --- pmb/config/__init__.py | 3 ++- pmb/config/init.py | 9 +++++---- pmb/helpers/lint.py | 2 +- pmb/parse/deviceinfo.py | 4 +++- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/pmb/config/__init__.py b/pmb/config/__init__.py index 6aaf8db0..4ae293b4 100644 --- a/pmb/config/__init__.py +++ b/pmb/config/__init__.py @@ -302,7 +302,8 @@ apkbuild_custom_valid_options = [ "!pmb:kconfigcheck", "pmb:cross-native", "pmb:cross-native2", - "pmb:gpu-accel", + "pmb:drm", + "pmb:gpu-accel", # deprecated "pmb:strict", "pmb:systemd", "pmb:systemd-never", diff --git a/pmb/config/init.py b/pmb/config/init.py index 22196732..f1d0afd0 100644 --- a/pmb/config/init.py +++ b/pmb/config/init.py @@ -229,12 +229,13 @@ def ask_for_channel(config: Config) -> str: def ask_for_ui(deviceinfo: Deviceinfo) -> str: ui_list = pmb.helpers.ui.list_ui(deviceinfo.arch) hidden_ui_count = 0 - device_is_accelerated = deviceinfo.gpu_accelerated == "true" - if not device_is_accelerated: + if not deviceinfo.drm == "true": for i in reversed(range(len(ui_list))): pkgname = f"postmarketos-ui-{ui_list[i][0]}" apkbuild = pmb.helpers.pmaports.get(pkgname, subpackages=False, must_exist=False) - if apkbuild and "pmb:gpu-accel" in apkbuild["options"]: + if apkbuild and ( + "pmb:drm" in apkbuild["options"] or "pmb:gpu-accel" in apkbuild["options"] + ): ui_list.pop(i) hidden_ui_count += 1 @@ -251,7 +252,7 @@ def ask_for_ui(deviceinfo: Deviceinfo) -> str: if hidden_ui_count > 0: logging.info( f"NOTE: {hidden_ui_count} UIs are hidden because" - ' "deviceinfo_gpu_accelerated" is not set (see' + ' "deviceinfo_drm" is not set (see' " https://postmarketos.org/deviceinfo)." ) while True: diff --git a/pmb/helpers/lint.py b/pmb/helpers/lint.py index e339859c..cdbc4eb5 100644 --- a/pmb/helpers/lint.py +++ b/pmb/helpers/lint.py @@ -23,7 +23,7 @@ import pmb.helpers.pmaports def get_custom_valid_options() -> list[str]: """Build a list of custom valid APKBUILD options that apkbuild-lint should not complain about. The list consists of hardcoded options from - pmb.config.apkbuild_custom_valid_options like pmb:gpu-accel, as well as + pmb.config.apkbuild_custom_valid_options like pmb:drm, as well as dynamically generated options from kconfigcheck.toml (pmb:kconfigcheck-libcamera etc.).""" ret = list(pmb.config.apkbuild_custom_valid_options) diff --git a/pmb/parse/deviceinfo.py b/pmb/parse/deviceinfo.py index 75496fb9..fcfeb045 100644 --- a/pmb/parse/deviceinfo.py +++ b/pmb/parse/deviceinfo.py @@ -110,7 +110,7 @@ class Deviceinfo: chassis: str keyboard: str | None = "" # deprecated external_storage: str | None = "" - gpu_accelerated: bool | None = False + drm: bool | None = False dev_touchscreen: str | None = "" dev_touchscreen_calibration: str | None = "" append_dtb: str | None = "" @@ -279,6 +279,8 @@ class Deviceinfo: # logging.warning(f"deviceinfo: {key} is not a known attribute") if key == "arch": setattr(self, key, Arch.from_str(value)) + elif key == "gpu_accelerated": # deprecated + setattr(self, "drm", value) else: setattr(self, key, value)