forked from Mirror/pmbootstrap
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
This commit is contained in:
parent
0c0f05caab
commit
19f8a3b8c8
6 changed files with 77 additions and 58 deletions
|
@ -50,37 +50,33 @@ def test_get_nonfree_packages(args):
|
|||
|
||||
def test_get_recommends(args):
|
||||
args.aports = pmb_test.const.testdata + "/pmb_recommends"
|
||||
func = pmb.install.ui.get_recommends
|
||||
func = pmb.install._install.get_recommends
|
||||
|
||||
# UI: none
|
||||
args.install_recommends = True
|
||||
args.ui = "none"
|
||||
assert func(args) == []
|
||||
assert func(args, ["postmarketos-ui-none"]) == []
|
||||
|
||||
# UI: test, --no-recommends
|
||||
args.install_recommends = False
|
||||
args.ui = "test"
|
||||
assert func(args) == []
|
||||
assert func(args, ["postmarketos-ui-test"]) == []
|
||||
|
||||
# UI: test, without -extras
|
||||
# UI: test
|
||||
args.install_recommends = True
|
||||
assert func(args, ["postmarketos-ui-test"]) == ["plasma-camera",
|
||||
"plasma-angelfish"]
|
||||
|
||||
# UI: test + test-extras
|
||||
args.install_recommends = True
|
||||
assert func(args, ["postmarketos-ui-test",
|
||||
"postmarketos-ui-test-extras"]) == ["plasma-camera",
|
||||
"plasma-angelfish",
|
||||
"buho", "kaidan",
|
||||
"test-app", "foot",
|
||||
"htop"]
|
||||
# Non-UI package
|
||||
args.install_recommends = True
|
||||
args.ui = "test"
|
||||
args.ui_extras = False
|
||||
assert func(args) == ["plasma-camera", "plasma-angelfish"]
|
||||
|
||||
# UI: test, with -extras
|
||||
args.install_recommends = True
|
||||
args.ui = "test"
|
||||
args.ui_extras = True
|
||||
assert func(args) == ["plasma-camera", "plasma-angelfish", "buho",
|
||||
"kaidan"]
|
||||
|
||||
# UI: invalid
|
||||
args.install_recommends = True
|
||||
args.ui = "invalid"
|
||||
with pytest.raises(RuntimeError) as e:
|
||||
func(args)
|
||||
assert str(e.value).startswith("Could not find aport for package")
|
||||
assert func(args, ["test-app"]) == ["foot", "htop"]
|
||||
|
||||
|
||||
def test_get_groups(args):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue