pmb.config: do not prompt for nonfree fw/userland (MR 2255)

This drops the prompt for using non-free firmware in images. The logic
for searching/installing non-free fw subpackages for devices is kept,
and will always be installed. This is to support the many device
packages in pmaports that still have nonfree-firmware subpackages. Going
forward, device packages can list firmware in `depends=` (for required
fw) or `pmb_recommends` (for optional fw).

nonfree-userland wasn't used in pmaports as far as I could find.
This commit is contained in:
Clayton Craft 2024-02-13 10:07:13 -08:00
parent 0bed6a0437
commit aa594b76fa
No known key found for this signature in database
GPG key ID: 4A4CED6D7EDF950A
5 changed files with 19 additions and 107 deletions

View file

@ -108,8 +108,6 @@ def test_questions_device(args, monkeypatch):
# Prepare args
args.aports = pmb_test.const.testdata + "/init_questions_device/aports"
args.device = "lg-mako"
args.nonfree_firmware = True
args.nonfree_userland = False
args.kernel = "downstream"
# Do not generate aports
@ -119,26 +117,25 @@ def test_questions_device(args, monkeypatch):
# Existing device (without non-free components so we have defaults there)
func = pmb.config.init.ask_for_device
nonfree = {"firmware": True, "userland": False}
fake_answers(monkeypatch, ["lg", "mako"])
kernel = args.kernel
assert func(args) == ("lg-mako", True, kernel, nonfree)
assert func(args) == ("lg-mako", True, kernel)
# Non-existing vendor, go back, existing vendor+device
fake_answers(monkeypatch, ["whoops", "n", "lg", "mako"])
assert func(args) == ("lg-mako", True, kernel, nonfree)
assert func(args) == ("lg-mako", True, kernel)
# Existing vendor, new device, go back, existing vendor+device
fake_answers(monkeypatch, ["lg", "nonexistent", "n", "lg", "mako"])
assert func(args) == ("lg-mako", True, kernel, nonfree)
assert func(args) == ("lg-mako", True, kernel)
# New vendor and new device (new port)
fake_answers(monkeypatch, ["new", "y", "device", "y"])
assert func(args) == ("new-device", False, kernel, nonfree)
assert func(args) == ("new-device", False, kernel)
# Existing vendor, new device (new port)
fake_answers(monkeypatch, ["lg", "nonexistent", "y"])
assert func(args) == ("lg-nonexistent", False, kernel, nonfree)
assert func(args) == ("lg-nonexistent", False, kernel)
def test_questions_device_kernel(args, monkeypatch):
@ -161,39 +158,6 @@ def test_questions_device_kernel(args, monkeypatch):
assert func(args, device) == "downstream"
def test_questions_device_nonfree(args, monkeypatch):
# Prepare args
args.aports = pmb_test.const.testdata + "/init_questions_device/aports"
args.nonfree_firmware = False
args.nonfree_userland = False
# APKBUILD with firmware and userland (all yes)
func = pmb.config.init.ask_for_device_nonfree
device = "nonfree-firmware-and-userland"
fake_answers(monkeypatch, ["y", "y"])
nonfree = {"firmware": True, "userland": True}
assert func(args, device) == nonfree
# APKBUILD with firmware and userland (all no)
fake_answers(monkeypatch, ["n", "n"])
nonfree = {"firmware": False, "userland": False}
assert func(args, device) == nonfree
# APKBUILD with firmware only
func = pmb.config.init.ask_for_device_nonfree
device = "nonfree-firmware"
fake_answers(monkeypatch, ["y"])
nonfree = {"firmware": True, "userland": False}
assert func(args, device) == nonfree
# APKBUILD with userland only
func = pmb.config.init.ask_for_device_nonfree
device = "nonfree-userland"
fake_answers(monkeypatch, ["y"])
nonfree = {"firmware": False, "userland": True}
assert func(args, device) == nonfree
def test_questions_flash_methods(args, monkeypatch):
func = pmb.aportgen.device.ask_for_flash_method
fake_answers(monkeypatch, ["invalid_flash_method", "fastboot"])