pmbootstrap init: only display UIs for device arch (MR 1937)

Hide user interfaces that are not available for the selected device's
architecture.

Closes #1790
This commit is contained in:
Anjandev Momi 2020-05-14 03:20:11 -07:00 committed by Oliver Smith
parent 2d2ab1df56
commit 0ff9c5d471
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
6 changed files with 55 additions and 7 deletions

View file

@ -5,15 +5,17 @@ import glob
import pmb.parse
def list(args):
def list(args, arch):
"""
Get all UIs, for which aports are available with their description.
:param arch: device architecture, for which the UIs must be available
:returns: [("none", "No graphical..."), ("weston", "Wayland reference...")]
"""
ret = [("none", "No graphical environment")]
for path in sorted(glob.glob(args.aports + "/main/postmarketos-ui-*")):
apkbuild = pmb.parse.apkbuild(args, path + "/APKBUILD")
ui = os.path.basename(path).split("-", 2)[2]
ret.append((ui, apkbuild["pkgdesc"]))
if pmb.helpers.package.check_arch(args, apkbuild["pkgname"], arch):
ret.append((ui, apkbuild["pkgdesc"]))
return ret