1
0
Fork 1
mirror of https://gitlab.postmarketos.org/postmarketOS/pmbootstrap.git synced 2025-07-13 03:19:47 +03:00
Commit graph

3230 commits

Author SHA1 Message Date
Newbyte
0752a202aa
pmb.core.arch: Handle unsupported arches in from_machine_type() better (MR 2498)
Closes https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/issues/2501
2024-11-29 10:43:09 +01:00
Newbyte
8012b3cefe
pmb.core.arch: Use match statement instead of mappings (MR 2498)
I think this is easier to read and has more obvious error handling.
2024-11-29 10:43:05 +01:00
Jens Reidel
828f80056e
qemu: run: Add support for ppc64le (MR 2476)
Signed-off-by: Jens Reidel <adrian@travitia.xyz>
2024-11-25 14:27:10 +01:00
Jens Reidel
1e3e41907f
qemu: run: Invoke the correct qemu command (MR 2476)
pmbootstrap qemu did not respect architecture-specfic QEMU command name
mappings.

Signed-off-by: Jens Reidel <adrian@travitia.xyz>
2024-11-25 14:27:10 +01:00
Jens Reidel
13d8154373
core: arch: Add ppc64le qemu mapping (MR 2476)
Signed-off-by: Jens Reidel <adrian@travitia.xyz>
2024-11-25 14:26:59 +01:00
Jens Reidel
822e89ed13
helpers: pmaports: Always fall back to parsing all APKBUILDS (MR 2476)
Previously, it would only fall back to parsing all APKBUILDs if a main
package was guessed for this potential subpackage. We do however want to
scan all APKBUILDs in case the package is provided by one of the
packages in pmaports.

Signed-off-by: Jens Reidel <adrian@travitia.xyz>
2024-11-25 13:09:53 +01:00
Jens Reidel
4b4ba1e6ec
core: arch: Add ppc64le as a supported architecture (MR 2476)
Signed-off-by: Jens Reidel <adrian@travitia.xyz>
2024-11-25 13:08:50 +01:00
Jens Reidel
e2354ec26f
helpers: pmaports: Fix package detection for cross g++ and musl-dev (MR 2476)
g++ is a subpackage of gcc, but cannot be detected as such easily by
pmbootstrap. This is because g++ is not gcc-g++ or any other variant of
such package names. Similarly, the detection for musl-dev-ppc64le and
other architectures is broken, since the -dev suffix detection does not
work if there is an architecture suffix.

To fix it, add special case handling for cross toolchain and packages
and have that fixup the -dev cases and hardcode g++ as a subpackage of
gcc.

To reproduce:
- Generate ppc64le cross packages:
  pmbootstrap aportgen gcc-ppc64le musl-ppc64le
- Build a package (to trigger building cross compilers):
  pmbootstrap build hello-world --arch=ppc64le

Signed-off-by: Jens Reidel <adrian@travitia.xyz>
2024-11-25 13:08:50 +01:00
Jens Reidel
9ca0ada582
core: chroot: Deduplicate supported arch list (MR 2476)
self.arch is a property and calls Arch.from_str, which errors upon
encountering an unknown architecture. Therefore, the error message is
changed and needs to be adjusted in the tests. Since Arch.supported is a
set, error messages were not deterministic before, so we need to sort
the list of architectures now.

Signed-off-by: Jens Reidel <adrian@travitia.xyz>
2024-11-25 13:08:50 +01:00
Jens Reidel
6d72043ac2
tests: Assert that riscv64 is supported (MR 2476)
riscv64 is supported but currently not covered by the arch test suite.

Signed-off-by: Jens Reidel <adrian@travitia.xyz>
2024-11-25 13:08:50 +01:00
Robert Eckelmann
07592b2ab6
.ci/docs.sh: add py3-sphinxcontrib-jquery to fix the failing search (MR 2500)
Signed-off-by: Robert Eckelmann <longnoserob@postmarketos.org>
2024-11-24 18:30:06 +09:00
Caleb Connolly
91f0a4feeb
build: newapkbuild: initialize chroot before use (MR 2495)
Otherwise abuild will try and fail to create /dev/null

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
[ci:skip-build]: already built successfully in CI
2024-11-22 12:18:52 +01:00
Caleb Connolly
04635dcb3e
build: envkernel: cleanup behaviour (MR 2491)
recent changes to the kernels build infra in -next seem to have exposed
some issues with "pmbootstrap build --envkernel", specifically in the
case where the APKBUILD doesn't build out-of-tree.

We used to rely on the fact that the kernel output directory contains a
Makefile which points to the source directory, however this Makefile
now(?) contains an absolute path on the host, which won't match what's
in the chroot.

As a result, it's now necessary to build with the same output directory
as the APKBUILD.

We probably need some smarter code here... and/or more consistent
APKBUILDs.

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
2024-11-20 22:49:32 +01:00
Stephan Gerhold
60da40232d
pmb/aportgen: lookup package in APKINDEX with correct arch (MR 2493)
This can otherwise fail if the package was only built for some
architectures so far, but not for the architecture that is being generated.

E.g. right now musl-1.2.5-r6 was built already for x86_64 but not aarch64,
which causes errors like the following when running "pmbootstrap aportgen
musl-x86_64" on aarch64:

>>> musl-x86_64: Fetching musl-1.2.5-r5-x86_64-edge.apk::http://dl-4.alpinelinux.org/alpine//edge/main/x86_64/musl-1.2.5-r5.apk
Connecting to dl-4.alpinelinux.org (147.75.40.42:80)
Connecting to dl-4.alpinelinux.org (147.75.40.42:443)
wget: server returned error: HTTP/1.1 404 Not Found
>>> ERROR: musl-x86_64: checksum failed
2024-11-20 22:05:02 +01:00
Oliver Smith
6836a55d60
pmb.config.apk_tools_min_version: add v3.21 2024-11-18 20:25:41 +01:00
Iuri Jikidze
215dfcc663
pmb.helpers.git: fix get_upstream_remote() (MR 2496)
Fixes bec2a4b154

[ci:skip-build]: already built successfully in CI
2024-11-18 12:16:42 +01:00
J. Pablo Navarro
bec2a4b154
helpers: git: ignore case in get_upstream_remote() 2024-11-18 04:12:38 +01:00
Newbyte
472726a9dc
pmb: Add more type hints (MR 2489) 2024-11-14 23:16:29 +01:00
Newbyte
0e9a2e596f
pmb.config.init: Call pmb.helpers.cli.confirm() correctly (MR 2489)
"y" only works here by accident as it's considered truthy by Python and
as such gets handled equivalently to True in the current implementation
of pmb.helpers.cli.confirm(), but it's still relying on unintended
behaviour. Change this to use a bool as intended.
2024-11-14 22:34:52 +01:00
Oliver Smith
79c6e4c36d
Prepare 3.0.0 release 2024-11-10 19:13:39 +01:00
Oliver Smith
cfa455cc5e
zap: cache_clean: get apk.static if missing (MR 2481)
After extending CI to always run "pmbootstrap zap -a" it revealed
another bug: we did not ensure at this point that apk.static is
available. Rung apk_static.init() to ensure it gets downloaded and
extracted at this point if it is missing.
2024-11-10 18:22:43 +01:00
Oliver Smith
7a5c04f660
ci/integration: run "zap -a" afterwards (MR 2481)
Make sure we don't regress in "pmbootstrap zap -a" by running it after
each integration test.
2024-11-10 18:22:43 +01:00
Oliver Smith
506b7685c2
Fix pmb zap -a permissions error (MR 2481)
The tmp dir is owned by root, when it gets created earlier by apk
running as root to store the apk progress fifo. Use another directory to
work around this for now (getting close to the 3.0.0 release), we can
rework the apk progress fifo later on if we want.

Fixes: issue 2491
2024-11-10 18:22:38 +01:00
Oliver Smith
2a7864b080
Tweak messages for 'Could not find aport' (MR 2480)
Replace aports -> pmaports in these messages.

$ pmbootstrap build systemd
[17:37:02] NOTE: The package 'systemd' exists in extra-repos/systemd, but systemd is currently disabled
[17:37:02] ERROR: Could not find package 'systemd' in pmaports
2024-11-10 17:43:39 +01:00
Oliver Smith
67318823b5
pmaports.find: show extra-repos/systemd hint (MR 2480)
If the user tries to build a package, but it can't be found: check if
systemd is disabled and the package is in extra-repos/systemd, display a
hint about it.

$ pmbootstrap build systemd
[17:33:53] NOTE: The package 'systemd' exists in extra-repos/systemd, but systemd is currently disabled
[17:33:53] ERROR: Could not find aport for package: systemd

Fixes: issue 2398
2024-11-10 17:43:39 +01:00
Oliver Smith
0a0f6ead33
Replace skip_extra_repos -> with_extra_repos (MR 2480)
Replace the boolean skip_extra_repos with a new with_extra_repos
argument that can be default, enabled or disabled.

This will be used to explicitly enable extra repos in a package search
even if systemd is currently disabled, so we can display a hint when a
package was not found because systemd is disabled in a follow-up patch.
2024-11-10 17:43:39 +01:00
Oliver Smith
444d9e256f
pmaports._find_apkbuilds: use new cache logic (MR 2480)
Use the nice @Cache decorator that Caleb introduced earlier.
2024-11-10 17:43:39 +01:00
Oliver Smith
214abed0bb
gitignore: add junit.xml (MR 2480) 2024-11-10 17:43:39 +01:00
Oliver Smith
7b5487dad8
Revert "test: aportgen: test deviceinfo fastboot content (MR 2477)" (MR 2482)
This caused a regression in CI tests.
This reverts commit 6ee82740a4.

Related: issue 2497
2024-11-10 17:23:00 +01:00
Oliver Smith
1b4c38a01d
Revert "test: parse: add tests for bootimg parsing (MR 2477)" (MR 2482)
This caused a regression in CI tests.
This reverts commit ae35603197.

Related: issue 2497
2024-11-10 17:23:00 +01:00
Oliver Smith
c8763a630b
Revert "test: conftest: adjust pmaports fixture (MR 2477)" (MR 2482)
This caused a regression in CI tests.
This reverts commit b888ddde30.

Related: issue 2497
2024-11-10 17:22:55 +01:00
Caleb Connolly
6ee82740a4
test: aportgen: test deviceinfo fastboot content (MR 2477)
Add some tests to ensure that we spit out correct deviceinfo options for
boot images of header v0, 2, and 3.

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
2024-11-08 01:57:26 +01:00
Caleb Connolly
ae35603197
test: parse: add tests for bootimg parsing (MR 2477)
Add some unit tests to ensure that the parser correctly detects boot
images with header v0, 2, and 3.

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
2024-11-08 01:57:26 +01:00
Caleb Connolly
b888ddde30
test: conftest: adjust pmaports fixture (MR 2477)
make sure that calls to get_upstream_remote() will succeed by setting
pmb.config.git_repos() for the entire run. This might pollute some other
tests...

TODO: make less things depend on pmaports being cloned...

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
2024-11-08 01:57:26 +01:00
Caleb Connolly
29b9a57cd6
test: conftest: describe paramaterize for config_file (MR 2477)
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
2024-11-08 01:57:26 +01:00
Caleb Connolly
953f84a79a
parse: bootimg: make it work again (MR 2477)
Commit 826bb4f2dd (pmb: Properly type Bootimg (MR 2464)) broke the
bootimg_analyze command since some assumptions in whether the bootimg
dictionary had empty keys or non-existent keys were changed without
their usage being updated.

Fix this and apply a trivial cleanup to aportgen.

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
2024-11-08 01:57:26 +01:00
Robert Eckelmann
4ecd45749d
docs: add section on ssh-key handling (MR 2251)
Signed-off-by: Robert Eckelmann <longnoserob@postmarketos.org>
2024-11-07 01:14:29 +01:00
Luca Weiss
26f9d56b20
pmb.config: Print ssh keys filenames that will be copied during init (MR 2251)
Make it clear to the user which SSH keys get copied to the device, and
also link to the wiki page that tells the user how to change
ssh_key_glob.
2024-11-07 01:14:06 +01:00
Luca Weiss
49fd496c94
pmb.config: Set default ssh_key_glob to *.pub (MR 2251)
When generating an ssh key it's simple to change the name of the key to
something that's not e.g. id_rsa.pub or id_ed25519.pub, so let's try to
capture ssh keys for more users.
2024-11-07 01:14:06 +01:00
Luca Weiss
ca9610a153
pmb.config: use ssh_key_glob for ask_for_ssh_keys (MR 2251)
Since a user can modify the glob to be somewhat arbitrary, use that to
check if any ssh keys exist and ask in pmbootstrap init.

Otherwise ssh_key_glob would only work if it was a subset of
~/.ssh/id_*.pub, so e.g. ~/.ssh/id_foo.pub but ~/.ssh/foo.pub wouldn't
work.
2024-11-07 01:14:02 +01:00
Newbyte
d19de946b3
CI: Add bootimg analysis integration test (MR 2467) 2024-11-07 00:43:09 +01:00
Oliver Smith
ee154ccdf9
require_programs: losetup --json: set output=null (MR 2475)
We don't care about the output of "losetup --json" here, we just want to
make sure that the argument exists. If it does not exist, we already
give an error to the user.

Set the output to null so it does not clutter the log since it runs with
every pmbootstrap command now.
2024-11-06 23:53:33 +01:00
Oliver Smith
54e55f26ef
require_programs: run losetup with absolute path (MR 2475)
Use the absolute path for it, so it works in Debian too as we run it
without sudo here to just check if the argument is supported.
2024-11-06 23:53:33 +01:00
Caleb Connolly
765ba770dd
chroot: merge executibles_absolute_path() logic into require_programs() (MR 2475)
Remove this chroot-specific helper and merge it in with the existing
require_programs() logic. Now we have one unified way to discover and
use programs from the host and where we can put any additional special
handling we might need.

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
2024-11-06 23:53:33 +01:00
Caleb Connolly
585c477239
config: find required programs every time pmbootstrap is run (MR 2475)
On debian systems in particular special handling is needed for
/usr/sbin. Let's do this once and then provide the host deps we use in a
nice accessible dictionary.

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
Tweaked-by: Oliver Smith <ollieparanoid@postmarketos.org>
2024-11-06 23:53:33 +01:00
Oliver Smith
c4194759f5
require_programs: Debian: find kpartx and losetup (MR 2475)
In Debian, /usr/sbin is not in PATH of regular users unless using sudo.
Fix that pmbootstrap won't find kpartx and losetup in /usr/sbin, and
complains about these even though they are installed.

Fixes: issue 2489
2024-11-06 23:53:29 +01:00
Oliver Smith
ef9d618199
README.md: remove deviceinfo_parse (MR 2469)
The command has been removed, so remove it from README.md too.
2024-11-05 00:18:33 +01:00
magdesign
d59a60acca
docs: update chroot/debugging/usage (MR 2469)
Add the content from README.md to these files.

Tweaked-by: Oliver Smith <ollieparanoid@postmarketos.org>
2024-11-05 00:17:58 +01:00
Caleb Connolly
515fd99552
CI: combine lint and test stages (MR 2478)
While there are places where it would make some sense to catch issues in
the lint stage, most of the lint failures are things like shellchcek or
ruff which don't actually effect the functionality of the code.

Let's just run pytest at the same time as these to speed up the overall
pipeline.

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
2024-11-04 10:47:15 +01:00
Caleb Connolly
e268ec24d5
pytest: generate coverage and junit reports (MR 2478)
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
2024-11-04 10:46:11 +01:00