1
0
Fork 1
mirror of https://gitlab.postmarketos.org/postmarketOS/pmbootstrap.git synced 2025-07-16 12:55:09 +03:00
Commit graph

2035 commits

Author SHA1 Message Date
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
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
Oliver Smith
476976ba14
helpers.package.get: pass try_other_arches along
Let the get() function pass the try_other_arches parameter when calling
itself, so it does not get lost.
2024-09-22 15:33:08 +02:00
Caleb Connolly
a79e52feeb
sideload: support doas (MR 2403)
Fall back to doas if sudo is not available.

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
2024-09-19 15:36:55 +02:00
Caleb Connolly
431f6ea14f
Revert "pmb.sideload: adapt sideload to support both doas and sudo (MR 2400)" (MR 2403)
This reverts commit 099a774190.
2024-09-19 15:36:55 +02:00
Oliver Smith
0478c30e5c
install: fix --no-local-pkgs
As chroot.glob() now returns a generator, convert it to a list first to
check if it is empty. This may not be the most efficient method, but
since we expect it to be empty here it is fine.

Without this patch, it always shows the error even if there are no
locally built packages:

  ERROR: --no-local-pkgs specified, but locally built packages found. Consider 'pmbootstrap zap -p' to delete them.
2024-09-19 02:09:43 +02:00
Oliver Smith
9cec60e057
lint: raise error if linter fails (MR 2398)
Fix that pmbootstrap exits with 0 on linter failure. Let it raise an
error instead (which results in exit != 0).
2024-09-18 17:02:19 +02:00
Oliver Smith
806d9a3925
build: package: fix missing f for f-string 2024-09-18 16:32:03 +02:00
Caleb Connolly
a5617cb110
pmb/data/merge-usr: relative symlink targets (MR 2402)
Make sure the symlinks are correct when not inside the chroot, they
should be relative!

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
2024-09-18 13:34:13 +02:00
Oliver Smith
0931eb924b
build: package: fix built pkgs count not going up
Fix #2448
2024-09-17 17:00:09 +02:00
Oliver Smith
b462a781ff
build: package: remove obsolete FIXME comment (MR 2388)
Logic for breaking dependency loops with existing binary packages is now
implemented, so remove the related comment.
2024-09-17 02:35:12 +02:00
Oliver Smith
fcbc96b2f1
build: package: proper missing dep error (MR 2388)
When a dependency cannot be found in source or binary packages of the
selected architecture, then don't look for binary packages in other
architectures package indexes.

This leads to a confusing error down the line when building packages for
extra_repos_systemd (and e.g. stable branches), because we don't have
binary packages for all arches that pmbootstrap supports, and so it
tries to fetch a non-existing APKINDEX.

Instead, print a nice error about a non-existing dependency.
2024-09-17 02:27:45 +02:00
Oliver Smith
94d917681e
pmb/data/merge-usr: fix cannot overwrite error (MR 2388)
Don't just run one "mv" command to move everything from source to
target. This fails if the same directory already exists in target.
Instead, go into each directory in source, and move all files inside
that directory into the target directory structure.

Fix the following error:
  mv: cannot overwrite '/home/user/.local/var/pmbootstrap/chroot_native/usr/lib/sysctl.d': Directory not empty
2024-09-17 02:27:45 +02:00
Oliver Smith
9a50d3398d
pmb/data/merge-usr: deduplicate code (MR 2388)
Create a common merge() function that can be adjusted in the next patch,
because the logic for merging needs to be more complicated now.
2024-09-17 02:27:45 +02:00
Oliver Smith
f38d525538
pmb.chroot.apk: better error for mising apk-tools (MR 2388)
Currently the usr-merge script fails, and this leads to a very confusing
error when running pmbootstrap the next time:

  (stack trace)
  KeyError: 'apk-tools'

Show a more helpful error instead.
2024-09-17 02:27:44 +02:00
Oliver Smith
0109af5245
prioritise_build_queue: subpkgs -> main pkgs (MR 2388)
Adjust the dependency resolver, so it uses the main pkgnames in
dependency resolution, instead of subpackages. This fixes for example
that it couldn't find -dev packages even though the binary packages for
those existed.

> systemd: missing dependency linux-pam-dev, trying to queue other packages first
> linux-pam: missing dependency systemd-dev, trying to queue other packages first
> dbus: missing dependency systemd-dev, trying to queue other packages first
2024-09-17 02:27:44 +02:00
Oliver Smith
7c4c63f9fc
build: package: split has_cyclical_dep in function (MR 2388)
Split has_cyclical_dependency logic into an extra function, so it is
easier to read.
2024-09-17 02:27:44 +02:00
Oliver Smith
b76963ab03
pmb: build: add debug log about missing deps (MR 2388)
Have messages like the following in "pmbootstrap log" to better
understand why resolving packages fails. The bug with -dev pkgs not
being recognized will be fixed in a follow-up patch.

> systemd: missing dependency linux-pam-dev, trying to queue other packages first
> linux-pam: missing dependency systemd-dev, trying to queue other packages first
> dbus: missing dependency systemd-dev, trying to queue other packages first
2024-09-17 02:27:44 +02:00
Oliver Smith
22865fdfa7
build: package: rename do_continue -> missing_deps (MR 2388)
Make the code easier to understand with a more meaningful variable name.
2024-09-17 02:27:44 +02:00
Oliver Smith
9542ed006d
build: package: better error for remaining pkgs (MR 2388)
List each pkgname in a new line, instead of having a one line list of
dictionaries with lots of attributes.
2024-09-17 02:27:44 +02:00
Oliver Smith
de7fdf6c97
build: package: add warning for cyclical build dep (MR 2388)
Print a warning when breaking cyclical dependencies, for example with
current kde-nightly branch:

> WARNING: cyclical build dependency, building kirigami with binary package of qqc2-desktop-style
2024-09-17 02:27:44 +02:00