mirror of
https://gitlab.postmarketos.org/postmarketOS/pmbootstrap.git
synced 2025-07-14 03:49:48 +03:00
pmb.helpers.git: parse channels.cfg (MR 1912)
Prepare to base postmarketOS on Alpine stable by parsing the new channels.cfg file in pmaports.git, that describes which channel needs which branches and mirror dirs from postmarketOS and Alpine. Use the information in pmb.helpers.git.get_branches_official() first, more is coming in follow-up commits. Read the file from origin/master, so we get the latest fetched version even if the last checked out master branch is not up-to-date (think of currently checked out release branch instead of master, master will never be updated to point to latest origin/master). Allow to override the file with a new --config-channels parameter. Related: https://postmarketos.org/channels.cfg
This commit is contained in:
parent
ed16a9d080
commit
c616874443
5 changed files with 102 additions and 5 deletions
|
@ -7,6 +7,7 @@ import shutil
|
|||
import time
|
||||
|
||||
import pmb_test # noqa
|
||||
import pmb_test.const
|
||||
import pmb_test.git
|
||||
import pmb.helpers.git
|
||||
import pmb.helpers.logging
|
||||
|
@ -16,7 +17,8 @@ import pmb.helpers.run
|
|||
@pytest.fixture
|
||||
def args(request):
|
||||
import pmb.parse
|
||||
sys.argv = ["pmbootstrap", "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)
|
||||
|
@ -108,6 +110,19 @@ def test_get_upstream_remote(args, monkeypatch, tmpdir):
|
|||
assert func(args, name_repo) == "hello"
|
||||
|
||||
|
||||
def test_parse_channels_cfg(args):
|
||||
exp = {"meta": {"recommended": "edge"},
|
||||
"channels": {"edge": {"description": "Rolling release channel",
|
||||
"branch_pmaports": "master",
|
||||
"branch_aports": "master",
|
||||
"mirrordir_alpine": "edge"},
|
||||
"stable": {"description": "For workgroups",
|
||||
"branch_pmaports": "v20.05",
|
||||
"branch_aports": "3.11-stable",
|
||||
"mirrordir_alpine": "v3.11"}}}
|
||||
assert pmb.helpers.git.parse_channels_cfg(args) == exp
|
||||
|
||||
|
||||
def test_pull_non_existing(args):
|
||||
assert pmb.helpers.git.pull(args, "non-existing-repo-name") == 1
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue