Set "stuck = False" in the "while disarray and not stuck" loop
directly, instead of setting it in the queue_item() function that gets
called from it. This way the loop logic can be understood without
looking at queue_item().
Most of the time when building it's reasonably safe to fall back on an
older binary package for building in order to break cyclical
dependencies (e.g. dbus and systemd depend on each other at build time,
but it's safe to build both against older versions of the other).
Implement the necessary logic to break cyclical dependencies by
detecting them and checking for the existence of a binary package.
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
Tweaked-by: Oliver Smith <ollieparanoid@postmarketos.org>
Decide the order to build packages in by looking through the build queue
and making sure dependencies are queued before any packages that depend
on them, bailing out in the case of cyclical dependencies.
This should handle subpackages too.
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
When building with --src or --force, other logic to detect when to build
a package is skipped. However there are no (known) cases when someone
might want to build a package if the resulting binary package version
will be older than an existing binary package. Catch this case and fail
with recommendations for user action (update pmaports, clear local
binary repo).
This should help avoid the situation where you accidentally build an old
version of a package and it never actually gets installed.
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
Tweaked-by: Oliver Smith <ollieparanoid@postmarketos.org>
This function is really hard to understand, try to make this a bit
better by adjusting the wording to better reflect what it does.
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
build_packages like apk-tools and alpine-base might get picked up and
queued for build as dependencies of other packages. We don't want this
since we always ensure they are queued first. Avoid queuing them in this
case.
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
It turns out the current behaviour was not preserving the old behaviour
at all, and was wrong. We want to build ALL outdated or new packages we
encounter via the dependency graph.
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
Get rid of 3 years and older migration code, so we don't need to
maintain it anymore. If the user should have run "pmbootstrap init" 3
years ago and suddenly upgrades to pmbootstrap v3, then they will just
need to delete their work dir (as pmbootstrap instructs to do) and start
over. This is fine, the work dir is just a bunch of caches and locally
built packages.
Instead of printing an URL with each warning, print one once at the
end. This gives less cluttered output, and we don't have information
about each and every option on that wiki page anyway (and given that we
now have so many options, I don't think it's good use of time to add it
there.)
repo is a Path obj now, and its name is used as a key in the dest_paths dict.
Fixes this failure:
working_dir=dest_paths[repo],
~~~~~~~~~~^^^^^^
KeyError: PosixPath('/home/clayton/src/pmaports')
When building a systemd image, this patch installs pmos-base-systemd
(and its dependencies) first before building the rest of the device
chroot. This is a workaround for...
The pmos-base-systemd package provides distro-wide systemd presets for
services, and when it's added to the `install_packages` list then
there's no guarantee that apk will install it *before* service packages
execute `systemctl preset`. In other words: `preset` may be run before
the distro presets are actually installed, and crushing expectations. By
making sure pmos-base-systemd is installed in the chroot first, we can
provide some guarantee that presets will be there when services are
installed a bit later.
This can be used when building images for generic device targets that
support devices with different sector size requirements.
For example, trailblazer prebuilts are currently expected to be flashed
to a USB drive where a 4096 sector size would be unsuitable since the
bootloader wouldn't detect it. But when building for a Qualcomm phone,
one would use --split and --sector-size to build the root and boot
partitions with a 4k sector size which is appropriate to the UFS
storage.
This flag could also be used by BPO to build both variants.
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
Change to "back to pamports dir" instead of "back to aports-folder".
Naming the pmaports dir just "aports" is legacy from before pmaports.git
was split out to a separate git repository.
Abort the "pmbootstrap kconfig check" on the first error, unless the
--keep-going argument was passed. This makes it easier to go through the
failed kernels one by one until they are all fixed.
Some shells, in particular Nushell, replace the built-in
POSIX-compatible uname with a custom one that does not support common
flags. I opened an issue in the Nushell repository about this, but it
was rejected on the grounds that POSIX compatibility is not a goal. As
such, run this in a subshell to ensure that we get the expected uname
interface.
Nushell issue: https://github.com/nushell/nushell/issues/12570
Remove arguments to set postmarketOS and Alpine mirrors.
The current implementation is broken with the way the mirrors are now
configured: The current implementation fills a list, but the mirror
configuration code expects a string. It is not longer possible to set
an arbitrary amount of mirrors for the postmarketOS mirror. The benefit
is that we don't have comma separated values in the config file anymore
but instead just simple strings. Now it is possible to have one proper
mirror for aports, pmaports and pmaports_systemd, and one _custom one
to override each of these.
We already have too many options in "pmbootstrap -h", and changing a
mirror is more of a base configuration that you do once and maybe change
a few times, but don't need to be able to set it with each pmbootstrap
run. Users are not going to write this out manually on their
command-lines, it only makes sense in scripts and wrappers for
pmbootstrap, and there you could as well use another method (as now
described in docs/mirrors.md) to set the mirrors.
Less important, but another reason is that using "-mp" (two letters as
short argument) isn't really elegant.
We handle this correctly for dependencies of the base package but not
the base package itself.... Fix this.
Should avoid duplication here ideally.
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
A previous attempt inserted subpackage depends into the package depends
list returned by get_depends().
This meant that pmb would try to install subpackage depends when
building the package, which breaks for some cases like device packages
with kernel variants since the depends of different subpackages might
conflict with each other.
Let's instead just add the subpackage depends to the build queue, so
they get built like package depends, without being pulled in as build
dependencies for the package.
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
When using fastboot-bootpart flash method to split root/boot partitions
out, it was no longer possible to flash the Android boot partition.
Add a new flash_boot action to handle this.
This will allow us to migrate devices like the OnePlus 6 to have the
boot partition (ESP) on system, and the rootfs on userdata rather than
the current subpartition method.
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This wrapper script, which was added in alpinelinux's heimdall 2.1.0
package, replaces heimdall_flash_kernel.sh and takes a fifth arg with
dtb name. The script then concatenates vmlinuz and the dtb into a
vmlinuz-dtb file and flashes it to the kernel partition.
Boot-deploy was previously responsible for creating vmlinuz-dtb, but
to save disk space we have moved away from creating it
unconditionally.
Fixes: https://gitlab.com/postmarketOS/boot-deploy/-/issues/26
Bail on empty build queue after checking if build_packages need
building. So if apk-tools / alpine-base / etc are outdated but nothing
else is they'll still be built.
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
Fix writing config options that are stored as CSV-list. Without this
patch:
$ pmbootstrap config aports /tmp/pmaports
[23:43:58] Config changed: aports='/tmp/pmaports'
$ pmbootstrap config aports
[PosixPath('/'), PosixPath('t'), PosixPath('m'), PosixPath('p'), PosixPath('/'), PosixPath('p'), PosixPath('m'), PosixPath('a'), PosixPath('p'), PosixPath('o'), PosixPath('r'), PosixPath('t'), PosixPath('s')]
Storing strings as CSV list isn't great and we probably want to
implement this more elegantly, see the related issue. But let's fix this
first.
Related: pmbootstrap issue 2412