This allows us to get rid of some of the validation in sanity_checks()
as mypy handles this validation at "build time", and any typos in the
enum instantiation would be a runtime error rather than a silent
failure.
Additionally, it allows us to encode some of the behaviour of the
different output types into the type definition itself by using methods.
Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2642
(cherry picked from commit 7d2f055bcb)
pmb: Fix PmbArgs containing a string for output
While the annotations were changed to suggest that the output property
of PmbArgs contains a RunOutputType, at runtime it actually contained a
string because the argument parsing code hadn't been adapted to create a
RunOutputType. Fix this, and also change it to RunOutputTypeDefault as
while at it as that's more accurate.
Fixes 7d2f055bcb
dtbtool-exynos has two options --platform and --subtype that are
embedded in dt.img header and need to match the values that the
bootloader expects. For most devices these values are 0x50a6 and
0x217584da, respectively, but for some they have other values.
Add functionality to parse the dt.img header and extract these values,
and add them to the deviceinfo as
bootimg_qcdt_exynos_{platform,subtype} if they are not equal to the
default values.
Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2638
This allows us to get rid of some of the validation in sanity_checks()
as mypy handles this validation at "build time", and any typos in the
enum instantiation would be a runtime error rather than a silent
failure.
Additionally, it allows us to encode some of the behaviour of the
different output types into the type definition itself by using methods.
Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2642
Tests were moved out of the pmb directory into their own test directory,
so no need to try to exclude them when they shouldn't be there anyway.
If test "documentation" appears in the docs with this, there's a test
that is where it shouldn't be and a separate bug.
Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2619
When using an msdos partition table and parted is called to enable the
esp flag on the boot partition, it will disable a previously existing
lba flag on that partition. However, some devices (at least the
Raspberry Pi 3) will not boot without that flag.
Only set that flag if the partition type is gpt.
Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2632
With apkv3, APKINDEX files get deleted when running "apk cache clean".
This is unexpected and needs to be investigated. Meanwhile run
cache_clean() on the native arch last, as it needs the APKINDEX for the
Alpine main repo of the native arch (even if cleaning other arches) in
order to set up the chroot where we run "apk cache clean". This prevents
crashing in "pmbootstrap zap -a" and "pmbootstrap zap -o".
Related: BPO issue 160
Related: pmb issue 2627
Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2636
This patch made the assumption that if the Alpine APKINDEX for the
"main" repository exist, all other Alpine indexes ("community",
"testing") as well as the postmarketOS indexes (normal one, systemd)
exist as well.
This is not always the case, e.g. when the internet connection dropped
while downloading indexes and so only "main" was downloaded. While this
is unlikely to happen, it is currently also breaking BPO where the
postmarketOS repository does not get set during "pmbootstrap init" on
purpose as it causes problems when bringing up new releases.
This reverts commit 752a3a98f5.
I'll make a different fix in the next patch for the problem that this
patch was made for, having a broken "pmbootstrap zap -a" with apkv3.
Related: BPO issue 160
Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2636
While this hypothetically could be triggered by a malicious server,
more likely is that this would be caused by a bug in pmbootstrap. As
such, soften the message a bit and also remove references to the removed
-m flag.
Fixes ebfda16d6d
Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2635
[ci:skip-build]: already built successfully in CI
When using `pmb zap --pkgs-online-mismatch`, the local index is
downloaded if missing and `update()` is cached, however pmb zap removes
the index and subsequent calls to `update()` don't actually do anything
(i.e. redownload the index) so later things that expect the indext to
exist (like finding providers) blow up.
Wrap update() with a new update() method that checks if the APKINDEX
exists, and always do a "real" update if it doesn't. Also rename
update() to _update().
Co-Developed-by: Clayton Craft <clayton@craftyguy.net>
Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2635
This is just a small detail, but in some way CLI options are similar
to public API. I did this while trying some changes, even if in the
end the issue to solve was not in pmbootstrap, I thought it'd make
sense to contribute this.
Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2626
Official mkinitfs flavors were dropped long ago. v23.12 already
released with "supported_mkinitfs_without_flavors=True". So there is
no need to keep this around anymore. When we have initramfs and
kernels that have suffixes (e.g: from alpine), we already deal with
them.
Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2621
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