forked from Mirror/pmbootstrap
Support setting custom mirrors + disabling mirrors (MR 2361)
Allow setting _custom mirrors in the config: * alpine_custom * pmaports_custom * systemd_custom When these are set, they are added to /etc/apk/repositories before real repositories. This is used by bpo to build packages with a WIP repository enabled, in addition to the final repository. All mirrors can also be set to "none" to be disabled. This is important for bootstrapping from pure Alpine without any binary repository, and the bpo testsuite also uses this. I've discussed with Caleb whether to name it _wip instead of _custom, but the latter is more generic and people may also use this for other use cases than the bpo wip repository thing.
This commit is contained in:
parent
7b164acb70
commit
591a737733
2 changed files with 34 additions and 13 deletions
|
@ -83,20 +83,35 @@ def urls(user_repository=False, mirrors_exclude: list[str] = []):
|
|||
for repo in pkgrepo_names() + ["alpine"]:
|
||||
if repo in mirrors_exclude:
|
||||
continue
|
||||
mirror = config.mirrors[repo]
|
||||
mirrordirs = []
|
||||
if repo == "alpine":
|
||||
# FIXME: This is a bit of a mess
|
||||
mirrordirs = [f"{mirrordir_alpine}/main", f"{mirrordir_alpine}/community"]
|
||||
if mirrordir_alpine == "edge":
|
||||
mirrordirs.append(f"{mirrordir_alpine}/testing")
|
||||
else:
|
||||
mirrordirs = [mirrordir_pmos]
|
||||
|
||||
for mirrordir in mirrordirs:
|
||||
url = os.path.join(mirror, mirrordir)
|
||||
if url not in ret:
|
||||
ret.append(url)
|
||||
# Allow adding a custom mirror infront of the real mirror. This is used
|
||||
# in bpo to build with a WIP repository in addition to the final
|
||||
# repository.
|
||||
for suffix in ["_custom", ""]:
|
||||
mirror = config.mirrors[f"{repo}{suffix}"]
|
||||
|
||||
# During bootstrap / bpo testing we run without a pmOS binary repo
|
||||
if mirror.lower() == "none":
|
||||
if suffix != "_custom":
|
||||
logging.warn_once(
|
||||
f"NOTE: Skipping mirrors.{repo} for /etc/apk/repositories (is configured"
|
||||
' as "none")'
|
||||
)
|
||||
continue
|
||||
|
||||
mirrordirs = []
|
||||
if repo == "alpine":
|
||||
# FIXME: This is a bit of a mess
|
||||
mirrordirs = [f"{mirrordir_alpine}/main", f"{mirrordir_alpine}/community"]
|
||||
if mirrordir_alpine == "edge":
|
||||
mirrordirs.append(f"{mirrordir_alpine}/testing")
|
||||
else:
|
||||
mirrordirs = [mirrordir_pmos]
|
||||
|
||||
for mirrordir in mirrordirs:
|
||||
url = os.path.join(mirror, mirrordir)
|
||||
if url not in ret:
|
||||
ret.append(url)
|
||||
|
||||
return ret
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue