chroot.apk,apk_static: always disable interactive mode
This fixes an issue when pmb is run on an Alpine/pmOS host and apk.static sees that /etc/apk/interactive is set on the host. It's really annoying to have the build pause so apk can prompt when building chroots, so this uses a flag to apk to disable interactive mode. I can't think of any situations where we would actually want to prompt users when building chroots, by then all user configuration should have been completed via pmb init/config. Reviewed-by: Oliver Smith <ollieparanoid@postmarketos.org> Co-developed-by: Oliver Smith <ollieparanoid@postmarketos.org> Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3C20231110185320.8358-1-clayton@craftyguy.net%3E
This commit is contained in:
parent
6b7a499b9a
commit
28b6106dd3
|
@ -192,6 +192,10 @@ def install_run_apk(args, to_add, to_add_local, to_del, suffix):
|
|||
commands += [["del"] + to_del]
|
||||
|
||||
for (i, command) in enumerate(commands):
|
||||
# --no-interactive is a parameter to `add`, so it must be appended or apk
|
||||
# gets confused
|
||||
command += ["--no-interactive"]
|
||||
|
||||
if args.offline:
|
||||
command = ["--no-network"] + command
|
||||
if i == 0:
|
||||
|
|
|
@ -166,6 +166,10 @@ def init(args):
|
|||
|
||||
|
||||
def run(args, parameters):
|
||||
# --no-interactive is a parameter to `add`, so it must be appended or apk
|
||||
# gets confused
|
||||
parameters += ["--no-interactive"]
|
||||
|
||||
if args.offline:
|
||||
parameters = ["--no-network"] + parameters
|
||||
pmb.helpers.apk.apk_with_progress(
|
||||
|
|
|
@ -111,7 +111,8 @@ def test_install_run_apk(monkeypatch, args):
|
|||
to_add_local = []
|
||||
to_del = []
|
||||
func(args, to_add, to_add_local, to_del, suffix)
|
||||
assert cmds_progress == [["apk", "add", "postmarketos-base", "device-ppp"]]
|
||||
assert cmds_progress == [["apk", "add", "postmarketos-base", "device-ppp",
|
||||
"--no-interactive"]]
|
||||
assert cmds == []
|
||||
|
||||
# Add and delete
|
||||
|
@ -120,8 +121,10 @@ def test_install_run_apk(monkeypatch, args):
|
|||
to_add_local = []
|
||||
to_del = ["osk-sdl"]
|
||||
func(args, to_add, to_add_local, to_del, suffix)
|
||||
assert cmds_progress == [["apk", "add", "postmarketos-base", "device-ppp"]]
|
||||
assert cmds == [["apk", "--no-progress", "del", "osk-sdl"]]
|
||||
assert cmds_progress == [["apk", "add", "postmarketos-base", "device-ppp",
|
||||
"--no-interactive"]]
|
||||
assert cmds == [["apk", "--no-progress", "del", "osk-sdl",
|
||||
"--no-interactive"]]
|
||||
|
||||
# Add with local package
|
||||
reset_cmds()
|
||||
|
@ -129,10 +132,12 @@ def test_install_run_apk(monkeypatch, args):
|
|||
to_add_local = ["/tmp/device-ppp.apk"]
|
||||
to_del = []
|
||||
func(args, to_add, to_add_local, to_del, suffix)
|
||||
assert cmds_progress == [["apk", "add", "postmarketos-base", "device-ppp"]]
|
||||
assert cmds_progress == [["apk", "add", "postmarketos-base", "device-ppp",
|
||||
"--no-interactive"]]
|
||||
assert cmds == [["apk", "--no-progress", "add", "-u", "--virtual",
|
||||
".pmbootstrap", "/tmp/device-ppp.apk"],
|
||||
["apk", "--no-progress", "del", ".pmbootstrap"]]
|
||||
".pmbootstrap", "/tmp/device-ppp.apk", "--no-interactive"],
|
||||
["apk", "--no-progress", "del", ".pmbootstrap",
|
||||
"--no-interactive"]]
|
||||
|
||||
# Add with --no-network
|
||||
reset_cmds()
|
||||
|
@ -141,7 +146,8 @@ def test_install_run_apk(monkeypatch, args):
|
|||
to_add_local = []
|
||||
to_del = []
|
||||
func(args, to_add, to_add_local, to_del, suffix)
|
||||
assert cmds_progress == [["apk", "--no-network", "add", "hello-world"]]
|
||||
assert cmds_progress == [["apk", "--no-network", "add", "hello-world",
|
||||
"--no-interactive"]]
|
||||
assert cmds == []
|
||||
|
||||
# Package name starting with '-'
|
||||
|
|
Loading…
Reference in New Issue