Commit graph

2994 commits

Author SHA1 Message Date
Clayton Craft
47dc493701
pmb.parse.depends.package_provider: add type hinting and fix references (MR 2439)
pmb.parse.apkindex.providers now returns a dict of string:ApkindexBlock,
probably from 71772b9b6

This adds type hinting to package_provider to reflect this, and fixes
code that calls it to properly deal with the possible return types.
Without this, building FDE images is broken.
2024-10-18 13:45:57 +02:00
Luca Weiss
4019636f72
ci: Run docs job in chroot (MR 2413)
Use the new "Artifacts" directive for .ci/docs.sh and run the job in the
pmbootstrap chroot to avoid needing to install sphinx dependencies on
the host.

Fixes #2352
2024-10-17 19:01:30 +02:00
Luca Weiss
342900aee1
ci: Add support for artifacts (MR 2413)
And make the docs job run in the chroot now and grab the 'public/'
directory so we have the built docs.
2024-10-17 18:53:44 +02:00
Luca Weiss
9e3d7af96b
helpers: make get_topdir return Path (MR 2413)
Since the return value is a file path, let's make it a Path object. Also
update the docstring to reflect reality.
2024-10-17 18:53:44 +02:00
Luca Weiss
75a72725c9
helpers: add return type annotations (MR 2413) 2024-10-17 18:53:44 +02:00
Clayton Craft
1ec55fc11a
Revert "pmb.install.losetup: Run kpartx, losetup in chroot (MR 2430)"
This series breaks pmbootstrap, and that's not good[1]. A bug was filed
about this (#2465), and there have been multiple attempts to fix it (!
2435 and !2436). It kinda seems like we don't have time to fix/test this
for a while longer, which is fine, but given the impact this bug has I
think we should be revert this series until this issue is solved/tested.

1. pmb is broken in some specific cases, which means some workflows are
broken. One example is that this breaks the pmaports CI, so no work can
be done in pmaports.
2024-10-16 11:35:36 -07:00
Newbyte
a7e2592f1a
pmb.install.losetup: Remove debug print (MR 2430)
Looks like an unintended leftover from debugging.
2024-10-16 00:07:48 +02:00
Newbyte
0975d06437
pmb.install.losetup: Run kpartx, losetup in chroot (MR 2430)
I tested $ pmbootstrap shutdown with this and observed no problems. All
the mounts disappear in lsblk as expected.

Closes https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/issues/2423
2024-10-16 00:07:48 +02:00
Newbyte
6455441464
pmb.install.losetup: Annotate return types (MR 2430)
And fix type errors.
2024-10-16 00:07:44 +02:00
Newbyte
fb7f53538c
CI: Run mypy with --check-untyped-defs (MR 2431)
All typing errors found with --check-untyped-defs have been fixed, so
let's make mypy stricter now to avoid regressing this.
2024-10-15 10:59:06 +02:00
Newbyte
ce2fca6a11
pmb.helpers.pmaports: Annotate return type for get_list() as list (MR 2431)
I'm not sure why this was annotated as a Sequence rather than list. The
function clearly returns a list, not a Sequence, and the commit that
originally did it[1] provides no justification. This causes problems
with mypy checks in other places, so let's just annotate this as
returning a list.

 [1]: 198f302a36
2024-10-15 10:59:06 +02:00
Newbyte
7ed07fb6de
pmb.helpers.logging: Annotate types for loglevels (MR 2431)
Otherwise mypy cannot figure out the type of these.
2024-10-15 10:59:01 +02:00
Stefan Hansson
3bb9953f6a
CI: Install mypy from pip instead of Alpine (MR 2425)
Alpine stable's mypy is currently outdated and has bugs in its
handling of overloads. As such, just use mypy from pip so we don't have
to worry about working aroud bugs in old mypy versions.

[ci:skip-build]: already built successfully in CI
2024-10-13 20:12:39 +02:00
Stefan Hansson
3ae2bf5e6a
pmb.chroot.apk: Import annotations from __future__ (MR 2425)
Works around circular import.
2024-10-13 20:12:39 +02:00
Stefan Hansson
8aa3b034b0
pmb.chroot.apk: Type hint package list in packages_get_locally_built_apks (MR 2425) 2024-10-13 20:12:39 +02:00
Stefan Hansson
71772b9b6b
pmb.parse.apkindex: Introduce proper typing (MR 2425)
And adjust other code.

Closes https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/issues/2455
2024-10-13 20:12:34 +02:00
Stefan Hansson
566b43edd4
pmb.core.package_metadata: Introduce (MR 2425) 2024-10-13 20:05:14 +02:00
Stefan Hansson
c5551f5924
pmb.core.apkindex_block: Introduce (MR 2425) 2024-10-13 20:05:14 +02:00
Aster Boese
8335d050bf
pmb.install: switch to gpt with discoverable partitions (MR 2426) 2024-10-13 19:59:26 +02:00
Aster Boese
002a23e252
pmb.core: add Discoverable Partitions Specification file (MR 2426) 2024-10-13 19:59:26 +02:00
Newbyte
4a0825bdc0
pmb: Remove args from aportgen command (MR 2432) 2024-10-13 19:43:31 +02:00
Newbyte
653d45500f
pmb.aportgne.core: Add type hints (MR 2432) 2024-10-13 19:43:31 +02:00
Newbyte
37a0bd02ee
pmb.aportgen: Use Arch in more places (MR 2432) 2024-10-13 19:43:31 +02:00
Oliver Smith
bf9f758691
lint: generate options from kconfigcheck.toml (MR 2412)
Now that we have moved the kconfigcheck configuration into pmaports
branches via kconfigcheck.toml, it is time to get rid of the hardcoded
list of valid "pmb:kconfigcheck-…" options for APKBUILDs. Generate it
from the kconfigcheck.toml of the current branch, too.

These options are passed from "pmbootstrap lint" to "apkbuild-lint",
which we run in pmaports CI.
2024-10-13 18:24:51 +02:00
Oliver Smith
67a52b949a
lint: make output of apkbuild-lint easy to spot (MR 2412)
The output of apkbuild-lint is hard to spot among other log messages
from pmbootstrap, because it is not colorized.

Add "*** apkbuild-lint output ***"" before and after the output of
apkbuild-lint, so we get a standing out message in green around the
apkbuild-lint output.
2024-10-13 18:24:51 +02:00
Oliver Smith
8b48a95c18
lint: run apkbuild-lint as user, not root (MR 2412)
It is not needed to run the linter as root, so don't do it. This is
probably a leftover from early days pmbootstrap, where pmaports.git
wasn't chowned by the user running pmbootstrap.
2024-10-13 18:24:43 +02:00
Clayton Craft
e56eadd6e9
pmb.build: make sure cross compiler config is appropriate for each given package (MR 2433)
Here's the problem: Imagine a queue with 2 packages in it, the 1st
package uses crossdirect and the second uses cross-native. When building
the 1st package, pmb will configure the native chroot for crossdirect
as expected. When it gets to the 2nd package, the chroot env/config
might not be appropriate for actually doing a native cross compile.

This re-inits the cross compiler stuff if the cross compile method
changes while processing the queue.

Another approach that might solve this problem is to not re-use chroots
when building packages... I didn't think this was a good way to go
because it would greatly increase runtime (having to recreate chroots
multiple times)
2024-10-11 14:06:47 -07:00
Oliver Smith
a6d34d66b3
git.get_upstream_remote: add fallback code path (MR 2429)
When running some commands like "pmbootstrap chroot" or even
"pmbootstrap work_migrate", pmbootstrap will attempt to read the
pmaports.cfg from origin/master *before* doing the work dir migration.

In order to do this, the "get_upstream_remote" function tries to find
the upstream remote by URL. Let it search with the outdated URLs too, so
this doesn't fail right before migrating to the new URLs.
2024-10-08 17:07:33 +02:00
Newbyte
344d6f22d9
pmb.helpers: Automatically migrate fetch and push URL (MR 2429)
This could be re-purposed in the future in case we migrate URLs again.

Co-authored-by: Caleb Connolly <caleb@postmarketos.org>
Tweaked-by: Oliver Smith <ollieparanoid@postmarketos.org>
2024-10-08 17:07:33 +02:00
Newbyte
405869db1b
pmb.commands.pull: Annotate return types (MR 2429) 2024-10-08 17:07:28 +02:00
Caleb Connolly
0b4fb9119f
chroot: always run apk static v2 (MR 2423)
Now that we don't need weird apk-tools hacks for systemd, we can
re-implement this optimisation and always run apk static rather than
running apk through the chroot.

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
2024-10-08 16:54:29 +02:00
Stefan Hansson
521628ba50
pmb.build._package: Use deduced arch for error message (MR 2424)
Otherwise Arch may be None here which results in an error.
2024-10-07 23:57:07 +02:00
Newbyte
4c0f346746
pmb: Migrate aportgen to Command (MR 2428) 2024-10-07 21:41:26 +02:00
Newbyte
b1b6c52b92
pmb.config: Adjust pmaports URLs to postmarketOS GitLab (MR 2427)
We moved from gitlab.com to gitlab.postmarketos.org.
2024-10-07 12:23:26 +02:00
Stefan Hansson
7aa7f63160
README.md: Add section about pmbootstrap's relation to pmaports (MR 2421)
This is section is not meant to represent my opinions, rather I seek to
document the status quo. I base the support range on what's been
reasoned in prior merge requests such as [1] and [2], as well as [3]
which only fixed CI in the one active stable release and left old stable
releases unfixed.

While I don't necessary think this is a great situation given that old
releases may sometimes be useful, extending the time pmbootstrap has to
support old releases would incur significant additional maintenance
effort and consequently require more discussion than just documenting
what's already happening. As such, I think this is the most reasonable
thing to do for now.

 [1]: https://gitlab.com/postmarketOS/pmbootstrap/-/merge_requests/2360#note_1999012908
 [2]: https://gitlab.com/postmarketOS/pmbootstrap/-/merge_requests/2417#note_2135527528
 [3]: https://gitlab.com/postmarketOS/pmaports/-/merge_requests/5676
2024-10-03 12:22:42 +02:00
Luca Weiss
c3016e02c5
newapkbuild: globbing and Path fixes (MR 2416) 2024-09-30 18:58:37 +02:00
Stefan Hansson
fb6073e835
pmb.parse.arguments: Remove unnecessary quotes (MR 2419)
This is probably a leftover from automatically reformatting this file.
2024-09-30 18:51:44 +02:00
Oliver Smith
eb747ad21f
find_providers: tweak default matching (MR 2301)
The previous version would fail if the suffix contained a dash as well,
e.g. postmarketos-base-ui-audio-some-new-thing. Fix it and add example
comments.
2024-09-30 18:41:09 +02:00
Oliver Smith
0bbf425c8b
helpers.pmaports.find_providers: add type hints (MR 2301) 2024-09-30 18:37:28 +02:00
Oliver Smith
fd1331c2bc
find_providers: set higher provider_priority (MR 2301)
For packages selected by the user (see last commit), set the
provider_priority to 999999 instead of 999. The previous number seems
not high enough, we might set this in the APKBUILDs.
2024-09-30 18:37:28 +02:00
JustSoup321
56a4329f4f
pmb.{config, helpers, install}: add _pmb_default support (MR 2301) 2024-09-30 18:37:01 +02:00
Clayton Craft
7a299b3fc4
pmb.chroot.apk_static: use sha256 sig for verification (MR 2417)
Fixes #2456
Depends on https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/72741
2024-09-30 18:07:59 +02:00
Caleb Connolly
4998e27cc7
chroot: force disable /usr merge (MR 2418)
We plan to ship systemd with split /usr until the /usr merge is complete
in Alpine. Let's not drop all our code yet but just forcefully disable
it.

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
2024-09-30 14:49:06 +02:00
Stefan Hansson
742300b090
pmb.commands: Add pkgver_bump (MR 2415)
Similar to pkgrel but for pkgver. Useful when dealing with e.g.
metapackages.

[ci:skip-build]: already built successfully in CI
2024-09-30 12:45:21 +02:00
Stefan Hansson
a1fdd01173
pmb.commands: Migrate if ... else chain to match (MR 2411)
We no longer care about supporting Python versions older than 3.10,
which is when match was introduced.
2024-09-26 18:27:00 +02:00
Stefan Hansson
8a64c9da8f
pmb: Migrate pkgrel_bump to Command (MR 2411)
Also remove args from functions that don't actually need it to
faciliate this.

This does not attempt to fix any of the bugs with pkgrel_bump.
2024-09-26 18:27:00 +02:00
Stefan Hansson
3d60673f64
pmb.commands.kconfig_check: Annotate None return types (MR 2411)
Otherwise we don't get type checking in these functions.
2024-09-26 17:34:06 +02:00
Oliver Smith
c7a7fee909
pmb.helpers.pmaports.get_repo: "systemd" or None (MR 2405)
This function is used by "pmbootstrap repo_missing", which is only used
by bpo. In order to support building the split repository in bpo, this
patch is required.

Return "systemd" for the packages that are in extra-repos/systemd, and
None for all other packages (indicating that they don't get split into a
separate repository).

Checking the parent-parent dir of the APKBUILD is a bit fragile
(assuming we don't have subdirs in the systemd repository), but that
assumption was made with the previous implementation as well (would only
return "systemd" in that case). I don't see a better solution with
reasonable effort right now, given that we also support multiple
pmaports dirs. We can improve this in the future, meanwhile let's just
not use subdirs in the systemd repository.
2024-09-22 21:15:34 +02:00
Oliver Smith
61a9bdc813
pmb.helpers.pmaports.get_repo: drop must_exist (MR 2405)
The function is never called with must_exist=False, so drop it.
2024-09-22 21:15:06 +02:00
Oliver Smith
b25fa5a854
repo_missing: set try_other_arches to False
Don't attempt to find packages of other arches in repo_missing code.
This leads to unexpected results in general (we want to check if a
binary package exists for only one specific architecture!) - and in case
of master_staging_systemd, it current causes errors because pmbootstrap
tries to fetch armhf, riscv etc. APKINDEXes for which we don't build the
staging repositories.
2024-09-22 15:33:12 +02:00