For some reason this also requires a fix in pmb.install._install.py,
didn't bother investigating why but the necessary change seems fine to
me.
Requires mypy 1.14 (maybe 1.14.1, not sure).
Presumably, args and kwargs are just here to retain compatibility with
add_argument() from argparse.ArgumentParser, but they aren't actually
used and consequently only give the illusion of compatibility. Just
remove them to simplify the function signature.
Previously, value would sometimes be a string despite the docstring
clearly stating that it should be an integer. This seems to have been a
consequence of literally copying the original C code without considering
that strings work differently between the languages, where the
original assigning a character in a string to an integer results in the
integer having the ASCII value of that character, in Python you just get
the string value of that character. As such, match the original
implementation by explicitly converting from a string to an integer
using ord(), which gives the Unicode code of the provided character.
It is not clear to me why this disparity didn't cause any issues beyond
type errors found by mypy.
See 5d796b5678/src/version.c (L101)
The file version.c in modern apk-tools does not at all resemble this
file. Link to one from around the time when this code was written to
make cross-referencing easier.
Also, switch from cgit to GitLab because I couldn't be bothered to
figure out how to go through file revisions on cgit.
This might have saved me a couple of minutes of debugging, at least.
While working with the aportgen code I had two distinct issues:
1. APKINDEX was outdated, so I got an error about not being able to
download the supposedly latest version of BusyBox as it no longer
existed on Alpine's mirror.
2. APKINDEX had not been created by any other command, so aportgen
would tell me that it couldn't find the "busybox" package.
The changes in this commit resolves both of these issues from my
testing.
These were almost identical across the Busybox, GRUB EFI, and musl
generators. Unify them by creating functions they all (and any future
aportgen generators) can call instead of having to maintain three
separate copies of this code.
When lk2nd is a dependency of a device subpackage (e.g. a mainline
kernel subpackage), it is not detected.
If no lk2nd pacakge is found, also parse the dependencies of all
subpackages.
Signed-off-by: Alexandre Messier <alex@me.ssier.org>
pmb.helpers.cli.ask() returns a string, so previously this function was
just lying about its return type (which happened to be fine in the
context it was used, but still not what we want).
pmb.helpers.cli.ask() takes a string and only work with Path by
accident, so explicitly convert <default> to a string if it is not None.
Additionally, while this function claimed to return a Path, it actually
returned a string, so fix that too.
Otherwise mypy gets confused by the type later in the code, and I also
think it might be confusing behaviour in general that <options> gets
overwritten in this loop.
The parameters of this function were needlessly complicated. While I
understand the intent of trying to replicate the API of retrieve()
without duplicating the parameter list, in practice this feels like
reducing duplication to a fault to me. This is due to that the third
parameter, <allow_404>, doesn't make sense in the context of
retrieve_json() as it would raise an exception[1] if retrieve() returns
None (which is the effect of <allow_404> when a 404 occurs), thus merely
changing the exception that gets raised to a less descriptive one
instead of actually behaving like retrieve() would with that parameter
set to True.
With <allow_404> eliminated, there's just two parameters left, and I
don't think duplicating those is a big deal. So make the function easier
to read and annotate by getting rid of the args/kwargs logic.
[1]: json.loads() raises an exception if its first argument is None
Devices using fastboot-bootpart typically boot directly from the boot file
system. They might still support "fastboot boot" though, which can be used
to boot a modified kernel more easily. Enable this similar to the existing
"flash_boot" action.
Prepare a new release, so pmbotostrap can be used with Alpine 3.21 /
postmarketOS v24.12. Also the big rewrite is done, so we can do more
frequent releases again.
Related: https://wiki.postmarketos.org/wiki/Pmbootstrap_release
Add module that provides utilities and information related to localization.
Initial implementation includes code to generate keyboard configs
for locale set by user.
Fix the following:
WARNING: Failed to import pmb.commands.kconfig_check.
WARNING: Failed to import pmb.commands.kconfig_edit.
WARNING: Failed to import pmb.core.crosstool.
Crosstool has been dropped and kconfig_check/_edit code has been merged
into a kconfig module.
Do not abort if one or more APKINDEX files cannot be downloaded, if
PMB_APK_FORCE_MISSING_REPOSITORIES is set. This is needed when
bootstrapping new stable branches. The same environment variable is
already used in pmbootstrap code to pass --force-missing-repositories to
apk in pmb.chroot.apk.install_run_apk().
the kernel has pending patches in -next which adjust the generated
Makefile in the output directory to include the source tree makefile
with an absolute path, this breaks envkernel which relies on it being a
relative path.
Fix this by mounting our own Makefile instead using the relative path.
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
Pmbootstrap finds all its host dependencies during init, ensure we do
that for pytest too.
Adapt require_programs() to use subprocess directly rather than have to
solve the weird dependency chain of pmb.helpers.run which depends on the
global context being initialised before it's usable.
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
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>
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>
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>
This test includes a binary blob which we want to avoid in our codebase.
It is also better suited as a unit test where it can contribute to code
coverage. Revert this and use a unit test version instead.
This reverts commit d19de946b3.