Using pmbootstrap v3 with the old config can cause problems, for example
when having $WORK in the pmaports dir instead of the actual work path.
This is not supported anymore by v3 to reduce complexity. The format of
how mirrors are stored in the config also has changed.
Use a separate config file, so users can go back from v3 to 2.3.x if
they need to (for figuring out a regression) and so users won't run into
bugs when moving from 2.3.x to v3.
Since abuild is an implicit dependency of everything, we need special
case handling for it. Insert it as a dependency of the first package in
the build queue so that it will be built if outdated, then after
building re-install it in the chroot so all subsequent packages will use
the freshly built abuild.
This is currently used for systemd where we use an abuild fork
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
chroot's aren't automatically initialized when running a command in them
anymore. Add the explicit chroot.init() call before checksum.
Fixes#2395
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
During rework this got lost, re-incorporate it so packages built with
--src have a relevant pkgver.
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
As we don't call apk from outside of the chroot, the paths need to be
adjusted to be /mnt/pmbootstrap instead of the outside paths.
This should be reverted together with the other TEMP commit after we
upgraded apk to fix this properly (see issue 2388).
Fixes: f5122420 ("TEMP: chroot: apk: run apk through QEMU again (MR 2351)")
This revers b82c4eb167 ("chroot: always run apk static (MR 2252)")
since the current iteration of the apk-tools /usr merge patches
don't handle --root properly and will behave differently based on your
host systems directory structure (specifially for /usr merge).
This commit can be reverted once we fix apk-tools.
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
Add the missing runtime conversion when --config is given on the
cmdline.
This expects a pathlib.Path object as the argument, but args.config is
only a string.
Remove a bunch of commented out code:
* debug leftovers
* update_work(): a function that used to replace $WORK in all kinds of
arguments to pmbootstrap, with the actual work dir. This seemed like a
good idea when I made this initially, but in hindsight it's clear that
this made args just much more complex. I'm glad that Caleb removed
this. Now $WORK only gets removed in one place, for mount points,
which makes much more sense.
* args.from_argparse and related comment: pmbootstrap used to make a
full copy of its args, so in some cases it could go back before $WORK
was replaced IIRC. This isn't great, but even worse is that this
caused each stack trace to say something like infinite recursion on
args. I'm also glad that Caleb got rid of this :)
Since master_staging_systemd doesn't have its own channel, handle the
special case where the user ran pmbootstrap init while on the systemd
branch, with systemd enabled. In this case it's probably unintuitive to
switch pmaports to the master branch.
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
By using a TypeVar we can make mypy give proper hints for the arguments
and return type of cached functions, rather than just showing "Wrapper"
as the type.
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
* Cache the function so we only do the check once per-run
* check all chroot's at once so the message will be printed near the
start of output (rather than halfway through after building packages
or something).
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
Add a warn_once() function using Cache. Since we use f-strings
everywhere we don't really need the varargs.
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
Don't crash on master_staging_systemd (and in the future the merged
systemd branch) if "none" is selected as UI.
Fix for:
ERROR: Could not find aport for package: postmarketos-ui-none
The --aports argument gets parsed into a list, see
pmb/parse/arguments.py:
parser.add_argument(
"-p",
"--aports",
help="postmarketos aports (pmaports) path",
type=lambda x: [Path(p.strip()) for p in x.split(",")],
)
Adjust pmb.types to reflect this.
Fix for:
pmb/helpers/args.py:58: error: "Path" has no attribute "__iter__"; maybe "__enter__"? (not iterable) [attr-defined]
The aports argument is a list of paths now, so iterate over each of them
when checking if they exist.
Fix for:
INFO:root:ERROR: 'list' object has no attribute 'exists'
Move all kconfig rules from pmb.config to a separate toml file
pmb/data/kconfigcheck.toml. This is a fallback, pmbootstrap now prefers
loading kconfigcheck.toml from the currently checked out pmaports branch
if it exists.
This finally allows having separate kconfig check rules per pmaports
branch and makes the workflow of adjusting these rules much more
pleasant as the rules and kernel configs can just be adjusted at the
same time in pmaports!
This patch also moves the definition of what rules should be checked for
community and main devices, those that have pmb:kconfigcheck-community
in their linux APKBUILD, to the new kconfigcheck.toml. This should make
it much more intuitive, previously one needed to find the place in the
pmbootstrap source and edit it there.
Furthermore the "enforce_check" logic is removed. Previously pmbootstrap
would print warnings for failed config checks in some cases, but not
exit with error which was very confusing. Now exit 0 means all checks
passed and exit 1 means, that there is at least one error.
Use toml for the file, as discussed in pmbootstrap issue 2165. Python
3.11 has a native toml reader, use tomli for previous Python versions
for compatibility.
Prepare to move the kconfigcheck config into pmaports, so it can be
different per branch and so we can adjust it at the same time as
adjusting the kernel configs.
Once it is moved, pmbootstrap will not know the cateogry names in
advance anymore, so remove the logic for having category-specific
argument names.
In a future patch, we could add an option to manually override the
categories to be tested with one specific category (taking a string
argument), if there is demand for that.
this turns out to have never been set??? We have config.device anyways,
so let's use that instead.
Tweaked-by: Oliver Smith <ollieparanoid@postmarketos.org>
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
Python 3.10.12 fails without this patch:
File "/media/gompa/73d88639-a730-456c-a428-6d500b4020b7/pmbootstrap/pmb/parse/arguments.py", line 844 help="Alpine Linux mirror, default: " f"{default_config.mirrors["alpine"]}",
SyntaxError: f-string: unmatched '['
Related: https://peps.python.org/pep-0701/
(Commit message written by Oliver)
Instead of
[PosixPath('/home/newbyte/.local/var/pmbootstrap/cache_git/pmaports')]
you get
/home/neboula/.local/var/pmbootstrap/cache_git/pmaports
like before.
Fixes envkernel.sh failing during activation.
Closes https://gitlab.com/postmarketOS/pmbootstrap/-/issues/2378
Otherwise pmbootstrap can't run these a few lines later. I don't know
how this worked before, but this makes $ pmbootstrap kconfig migrate
function again.
crosscompile() in autodetect.py expects <arch> to be an Arch type
instead of a str, which is also probably what we want to move the entire
codebase towards. As such, let's convert this string into an Arch here.