forked from Mirror/pmbootstrap
init: systemd: fix always switching pma to edge
Fix that pmbootstrap doesn't recognize v25.06 with systemd enabled as valid channel and suggests switching to edge. This happens because pmb.config.pmaports.read_config() unconditionally prepends "systemd-" before the channel name if systemd is enabled, even though the init code doesn't expect this. The result is when running 'yes "" | pmbootstrap init' (as we do in BPO and CI), pmbootstrap attempts to replace the correctly checked out v25.06 branch with edge: Fix for: [20:36:37] Available (12): [20:36:37] * edge: Rolling release / Most devices / Occasional breakage: https://postmarketos.org/edge [20:36:37] * v25.06: Upcoming stable release (DO NOT USE) [20:36:37] * v24.12: Latest release / Recommended for best stability [20:36:37] Channel [edge]: [20:36:37] Currently checked out branch 'v25.06' of pmaports.git is on channel 'v25.06'. [20:36:37] Switching to branch 'master' on channel 'edge'... … ERROR: pmbootstrap switched to the wrong branch: master Related: https://builds.sr.ht/~postmarketos/job/1497179#task-bpo_setup-23 Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2613
This commit is contained in:
parent
c39ac5fe99
commit
26c310f374
2 changed files with 6 additions and 4 deletions
|
@ -214,7 +214,7 @@ def ask_for_channel(config: Config) -> str:
|
||||||
# Otherwise, if valid: channel from pmaports.cfg of current branch
|
# Otherwise, if valid: channel from pmaports.cfg of current branch
|
||||||
# The actual channel name is not saved in pmbootstrap_v3.cfg, because then
|
# The actual channel name is not saved in pmbootstrap_v3.cfg, because then
|
||||||
# we would need to sync it with what is checked out in pmaports.git.
|
# we would need to sync it with what is checked out in pmaports.git.
|
||||||
default = pmb.config.pmaports.read_config()["channel"]
|
default = pmb.config.pmaports.read_config(add_systemd_prefix=False)["channel"]
|
||||||
choices = channels_cfg["channels"].keys()
|
choices = channels_cfg["channels"].keys()
|
||||||
if config.is_default_channel or default not in choices:
|
if config.is_default_channel or default not in choices:
|
||||||
default = channels_cfg["meta"]["recommended"]
|
default = channels_cfg["meta"]["recommended"]
|
||||||
|
|
|
@ -90,8 +90,10 @@ def read_config_repos() -> dict[str, configparser.SectionProxy]:
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
||||||
@Cache("aports")
|
@Cache("aports", "add_systemd_prefix")
|
||||||
def read_config(aports: Path | None = None) -> configparser.SectionProxy:
|
def read_config(
|
||||||
|
aports: Path | None = None, add_systemd_prefix: bool = True
|
||||||
|
) -> configparser.SectionProxy:
|
||||||
"""Read and verify pmaports.cfg. If aports is not
|
"""Read and verify pmaports.cfg. If aports is not
|
||||||
specified and systemd is enabled, the returned channel
|
specified and systemd is enabled, the returned channel
|
||||||
will be the systemd one (e.g. systemd-edge instead of edge)
|
will be the systemd one (e.g. systemd-edge instead of edge)
|
||||||
|
@ -128,7 +130,7 @@ def read_config(aports: Path | None = None) -> configparser.SectionProxy:
|
||||||
# Translate legacy channel names
|
# Translate legacy channel names
|
||||||
ret["channel"] = pmb.helpers.pmaports.get_channel_new(ret["channel"])
|
ret["channel"] = pmb.helpers.pmaports.get_channel_new(ret["channel"])
|
||||||
|
|
||||||
if systemd:
|
if systemd and add_systemd_prefix:
|
||||||
ret["channel"] = "systemd-" + ret["channel"]
|
ret["channel"] = "systemd-" + ret["channel"]
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue