pmbootstrap install: support _pmb_groups (MR 2010)

This commit is contained in:
Dylan Van Assche 2021-01-24 10:03:51 +01:00 committed by Alexey Min
parent e357ee885e
commit dd61d57b0e
No known key found for this signature in database
GPG key ID: 0B19D2A65870B448
5 changed files with 73 additions and 1 deletions

View file

@ -35,3 +35,32 @@ def get_recommends(args):
return ret
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