1
0
Fork 1
mirror of https://gitlab.postmarketos.org/postmarketOS/pmbootstrap.git synced 2025-07-13 11:29:46 +03:00
pmbootstrap/pmb/install/ui.py
Clayton Craft 19f8a3b8c8
pmb.install: support pmb_recommends for any package
This refactors the get_recommends function that was originally used for
UI packages to support pmb_recommends for any package (and subpackage).

Extending pmb_recommends will, for example, help us create better
generic device packages [1] and can be used to improve packaging for UIs
with shared pmb_recommends[2].

1. https://gitlab.com/postmarketOS/pmaports/-/merge_requests/4673
2. https://gitlab.com/postmarketOS/pmaports/-/merge_requests/3700

Reviewed-by: Oliver Smith <ollieparanoid@postmarketos.org>
Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3C20240102074605.23248-2-clayton@craftyguy.net%3E
2024-01-09 16:55:47 +01:00

36 lines
1.1 KiB
Python

# Copyright 2023 Dylan Van Assche
# SPDX-License-Identifier: GPL-3.0-or-later
import logging
import pmb.helpers.pmaports
def get_groups(args):
""" Get all groups to which the user additionally must be added.
The list of groups are listed in _pmb_groups of the UI and
UI-extras package.
:returns: list of groups, e.g. ["feedbackd", "udev"] """
ret = []
if args.ui == "none":
return ret
# UI package
meta = f"postmarketos-ui-{args.ui}"
apkbuild = pmb.helpers.pmaports.get(args, meta)
groups = apkbuild["_pmb_groups"]
if groups:
logging.debug(f"{meta}: install _pmb_groups:"
f" {', '.join(groups)}")
ret += groups
# UI-extras subpackage
meta_extras = f"{meta}-extras"
if args.ui_extras and meta_extras in apkbuild["subpackages"]:
groups = apkbuild["subpackages"][meta_extras]["_pmb_groups"]
if groups:
logging.debug(f"{meta_extras}: install _pmb_groups:"
f" {', '.join(groups)}")
ret += groups
return ret