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
In "pmbootstrap init", always use the pmaports root path when figuring
out the channel of the checked out commit (-> edge, v24.12, ...).
Otherwise the systemd path may get used, which returns channels prefixed
with "systemd-", such as "systemd-edge".
The default UI is "console", and it was recently switched to use systemd
by default. Since then the channel in pmaports CI gets detected as
"systemd-edge", which is not the same as "edge" and so pmbootstrap
switched to the master branch during "pmbootstrap init", resulting in CI
running on the wrong branch:
[10:54:44] Currently checked out branch 'HEAD' of pmaports.git is on channel 'systemd-edge'.
[10:54:44] Switching to branch 'master' on channel 'edge'...
Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2586
According to Python documentation, p.match checks
if characters at the beginning of string match the regex
This commit changes validation to full length of string
- Properly run commands at host to mount rootfs
- Always refuse to zap chroot_image, since it is never added to workdir.cfg
Co-authored-by: Newbyte <newbyte@postmarketos.org>
This changes the output from e.g.
WARNING: xiaomi-markw is archived: None
to
WARNING: xiaomi-markw is archived: No reason given (this is a bug)
which I think is better and makes it clear that this is not behaviour
one should rely upon. All archived ports should have a reason given, but
this has not been (and still isn't as I'm writing this) enforced in
pmaports, so we can't rely on there being one.
Related: https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/6085
Without this, `$ pmbootstrap init` crashes if a nonexistent UI package
is selected. This can happen if one previously selected a UI package in
a former checkout of pmaports, but then switched away to a different one
that doesn't have the UI package. For example, if someone is working on
a new UI in a feature branch and then switches away from it, or if a UI
is removed from the canonical pmaports repository altogether.
Now that systemd was merged into master, it is extra-repos/systemd
instead of staging/systemd.
As of writing, the repository is not published yet but this will happen
soon.
Related: https://postmarketos.org/edge/2025/01/09/systemd-soon/
I tried my best to get the right author based on git commit history, but
in the case of code being moved from one file to make another I might
have gotten something wrong.
For some reason this also requires a fix in pmb.install._install.py,
didn't bother investigating why but the necessary change seems fine to
me.
Requires mypy 1.14 (maybe 1.14.1, not sure).
pmb.helpers.cli.ask() returns a string, so previously this function was
just lying about its return type (which happened to be fine in the
context it was used, but still not what we want).
pmb.helpers.cli.ask() takes a string and only work with Path by
accident, so explicitly convert <default> to a string if it is not None.
Additionally, while this function claimed to return a Path, it actually
returned a string, so fix that too.
Devices using fastboot-bootpart typically boot directly from the boot file
system. They might still support "fastboot boot" though, which can be used
to boot a modified kernel more easily. Enable this similar to the existing
"flash_boot" action.
Prepare a new release, so pmbotostrap can be used with Alpine 3.21 /
postmarketOS v24.12. Also the big rewrite is done, so we can do more
frequent releases again.
Related: https://wiki.postmarketos.org/wiki/Pmbootstrap_release
Pmbootstrap finds all its host dependencies during init, ensure we do
that for pytest too.
Adapt require_programs() to use subprocess directly rather than have to
solve the weird dependency chain of pmb.helpers.run which depends on the
global context being initialised before it's usable.
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
"y" only works here by accident as it's considered truthy by Python and
as such gets handled equivalently to True in the current implementation
of pmb.helpers.cli.confirm(), but it's still relying on unintended
behaviour. Change this to use a bool as intended.
Replace the boolean skip_extra_repos with a new with_extra_repos
argument that can be default, enabled or disabled.
This will be used to explicitly enable extra repos in a package search
even if systemd is currently disabled, so we can display a hint when a
package was not found because systemd is disabled in a follow-up patch.
Since a user can modify the glob to be somewhat arbitrary, use that to
check if any ssh keys exist and ask in pmbootstrap init.
Otherwise ssh_key_glob would only work if it was a subset of
~/.ssh/id_*.pub, so e.g. ~/.ssh/id_foo.pub but ~/.ssh/foo.pub wouldn't
work.
We don't care about the output of "losetup --json" here, we just want to
make sure that the argument exists. If it does not exist, we already
give an error to the user.
Set the output to null so it does not clutter the log since it runs with
every pmbootstrap command now.
Remove this chroot-specific helper and merge it in with the existing
require_programs() logic. Now we have one unified way to discover and
use programs from the host and where we can put any additional special
handling we might need.
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
On debian systems in particular special handling is needed for
/usr/sbin. Let's do this once and then provide the host deps we use in a
nice accessible dictionary.
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
Tweaked-by: Oliver Smith <ollieparanoid@postmarketos.org>