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

2035 commits

Author SHA1 Message Date
Oliver Smith
3ead8f8859
migrate_work_folder: print suffix in migration msg (MR 2460) 2024-10-27 20:47:06 +01:00
Oliver Smith
60cae5811b
migrate_work_folder: 7-2.x: skip update git url 2x (MR 2460)
Don't update the git URL again when coming from 7-2.x where this step
was already done. This didn't fail, but was potentially confusing for
the user since the git URLs were already upgraded from 7 -> 7-2x.
2024-10-27 20:47:00 +01:00
Caleb Connolly
50321d41f6
build: package: skip prioritizing deps of pkg which are a subpkg of pkg (MR 2459)
Some packages in aports have their own subpackages in their
dependencies, for some reason. This causes our resolver to assume there
is a cyclical dependency.

Adjust the resolver to safely ignore these dependencies, since they'll
be built as a part of the package that depends on them.

For example, modemmanager depends on libmm-glib which is a subpackage of
modemmanager. Currently to build modemmanager in pmaports it would be
necessary to manually modify the APKBUILD after copying it from aports.
This change avoids that.

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
2024-10-27 19:36:04 +01:00
Caleb Connolly
acc989de65
commands: getattr autoinstall (MR 2461)
args.autoinstall attribute might not exist, use getattr like for others,
and add a fixme about the default value...

Fixes: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/issues/2476
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
2024-10-27 18:59:42 +01:00
Newbyte
9f5642fd44
pmb.helpers.args: Remove please_i_really_need_args() (MR 2442)
All call sites that use this have been removed. This was only introduced
as a stopgap until we could refactor more code to not use args
everywhere, and that has now been achived. As such, remove this so it
doesn't get used in more locations.
2024-10-27 17:49:15 +01:00
Caleb Connolly
657c25c904
build: package: error when --src and --arch but no APKBUILD (MR 2458)
See
https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/issues/2473

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
2024-10-27 17:03:00 +01:00
Caleb Connolly
d4d7ba0368
test: parse: apkindex: check that cache works (MR 2455)
Add a basic test to ensure that the cache does get hit as we expect.
This doesn't test for cache conflicts.

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
2024-10-27 16:42:54 +01:00
Caleb Connolly
12f9e43a08
parse: apkindex: don't require python 3.12 (MR 2455)
Use a different way of keying the apkindex path cache.

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
2024-10-27 16:42:49 +01:00
Caleb Connolly
2106e13f97
build: package: allow building old versions of packages with --force (MR 2457)
It may be desirable to test older versions of packages, allow them to be
built when --force is specified and print a warning that they won't be
installed automatically.

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
2024-10-27 16:17:12 +01:00
Vikram Alagh
8ac2e48a21
install: losetup: check if the back-file attribute for a loop device is null (MR 2456)
Seems to be ChromeOS specific:

> this happens every time on my machine. I am on ChromeOS 129.0.6668.112
> using a Debian bookworm chroot through Crouton. I am not sure why
> this is happening nor which layer is responsible for this. I deleted
> the chroot and created another one but the problem persists.

Commit msg tweaked by Oliver.
2024-10-27 16:03:17 +01:00
Newbyte
3c47a52f91
pmb.install.losetup: Remove debug print (MR 2450)
Looks like an unintended leftover from debugging.

---

This was needlessly reverted by
1ec55fc11a. While revreting
0975d06437 was good, this commit did not
cause any harm.
2024-10-27 13:14:11 +01:00
Newbyte
bbf20a030b
pmb.install.losetup: Annotate return types (MR 2430) (MR 2450)
And fix type errors.

---

This was needlessly reverted by
1ec55fc11a. While revreting
0975d06437 was good, this commit did not
cause any harm.
2024-10-27 13:14:11 +01:00
Newbyte
e0a2fbf28c
pmb.config: Check for kpartx and losetup with --json support (MR 2450)
Running these inside the chroot is tricky, and we ended up reverting
previous commits that attempted to make them run there (see
1ec55fc11a). As such, just accept defeat
and ensure that the host has these.

Also see https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/issues/2465
2024-10-27 13:14:10 +01:00
Newbyte
612e212a5b
pmb.config.init: Use NonBugError if programs are missing (MR 2450)
We fully expect this to happen if a user hasn't configured their host
system properly. As such, don't treat it like a programming error.
2024-10-27 13:13:10 +01:00
Newbyte
ddd920b1b5
pmb.config.init: Add more type hints (MR 2434) 2024-10-27 00:38:16 +02:00
Newbyte
82a9059dc8
pmb.config.init: Don't convert sudo timer return value to str (MR 2434)
config.sudo_timer is a bool, and the returned value here is a bool. No
point in converting it to a str.
2024-10-27 00:38:16 +02:00
Newbyte
ca5c77fa20
pmb.core.config: Fix type of jobs variable (MR 2434)
I don't think there's any case where the number of jobs would have to be
a string. It's also being assigned an integer elsewhere the code (in
ask_for_additional_options() inside of init.py), so an integer seems
like what we actually want. Also fix type errors resulting of this.
2024-10-27 00:38:16 +02:00
Newbyte
9467c8008c
pmb.config.init: Fixup strings (MR 2434)
These are artefacts from when our line length was shorter. Ruff didn't
really do a great job at fixing them up when autoformatting.
2024-10-27 00:38:16 +02:00
Newbyte
9348cacff5
pmb.helpers.mount: Add more type hints (MR 2434) 2024-10-27 00:38:16 +02:00
Luca Weiss
a1e982aa1e
pmb.helpers: Handle workdir version suffix from 2.3.x (MR 2447)
For the gitlab.com -> gitlab.postmarketos.org migration we needed to
also migrate the workdir in pmb v2 since pmb v3 is not ready yet.

Therefore we need to handle that "7-2.x" workdir version and migrate
correctly when switching to pmbootstrap v3.

See https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2445
2024-10-26 15:53:45 +02:00
Clayton Craft
83d6a26291
pmb.config: add the full hexdump to the list of installed build packages (MR 2454)
This works around https://gitlab.postmarketos.org/postmarketOS/
pmaports/-/issues/3268, by always installing hexdump when building
packages. The full hexdump is small (like 80KB), and even though this
isn't required in most situations it seems like the best of a group
of bad workarounds, until upstream/busybox fix the bug in the pmaports
issue.
2024-10-24 09:39:37 -07:00
Caleb Connolly
8627ee7e73
test: parse: add test_apkindex (MR 2448)
Add a test to parse some APKINDEX data.

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
2024-10-23 23:22:04 +02:00
Caleb Connolly
a874025bbe
parse: apkindex: fix provider_priority type (MR 2448)
should be an int, but was always a string...

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
2024-10-23 23:17:03 +02:00
Caleb Connolly
da78b11dfd
core: drop unused crosstool.py (MR 2448)
I guess this is leftover from some experimentation.

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
2024-10-23 23:16:28 +02:00
Caleb Connolly
b151871976
test: chroot: apk: fix missing return in _apkindex_package() (MR 2448)
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
2024-10-23 23:16:28 +02:00
Newbyte
37ec73c07c
pmb.flasher: Remove use of args (MR 2441)
Also adapt pmb/install/recovery.py to new API for variables.py.

[ci:skip-build]: already built successfully in CI
2024-10-22 15:12:40 +02:00
Clayton Craft
2305cc5db6
pmb.parse.apkindex: fix crash when origin or timestamp are unset (MR 2449)
Sometimes these fields are not set, e.g.:

pdb> p ret
{'depends': ['build-base', 'bash', 'bison', 'findutils', 'flex', 'musl-dev', 'openssl-dev', 'perl', 'python3'], 'arch': 'noarch', 'version': '20241022.022230', 'pkgname': '.makedepends-linux-lenovo-21bx', 'provides': []}

I hit this crash when I installed the build deps for the
linux-lenovo-21bx package in the native chroot, and then ran
`pmbootstrap stats`
[ci:skip-build]: already built successfully in CI
2024-10-22 11:11:28 +02:00
Newbyte
11c7d23575
pmb.parse.arguments: Make -x and -n mutually exclusive in kconfig edit (MR 2346)
It doesn't make sense to both request the nconfig UI and the xconfig UI
at the same time. Make them mutually exclusive.
2024-10-22 00:04:33 +02:00
jane400
afb036da0d
pmb.kconfig: refactor to remove args (MR 2346)
Co-authored-by: Stefan Hansson <newbyte@postmarketos.org>

Closes https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/issues/2402
2024-10-22 00:04:32 +02:00
Luca Weiss
35cd64086f
Improvements to documentation (MR 2440)
* Make sure all Python modules are documented by adding a bit of shell
  to .ci/docs.sh
* Remove non-existing module references from .rst
* Fix various warnings from sphinx by adjusting Python docstrings
* Add class member docs to ApkindexBlock
2024-10-21 21:46:26 +02:00
Clayton Craft
c7a97df79a
pmb.core.arch: add noarch (MR 2446)
When a `noarch` APKBUILD is changed in local pmaports, `pmb install`
will build it automatically but image creation will fail with the
following error:

```
$ pmbootstrap install
...
[12:00:43] Build is necessary for package 'postmarketos-base-ui': binary package out of date (binary: 28-r6, local pmaports: 29-r0)
[12:00:48] => edge/postmarketos-base-ui: Done!
...
[12:01:02] (rootfs_lenovo-21bx) % apk --no-progress --repository /home/clayton/.local/var/pmbootstrap/packages/edge add -u --virtual .pmbootstrap /mnt/pmbootstrap/packages/edge/aarch64/postmarketos-base-ui-wifi-iwd-29-r0.apk /mnt/pmbootstrap/packages/edge/aarch64/postmarketos-base-ui-qt-wayland-29-r0.apk /mnt/pmbootstrap/packages/edge/aarch64/postmarketos-base-ui-qt-tweaks-29-r0.apk /mnt/pmbootstrap/packages/edge/aarch64/postmarketos-base-ui-29-r0.apk /mnt/pmbootstrap/packages/edge/aarch64/postmarketos-base-ui-audio-none-29-r0.apk /mnt/pmbootstrap/packages/edge/aarch64/postmarketos-base-ui-networkmanager-29-r0.apk /mnt/pmbootstrap/packages/edge/aarch64/postmarketos-base-ui-wifi-iwd-29-r0.apk --no-interactive
...
[12:01:04] ERROR: Invalid architecture: 'noarch', expected something like: x86_64, aarch64, riscv64, armhf, x86, armv7
[12:01:04] See also: <https://postmarketos.org/troubleshooting>
[12:01:04] Traceback (most recent call last):
  File "/home/clayton/src/pmbootstrap/pmb/core/arch.py", line 42, in from_str
    return Arch(arch)
           ^^^^^^^^^^
  File "/usr/lib/python3.12/enum.py", line 757, in __call__
    return cls.__new__(cls, value)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/enum.py", line 1171, in __new__
    raise ve_exc
ValueError: 'noarch' is not a valid Arch

```

[caleb: fixed tests]
2024-10-21 21:41:16 +02:00
Luca Weiss
327010cff1
pmb.parse.apkindex: Add missing type hints in package() (MR 2438)
Make sure to annotate the parameters.
2024-10-21 21:05:18 +02:00
Luca Weiss
9a5b5fc5e1
pmb.helpers.pkgrel_bump: Add type hints and fix auto_apkindex_package (MR 2438) 2024-10-21 21:05:17 +02:00
Luca Weiss
99f770d27c
pmb.core.apkindex_block: Don't mark depends as optional (MR 2438)
In the code where the object is made (pmb/parse/apkindex.py) depends
already will become an empty array when there's no dependencies.

And there's no point in having a differentiation between None and empty
array.
2024-10-21 21:05:17 +02:00
Luca Weiss
3df0be358f
Replace gitlab.com with gitlab.postmarketos.org (MR 2443)
Try to finish the migration by changing various links and texts to point
to the new GitLab instance.
2024-10-21 18:12:21 +02:00
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
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
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
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