The repo bootstrap logic has worked well enough in the initial systemd
bringup. But we have decided to replace the approach of building
packages multiple times during the repo_bootstrap with building each
package only once and adding -stage0 packages where necessary (currently
only a systemd-stage0 package).
Advantages:
* Replace the often breaking repo_bootstrap logic with something less
fragile (repo_bootstrap is currently broken again).
* Can get rid of the whole bootstrap logic in pmaports.cfg, pmbootstrap,
build.postmarketos.org. This will make pmbootstrap and bpo easier to
maintain.
* Fix problems we have seen when upgrading two or more of (systemd,
dbus, linux-pam-pmos) at once: it doesn't pass in CI and it doesn't
pass in BPO
* You don't need to do a whole bootstrap at once, it is again broken
down by package. This means if building one package fails (locally or
in bpo), we don't need to do the whole thing again, just start at the
package that failed. This also means it is much easier to optimize
e.g. the stage0 packages to build faster.
* Fixes some specific bugs we currently have (abuild twice in pmaports,
bpo tests disabled because of that, ...)
Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2588
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
Apparently python reads uname for this value, the correct value for
64-bit intel/amd stuff is `x86_64` even though python's docs list
`amd64` as an example of a value `platform.machine()` can return 🤷fixes#2612
[ci:skip-build]: already built successfully in CI
Since cross-native2 was introduced, pmbootstrap now tells the user which
host and which build dependencies are getting installed. This makes
sense if they get installed into separate chroots, but not if they get
installed into the same chroot:
$ pmbootstrap build hello-world-wrapper --force
[16:47:19] Building 1 package
[16:47:19] * edge/hello-world-wrapper
[16:47:19] => (1/1) edge/hello-world-wrapper: Installing dependencies
[16:47:19] *** Install host dependencies
[16:47:19] (native) install hello-world
[16:47:20] *** Install build dependencies
[16:47:20] (native) install hello-world
[16:47:22] => edge/hello-world-wrapper: Building package
Don't list the depends separately if we are installing them into the
same chroot:
$ pmbootstrap build hello-world-wrapper --force
[16:51:35] Building 1 package
[16:51:35] * edge/hello-world-wrapper
[16:51:35] => (1/1) edge/hello-world-wrapper: Installing dependencies
[16:51:35] (native) install hello-world
[16:51:36] => edge/hello-world-wrapper: Building package
Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2589
In strict mode, pmbootstrap uninstalls packages between builds. This was
broken since we switched from installing dependencies via abuild to
pmbootstrap since our code doesn't use "--virtual .makedepends-…" when
installing the makedepends:
(088776) [15:32:34] (native) % cd /home/pmos/build; busybox su pmos -c SUDO_APK='abuild-apk --no-progress' HOME=/home/pmos abuild undeps ;
ERROR: No such package: .makedepends-systemd-stage0
Instead of restoring the logic and worrying about uninstalling deps in
the right chroots, just zap all chroots in strict mode.
I've also considered implementing "--virtual .makedepends-…" again, but
running zap on the chroots makes the logic much simpler, is easier to
maintain and makes so little speed difference that it is worth the
trade-off. We don't need to pass additional parameters fore the 2nd
chroot to zap in cross-native2, no need to figure out the virtual
package name in two places, etc.
Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2587
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
With recent changes we don't install alpine-base in the chroots anymore.
It still gets installed as postmarketos-base depends on it (for now,
this will change soon in master). But it is not guaranteed to be
installed before other packages which may run "rc-update" in their
postinst scripts.
Fix this by explicitly installing alpine-base early on during
"pmbootstrap install".
Fix for e.g. v24.12:pine64-pinephone:phosh images:
(342/976) Installing eg25-manager-openrc (0.4.6-r5)
(343/976) Installing device-pine64-pinephone-openrc (7-r0)
Executing device-pine64-pinephone-openrc-7-r0.post-install
lib/apk/exec/device-pine64-pinephone-openrc-7-r0.post-install: line 3: rc-update: not found
ERROR: device-pine64-pinephone-openrc-7-r0.post-install: script exited with error 127
Related: https://builds.sr.ht/~postmarketos/job/1473669#task-img-743
Fixes: 12d125ab ("chroot: don't depende on alpine-base")
Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2585
This fixes an issue where pmb lint tries to lint an apkbuild using a repo path that the apkbuild doesn't exist in.
For example, it fixes this:
```
[22:13:26] (native) linting postmarketos-ui-cosmic with apkbuild-lint
[22:13:26] *** apkbuild-lint output ***
Error: File APKBUILD does not exist
[22:13:26] *** apkbuild-lint output ***
[22:13:26] ERROR: Linter failed!
Traceback (most recent call last):
File "/builds/postmarketOS/pmaports/.ci/lib/apkbuild_linting.py", line 26, in <module>
common.run_pmbootstrap(["-q", "lint"] + packages)
File "/builds/postmarketOS/pmaports/.ci/lib/common.py", line 52, in run_pmbootstrap
subprocess.run(cmd, universal_newlines=True, check=True)
File "/usr/lib/python3.12/subprocess.py", line 571, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['pmbootstrap', '--aports', '/builds/postmarketOS/pmaports', '-q', 'lint', 'postmarketos-ui-cosmic']' returned non-zero exit status 2.
```
Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2584
With recent rework in postmarketos-initramfs, we no longer need to mount
the /boot partition in the initramfs (assuming initramfs-extra is not
used). On devices that boot without accessing the boot file system (e.g.
Android boot images, fastboot, ...), that makes it possible to install
postmarketOS on a single (potentially encrypted) partition that contains
both root (/) and /boot files.
This avoids the extra complexity of the subpartition setup we usually use
on such devices, and also avoids having to flash two partitions (when using
--split to avoid the subpartitions).
Add a --single-partition option to pmbootstrap install that allows
installing postmarketOS in this mode. For now this is just an option that
must be selected explicitly, in the future we could choose to make this the
default for Android-based devices with a large enough boot partition.
Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2512
When an APKBUILD has no makedepends, depends_build would be empty so we
would skip adding rsync when building with --src.
Fix this logic so we always add rsync even when there are no other
makedepends.
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2581
Previous reasons to write the locales to /etc/profile.d/.. was because
musl-locales do only support reading from environment variables and not
/etc/locale.conf.
However systemd-localed (and glibc) uses /etc/locale.conf to read and
write locale configurations. gnome-control-center, for example, uses
localed to change locales.
In the sake of a single source of truth, allow pmb to write to
/etc/locale.conf and allow its consumers (e.g. g-c-c via systemd) to
read/change these variables.
Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2547