Commit graph

2126 commits

Author SHA1 Message Date
a7d634e735 config: add my aports/pmaports
Signed-off-by: Vasiliy Doylov <nekocwd@mainlining.org>
2025-07-11 00:01:04 +00:00
10a051b090 build: add ability to override pkgdesc prefix/suffix when building from custom source
Signed-off-by: Vasiliy Doylov <nekocwd@mainlining.org>
2025-07-11 00:01:04 +00:00
0c74743b32 build: add ability to override date in pkgver when building from custom source
Signed-off-by: Vasiliy Doylov <nekocwd@mainlining.org>
2025-07-11 00:01:04 +00:00
Oliver Smith
3ea5a3433b
Revert "pmb: Make RunOutputTypeDefault and RunOutputTypePopen enums"
Revert the patch, as it breaks "pmbootstrap chroot".

This reverts commit 7d2f055bcb.
2025-07-10 23:53:54 +02:00
Anri Dellal
ae0d162d31
pmb.chroot.initfs: Fix initfs commands
Fix "initfs ls" and "initfs extract" crashing if initramfs-extra is missing.

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2643
2025-07-10 22:41:32 +02:00
Newbyte
ba56809dc3
pmb.helpers.locale: Mark XkbLayout.primary_locales as Final
This removes any ambiguity about whether this is a class or instance
variable, which Mypyc requires.

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2634
2025-07-10 21:09:41 +02:00
Newbyte
0ade6cab4d
pmb: Use inspect.get_annotations()
On Python 3.10 and newer, this is the recommended way of accessing
annotations[1]. It also works with Mypyc, unlike directly accessing
__annotations__.

 [1]: https://docs.python.org/3/howto/annotations.html

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2634
2025-07-10 21:09:41 +02:00
Henrik Grimler
9662fcfb24
aportgen: device: set bootimg_qcdt_exynos_{platform,subtype}
If they are present.

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2638
2025-07-10 21:03:01 +02:00
Henrik Grimler
2872ec6be8
bootimg: exynos: extract platform and subtype from dt.img header
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
2025-07-10 21:03:01 +02:00
Newbyte
7d2f055bcb
pmb: Make RunOutputTypeDefault and RunOutputTypePopen enums
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
2025-07-10 20:57:51 +02:00
Anri Dellal
77b2717d66
pmb.chroot.mount: Fix pmb chroot --image for single-partition rootfs
Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2641
2025-07-08 13:26:35 +02:00
Newbyte
7b78bcfcf9
pmb: Also apply ext4 metadata_csum workaround for archived ports
Ports in the archived category may be downstream ports. While mainline
ports also are allowed, archived ports should generally not be relied on
anyway so the loss of ext4 reliability on those shouldn't matter.

Fixes 89a80265de

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2640
2025-07-07 15:08:54 +02:00
Newbyte
3c1699b5c1
Revert "pmb.config: add the full hexdump to the list of installed build packages (MR 2454)"
This should have been fixed as of seven months ago[1], so we should be good
to revert this by now.

This reverts commit 83d6a26291.

Closes https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/issues/2472

 [1]: https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/74494

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2618
2025-07-06 22:01:30 +02:00
Newbyte
3c15b993b5
pmb.parse._apkbuild: Use NonBugError for all errors
While it is possible for these code paths to be triggered by genuine
pmbootstrap bugs, in general these should be caused by APKBUILD. As
such, use NonBugError to reduce noise.

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2622
2025-07-06 21:15:31 +02:00
Marc Lehmann
ec49117cff
Don't set esp flag for msdos boot partitions
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
2025-07-06 20:45:20 +02:00
Newbyte
eaaa7091ff
pmb.core.context: Properly type get_context()
Instead of just disabling the return-value error code, actually type it
properly using overloads.

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2614
2025-07-06 20:40:43 +02:00
Newbyte
b21c545956
pmb.helpers.devices: Use get_device_category_by_directory_path()
Simplifies the code slightly.

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2616
2025-07-06 19:15:21 +02:00
Newbyte
89a80265de
pmb: Only disable metadata_csum for ext4 on downstream ports
No need to worsen filesystem reliability for mainline devices that don't
need this workaround.

Closes https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/issues/2557

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2616
2025-07-06 19:15:21 +02:00
Newbyte
7035c0239d
test: Move test_devices to where it should be
Consequence of tests being moved back and forth over time.

Fixes cd672222c4

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2616
2025-07-06 19:15:13 +02:00
Oliver Smith
c9674c4455
Fix crash in "zap -a" and "zap -o" with apk3
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
2025-07-03 21:52:54 +02:00
Oliver Smith
3d764546c1
Revert "pmb.helpers.repo: Always update APKINDEX if it doesn't exist"
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
2025-07-03 21:52:06 +02:00
Henrik Grimler
8ae3050a0d
aportgen: re-add bootimg_qcdt variable
It was accidentally dropped from deviceinfo generator in commit
953f84a79a ("parse: bootimg: make it work again").

Part-of: https://gitlab.postmarketos.org/postmarketos/pmbootstrap/-/merge_requests/2628
Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2628
2025-07-03 17:01:41 +02:00
Henrik Grimler
f25a8bf374
treewide: switch back to bootimg_qcdt{,_type}
In some refactoring work deviceinfo_bootimg_qcdt and
deviceinfo_bootimg_qcdt_type were accidentally renamed to just
deviceinfo_qcdt{,_type}. Change back to original name everywhere.

Among the notable changes is that we modify the bootimg header_v2 test
so that bootimg_qcdt="false" is acceptable in the deviceinfo. I am not
sure why it was added to the !expected substrings, we have plenty of
header_v2 devices with the property set.

Part-of: https://gitlab.postmarketos.org/postmarketos/pmbootstrap/-/merge_requests/2628
Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2628
2025-07-03 17:01:33 +02:00
Newbyte
799140da2b
Prepare 3.5.2 release 2025-07-02 20:16:02 +02:00
Newbyte
3f09e87346
pmb.helpers.apk_static: Update "malicious server" message
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
2025-07-02 17:25:34 +02:00
Newbyte
752a3a98f5
pmb.helpers.repo: Always update APKINDEX if it doesn't exist
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
2025-07-02 17:25:33 +02:00
Clayton Craft
f9add1b6d2
pmb.helpers.apk: fix crash computing progress from apk3
Fixes:

tot = float(cur_tot[1])
      ^^^^^^^^^^^^^^^^^
ValueError: could not convert string to float: '5383561 download'

Because this line now includes " download" at the end:

  ipdb> p line
  '10727/5383561 download\n'

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2635
2025-07-02 17:25:33 +02:00
Clayton Craft
a8988872b6
pmb.helpers.apk_static: fix version check for apk3
ipdb> p version_bin
'3.0.0_rc5_git20250613-r0'
ipdb> p version
'3.0.0_rc5_git20250613-r0'

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2635
2025-07-02 17:25:32 +02:00
Pablo Correa Gómez
ed396475f5
pmb: drop unused import
Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2621

[ci:skip-build]: already built successfully in CI
2025-06-09 22:43:57 +02:00
Pablo Correa Gómez
527fc9359f
export: drop support for flavor in export
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
2025-06-09 22:43:57 +02:00
Pablo Correa Gómez
d9560962ac
export: allow to export vmlinuz files which have any suffix
This is useful, for example, to export alpine linux kernels.

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2621
2025-06-09 22:43:57 +02:00
Oliver Smith
562e6519d5
Prepare 3.5.0 release 2025-06-09 19:32:22 +02:00
Luca Weiss
606eb669fc
pmb.aportgen: Add default value to fork_alpine parameter
No need to specify this when fork_alpine has nothing to do with the
usage.

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2610
2025-06-04 10:12:55 +02:00
Luca Weiss
ed57b3dac3
pmb.aportgen: Match aportgen prefixes explicitly
Instead of using getattr with an arbitrary prefix, just match the couple
of cases explicitly.

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2610
2025-06-04 10:12:54 +02:00
Luca Weiss
f1a6f0034b
pmb.aportgen.core: Initialize chroot properly
Make sure to initialize the native chroot before trying to run a command
in it.

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2610
2025-06-04 10:12:53 +02:00
Oliver Smith
47be020c7a
Remove "pmbootstrap repo_bootstrap"
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
2025-06-03 17:25:41 +02:00
Oliver Smith
f6b0ebd78c
pmb/helpers/other: fix typo found by codespell
Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2588
2025-06-03 17:25:41 +02:00
Oliver Smith
26c310f374
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
2025-05-30 11:08:34 +02:00
Clayton Craft
c39ac5fe99
pmb.qemu.run: fix x86_64 CPU check for EFI support (MR 2612)
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
2025-05-27 11:33:16 +02:00
Oliver Smith
63dea3993d
pmb.config.apk_tools_min_version: add v3.22
Prepare for the upcoming postmarketOS v25.06 release.
2025-05-26 22:02:00 +02:00
Newbyte
548a1dfe2e
pmb: Warn users about downstream ports
And make the archived port detection more robust while at it.

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2549
2025-05-25 19:26:57 +02:00
Newbyte
cd672222c4
pmb: Split devices by category during codename selection
This also reworks list_codenames() somewhat. The option to show archived
devices is removed as it never actually was used. It should be easy to
restore if someone is interested.

Closes https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/issues/2558

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2549
2025-05-25 19:26:57 +02:00
Newbyte
a9c3628297
pmb.helpers.logging: Fix type for args
This is supposed to be `object` rather than `str` according to typeshed:
57cb510fd2/stdlib/logging/__init__.pyi (L129-L212)

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2549
2025-05-25 19:26:57 +02:00
Newbyte
a1057c9770
pmb.config.__init__: Add escape sequence for magenta text
Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2549
2025-05-25 19:26:57 +02:00
Newbyte
c426c14f47
pmb.helpers.pmaports: Clean up some strings
Use f-strings to make them easier to read and combine some not-so-long
ones into one line for easier grepping.

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2549
2025-05-25 19:26:52 +02:00
Newbyte
5783d1c507
Prepare 3.4.1 release 2025-05-25 15:13:41 +02:00
Clayton Craft
f4001310f2
pmb.qemu.run: command_qemu: refactor applying arch-specific options
Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2560
2025-05-25 12:05:56 +02:00
Clayton Craft
b214fa6c4a
pmb.qemu.run: add support for EFI on aarch64
Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2560
2025-05-25 12:05:56 +02:00
Clayton Craft
4a7ec11f4c
pmb.qemu.run: use virgl on aarch64 hosts
This enables faster/more featureful 3D accel support in VMs, which is necessary
for running some future UIs.

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2560
2025-05-25 12:05:56 +02:00
Stefan Hansson
da3fa09ca2
pmb.helpers.apk: Avoid concatenation
Appeases Ruff.

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2600
2025-05-25 11:39:14 +02:00