pmbootstrap init: ask for release channel (MR 1912)

Ask for release channel and switch pmaports branch to the related branch
defined in channels.cfg.

Store in pmbootstrap.cfg whether the user chose a channel (boolean). If
the user did not choose a channel yet, suggest the recommended channel
from channels.cfg (currently "edge").
This commit is contained in:
Oliver Smith 2020-04-09 20:48:21 +02:00
parent 261e8595ad
commit 17f3b3c2f0
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
5 changed files with 132 additions and 1 deletions

View file

@ -16,7 +16,8 @@ import pmb.helpers.logging
@pytest.fixture
def args(tmpdir, request):
import pmb.parse
sys.argv = ["pmbootstrap.py", "init"]
cfg = f"{pmb_test.const.testdata}/channels.cfg"
sys.argv = ["pmbootstrap.py", "--config-channels", cfg, "init"]
args = pmb.parse.arguments()
args.log = args.work + "/log_testsuite.txt"
pmb.helpers.logging.init(args)
@ -287,3 +288,8 @@ def test_questions_hostname(args, monkeypatch):
# Device name: empty string
fake_answers(monkeypatch, [device])
assert func(args, device) == ""
def test_questions_channel(args, monkeypatch):
fake_answers(monkeypatch, ["invalid-channel", "stable"])
assert pmb.config.init.ask_for_channel(args) == "stable"