pmb: Only disable metadata_csum for ext4 on downstream ports

No need to worsen filesystem reliability for mainline devices that don't
need this workaround.

Closes https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/issues/2557

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2616
This commit is contained in:
Newbyte 2025-06-03 12:51:45 +02:00 committed by Oliver Smith
parent 7035c0239d
commit 89a80265de
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
2 changed files with 37 additions and 4 deletions

View file

@ -9,6 +9,7 @@ from pathlib import Path
import pmb.config
from pmb.core.pkgrepo import pkgrepo_glob_one, pkgrepo_iglob
from pmb.helpers import logging
import pmb.helpers.pmaports
def find_path(codename: str, file: str = "") -> Path | None:
@ -164,3 +165,26 @@ def get_device_category_by_apkbuild_path(apkbuild_path: Path) -> DeviceCategory:
raise RuntimeError(f'Unknown device category "{category_str}"') from exception
return device_category
def get_device_category_by_directory_path(device_directory: Path) -> DeviceCategory:
"""Get the category of a device based on the path to its directory inside of pmaports.
:device_directory: Path to the device package directory for a particular device.
:returns: The device category of the provided device directory.
"""
device_apkbuild_path = device_directory / "APKBUILD"
return get_device_category_by_apkbuild_path(device_apkbuild_path)
def get_device_category_by_name(device_name: str) -> DeviceCategory:
"""Get the category of a device based on its name.
:device_name: Name of a particular device to determine the category of.
Format should be "vendor-codename".
:returns: The device category of the provided device name.
"""
device_directory = pmb.helpers.pmaports.find(f"device-{device_name}")
return get_device_category_by_directory_path(device_directory)