config: workdir: handle systemd chroot channel (MR 2252)

Correctly denote whether the chroot is for the systemd channel or not so
users are warned when switching from edge to systemd staging without
zapping.

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
Caleb Connolly 2024-06-13 21:39:45 +02:00 committed by Oliver Smith
parent 3f11fa2500
commit 4ed813cf0e
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB

View file

@ -30,7 +30,7 @@ def chroot_save_init(suffix: Chroot):
cfg[key] = {} cfg[key] = {}
# Update sections # Update sections
channel = pmb.config.pmaports.read_config(pkgrepo_default_path())["channel"] channel = pmb.config.pmaports.read_config()["channel"]
cfg["chroot-channels"][str(suffix)] = channel cfg["chroot-channels"][str(suffix)] = channel
cfg["chroot-init-dates"][str(suffix)] = str(int(time.time())) cfg["chroot-init-dates"][str(suffix)] = str(int(time.time()))
@ -83,9 +83,7 @@ def chroot_check_channel(chroot: Chroot):
if key not in cfg or str(chroot) not in cfg[key]: if key not in cfg or str(chroot) not in cfg[key]:
raise RuntimeError(f"{msg_unknown} {msg_again}") raise RuntimeError(f"{msg_unknown} {msg_again}")
# Exclude systemd repo channel = pmb.config.pmaports.read_config()["channel"]
aports = pkgrepo_default_path()
channel = pmb.config.pmaports.read_config(aports)["channel"]
channel_cfg = cfg[key][str(chroot)] channel_cfg = cfg[key][str(chroot)]
if channel != channel_cfg: if channel != channel_cfg:
raise RuntimeError(f"Chroot '{chroot}' was created for the" raise RuntimeError(f"Chroot '{chroot}' was created for the"