pmb: Introduce support for "unmaintained" devices (MR 2018)
Unmaintained devices are device packages that: - Are known to be broken in some way without an active maintainer who can investigate how to fix it, or - Have not received any updates for a very long time, or - Are discouraged from using because they are just intended for testing. An example for this are ports using the downstream kernel for devices which have a mainline port that is working quite well. Unmaintained devices are still built by bpo (otherwise it would not make sense to keep them), but they do not show up in "pmbootstrap init". However, it is possible to manually select them by entering the name. pmbootstrap will warn in that case. Unmaintained packages should have a # Unmaintained: <reason> comment in the APKBUILD, this comment is displayed in "pmbootstrap init" so that the user knows why the device should not be used unless they know what they are doing.
This commit is contained in:
parent
03b3b250a5
commit
7dc2e197d3
|
@ -301,7 +301,8 @@ def ask_for_device(args):
|
|||
if not pmb.helpers.cli.confirm(args, default=True):
|
||||
continue
|
||||
else:
|
||||
devices = sorted(pmb.helpers.devices.list_codenames(args, vendor))
|
||||
# Unmaintained devices can be selected, but are not displayed
|
||||
devices = sorted(pmb.helpers.devices.list_codenames(args, vendor, unmaintained=False))
|
||||
# Remove "vendor-" prefixes from device list
|
||||
codenames = [x.split('-', 1)[1] for x in devices]
|
||||
logging.info("Available codenames (" + str(len(codenames)) + "): " +
|
||||
|
@ -314,7 +315,8 @@ def ask_for_device(args):
|
|||
codenames)
|
||||
|
||||
device = vendor + '-' + codename
|
||||
device_exists = pmb.helpers.devices.find_path(args, device, 'deviceinfo') is not None
|
||||
device_path = pmb.helpers.devices.find_path(args, device, 'deviceinfo')
|
||||
device_exists = device_path is not None
|
||||
if not device_exists:
|
||||
if device == args.device:
|
||||
raise RuntimeError(
|
||||
|
@ -331,6 +333,12 @@ def ask_for_device(args):
|
|||
logging.info("Generating new aports for: {}...".format(device))
|
||||
pmb.aportgen.generate(args, "device-" + device)
|
||||
pmb.aportgen.generate(args, "linux-" + device)
|
||||
elif "/unmaintained/" in device_path:
|
||||
apkbuild = device_path[:-len("deviceinfo")] + 'APKBUILD'
|
||||
unmaintained = pmb.parse._apkbuild.unmaintained(apkbuild)
|
||||
logging.info(f"WARNING: {device} is unmaintained: {unmaintained}")
|
||||
if not pmb.helpers.cli.confirm(args):
|
||||
continue
|
||||
break
|
||||
|
||||
kernel = ask_for_device_kernel(args, device)
|
||||
|
|
|
@ -23,14 +23,17 @@ def find_path(args, codename, file=''):
|
|||
return g[0]
|
||||
|
||||
|
||||
def list_codenames(args, vendor=None):
|
||||
def list_codenames(args, vendor=None, unmaintained=True):
|
||||
"""
|
||||
Get all devices, for which aports are available
|
||||
:param vendor: vendor name to choose devices from, or None for all vendors
|
||||
:param unmaintained: include unmaintained devices
|
||||
:returns: ["first-device", "second-device", ...]
|
||||
"""
|
||||
ret = []
|
||||
for path in glob.glob(args.aports + "/device/*/device-*"):
|
||||
if not unmaintained and '/unmaintained/' in path:
|
||||
continue
|
||||
device = os.path.basename(path).split("-", 1)[1]
|
||||
if (vendor is None) or device.startswith(vendor + '-'):
|
||||
ret.append(device)
|
||||
|
|
|
@ -402,3 +402,17 @@ def maintainers(path):
|
|||
if '' in maintainers:
|
||||
raise RuntimeError("Empty (Co-)Maintainer: tag")
|
||||
return maintainers
|
||||
|
||||
|
||||
def unmaintained(path):
|
||||
"""
|
||||
Return if (and why) an APKBUILD might be unmaintained. This should be
|
||||
defined using a # Unmaintained: <reason> tag in the APKBUILD.
|
||||
|
||||
:param path: full path to the APKBUILD
|
||||
:returns: reason why APKBUILD is unmaintained, or None
|
||||
"""
|
||||
unmaintained = _parse_comment_tags(read_file(path), 'Unmaintained')
|
||||
if not unmaintained:
|
||||
return None
|
||||
return '\n'.join(unmaintained)
|
||||
|
|
|
@ -145,3 +145,9 @@ def test_parse_maintainers(args):
|
|||
]
|
||||
|
||||
assert pmb.parse._apkbuild.maintainers(path) == maintainers
|
||||
|
||||
|
||||
def test_parse_unmaintained(args):
|
||||
path = (f"{pmb_test.const.testdata}/apkbuild"
|
||||
"/APKBUILD.missing-pkgdesc-in-subpackage")
|
||||
assert pmb.parse._apkbuild.unmaintained(path) == "This is broken!"
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# Reference: <https://postmarketos.org/devicepkg>
|
||||
# Unmaintained: This is broken!
|
||||
pkgname="missing-pkgdesc-in-subpackage"
|
||||
arch="noarch"
|
||||
subpackages="$pkgname-subpackage invalid-function:does_not_exist"
|
||||
|
|
Loading…
Reference in New Issue