]> git.ipfire.org Git - thirdparty/mkosi.git/log
thirdparty/mkosi.git
13 months agoTighten package globs 2882/head
Daan De Meyer [Thu, 18 Jul 2024 18:42:11 +0000 (20:42 +0200)] 
Tighten package globs

Debs don't do compression suffixes. Udebs aren't really used except
for stuff to do with the debian installer so ignore those as well.

13 months agoUse PACKAGE_GLOBS in one more place
Daan De Meyer [Thu, 18 Jul 2024 18:39:39 +0000 (20:39 +0200)] 
Use PACKAGE_GLOBS in one more place

13 months agoOnly pass kernel command line to ukify if there is one
Daan De Meyer [Thu, 18 Jul 2024 14:50:09 +0000 (16:50 +0200)] 
Only pass kernel command line to ukify if there is one

If we don't have any kernel command line arguments, don't pass
--cmdline to ukify.

Turns out systemd-stub will hang on boot when .cmdline contains only
a null terminator so with this change we avoid that from happening.

13 months agoDon't fail if kernel-install is not installed
Daan De Meyer [Thu, 18 Jul 2024 08:24:27 +0000 (10:24 +0200)] 
Don't fail if kernel-install is not installed

13 months agoInstall rpmautospec on Fedora and CentOS Stream 9 with EPEL
Daan De Meyer [Wed, 17 Jul 2024 14:58:57 +0000 (16:58 +0200)] 
Install rpmautospec on Fedora and CentOS Stream 9 with EPEL

Required for building some rpms so let's make sure these are installed.

13 months agoMerge pull request #2878 from DaanDeMeyer/stuff
Daan De Meyer [Wed, 17 Jul 2024 13:03:23 +0000 (15:03 +0200)] 
Merge pull request #2878 from DaanDeMeyer/stuff

Various small improvements

13 months agoAdd a repart partition definition for the root partition into the default image 2878/head
Daan De Meyer [Wed, 17 Jul 2024 10:42:04 +0000 (12:42 +0200)] 
Add a repart partition definition for the root partition into the default image

This makes sure the partition is grown on boot to fill the disk, which
is required for RuntimeSize= to work properly.

13 months agoOnly remount various directories if invoked as root
Daan De Meyer [Wed, 17 Jul 2024 10:41:25 +0000 (12:41 +0200)] 
Only remount various directories if invoked as root

If we weren't invoked as root we aren't allowed to write to any of
these anyway so no need to remount them read-only.

13 months agoSort one package list
Daan De Meyer [Wed, 17 Jul 2024 10:41:10 +0000 (12:41 +0200)] 
Sort one package list

13 months agoAdd unprivileged user to default image
Daan De Meyer [Wed, 17 Jul 2024 10:40:14 +0000 (12:40 +0200)] 
Add unprivileged user to default image

Makes testing as an unprivileged user easier. We also install sudo
and polkit in the default image to make auth work.

13 months agoFail when trying to change universal settings in subimages
Daan De Meyer [Tue, 16 Jul 2024 09:48:04 +0000 (11:48 +0200)] 
Fail when trying to change universal settings in subimages

Let's error out when users try to configure universal settings in
subimages since these will always be overridden.

13 months agoMake sure we always update the local repository metadata
Daan De Meyer [Mon, 15 Jul 2024 12:56:04 +0000 (14:56 +0200)] 
Make sure we always update the local repository metadata

The latest release of dnf5 introduced a change in behavior causing us
to not always sync the local repository metadata. To mitigate this, let's
always specify --refresh or similar for all package managers when we sync
the local repository to make sure its metadata is updated.

13 months agoOnly create local repository if actually needed
Daan De Meyer [Mon, 15 Jul 2024 07:22:21 +0000 (09:22 +0200)] 
Only create local repository if actually needed

13 months agoUse the same SPDX license identifier everywhere
Daan De Meyer [Mon, 15 Jul 2024 10:48:24 +0000 (12:48 +0200)] 
Use the same SPDX license identifier everywhere

13 months agoMerge pull request #2868 from DaanDeMeyer/packagedir
Jörg Behrmann [Sun, 14 Jul 2024 20:12:09 +0000 (22:12 +0200)] 
Merge pull request #2868 from DaanDeMeyer/packagedir

Two small improvements

13 months agoAdd DISTRIBUTION_ARCHITECTURE environment variable 2868/head
Daan De Meyer [Sun, 14 Jul 2024 14:51:53 +0000 (16:51 +0200)] 
Add DISTRIBUTION_ARCHITECTURE environment variable

13 months agoMake volatile packages available in local repository earlier 2867/head
Daan De Meyer [Sat, 13 Jul 2024 13:38:30 +0000 (15:38 +0200)] 
Make volatile packages available in local repository earlier

By making the volatile packages available earlier, we can query,
install and cache their dependencies in a prepare script.

13 months agoAdd --expand-environment+no to systemd-run command line
Daan De Meyer [Sat, 13 Jul 2024 06:56:34 +0000 (08:56 +0200)] 
Add --expand-environment+no to systemd-run command line

Otherwise systemd will try to expand environment variables in our
command instead of the shell.

13 months agoShare the package directory across all image builds
Daan De Meyer [Fri, 12 Jul 2024 15:07:22 +0000 (17:07 +0200)] 
Share the package directory across all image builds

This allows packages built by one image to easily be installed in
another image when using mkosi.images.

13 months agoMerge pull request #2864 from DaanDeMeyer/build
Daan De Meyer [Fri, 12 Jul 2024 13:21:20 +0000 (15:21 +0200)] 
Merge pull request #2864 from DaanDeMeyer/build

Various fixes to streamline using build scripts in subimages

13 months agoDrop per subimage build directory again 2864/head
Daan De Meyer [Fri, 12 Jul 2024 12:27:55 +0000 (14:27 +0200)] 
Drop per subimage build directory again

Let's leave this up to the individual subimage build scripts instead,
so that it's also possible for different subimages to share a build
directory if they want to do so.

13 months agoMark various settings as universal
Daan De Meyer [Fri, 12 Jul 2024 12:27:02 +0000 (14:27 +0200)] 
Mark various settings as universal

Let's make BuildSources=, BuildSourcesEphemeral=, WithTests= and
WithNetwork= universal so that packages can easily be built in a
subimage instead of in the main image build.

13 months agoIntroduce PassEnvironment=
Daan De Meyer [Fri, 12 Jul 2024 12:25:44 +0000 (14:25 +0200)] 
Introduce PassEnvironment=

We can't mark Environment= as a universal setting as only some environment
variables should be universal and others shouldn't be. So let's introduce
PassEnvironment= to mark specific environment variables as universal so that
they are passed to subimage builds.

13 months agoDrop --append documentation
Daan De Meyer [Fri, 12 Jul 2024 12:23:31 +0000 (14:23 +0200)] 
Drop --append documentation

13 months agoFix Images= and Dependencies= documentation
Daan De Meyer [Fri, 12 Jul 2024 12:23:07 +0000 (14:23 +0200)] 
Fix Images= and Dependencies= documentation

13 months agoFix spacing in documentation
Daan De Meyer [Fri, 12 Jul 2024 12:19:59 +0000 (14:19 +0200)] 
Fix spacing in documentation

13 months agoMake $BUILDDIR accessible to various scripts
Daan De Meyer [Fri, 12 Jul 2024 12:17:02 +0000 (14:17 +0200)] 
Make $BUILDDIR accessible to various scripts

Let's allow scripts to access the build directory so that outputs produced
by previous (sub)image builds can be accessed. Let's mount the build directory
read-only so that these scripts can't actually write to it.

13 months agoMerge pull request #2863 from DaanDeMeyer/apt
Daan De Meyer [Thu, 11 Jul 2024 11:55:25 +0000 (13:55 +0200)] 
Merge pull request #2863 from DaanDeMeyer/apt

Set RPM_FORCE_DEBIAN=1 for zypper and dnf

13 months agoSet RPM_FORCE_DEBIAN=1 for zypper and dnf 2863/head
Daan De Meyer [Thu, 11 Jul 2024 11:46:39 +0000 (13:46 +0200)] 
Set RPM_FORCE_DEBIAN=1 for zypper and dnf

This stops rpm on Ubuntu from printing noisy warnings about aliens.

13 months agoInstall binutils in default image
Daan De Meyer [Thu, 11 Jul 2024 11:41:36 +0000 (13:41 +0200)] 
Install binutils in default image

13 months agoFix partition identification for mount.usr=PARTUUID
Nick Labich [Thu, 11 Jul 2024 07:08:25 +0000 (03:08 -0400)] 
Fix partition identification for mount.usr=PARTUUID

13 months agoFix --profile
Daan De Meyer [Thu, 11 Jul 2024 06:19:21 +0000 (08:19 +0200)] 
Fix --profile

The attribute might be set on either the cli or the config namespace
so don't assume it's set on the config namespace.

Fixes #2860

13 months agoDowngrade SELinuxRelabel=yes to SELinuxRelabel=auto for the initrd
Daan De Meyer [Wed, 10 Jul 2024 14:33:44 +0000 (16:33 +0200)] 
Downgrade SELinuxRelabel=yes to SELinuxRelabel=auto for the initrd

Otherwise we fail if there's no policy installed in the initramfs.
Putting a policy in the initramfs isn't really a thing so let's not
fail if there is one available but still relabel if there is one
installed.

13 months agodebian/ubuntu: Exclude docs in extract_tar() if WithDocs=no
Daan De Meyer [Wed, 10 Jul 2024 08:37:50 +0000 (10:37 +0200)] 
debian/ubuntu: Exclude docs in extract_tar() if WithDocs=no

Fixes #2851

13 months agoDon't require extra trees and initrds to exist if Format=none
Daan De Meyer [Wed, 10 Jul 2024 06:39:47 +0000 (08:39 +0200)] 
Don't require extra trees and initrds to exist if Format=none

We don't use these if Format=none so let's not check if they exist.

13 months agoModernize mkosi rpm build configuration
Daan De Meyer [Wed, 10 Jul 2024 06:38:32 +0000 (08:38 +0200)] 
Modernize mkosi rpm build configuration

13 months agoMerge pull request #2850 from DaanDeMeyer/cache
Daan De Meyer [Wed, 10 Jul 2024 08:27:47 +0000 (10:27 +0200)] 
Merge pull request #2850 from DaanDeMeyer/cache

Track local packages in cache manifest

13 months agoAdd `mkosi.pkgmngr` path to `PackageManagerTrees=`
Michael Ferrari [Wed, 10 Jul 2024 00:29:49 +0000 (02:29 +0200)] 
Add `mkosi.pkgmngr` path to `PackageManagerTrees=`

13 months agoTrack local packages in cache manifest 2850/head
Daan De Meyer [Mon, 8 Jul 2024 21:26:39 +0000 (23:26 +0200)] 
Track local packages in cache manifest

Let's track the modification timestamps of the packages from configured
package directories so we can rebuild the image if new packages appear
or are removed or changed.

13 months agoIntroduce VolatilePackageDirectories=
Daan De Meyer [Tue, 9 Jul 2024 12:24:10 +0000 (14:24 +0200)] 
Introduce VolatilePackageDirectories=

For packages that should not be available when building the cached
image but should be available when installing volatile packages.

Additionally, we have build scripts write their packages to a separate
directory instead of the repository directory and later on pass these
packages as a separate volatile package directory to the default initrd
build.

This will allow us to introduce proper caching for package directories
in the next commit.

13 months agoOnly install systemd-ukify on Fedora on UEFI architectures
Daan De Meyer [Sat, 6 Jul 2024 22:32:24 +0000 (00:32 +0200)] 
Only install systemd-ukify on Fedora on UEFI architectures

- systemd-ukify is only available on Fedora on UEFI architectures,
so let's not try to install it on other architectures.
- systemd-ukify is not in CentOS Stream 10 at the moment, so let's
not try to install it on CentOS just yet.

13 months agoDecouple local repository from package directory
Daan De Meyer [Tue, 9 Jul 2024 12:08:02 +0000 (14:08 +0200)] 
Decouple local repository from package directory

In preparation for the next commit, let's decouple the location of
the local repository from the location of the package directory where
scripts can look for packages.

13 months agoSimplify createrepo()
Daan De Meyer [Tue, 9 Jul 2024 12:01:21 +0000 (14:01 +0200)] 
Simplify createrepo()

13 months agoOptimize hash_file()
Daan De Meyer [Mon, 8 Jul 2024 21:26:10 +0000 (23:26 +0200)] 
Optimize hash_file()

Let's reduce unnecessary copies.

13 months agoIntroduce PACKAGE_GLOBS constant
Daan De Meyer [Mon, 8 Jul 2024 21:25:52 +0000 (23:25 +0200)] 
Introduce PACKAGE_GLOBS constant

13 months agoMerge pull request #2845 from DaanDeMeyer/repositories
Daan De Meyer [Tue, 9 Jul 2024 08:55:49 +0000 (10:55 +0200)] 
Merge pull request #2845 from DaanDeMeyer/repositories

Enable EPEL again for CentOS default tools tree

13 months agoEnable EPEL again for CentOS default tools tree 2845/head
Daan De Meyer [Sat, 6 Jul 2024 22:32:24 +0000 (00:32 +0200)] 
Enable EPEL again for CentOS default tools tree

Now that we have a Repositories= match, we can conditionally enable
EPEL for CentOS Stream 9 only and override the repositories when we
call mkosi dependencies. This means that the CentOS Stream 9 default
tools tree will have all the EPEL packages but we won't list them in
the output of mkosi dependencies.

We also add various missing packages to the CentOS Stream default tools
tree.

13 months agoAdd Repositories= match
Daan De Meyer [Sat, 6 Jul 2024 22:20:00 +0000 (00:20 +0200)] 
Add Repositories= match

13 months agoMerge pull request #2847 from DaanDeMeyer/config
Daan De Meyer [Tue, 9 Jul 2024 06:06:39 +0000 (08:06 +0200)] 
Merge pull request #2847 from DaanDeMeyer/config

Rework configuration parsing (again)

13 months agomkosi-initrd: Always add virtio_console module to initramfs
Daan De Meyer [Mon, 8 Jul 2024 22:25:38 +0000 (00:25 +0200)] 
mkosi-initrd: Always add virtio_console module to initramfs

13 months agoRework configuration parsing (again) 2847/head
Daan De Meyer [Sun, 7 Jul 2024 15:22:40 +0000 (17:22 +0200)] 
Rework configuration parsing (again)

As explained in #2846, there are multiple issues with the current
implementation of mkosi.images. Let's take what we learned from the
default initrd and the default tools tree and apply it mkosi.images.

Specifically, all issues arise from the fact that we apply every option
from the global configuration (including CLI arguments) to the images
from mkosi.images/. To avoid the issues that arise from this (e.g --package
abc installing abc in all images), we made configuration values override
CLI arguments again so that we could override faulty CLI arguments again
in subimages so that they would only apply to the main image (e.g. set
Format= explicitly for each subimage so that --format on the command line
only applies to the main image).

Because we still wanted to allow configurable settings that can be modified
via the command line, we introduced the default specifier '@' which can be
prefixed to a setting to set a default value instead of overriding the value.
The '@' specifier is generally used in the global image independent
configuration to specify default values that can be overridden from the command
line. This specifier has led to a lot of confusion, along with the behavior that
the CLI does not override the configuration.

From the default tools tree and default initrd, we learned that what works
very well is to only have specific settings from the main image configuration
apply to the default tools tree and default initrd. For example, the distribution,
release, mirror and architecture should be the same for the main image and the
initrd, but the packages from the main image should not all be installed in the
initrd.

We can apply this idea to the images from mkosi.images/ as well, if we
introduce the assumption that all images defined in mkosi.images are
subimages intended to be included in some way or form in the main image.
This assumption allows us to divide all settings into either image specific
settings or "universal" settings that should apply to the main image and all
its subimages. The universal settings are passed on to each subimage. The image
specific settings are not.

This idea also allows us to define the "main" image outside of mkosi.images
again. Since only "universal" settings are passed on, we can safely define
an output format and such again in the global configuration, as we know this
won't be passed on to subimages.

It also allows us to make CLI arguments override configuration again. Since
there is no need anymore for subimages to override the CLI configuration as
inappropriate CLI configuration such as extra packages will only apply to the
main image and not any subimages from mkosi.images/. Because CLI configuration
overrides file configuration again, we also don't need the '@' specifier anymore,
as default values can simply be set without '@', since the CLI will override
the configuration file values by default.

We also lose the need for --append, because the sole use for --append was again
to override file based configuration.

Note that configuration from mkosi.local.conf is special in that it
should override settings from other configuration files, but not settings
that are specified on the CLI.

This commit implements all of what's mentioned above, specifically:

- CLI configuration now always trumps file based configuration.
- The '@' specifier is dropped automatically during parsing
- The main image is now always added from global configuration, even
if there are images in mkosi.images/. The main image is always built
last, and cannot be used as a dependency in the Dependencies= setting
for images defined in mkosi.images/.
- The Dependencies= setting for the main image now is used to specify
which subimages from mkosi.images/ to build. By default all subimages
are built.
- A universal tag is introduced for settings and appropriate settings
are marked as universal. Universal settings are passed on from the
main image configuration to subimage configuration.
- The Images= setting is removed, as it's role is replaced by
Dependencies=.
- The old name mkosi.presets and the Preset section name are removed
as they have been deprecated for a long time now.
- The config parsing tests are extended to cover more cases.
- All builtin configuration is adapted to stop using the '@' specifier.
- The documentation is updated in accordance with the changes.

13 months agoFix empty strings for lists and dicts
Daan De Meyer [Mon, 8 Jul 2024 17:41:16 +0000 (19:41 +0200)] 
Fix empty strings for lists and dicts

Parse functions should return None to pick the default value. Also,
we don't get any values at all if unescape=True and the empty string
is passed so make sure we handle that case as well.

13 months agoDon't do caching if we have base trees
Daan De Meyer [Mon, 8 Jul 2024 14:39:32 +0000 (16:39 +0200)] 
Don't do caching if we have base trees

Instead of doing a complicated scheme with cache overlays which
aren't invalidated when the base tree changes, let's not do caching
when there are base trees. We assume that if there's a base tree
only a minimal amount of extra packages is installed that is sufficiently
fast without caching.

13 months agoUse list type for Images= and Dependencies= instead of tuple
Daan De Meyer [Mon, 8 Jul 2024 13:40:25 +0000 (15:40 +0200)] 
Use list type for Images= and Dependencies= instead of tuple

Also remove the unneeded JSON transformer/parser.

13 months agoRevert "action: Remove apparmor disable logic"
Daan De Meyer [Mon, 8 Jul 2024 12:19:42 +0000 (14:19 +0200)] 
Revert "action: Remove apparmor disable logic"

Turns out this hasn't been shipped in the default image yet.

This reverts commit 90cb8d54a0c65f46f0c7462be74a4135576edddf.

13 months agoMake INVOKING_USER.chown() take /tmp and /var/tmp into account
Daan De Meyer [Mon, 8 Jul 2024 10:45:23 +0000 (12:45 +0200)] 
Make INVOKING_USER.chown() take /tmp and /var/tmp into account

Let's also chown the directory to be user owned if located in /tmp
or /var/tmp.

13 months agoUse subdirectory of build directory for each subimage
Daan De Meyer [Mon, 8 Jul 2024 08:15:36 +0000 (10:15 +0200)] 
Use subdirectory of build directory for each subimage

Instead of sharing the build directory between all images, let's
use a subdirectory of the build directory for subimages.

This requires us to unshare the user namespace in run_build() before
we create the directories so that we always have permissions to create
any nested build directories.

13 months agoResolve source path in mount_base_trees()
Daan De Meyer [Mon, 8 Jul 2024 07:28:46 +0000 (09:28 +0200)] 
Resolve source path in mount_base_trees()

We want to check the extension on the resolved path, not on any
symlinks, so let's make sure we resolve the path first.

13 months agoDrop dead code
Daan De Meyer [Sun, 7 Jul 2024 13:44:16 +0000 (15:44 +0200)] 
Drop dead code

We don't read configuration for the genkey verb anymore so this can
be dropped.

13 months agoUse return value of finalize_value() in one more place
Daan De Meyer [Sun, 7 Jul 2024 13:39:13 +0000 (15:39 +0200)] 
Use return value of finalize_value() in one more place

Doesn't change behavior, just slightly easier to read.

13 months agoSimplify parse_new_includes()
Daan De Meyer [Sun, 7 Jul 2024 13:35:27 +0000 (15:35 +0200)] 
Simplify parse_new_includes()

We don't need to keep track of the current amount of includes since
those includes are already tracked in parsed_includes and will be
ignored. Slightly less efficient but this shouldn't matter here.

We also store the inode in parsed_includes before we parse the config
to make sure we don't try to parse it more than once.

13 months agoRename finalize_default() to finalize_value()
Daan De Meyer [Sun, 7 Jul 2024 13:33:52 +0000 (15:33 +0200)] 
Rename finalize_default() to finalize_value()

Fits what the function does better.

13 months agoMerge pull request #2843 from DaanDeMeyer/opensuse
Daan De Meyer [Sat, 6 Jul 2024 21:38:12 +0000 (23:38 +0200)] 
Merge pull request #2843 from DaanDeMeyer/opensuse

opensuse: Add support for aarch64

13 months agoopensuse: Install qemu-ovmf-x86_64 and qemu-uefi-aarch64 in tools tree 2843/head
Daan De Meyer [Sat, 6 Jul 2024 19:27:08 +0000 (21:27 +0200)] 
opensuse: Install qemu-ovmf-x86_64 and qemu-uefi-aarch64 in tools tree

Let's make sure the UEFI firmware for both x86-64 and arm64 is
available.

13 months agoopensuse: Install qemu-ipxe
Daan De Meyer [Sat, 6 Jul 2024 19:16:32 +0000 (21:16 +0200)] 
opensuse: Install qemu-ipxe

qemu-ipxe contains efi-virtio.rom which fixes the following failure:

"""
qemu-system-aarch64: failed to find romfile "efi-virtio.rom"
"""

13 months agoInstall qemu-efi-aarch64 in Debian/Ubuntu tools trees
Daan De Meyer [Sat, 6 Jul 2024 19:06:26 +0000 (21:06 +0200)] 
Install qemu-efi-aarch64 in Debian/Ubuntu tools trees

This package provides the aarch64 OVMF firmware required to do
UEFI on arm64.

13 months agoDo not unconditionally try to install systemd-boot and resolved on Debian/Ubuntu
Daan De Meyer [Sat, 6 Jul 2024 19:05:10 +0000 (21:05 +0200)] 
Do not unconditionally try to install systemd-boot and resolved on Debian/Ubuntu

These are already handled by the systemd-extras.conf dropin.

Fixes bcfaa035716ee0208b869d4f74ffcca55c498a59

13 months agoVarious fixes for grub packages in default tools trees
Daan De Meyer [Sat, 6 Jul 2024 19:02:31 +0000 (21:02 +0200)] 
Various fixes for grub packages in default tools trees

- Install grub2-tools on all architectures on CentOS/Fedora instead
of just x86-64.
- Only install grub-pc-bin on x86-64 on Debian/Ubuntu as it is not
available on other architectures
- Install grub-common instead of grub2 as grub-common contains all
the binaries we need and grub2 configures the system to use grub
as the bootloader which we don't want when these packages might be
installed on user's systems via mkosi dependencies.
- Do not install grub2 on OpenSUSE due to the same problem, it
configures the system to use grub as the bootloader which we don't
want. Unfortunately there is no subpackage with only the grub binaries
on OpenSUSE. Reported as https://bugzilla.opensuse.org/show_bug.cgi?id=1227464.
The tests are changed to not try to build or boot opensuse images
with bios.

13 months agoExtend grub binary search path
Daan De Meyer [Sat, 6 Jul 2024 20:03:07 +0000 (22:03 +0200)] 
Extend grub binary search path

Debian has a bespoke setup where if only grub-pc-bin is installed,
grub-bios-setup is installed in /usr/lib/i386-pc instead of in
/usr/bin. Let's take that into account and look for binaries in
/usr/lib/grub/i386-pc as well.

13 months agoUpdate docs to reflect removed packages from CentOS tools tree
Daan De Meyer [Sat, 6 Jul 2024 18:52:52 +0000 (20:52 +0200)] 
Update docs to reflect removed packages from CentOS tools tree

13 months agoopensuse: Allow building default image for arm64
Daan De Meyer [Sat, 6 Jul 2024 18:38:32 +0000 (20:38 +0200)] 
opensuse: Allow building default image for arm64

We also get rid of the systemd-coredump package which got merged back
into the main systemd package.

13 months agoopensuse: Add support for aarch64
Daan De Meyer [Sat, 6 Jul 2024 18:24:10 +0000 (20:24 +0200)] 
opensuse: Add support for aarch64

This requires another rework for the repositories() method for
OpenSUSE. Whereas before we picked up all the repositories from
https://download.opensuse.org/tumbleweed/repo/, it turns out that
the debug and source repositories can also be found at
https://download.opensuse.org/debug/tumbleweed/repo/ and
https://download.opensuse.org/source/tumbleweed/repo/ respectively.
Furthermore, the latter locations are the only ones that are available
for ports under https://download.opensuse.org/ports/ so we switch to
those instead.

Additionally, openSUSE-current is not available for ports so we disallow
using current, stable and release with architectures other than x86-64.

While there are more ports than just aarch64, for now let's just add
aarch64 and wait for user demand before we add any others.

13 months agorun: Don't try to communicate inner pid for debug shell
Daan De Meyer [Sat, 6 Jul 2024 19:49:19 +0000 (21:49 +0200)] 
run: Don't try to communicate inner pid for debug shell

The pipe write end has already been closed by then so bash will
fail with "bad file descriptor". Since there's no reason in having
the inner pid in the debug shell let's make sure we don't try to
communicate it there.

13 months agoAlways execute ukify with the configured python interpreter
Daan De Meyer [Sat, 6 Jul 2024 15:41:42 +0000 (17:41 +0200)] 
Always execute ukify with the configured python interpreter

We extend python_binary() with a binary argument so we can pass in
the binary we want to execute with python so python_binary() can
figure out whether we're going to use the python binary from the
tools tree or not.

13 months agoOnly use cache.direct if image size is aligned to page size
Daan De Meyer [Sat, 6 Jul 2024 15:24:21 +0000 (17:24 +0200)] 
Only use cache.direct if image size is aligned to page size

Trying to use cache.direct with an image whose size is not a multiple
of the page size fails so let's make sure we only use cache.direct if
that's the case and make sure the image size is a multiple of the page
size if we can.

13 months agoMerge pull request #2839 from DaanDeMeyer/dependencies
Daan De Meyer [Sat, 6 Jul 2024 15:43:15 +0000 (17:43 +0200)] 
Merge pull request #2839 from DaanDeMeyer/dependencies

Use mkosi dependencies in default image

13 months agoUse mkosi dependencies in default image 2839/head
Daan De Meyer [Fri, 5 Jul 2024 18:52:22 +0000 (20:52 +0200)] 
Use mkosi dependencies in default image

Let's reduce duplication by using mkosi dependencies to install
all required dependencies to build the default image. To make this
work we add support for tools trees on jammy/bookworm. We also drop
support for a focal default image as it's too much of a burden to
maintain.

We also remove the EPEL only packages from the CentOS tools tree so
that mkosi dependencies works on a CentOS Stream system without EPEL
enabled.

Finally, curl-minimal is replaced by curl because trying to install
curl-minimal on a system with curl leads to a dnf failure so we opt
for the larger curl in order to make mkosi dependencies useful in
more situations.

13 months agoaction: Remove apparmor disable logic
Daan De Meyer [Sat, 6 Jul 2024 14:31:45 +0000 (16:31 +0200)] 
action: Remove apparmor disable logic

This is now done in GA itself so we can drop our logic.

13 months agoDon't parse configuration for dependencies verb
Daan De Meyer [Sat, 6 Jul 2024 14:40:22 +0000 (16:40 +0200)] 
Don't parse configuration for dependencies verb

13 months agoopensuse: Modernize and complete repositories
Daan De Meyer [Fri, 5 Jul 2024 11:53:47 +0000 (13:53 +0200)] 
opensuse: Modernize and complete repositories

Let's complete our list of opensuse repositories and modernize the
implementation at the same time.

13 months agoAdd %F to access the default filesystem of a distribution
Daan De Meyer [Fri, 5 Jul 2024 07:19:51 +0000 (09:19 +0200)] 
Add %F to access the default filesystem of a distribution

One annoyance about using mkosi.repart has always been that to keep
using the default filesystem per distribution you have to write a
lot of matches. Now that systemd-repart supports
$SYSTEMD_REPART_OVERRIDE_FSTYPE_ROOT, let's add a specifier to access
the default filesystem so that it can be combined with the environment
variable to get the same result.

13 months agoReplace root=PARTUUID and mount.usr=PARTUUID with the actual partition UUID
Daan De Meyer [Thu, 4 Jul 2024 18:41:09 +0000 (20:41 +0200)] 
Replace root=PARTUUID and mount.usr=PARTUUID with the actual partition UUID

These are not known upfront so let's treat these literals as placeholders
which are to be replaced with the actual partition UUID when we know it.

13 months agoMerge pull request #2834 from DaanDeMeyer/virtconsole
Jörg Behrmann [Thu, 4 Jul 2024 16:24:38 +0000 (18:24 +0200)] 
Merge pull request #2834 from DaanDeMeyer/virtconsole

Use qemu's virtconsole for the serial console

13 months agoUse qemu's virtconsole for the serial console 2834/head
Daan De Meyer [Thu, 4 Jul 2024 15:16:35 +0000 (17:16 +0200)] 
Use qemu's virtconsole for the serial console

edk2 now has a virtio serial driver so let's switch to virtconsole
for the serial console as it's significantly faster compared to the
old ISA serial console.

13 months agoMove systemd-ukify to UEFI only config file
Daan De Meyer [Thu, 4 Jul 2024 15:15:14 +0000 (17:15 +0200)] 
Move systemd-ukify to UEFI only config file

It cannot be installed on powerpc or s390x.

13 months agoDrop default kernel command line
Daan De Meyer [Thu, 4 Jul 2024 14:41:53 +0000 (16:41 +0200)] 
Drop default kernel command line

All the latest releases of distributions now have a systemd stub
that knows how to read extra kernel command line arguments from
SMBIOS (It was backported to CentOS Stream 9), so let's drop the
default kernel command line and rely completely on passing the
console to use via SMBIOS.

This makes sure that users trying to deploy our images on bare metal
have a working console. Users that want to access the system via the
serial console will have to add the required console= argument
themselves.

13 months agoadd Arch Linux ARM repo
Grey Christoforo [Wed, 3 Jul 2024 16:27:10 +0000 (17:27 +0100)] 
add Arch Linux ARM repo

13 months agojson: appease type checkers in a less cumbersome way for now
Jörg Behrmann [Wed, 3 Jul 2024 15:15:03 +0000 (17:15 +0200)] 
json: appease type checkers in a less cumbersome way for now

13 months agoMerge pull request #2827 from DaanDeMeyer/rmtree
Luca Boccassi [Wed, 3 Jul 2024 13:46:07 +0000 (15:46 +0200)] 
Merge pull request #2827 from DaanDeMeyer/rmtree

Call rmtree() on context.root after finalize_staging()

13 months agoWork around pyright errors 2827/head
Daan De Meyer [Wed, 3 Jul 2024 10:51:34 +0000 (12:51 +0200)] 
Work around pyright errors

13 months agoCall rmtree() on context.root after finalize_staging()
Daan De Meyer [Wed, 3 Jul 2024 10:17:03 +0000 (12:17 +0200)] 
Call rmtree() on context.root after finalize_staging()

After we've finalized the staging directory, there is no more need
for the root directory in the workspace. It used to get cleaned by
the setup_workspace() context manager but this is rather slow (can
take more than a second). By calling rmtree() explicitly, if we're
on a btrfs filesystem, we'll call btrfs subvolume delete which is
much faster than rm.

13 months agoMake sure rmtree() doesn't fail on paths that don't exist
Daan De Meyer [Wed, 3 Jul 2024 10:16:40 +0000 (12:16 +0200)] 
Make sure rmtree() doesn't fail on paths that don't exist

13 months agoMerge pull request #2826 from DaanDeMeyer/fstab
Luca Boccassi [Wed, 3 Jul 2024 09:09:20 +0000 (11:09 +0200)] 
Merge pull request #2826 from DaanDeMeyer/fstab

Use fstab.extra instead of kernel command line for extra mounts

13 months agoMount all virtiofs mounts in the initrd 2826/head
Daan De Meyer [Tue, 2 Jul 2024 21:45:00 +0000 (23:45 +0200)] 
Mount all virtiofs mounts in the initrd

This allows using these to mount e.g. kernel modules as well
before switch-root. If there is no initramfs, the modules will still
be loaded in the rootfs.

13 months agoUse fstab.extra instead of kernel command line for extra mounts
Daan De Meyer [Tue, 2 Jul 2024 21:43:55 +0000 (23:43 +0200)] 
Use fstab.extra instead of kernel command line for extra mounts

Kernel command line space is very limited, so let's use credentials
where we can instead.

13 months agoAdd rw to extra kernel command line by default
Daan De Meyer [Tue, 2 Jul 2024 21:43:13 +0000 (23:43 +0200)] 
Add rw to extra kernel command line by default

This generally makes more sense as the default for us instead of
ro.

13 months agoAlways rerun build if Format=none and don't remove previous outputs
Daan De Meyer [Tue, 2 Jul 2024 20:56:25 +0000 (22:56 +0200)] 
Always rerun build if Format=none and don't remove previous outputs

Let's always rerun the build if Format=none. Also, since we know
Format=none won't touch any of the outputs we know about, let's keep
the existing outputs intact. This allows using Format=none to rerun
the build script without removing the existing output (e.g. directory
or disk image).

We'll be able to make use of this in mkosi-kernel to rebuild the kernel
modules without removing the disk image produced in a previous step.

We also simplify check_outputs() to only check the main output and not
the auxiliary outputs.

13 months agoFix disk image check
Daan De Meyer [Tue, 2 Jul 2024 19:58:02 +0000 (21:58 +0200)] 
Fix disk image check

13 months agoShow proper error when using disk images as a tree without being root
Daan De Meyer [Tue, 2 Jul 2024 17:27:06 +0000 (19:27 +0200)] 
Show proper error when using disk images as a tree without being root

Fixes #2818

13 months agoAdd mirror to package cache key if one is specified
Daan De Meyer [Tue, 2 Jul 2024 11:36:29 +0000 (13:36 +0200)] 
Add mirror to package cache key if one is specified

On Arch Linux, pacman seems to only check if the sync db on the
mirror is newer than the one available locally, which breaks when
using e.g. the archive where the sync db is older by definition.

Let's add any specified mirror to the default package cache dir key
to make sure that a different cache is used for explicitly specified
mirrors.