Reusing this variable might lead to confusing bugs later if this code is
changed in the future, and also leads to mypy being confused about the
type of size_mb as it then gets assigned both str and int values.
At some point, this function was updated to use the Arch type instead of
plain strings, but the return type was left omitted and the docstring
outdated.
Flush the progress bar displayed by the function before logging a
warning message for 404 not found responses from the server. Without
flushing, this message gets lost.
In addition to the warning, display a NOTE and ERROR at the end to
explain what went wrong:
[20:16:50] Update package index for x86_64 (4 file(s))
[20:16:51] WARNING: file not found: http://mirror.postmarketos.org/postmarketos_get_404_test/edge/main/x86_64/APKINDEX.tar.gz
[20:16:51] NOTE: check the [mirrors] section in 'pmbootstrap config'
[20:16:51] ERROR: getting APKINDEX from binary package mirror failed!
Without handling this properly, pmbootstrap would fail slightly later
with a much less useful error:
[15:14:28] ERROR: expected str, bytes or os.PathLike object, not NoneType
Fixes: pmbootstrap issue 2424
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.
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>
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.
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>
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>
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.
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.
We now run the job in chroot, so remove the unnecessary check. If
sphinx-build is missing for some reason, it will fail a bit further in
the script anyways.
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.
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
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.
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
* 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
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]
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.
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.
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