]> git.ipfire.org Git - thirdparty/mkosi.git/log
thirdparty/mkosi.git
18 months agorpm: use Path.as_uri() in one more place 2398/head
Zbigniew Jędrzejewski-Szmek [Fri, 16 Feb 2024 17:10:45 +0000 (18:10 +0100)] 
rpm: use Path.as_uri() in one more place

18 months agofedora: for rawhide, also load key for FN+1 just in case
Zbigniew Jędrzejewski-Szmek [Fri, 16 Feb 2024 16:21:43 +0000 (17:21 +0100)] 
fedora: for rawhide, also load key for FN+1 just in case

See the commit for explanation. This fixes a problem where during
each Fedora upgrades, the local key for rawhide points to e.g. F40,
but Fedora has already branched and rawhide is actually F41.

We may specify an additional key, that will be used a future version,
but that doesn't really matter, we assume all keys as equally good.

18 months agofedora: also look for secondary GPG keys
Zbigniew Jędrzejewski-Szmek [Fri, 16 Feb 2024 16:07:04 +0000 (17:07 +0100)] 
fedora: also look for secondary GPG keys

Older Fedora versions distributed and used those. No recent
versions do that, but I think they are still generated "just in case".
So let's check for them, in case Fedora decides to use them
again, and so that checking for the very old versions works too.

18 months agoMerge pull request #2394 from DaanDeMeyer/manifest
Jörg Behrmann [Fri, 16 Feb 2024 09:38:32 +0000 (10:38 +0100)] 
Merge pull request #2394 from DaanDeMeyer/manifest

Manifest improvements

18 months agoManifest improvements 2394/head
Daan De Meyer [Thu, 15 Feb 2024 09:01:07 +0000 (10:01 +0100)] 
Manifest improvements

- Pass in Context instead of Config
- Fix the sandbox for all the executed commands
- Move complete_step() into record_packages()
- Fix writing of changelog

Fixes #2392

18 months agoIntroduce is_x86_variant() and is_arm_variant()
Daan De Meyer [Fri, 16 Feb 2024 08:43:02 +0000 (09:43 +0100)] 
Introduce is_x86_variant() and is_arm_variant()

Let's make sure we always check for both the 64-bit and the 32-bit
variant where it makes sense to do so. Also make sure the Debian
default image can be built for x86.

18 months agoFix apt scripts
Daan De Meyer [Thu, 15 Feb 2024 21:47:36 +0000 (22:47 +0100)] 
Fix apt scripts

18 months agoInstall jq in default image
Daan De Meyer [Thu, 15 Feb 2024 19:09:34 +0000 (20:09 +0100)] 
Install jq in default image

18 months agoFix formatting
Daan De Meyer [Thu, 15 Feb 2024 18:59:09 +0000 (19:59 +0100)] 
Fix formatting

18 months agoConfigure rpm dbpath using rpm macro
Daan De Meyer [Thu, 15 Feb 2024 18:52:59 +0000 (19:52 +0100)] 
Configure rpm dbpath using rpm macro

Let's get rid of all our cruft for fixing up the rpmdb location
after running rpm by simply making sure it gets written to the right
location in the first place.

18 months agoAdd stdout parameter to package manager invoke() functions
Daan De Meyer [Thu, 15 Feb 2024 10:28:42 +0000 (11:28 +0100)] 
Add stdout parameter to package manager invoke() functions

Let's allow getting the output when we invoke the package managers.

18 months agoapt: Set Dir::Etc and Dir::Log to absolute paths as well
Daan De Meyer [Thu, 15 Feb 2024 10:27:57 +0000 (11:27 +0100)] 
apt: Set Dir::Etc and Dir::Log to absolute paths as well

This allows "Dir" to be overridden which is needed in a later commit.

18 months agoPass in a single arguments parameter to invoke() methods
Daan De Meyer [Thu, 15 Feb 2024 09:57:29 +0000 (10:57 +0100)] 
Pass in a single arguments parameter to invoke() methods

Instead of passing in packages and options separately, let's just
have a single arguments parameter.

18 months agoMake apivfs argument of invoke() false by default
Daan De Meyer [Thu, 15 Feb 2024 09:48:26 +0000 (10:48 +0100)] 
Make apivfs argument of invoke() false by default

Let's not implicitly mount an apivfs every time we mount a package
manager but make this opt-in instead.

18 months agoMake package manager invoke() methods return the result
Daan De Meyer [Thu, 15 Feb 2024 09:43:48 +0000 (10:43 +0100)] 
Make package manager invoke() methods return the result

We also move the rpm database fixup call to the install() method
of the distribution so we don't try to do it every time we invoke
the package manager as it only needs to be done once.

18 months agoAdd mkosi-reinstall
Daan De Meyer [Thu, 15 Feb 2024 14:16:24 +0000 (15:16 +0100)] 
Add mkosi-reinstall

18 months agoOnly install amd-ucode-firmware on x86-64
Daan De Meyer [Thu, 15 Feb 2024 07:43:46 +0000 (08:43 +0100)] 
Only install amd-ucode-firmware on x86-64

Fixes #2391

18 months agoUse a private file for the newuidmap/newgidmap locking dance
Daan De Meyer [Wed, 14 Feb 2024 15:51:26 +0000 (16:51 +0100)] 
Use a private file for the newuidmap/newgidmap locking dance

Using a publicly accessible file such as /etc/subuid means that other
applications can interrupt mkosi's operation by taking the lock
themselves, so let's lock a private temporary file instead which only
mkosi's user can lock.

18 months agoAdd used package manager to cache manifest
Daan De Meyer [Wed, 14 Feb 2024 08:53:45 +0000 (09:53 +0100)] 
Add used package manager to cache manifest

If the package manager changes, the cache is invalid as the
repository metadata directories change as well, so let's invalidate
the cache when that happens.

18 months agodocs: Make "Building rpms from source" non-dnf specific
Daan De Meyer [Tue, 13 Feb 2024 20:24:42 +0000 (21:24 +0100)] 
docs: Make "Building rpms from source" non-dnf specific

Let's make the doc non-dnf specific by not relying on dnf builddep
and using mkosi-install to install packages. This allows using the
same logic for opensuse images.

We also simplify things by only installing --buildrequires since
trying to cache --requires from the rpm spec isn't very useful as
most of the --requires dependencies are automatically generated and
won't be listed by rpmspec --requires in the first place.

18 months agoMerge pull request #2385 from DaanDeMeyer/focal
Jörg Behrmann [Tue, 13 Feb 2024 16:34:52 +0000 (17:34 +0100)] 
Merge pull request #2385 from DaanDeMeyer/focal

Various apt based distribution fixes

18 months agoAdd Ubuntu Focal support to default image 2385/head
Daan De Meyer [Tue, 13 Feb 2024 15:06:31 +0000 (16:06 +0100)] 
Add Ubuntu Focal support to default image

We install fewer packages that are not available on Focal and make
sure to configure repart to disable an ext4 default feature that
isn't supported by the Jammy and Focal kernels.

18 months agoCompression improvements for apt distributions
Daan De Meyer [Tue, 13 Feb 2024 15:05:04 +0000 (16:05 +0100)] 
Compression improvements for apt distributions

Focal's kernel does not support zstd compression so let's make sure
we use xz there, just like we do for CentOS 8 Stream.

In Debian testing and sid, kernel modules are compressed now so let's
stop compressing the kernel modules initrd on those releases.

18 months agoFail early with a clear error if keyring does not exist
Daan De Meyer [Tue, 13 Feb 2024 11:26:46 +0000 (12:26 +0100)] 
Fail early with a clear error if keyring does not exist

We also introduce listify() and apply it to all repositories()
functions to make them return lists instead of generators to avoid
tripping up on the fact that generators can only be iterated once.

18 months agoMerge pull request #2381 from DaanDeMeyer/fixes
Jörg Behrmann [Mon, 12 Feb 2024 19:23:32 +0000 (20:23 +0100)] 
Merge pull request #2381 from DaanDeMeyer/fixes

Fixes

18 months agoExpand specifiers in match values as well 2381/head
Daan De Meyer [Mon, 12 Feb 2024 18:34:48 +0000 (19:34 +0100)] 
Expand specifiers in match values as well

Fixes #2379

18 months agoAdd QEMU kernel to summary
Daan De Meyer [Mon, 12 Feb 2024 18:34:33 +0000 (19:34 +0100)] 
Add QEMU kernel to summary

18 months agoMerge pull request #2377 from DaanDeMeyer/sandbox
Daan De Meyer [Mon, 12 Feb 2024 11:42:13 +0000 (12:42 +0100)] 
Merge pull request #2377 from DaanDeMeyer/sandbox

tree-wide: Introduce SandboxProtocol

18 months agoAdd mkosi-install, mkosi-upgrade and mkosi-remove scripts 2377/head
Daan De Meyer [Sun, 11 Feb 2024 22:05:36 +0000 (23:05 +0100)] 
Add mkosi-install, mkosi-upgrade and mkosi-remove scripts

These are primarily useful to provide a common way to install
packages from scripts for opensuse which might be built with either
zypper or dnf.

18 months agoMount makepkg.conf from tools tree as fallback
Daan De Meyer [Sun, 11 Feb 2024 17:11:31 +0000 (18:11 +0100)] 
Mount makepkg.conf from tools tree as fallback

If no makepkg.conf is provided by the user, mount it from the tools
tree as makepkg will fail with an error if no makepkg.conf is
available.

18 months agoAdd more debug logging around copying repository metadata
Daan De Meyer [Sun, 11 Feb 2024 12:35:18 +0000 (13:35 +0100)] 
Add more debug logging around copying repository metadata

18 months agoMake sure destination directory exists when extracting tar
Daan De Meyer [Sun, 11 Feb 2024 11:22:37 +0000 (12:22 +0100)] 
Make sure destination directory exists when extracting tar

Fixes #2374

18 months agoAdd missing sandbox
Daan De Meyer [Sun, 11 Feb 2024 10:03:23 +0000 (11:03 +0100)] 
Add missing sandbox

18 months agotree-wide: Introduce SandboxProtocol
Daan De Meyer [Sun, 11 Feb 2024 09:59:57 +0000 (10:59 +0100)] 
tree-wide: Introduce SandboxProtocol

Instead of passing a full sandbox command into the functions from
tree.py, archive.py, kmod.py and partition.py, let's instead pass
in a function that creates a sandbox, so we can pass in the required
options from the functions themselves. This reduces duplication a lot
as we don't have to specify all the sandbox options at each callsite.

18 months agoFix base tree tar archive unpacking
Daan De Meyer [Sun, 11 Feb 2024 07:52:27 +0000 (08:52 +0100)] 
Fix base tree tar archive unpacking

18 months agoRevert "Do not use underscore in image names"
Daan De Meyer [Sun, 11 Feb 2024 07:47:14 +0000 (08:47 +0100)] 
Revert "Do not use underscore in image names"

This reverts commit 2fd8cda4316ebd80f25d2d54c9fd818c96b91060.

This breaks assumptions about DDI naming so let's revert this change.

Specifiers can be used instead to override the output naming.

18 months agoAdd acl to tools tree
Septatrix [Sat, 10 Feb 2024 19:19:15 +0000 (20:19 +0100)] 
Add acl to tools tree

This is required when using the --acl option

18 months agoDo not use underscore in image names
Tj [Sat, 10 Feb 2024 16:40:18 +0000 (16:40 +0000)] 
Do not use underscore in image names

When suffixing image_version (mkosi.version) do not use an underscore
since that breaks systemd-machined/machinectl because undescore are
invalid in machine names.

This is related to commit 7eb4ea8

Closes: #2367
18 months agoImprove logging message for workspace directory
Daan De Meyer [Sat, 10 Feb 2024 15:04:27 +0000 (16:04 +0100)] 
Improve logging message for workspace directory

18 months agodocs: Add some extra useful defines to rpm build doc
Daan De Meyer [Fri, 9 Feb 2024 20:26:27 +0000 (21:26 +0100)] 
docs: Add some extra useful defines to rpm build doc

These speed up the build so let's make readers aware that they exist.

18 months agoopensuse: Add python3-pefile to tools tree and default image
Daan De Meyer [Fri, 9 Feb 2024 18:13:19 +0000 (19:13 +0100)] 
opensuse: Add python3-pefile to tools tree and default image

This dependency was dropped in opensuse's systemd packaging so add
it ourselves.

See https://build.opensuse.org/request/show/1144939.

18 months agoResolve dependencies before calling load_config()
Daan De Meyer [Fri, 9 Feb 2024 11:21:22 +0000 (12:21 +0100)] 
Resolve dependencies before calling load_config()

Let's not call load_config() for images that we're going to discard
immediately after.

Fixes #2348

18 months agoOnly bind mount /var/lib/pacman/local from image if it exists
Daan De Meyer [Fri, 9 Feb 2024 11:12:22 +0000 (12:12 +0100)] 
Only bind mount /var/lib/pacman/local from image if it exists

When running the finalize scripts, this directory might have been
cleaned up already as part of removing package manager metadata so
let's make sure we don't mount it in that case.

18 months agomkosi-initrd: split Debian/Ubuntu config for libtss dependencies by release
Joerg Behrmann [Tue, 6 Feb 2024 11:55:17 +0000 (12:55 +0100)] 
mkosi-initrd: split Debian/Ubuntu config for libtss dependencies by release

The package changes from libtss2-mu0 to libtss2-mu-4.0.1-0 in Debian
trixie.

Also remove unnecessary escaping in the regex.

Fixes: #2346
18 months agoMerge pull request #2352 from DaanDeMeyer/qemu-user
Daan De Meyer [Fri, 9 Feb 2024 10:02:55 +0000 (11:02 +0100)] 
Merge pull request #2352 from DaanDeMeyer/qemu-user

Add qemu user static packages to default image

18 months agoAdd qemu user static packages to default image 2352/head
Daan De Meyer [Mon, 5 Feb 2024 09:41:14 +0000 (10:41 +0100)] 
Add qemu user static packages to default image

Useful for debugging cross architecture builds. This is not packaged
in centos so we don't install it there.

18 months agoUse 8G by default for default image initrd boots in qemu
Daan De Meyer [Mon, 5 Feb 2024 10:36:28 +0000 (11:36 +0100)] 
Use 8G by default for default image initrd boots in qemu

Default image size has grown enough to need 8G when booting as cpio,
UKI or ESP output.

18 months agoAdd [TriggerMatch] section support
Daan De Meyer [Thu, 8 Feb 2024 12:37:48 +0000 (13:37 +0100)] 
Add [TriggerMatch] section support

These allow specifying that one of multiple sets of conditions should
be satisfied for the configuration file to be included.

18 months agoMerge pull request #2344 from DaanDeMeyer/firstboot
Jörg Behrmann [Thu, 8 Feb 2024 16:24:57 +0000 (17:24 +0100)] 
Merge pull request #2344 from DaanDeMeyer/firstboot

Fixes

18 months agoAdd links to FOSDEM 2024 presentations
Daan De Meyer [Thu, 8 Feb 2024 13:13:05 +0000 (14:13 +0100)] 
Add links to FOSDEM 2024 presentations

18 months agoFree up disk space before running integration tests 2344/head
Daan De Meyer [Thu, 8 Feb 2024 14:31:47 +0000 (15:31 +0100)] 
Free up disk space before running integration tests

We shouldn't need anything from /usr/local and /opt/hostedtoolcache
so let's just nuke these directories before doing anything else.

18 months agoAdd --debug-shell option to pytest
Daan De Meyer [Thu, 8 Feb 2024 09:28:12 +0000 (10:28 +0100)] 
Add --debug-shell option to pytest

18 months agoDon't use the full output path when calculating the output hash
Daan De Meyer [Mon, 5 Feb 2024 16:13:02 +0000 (17:13 +0100)] 
Don't use the full output path when calculating the output hash

This avoids having to specify the exact same output format when running
mkosi ssh to get the same vsocK CID.

18 months agoUpdate libtss2-mu to use apt search pattern
Daan De Meyer [Mon, 5 Feb 2024 09:41:42 +0000 (10:41 +0100)] 
Update libtss2-mu to use apt search pattern

This package changed name so let's update to use a search pattern
to always pull in the right package.

18 months agoBump tooling not available messages to warnings
Daan De Meyer [Mon, 5 Feb 2024 08:48:42 +0000 (09:48 +0100)] 
Bump tooling not available messages to warnings

18 months agoSkip first boot settings if systemd-firstboot is not installed
Daan De Meyer [Mon, 5 Feb 2024 08:47:16 +0000 (09:47 +0100)] 
Skip first boot settings if systemd-firstboot is not installed

18 months agoMerge pull request #2341 from DaanDeMeyer/uefi
Daan De Meyer [Fri, 2 Feb 2024 12:29:10 +0000 (13:29 +0100)] 
Merge pull request #2341 from DaanDeMeyer/uefi

Move shim for Fedora to uefi only packages

18 months agoAdd fallback for older bootctl 2341/head
Daan De Meyer [Fri, 2 Feb 2024 08:51:45 +0000 (09:51 +0100)] 
Add fallback for older bootctl

18 months agoMove shim for Fedora to uefi only packages
Daan De Meyer [Fri, 2 Feb 2024 07:44:03 +0000 (08:44 +0100)] 
Move shim for Fedora to uefi only packages

18 months agoMerge pull request #2339 from DaanDeMeyer/fix
Jörg Behrmann [Thu, 1 Feb 2024 14:22:38 +0000 (15:22 +0100)] 
Merge pull request #2339 from DaanDeMeyer/fix

Store repository metadata snapshot in /var

18 months agoDecouple base trees from repository metadata snapshot 2339/head
Daan De Meyer [Thu, 1 Feb 2024 11:32:43 +0000 (12:32 +0100)] 
Decouple base trees from repository metadata snapshot

The syncing can be disabled with CacheOnly=metadata and we already
don't use repository metadata that's already populated so let's not
imply anything specific when using base trees so that base trees
without repository metadata can still be used to build extension
images.

18 months agoStore repository metadata snapshot in /var
Daan De Meyer [Thu, 1 Feb 2024 10:48:28 +0000 (11:48 +0100)] 
Store repository metadata snapshot in /var

This makes us more compatible with third-party base trees as the
repository metadata is stored in the canonical locations by using
/var.

This also means that the repository metadata becomes subject to the
regular CleanPackageMetadata= cleanup rules.

18 months agoMerge pull request #2338 from DaanDeMeyer/fix
Jörg Behrmann [Thu, 1 Feb 2024 10:27:21 +0000 (11:27 +0100)] 
Merge pull request #2338 from DaanDeMeyer/fix

Fixes

18 months agoUse context.package_cache_dir in one more place 2338/head
Daan De Meyer [Wed, 31 Jan 2024 15:59:47 +0000 (16:59 +0100)] 
Use context.package_cache_dir in one more place

18 months agoAdd example usage of QemuDrives= to the man page
Daan De Meyer [Wed, 31 Jan 2024 15:23:06 +0000 (16:23 +0100)] 
Add example usage of QemuDrives= to the man page

18 months agoRename copy_package_manager_state() to copy_repository_metadata()
Daan De Meyer [Wed, 31 Jan 2024 15:15:35 +0000 (16:15 +0100)] 
Rename copy_package_manager_state() to copy_repository_metadata()

This matches better with sync_repository_metadata().

18 months agoFix execution workflow section
Daan De Meyer [Wed, 31 Jan 2024 15:14:31 +0000 (16:14 +0100)] 
Fix execution workflow section

18 months agoFix typo
Daan De Meyer [Wed, 31 Jan 2024 15:11:07 +0000 (16:11 +0100)] 
Fix typo

18 months agoDon't copy repository metadata when reusing a cached image
Daan De Meyer [Wed, 31 Jan 2024 15:09:56 +0000 (16:09 +0100)] 
Don't copy repository metadata when reusing a cached image

When reusing a cache we reuse the snapshot from the cache and there's
no need to copy repository metadata.

While we're at it, also remove the outdated comment.

18 months agoOnly copy repository metadata snapshot if /mkosi is empty
Daan De Meyer [Wed, 31 Jan 2024 15:08:33 +0000 (16:08 +0100)] 
Only copy repository metadata snapshot if /mkosi is empty

Otherwise we might be building using a base tree and there's no
need to copy anything.

18 months agoFix custom distribution builds
Daan De Meyer [Wed, 31 Jan 2024 14:59:05 +0000 (15:59 +0100)] 
Fix custom distribution builds

18 months agoMerge pull request #2336 from DaanDeMeyer/cache
Jörg Behrmann [Wed, 31 Jan 2024 14:50:19 +0000 (15:50 +0100)] 
Merge pull request #2336 from DaanDeMeyer/cache

Rework package manager caching

18 months agoImplement CacheOnly=metadata 2336/head
Daan De Meyer [Wed, 31 Jan 2024 13:13:37 +0000 (14:13 +0100)] 
Implement CacheOnly=metadata

We make CacheOnly= take an enum but keep backwards compat with the
boolean argument as well.

CacheOnly=metadata means we'll download packages but we won't sync
repository metadata. We also enable this in the kernel-install so that
our built initrds use exactly the same package versions as the host
system.

While we're at it we rename the internal variable to cacheonly instead
of cache_only (to match dnf's --cacheonly option). We keep the user
facing stuff the same to not break backwards compat.

We also make all of our enum functions take StrEnum as argument instead
of the generic enum.Enum.

18 months agokernel-install: Prefer dnf over dnf5
Daan De Meyer [Wed, 31 Jan 2024 13:11:53 +0000 (14:11 +0100)] 
kernel-install: Prefer dnf over dnf5

18 months agoRework package manager caching
Daan De Meyer [Tue, 30 Jan 2024 13:50:42 +0000 (14:50 +0100)] 
Rework package manager caching

Currently, CacheDirectory= is used for all caching, both incremental
images and package manager cache. While this works great for incremental
images, there's a few issues with using CacheDirectory= for all package
manager caching:

- By default we don't do any caching, this has to be explicitly
  configured by setting CacheDirectory=mkosi.cache or telling users
  to manually create mkosi.cache. This means new users might be frustrated
  by their image builds downloading everything again on subsequent builds.

- By doing package manager caches per individual mkosi project, we
  unnecessarily download multiple copies of the same repo metadata and
  packages.

- When using incremental images, if the post-install or finalize scripts
  install extra packages, these packages can trigger repository metadata
  updates, which will result in the image being built from two repository
  metadata snapshots, one from when the incremental image was built, the
  other from the new packages installed using the refreshed repository
  metadata. Even if the scripts don't trigger repository metadata updates
  themselves, because the cache is shared, the repository metadata could
  already have been updated during another image build.

- When using base trees, any images using the base tree might trigger a
  repository metadata update as well, resulting in the same issue, where
  the image is built from multiple different snapshots of the repository
  metadata.

To fix the first two issues, we introduce a new setting PackageCacheDirectory=
and make its default either a system or per user cache directory depending
on how mkosi is invoked. This makes sure we cache by default and use a shared
package manager cache directory so that we do not unnecessarily download duplicate
copies of repository metadata and packages

To fix the two remaining issues, we need to make sure we only sync repository
metadata once for each image. We opt to do this at the start of each image build
and configure the package manager commands to not do any metadata syncing by
default. To make sure the repository metadata snapshot stays available for
extension images and for incremental images, we copy the repository metadata from
the shared cache into the image itself at /mkosi/cache/<subdir>. This makes sure
that even if the repository metadata in the shared cache is refreshed by another
image build it won't remove the old snapshot for incremental builds or images
intended to be used as base trees.

To make sure the actual packages downloaded during the image build are still
written into the shared package cache, in finalize_package_manager_mounts(), we
bind mounts the relevant directories from the shared package cache instead of
from /mkosi/cache/<subdir> in the image to make sure that other image builds can
take advantage of the downloaded packages.

The /mkosi/ directory is removed from the image at the end of each image build
before packaging up the result unless we're building a directory or tar image
and CleanPackageMetadata= is explicitly disabled.

The initial sync we do at the start of each image build operates on the shared
package cache directory so that repository metadata is only refreshed once and
can be reused by other image builds.

Because package managers now prevent automatic syncing by default, we have to
rework the local package repositories slightly to make sure the local package
repository is still synced whenever it is updated. We get rid of the localrepo()
functions and opt to again write the repo definitions for the local package
repository inline to keep things simple and localized.

To avoid pacman from writing packages from the local package repository to the
shared package cache directory, we configure the local repository itself as an
additional read-only cache directory, which makes sure that pacman will read cached
packages from this directory but won't write any new packages to this directory.

For zypper we disable "keeppackages" for the local package repository to prevent
those packages from getting cached.

For dnf, we don't mount in any directory from the shared package cache for the
mkosi-packages repository to make sure it stays local to the image.

Apt doesn't support any mechanism that allows us to prevent packages from the
local repository from getting cached so we allow these to be written to the
shared package cache.

We also take the opportunity to rename the mkosi-packages repo to the mkosi repo,
and rename the accompanying config files as well;

Because pacman does not employ any sort of cache key for its repository metadata,
when using the default shared package cache directory, we use a subdirectory based
on the distribution, release and architecture that we're building for to prevent
any possible conflicts in the cache directory when different pacman based distributions
use the same repo identifiers.

To avoid issues when two instances of mkosi operate on the same package cache directory,
we take an advisory BSD lock on the cache subdirectory that we're going to sync or copy.

When building the default initrd, we make sure it uses the same repository snapshot
as the associated image.

18 months agoIntroduce PackageManager interface
Daan De Meyer [Tue, 30 Jan 2024 14:29:18 +0000 (15:29 +0100)] 
Introduce PackageManager interface

Let's start introducing a common interface for package manager
implementations. This will allow us to slowly get rid of the
functions where we do logic for each package manager because we
don't know the one that's being used. For example we add scripts
for each package manager right now which we can get rid of with a
package manager interface.

This also allows for more intuitive naming of package manager functions,
instead of invoke_dnf() we can now write Dnf.invoke().

18 months agoFix mkosi clean
Daan De Meyer [Wed, 31 Jan 2024 11:40:32 +0000 (12:40 +0100)] 
Fix mkosi clean

18 months agoHave all tree functions return the destination path
Daan De Meyer [Wed, 31 Jan 2024 07:32:40 +0000 (08:32 +0100)] 
Have all tree functions return the destination path

18 months agoRename build_initrd() to build_default_initrd()
Daan De Meyer [Tue, 30 Jan 2024 21:06:54 +0000 (22:06 +0100)] 
Rename build_initrd() to build_default_initrd()

18 months agoIntroduce want_initrd()
Daan De Meyer [Tue, 30 Jan 2024 21:05:34 +0000 (22:05 +0100)] 
Introduce want_initrd()

18 months agoDebug log in flock()
Daan De Meyer [Tue, 30 Jan 2024 20:41:54 +0000 (21:41 +0100)] 
Debug log in flock()

18 months agoWrite early apt config instead of /etc in package manager tree
Daan De Meyer [Tue, 30 Jan 2024 20:18:46 +0000 (21:18 +0100)] 
Write early apt config instead of /etc in package manager tree

This saves us from having to mount it separately as it will be mounted
as part of mounting the package manager tree.

18 months agoRemove command argument from invoke_apt()
Daan De Meyer [Tue, 30 Jan 2024 18:53:45 +0000 (19:53 +0100)] 
Remove command argument from invoke_apt()

This is always "apt-get" so let's remove the argument.

Also rename "command" and "verb" arguments for other other invoke()
functions to "operation" to be consistent in our naming.

18 months agoSimplify arch repositories() function a bit
Daan De Meyer [Tue, 30 Jan 2024 18:06:28 +0000 (19:06 +0100)] 
Simplify arch repositories() function a bit

18 months agoAdd newline between zypper repo definitions
Daan De Meyer [Tue, 30 Jan 2024 16:01:29 +0000 (17:01 +0100)] 
Add newline between zypper repo definitions

18 months agoEnsure opensuse repo id is unique
Daan De Meyer [Tue, 30 Jan 2024 15:58:01 +0000 (16:58 +0100)] 
Ensure opensuse repo id is unique

The repo ID is used as a cache key so let's make sure it is unique
based on the used url, similar to how dnf does it.

18 months agoStop using file provides in mkosi-initrd
Daan De Meyer [Tue, 30 Jan 2024 15:35:43 +0000 (16:35 +0100)] 
Stop using file provides in mkosi-initrd

These require extra metadata to be downloaded by dnf so let's instead
refer to the packages by name.

18 months agoMake options= argument for invoke_zypper() keyword-only
Daan De Meyer [Tue, 30 Jan 2024 14:37:39 +0000 (15:37 +0100)] 
Make options= argument for invoke_zypper() keyword-only

18 months agoDisable filelists on Fedora
Daan De Meyer [Tue, 30 Jan 2024 14:34:33 +0000 (15:34 +0100)] 
Disable filelists on Fedora

This was accidentally removed in a previous commit.

18 months agoSimplify clean_package_manager_metadata()
Daan De Meyer [Tue, 30 Jan 2024 14:03:00 +0000 (15:03 +0100)] 
Simplify clean_package_manager_metadata()

18 months agoUse find_rpm_gpgkey() for OpenSUSE Tumbleweed rpm keys
Daan De Meyer [Tue, 30 Jan 2024 13:49:14 +0000 (14:49 +0100)] 
Use find_rpm_gpgkey() for OpenSUSE Tumbleweed rpm keys

There's no direct url to configure for these so we modify
find_rpm_gpgkey() so that we don't pass in a url anymore.

18 months agoIntroduce INVOKING_USER.mkdir()
Daan De Meyer [Tue, 30 Jan 2024 13:43:12 +0000 (14:43 +0100)] 
Introduce INVOKING_USER.mkdir()

This function creates a directory as the appropriate user depending
on where the directory is being created.

18 months agoRemove outdated comment
Daan De Meyer [Tue, 30 Jan 2024 13:41:47 +0000 (14:41 +0100)] 
Remove outdated comment

We don't mount tools anymore at the start of the build. Mounting
them is done as part of setting the sandbox.

18 months agoInstall local packages later
Daan De Meyer [Tue, 30 Jan 2024 13:40:28 +0000 (14:40 +0100)] 
Install local packages later

Let's set these up after we've configured the package manager so
that any necessary directories exist.

18 months agoCheck if we can write to the cache directory before using it as the workspace
Daan De Meyer [Wed, 31 Jan 2024 10:17:32 +0000 (11:17 +0100)] 
Check if we can write to the cache directory before using it as the workspace

18 months agoSimplify cache directory calculation
Daan De Meyer [Tue, 30 Jan 2024 13:38:32 +0000 (14:38 +0100)] 
Simplify cache directory calculation

18 months agoMove Context creation out of build_image()
Daan De Meyer [Tue, 30 Jan 2024 13:27:35 +0000 (14:27 +0100)] 
Move Context creation out of build_image()

This allows us to reduce the indentation level of build_image().

18 months agoAdd missing log message about local repository
Daan De Meyer [Tue, 30 Jan 2024 13:24:55 +0000 (14:24 +0100)] 
Add missing log message about local repository

18 months agoIntroduce have_cache()
Daan De Meyer [Tue, 30 Jan 2024 13:24:17 +0000 (14:24 +0100)] 
Introduce have_cache()

Let's split of the logic to check whether we have a cached image
from reuse_cache().

18 months agoAdd missing license header
Daan De Meyer [Tue, 30 Jan 2024 13:23:25 +0000 (14:23 +0100)] 
Add missing license header