]> git.ipfire.org Git - thirdparty/mkosi.git/log
thirdparty/mkosi.git
3 years agomkosi: create bmap before compression 994/head
Gerard Salvatella [Wed, 1 Jun 2022 15:44:45 +0000 (17:44 +0200)] 
mkosi: create bmap before compression

Creation of bmap files needs to take place before any compression
happens, since bmaptool has to know where the "holes" of the image lie.
Compression removes the holes, preventing bmap from recreating the
original raw image. Move the bmap calculation step before the
compression.

3 years agoMerge pull request #996 from behrmann/parsesshagentlogic
Jörg Behrmann [Thu, 2 Jun 2022 07:56:34 +0000 (09:56 +0200)] 
Merge pull request #996 from behrmann/parsesshagentlogic

ssh: make parse_ssh_agent only handle strings

3 years agossh: make parse_ssh_agent only handle strings 996/head
Joerg Behrmann [Wed, 1 Jun 2022 17:35:39 +0000 (19:35 +0200)] 
ssh: make parse_ssh_agent only handle strings

pyright complains (wrongly I think) about value being None when passed to Path
to create the socket variable. Let's work around this by eliminating Nones as
values.

3 years agoMerge pull request #985 from DaanDeMeyer/pytest-graceful-build
Jörg Behrmann [Mon, 30 May 2022 11:45:24 +0000 (13:45 +0200)] 
Merge pull request #985 from DaanDeMeyer/pytest-graceful-build

machine: Hide subprocess stacktrace when a command fails during build

3 years agoset SYSTEMD_LOG_LEVEL=debug in workspace cmd when debugging it
Joerg Behrmann [Tue, 24 May 2022 11:15:57 +0000 (13:15 +0200)] 
set SYSTEMD_LOG_LEVEL=debug in workspace cmd when debugging it

3 years agomachine: Hide subprocess stacktrace when a command fails during build 985/head
Daan De Meyer [Fri, 20 May 2022 11:32:20 +0000 (13:32 +0200)] 
machine: Hide subprocess stacktrace when a command fails during build

Similar to #983 but when building the image instead of booting it.

3 years agoMerge pull request #983 from DaanDeMeyer/pytest-graceful
Jörg Behrmann [Fri, 20 May 2022 09:25:46 +0000 (11:25 +0200)] 
Merge pull request #983 from DaanDeMeyer/pytest-graceful

machine: Hide pexpect stacktrace when machine fails to boot

3 years agomachine: Hide pexpect stacktrace when machine fails to boot 983/head
Daan De Meyer [Thu, 19 May 2022 12:25:33 +0000 (14:25 +0200)] 
machine: Hide pexpect stacktrace when machine fails to boot

Follow up for b799c6de4ec80a5519391a7c15ac52481b50d33f

3 years agoMerge pull request #982 from DaanDeMeyer/fixes
Daan De Meyer [Thu, 19 May 2022 10:56:25 +0000 (11:56 +0100)] 
Merge pull request #982 from DaanDeMeyer/fixes

Fixes

3 years agomachine: Fail test more gracefully if the image fails to boot 982/head
Daan De Meyer [Tue, 19 Apr 2022 19:15:41 +0000 (21:15 +0200)] 
machine: Fail test more gracefully if the image fails to boot

3 years agomachine: Pass a list of arguments to pexpect instead of a single string
Daan De Meyer [Tue, 19 Apr 2022 17:31:08 +0000 (19:31 +0200)] 
machine: Pass a list of arguments to pexpect instead of a single string

3 years agoMerge pull request #981 from DaanDeMeyer/fix-qemu-bios
Jörg Behrmann [Thu, 19 May 2022 08:31:29 +0000 (10:31 +0200)] 
Merge pull request #981 from DaanDeMeyer/fix-qemu-bios

qemu: Only enable uefi related options when we want to boot using uefi

3 years agoSelect qemu executable based on image architecture
Daan De Meyer [Tue, 4 Jan 2022 09:24:04 +0000 (09:24 +0000)] 
Select qemu executable based on image architecture

3 years agomkosi: add option for adding extra qemu args
Lennart Poettering [Fri, 8 Apr 2022 14:40:41 +0000 (16:40 +0200)] 
mkosi: add option for adding extra qemu args

Let's add an option for adding extra options to pass to all our qemu
invocations.

Example mkosi.default:

```
[Host]
QemuArgs=-fw_cfg name=opt/io.systemd.credentials/foo,string=bar
```

3 years agoqemu: Only enable uefi related options when we want to boot using uefi 981/head
Daan De Meyer [Wed, 18 May 2022 16:06:28 +0000 (18:06 +0200)] 
qemu: Only enable uefi related options when we want to boot using uefi

3 years agomkosi: Always use the embedded default version when no release is specified
Daan De Meyer [Mon, 16 May 2022 13:57:53 +0000 (15:57 +0200)] 
mkosi: Always use the embedded default version when no release is specified

Let's not have the host system determine the image distribution release.
Instead, let's always default to the default release embedded within mkosi.
This gives more consistent results when building images for a single distro
regardless of the host distribution.

3 years agoAdd two more OVMF code locations
Daan De Meyer [Tue, 17 May 2022 13:57:32 +0000 (15:57 +0200)] 
Add two more OVMF code locations

Used on Ubuntu. Should make sure we find the secure boot OVMF stuff
on Github Actions.

3 years agoFix wrong verity sigs for s390
Daan De Meyer [Wed, 18 May 2022 13:15:17 +0000 (15:15 +0200)] 
Fix wrong verity sigs for s390

3 years agoMerge pull request #978 from behrmann/manifestsizeoptional
Jörg Behrmann [Wed, 18 May 2022 09:18:45 +0000 (11:18 +0200)] 
Merge pull request #978 from behrmann/manifestsizeoptional

manifest: don't assume the size field to be valid on deb systems

3 years agomanifest: don't assume the size field to be valid on deb systems 978/head
Joerg Behrmann [Tue, 17 May 2022 17:38:22 +0000 (19:38 +0200)] 
manifest: don't assume the size field to be valid on deb systems

Fixes: 977
3 years agomachine: Translate \r\n to \n in logfile
Daan De Meyer [Tue, 17 May 2022 09:45:08 +0000 (11:45 +0200)] 
machine: Translate \r\n to \n in logfile

Output lines from pexpect sent to the logfile will always end with
"\r\n" (side-effect of working with pseudo-TTYs) . On Github Actions,
this results in blank lines in the test output. Let's add a simple
adapter that translates "\r\n" back to "\n" before actually writing
to the logfile.

3 years agoMerge pull request #972 from DaanDeMeyer/remove-pacstrap-refs
Jörg Behrmann [Mon, 16 May 2022 07:51:24 +0000 (09:51 +0200)] 
Merge pull request #972 from DaanDeMeyer/remove-pacstrap-refs

Replace references to pacstrap with pacman

3 years agoReplace references to pacstrap with pacman 972/head
Daan De Meyer [Mon, 16 May 2022 07:48:05 +0000 (09:48 +0200)] 
Replace references to pacstrap with pacman

We call pacman directly these days so let's remove all references
to pacstrap.

3 years agoAllow rhel-likes to build on more than x86_64
Neil Hanlon [Sat, 14 May 2022 03:11:22 +0000 (23:11 -0400)] 
Allow rhel-likes to build on more than x86_64

* also add Rocky 9 key name change and the bdb/sqlite fix as well

Relates-to: #323
3 years agoadd a workaround for missing user= parameter in subprocess.run on python 3.8
Joerg Behrmann [Fri, 13 May 2022 07:27:18 +0000 (09:27 +0200)] 
add a workaround for missing user= parameter in subprocess.run on python 3.8

Fixes: #967
3 years agoMerge pull request #966 from DaanDeMeyer/ubuntu-jammy
Jörg Behrmann [Thu, 12 May 2022 07:43:42 +0000 (09:43 +0200)] 
Merge pull request #966 from DaanDeMeyer/ubuntu-jammy

Update ubuntu default version to jammy

3 years agoUpdate ubuntu default version to jammy 966/head
Daan De Meyer [Wed, 11 May 2022 21:57:37 +0000 (23:57 +0200)] 
Update ubuntu default version to jammy

3 years agoMerge pull request #961 from DaanDeMeyer/fedora-36
Daan De Meyer [Wed, 11 May 2022 13:22:43 +0000 (15:22 +0200)] 
Merge pull request #961 from DaanDeMeyer/fedora-36

3 years agoMerge pull request #963 from behrmann/debian-ca-certs
Jörg Behrmann [Wed, 11 May 2022 11:58:18 +0000 (13:58 +0200)] 
Merge pull request #963 from behrmann/debian-ca-certs

debian: include ca-certificates for bootstrap packages

3 years agoInstall util-linux explicitly on Fedora 961/head
Daan De Meyer [Wed, 11 May 2022 11:54:24 +0000 (13:54 +0200)] 
Install util-linux explicitly on Fedora

In Fedora 36, by default only util-linux-core is pulled in which
is missing /bin/login which is required by /sbin/agetty to function
properly. Let's pull it in explicitly until the bug is resolved.

3 years agoDon't fail if /etc/pam.d/login doesn't exist.
Daan De Meyer [Wed, 11 May 2022 07:58:15 +0000 (09:58 +0200)] 
Don't fail if /etc/pam.d/login doesn't exist.

3 years agodebian: include ca-certificates for bootstrap packages 963/head
Joerg Behrmann [Wed, 11 May 2022 07:41:35 +0000 (09:41 +0200)] 
debian: include ca-certificates for bootstrap packages

apt throws warnings because it cannot verify the certificates for the security
repositories we included recently. We could add this to extra-packages, but then
ca-certificates is missing when we call apt update for the first time, so add it
to the debootsrap call.

Fixes: #962
3 years agoUpdate default fedora version to 36
Daan De Meyer [Tue, 10 May 2022 19:43:30 +0000 (21:43 +0200)] 
Update default fedora version to 36

3 years agoMerge pull request #960 from DaanDeMeyer/fixes
Daan De Meyer [Sun, 8 May 2022 06:19:42 +0000 (08:19 +0200)] 
Merge pull request #960 from DaanDeMeyer/fixes

Fixes

3 years agoRun git operations as user running mkosi 960/head
Daan De Meyer [Sat, 7 May 2022 18:58:38 +0000 (20:58 +0200)] 
Run git operations as user running mkosi

Latest git complains when executed as root on a user owned directory.
Let's run the git operations as the user running mkosi to avoid the
error.

3 years agoAlways update /etc/kernel/cmdline
Daan De Meyer [Sat, 7 May 2022 18:56:59 +0000 (20:56 +0200)] 
Always update /etc/kernel/cmdline

Allows updating the kernel cmdline without needing a full rebuild.

3 years agoMerge pull request #959 from DaanDeMeyer/arch
Daan De Meyer [Thu, 5 May 2022 13:24:47 +0000 (15:24 +0200)] 
Merge pull request #959 from DaanDeMeyer/arch

3 years agoAdd nspawn version check to check_native() 959/head
Daan De Meyer [Thu, 5 May 2022 09:23:29 +0000 (11:23 +0200)] 
Add nspawn version check to check_native()

From systemd-nspawn v250 onwards, it's possible to run build scripts
on non-native architectures (as long as binfmt.d is configured correctly)
so update the native check to consider that.

3 years agoAdd env variable to configure nspawn executable to use
Daan De Meyer [Thu, 5 May 2022 09:22:54 +0000 (11:22 +0200)] 
Add env variable to configure nspawn executable to use

Useful when working on nspawn to configure mkosi to use nspawn
from the build directory instead of system nspawn.

3 years agoEnsure we use C.UTF-8 as the default locale on all distributions
Daan De Meyer [Fri, 22 Apr 2022 13:49:03 +0000 (15:49 +0200)] 
Ensure we use C.UTF-8 as the default locale on all distributions

3 years agodebian: load skeletons after running debootstrap
Joerg Behrmann [Fri, 22 Apr 2022 15:09:15 +0000 (17:09 +0200)] 
debian: load skeletons after running debootstrap

Right now mkosi.skeleton cannot be used for dpkg-based distributions, since
debootstrap will not work on a non-empty target. This adds a parameter to
install_skeleton_trees to hack around this for Debian and Ubuntu, so that the
call before install_distribution is skipped and we only add skeletons before
invoking apt again after doing the initial debootstrap.

3 years agoMerge pull request #957 from keszybz/py3.11-compat
Daan De Meyer [Mon, 25 Apr 2022 11:13:54 +0000 (13:13 +0200)] 
Merge pull request #957 from keszybz/py3.11-compat

py3.11: fix Enum formatting to work with python3.11-a7

3 years agoDrop special __repr__ from Parseable mixin 957/head
Zbigniew Jędrzejewski-Szmek [Sun, 24 Apr 2022 14:07:03 +0000 (16:07 +0200)] 
Drop special __repr__ from Parseable mixin

We want to override __str__, and we also did __repr__, but there doesn't
seem to be any particular reason for this.

3 years agopy3.11: fix Enum formatting to work with python3.11-a7
Zbigniew Jędrzejewski-Szmek [Sun, 24 Apr 2022 10:54:57 +0000 (12:54 +0200)] 
py3.11: fix Enum formatting to work with python3.11-a7

Something strange is happening with .__repr__() access in python3.11:

>>> mkosi.backend.ManifestFormat.mro()
[<enum 'ManifestFormat'>, <class 'mkosi.backend.Parseable'>, <enum 'Enum'>, <class 'object'>]
>>> mkosi.backend.ManifestFormat.changelog.__repr__()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python3.11/enum.py", line 1194, in __repr__
    return "<%s.%s: %s>" % (self.__class__.__name__, self._name_, v_repr(self._value_))
                                                                  ^^^^^^^^^^^^^^^^^^^^
  File "/home/zbyszek/src/mkosi/mkosi/backend.py", line 95, in __repr__
    return cast(str, getattr(self, "name"))
                     ^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'name'

Enum somehow subverts normal lookup and makes its own __repr__ function be
used, even though Parseable is listed first in MRO. This seems to be related to
PEP 663, which was rejected, and the changes reverted for -a4 [1], but then the revert
was reverted [2].

Let's just sidestep MRO with a method redefinition:

>>> mkosi.backend.ManifestFormat.changelog.__repr__
<bound method ManifestFormat.__repr__ of changelog>
>>> mkosi.backend.ManifestFormat.changelog.__repr__()
'changelog'

This should work on all python versions. If python3.11 returns to previous
semantics before the final release, we can remove the workaround.

[1] commit acf7403f9baea3ae1119fc6b4a3298522188bf96
Author: Ethan Furman <ethan@stoneleaf.us>
Date:   Sat Jan 15 22:41:43 2022 -0800

    bpo-40066:  [Enum] update str() and format() output (GH-30582)

    Undo rejected PEP-663 changes:

    - restore `repr()` to its 3.10 status
    - restore `str()` to its 3.10 status

[2] commit 42a64c03ec5c443f2a5c2ee4284622f5d1f5326c
Author: Victor Stinner <vstinner@python.org>
Date:   Mon Jan 17 13:58:40 2022 +0100

    Revert "bpo-40066:  [Enum] update str() and format() output (GH-30582)" (GH-30632)

    This reverts commit acf7403f9baea3ae1119fc6b4a3298522188bf96.

3 years agoMerge pull request #954 from behrmann/missingdocs
Daan De Meyer [Fri, 22 Apr 2022 11:27:48 +0000 (13:27 +0200)] 
Merge pull request #954 from behrmann/missingdocs

Add missing docs

3 years agodocs: add missing genkey command summary 954/head
Joerg Behrmann [Fri, 22 Apr 2022 11:24:20 +0000 (13:24 +0200)] 
docs: add missing genkey command summary

3 years agodocs: add missing commands to synopsis
Joerg Behrmann [Fri, 22 Apr 2022 11:24:07 +0000 (13:24 +0200)] 
docs: add missing commands to synopsis

3 years agoMake a relative symlink instead of an absolute one
Joerg Behrmann [Wed, 20 Apr 2022 17:53:36 +0000 (19:53 +0200)] 
Make a relative symlink instead of an absolute one

THis should ensure, that we never link outside of the image.

3 years agoMerge pull request #952 from DaanDeMeyer/locale-force-symlink
Jörg Behrmann [Thu, 21 Apr 2022 14:50:47 +0000 (16:50 +0200)] 
Merge pull request #952 from DaanDeMeyer/locale-force-symlink

mkosi: Force /etc/default/locale to be a symlink to locale.conf

3 years agomkosi: Force /etc/default/locale to be a symlink to locale.conf 952/head
Daan De Meyer [Wed, 20 Apr 2022 18:08:24 +0000 (20:08 +0200)] 
mkosi: Force /etc/default/locale to be a symlink to locale.conf

If the locales package is installed, /etc/default/locale will exist
in the filesystem already. Let's make sure we handle that properly.

3 years agoMerge pull request #932 from DaanDeMeyer/debug-bootable
Daan De Meyer [Tue, 19 Apr 2022 14:55:23 +0000 (16:55 +0200)] 
Merge pull request #932 from DaanDeMeyer/debug-bootable

Various fixes

3 years agoarch: Use C.UTF-8 instead of en_US.UTF-8 932/head
Daan De Meyer [Tue, 19 Apr 2022 07:33:40 +0000 (09:33 +0200)] 
arch: Use C.UTF-8 instead of en_US.UTF-8

3 years agoubuntu/debian: Add updates/security repos to new images
Daan De Meyer [Thu, 14 Apr 2022 19:05:55 +0000 (21:05 +0200)] 
ubuntu/debian: Add updates/security repos to new images

Fixes #534

3 years agoubuntu/debian: Preserve runtime directory
Daan De Meyer [Wed, 13 Apr 2022 11:02:12 +0000 (13:02 +0200)] 
ubuntu/debian: Preserve runtime directory

sshd logs on CI complain about a missing runtime directory. Let's
make sure the runtime directory is preserved to avoid this error.

3 years agoci: Update dependency versions
Daan De Meyer [Wed, 13 Apr 2022 15:51:57 +0000 (17:51 +0200)] 
ci: Update dependency versions

3 years agoci: Cache dependencies build step
Daan De Meyer [Wed, 13 Apr 2022 10:43:06 +0000 (12:43 +0200)] 
ci: Cache dependencies build step

3 years agoci: Fix $BUILDDIR unset in setup-github-actions.sh
Daan De Meyer [Tue, 19 Apr 2022 13:17:04 +0000 (15:17 +0200)] 
ci: Fix $BUILDDIR unset in setup-github-actions.sh

sudo doesn't transfer environment variables by default.

3 years agoubuntu/debian: Set up locale correctly on Debian/Ubuntu
Daan De Meyer [Wed, 13 Apr 2022 09:08:03 +0000 (11:08 +0200)] 
ubuntu/debian: Set up locale correctly on Debian/Ubuntu

Let's make sure we configure the locale. Also, some programs
expect /etc/default/locale to exist on Ubuntu/Debian so let's
create a symlink from there to /etc/locale.conf as well.

3 years agomachine: Rework run() output capture
Daan De Meyer [Tue, 12 Apr 2022 20:52:10 +0000 (22:52 +0200)] 
machine: Rework run() output capture

Let's not capture output by default. Instead, let's forward it
directly to stdout/stderr to simplify debugging. Similar to the
subprocess.run() function, let's add a capture_output argument
to allow configuring whether to capture the output.

We also remove the debug argument from Machine since logging to
stdout/stderr is now the default.

3 years agoRename test_skip_not_supported() to skip_not_supported()
Daan De Meyer [Tue, 12 Apr 2022 13:15:58 +0000 (15:15 +0200)] 
Rename test_skip_not_supported() to skip_not_supported()

pytest runs it as a test with the previous name which is not
what we want to happen.

3 years agoExpect qemu tests to fail on centos_epel due to arch issue
Daan De Meyer [Tue, 12 Apr 2022 12:02:47 +0000 (14:02 +0200)] 
Expect qemu tests to fail on centos_epel due to arch issue

3 years agoAdd --qemu-kvm option
Daan De Meyer [Tue, 12 Apr 2022 11:58:58 +0000 (13:58 +0200)] 
Add --qemu-kvm option

Allows running without KVM acceleration on machines that support KVM.
Useful when trying to reproduce CI issues where KVM is not supported.

3 years agoci: Print more verbose output when running pytest
Daan De Meyer [Tue, 12 Apr 2022 11:38:55 +0000 (13:38 +0200)] 
ci: Print more verbose output when running pytest

Let's have pytest output which tests succeeded and were skipped.

3 years agoDrop --hostonly-initrd from test machine bootable images
Daan De Meyer [Thu, 7 Apr 2022 13:06:18 +0000 (15:06 +0200)] 
Drop --hostonly-initrd from test machine bootable images

Causes a few boot issues with rocky and alma bootable images so
let's remove the option as it the speed improvement shouldn't matter
too much for integration tests.

3 years agoAdd missing binaries to initrd
Daan De Meyer [Thu, 7 Apr 2022 12:57:10 +0000 (14:57 +0200)] 
Add missing binaries to initrd

These aren't included on Ubuntu which causes an error during boot,
let's fix that by including them explicitly.

3 years agoci: Remove systemd.volatile from kernel command line
Daan De Meyer [Thu, 7 Apr 2022 09:49:58 +0000 (11:49 +0200)] 
ci: Remove systemd.volatile from kernel command line

volatile doesn't work on many distros. We initially added it to
support booting GPT squashfs images but since we don't test those
in CI anymore, we can safely remove volatile from the kernel
commandline as well.

3 years agoci: Use gpt_ext4 as the bootable system format instead of gpt_btrfs
Daan De Meyer [Thu, 7 Apr 2022 09:49:27 +0000 (11:49 +0200)] 
ci: Use gpt_ext4 as the bootable system format instead of gpt_btrfs

gpt_ext4 is usable everywhere unlike gpt_btrfs.

3 years agotests: Add back isinstance() check to pytest_assertrepr_compare()
Daan De Meyer [Thu, 7 Apr 2022 08:48:25 +0000 (10:48 +0200)] 
tests: Add back isinstance() check to pytest_assertrepr_compare()

Turns out that the added typing was wrong, not the isinstance()
check so add back the isinstance() check and change the type to Any
instead.

3 years agomachine: Duplicate pexpect serial output to stdout
Daan De Meyer [Wed, 6 Apr 2022 10:44:01 +0000 (12:44 +0200)] 
machine: Duplicate pexpect serial output to stdout

Helps with debugging failing tests.

3 years agoDifferentiate between machine name and interface name
Daan De Meyer [Wed, 6 Apr 2022 10:42:05 +0000 (12:42 +0200)] 
Differentiate between machine name and interface name

We only need to shorten the interface name. For machine names, we
can use the full name.

3 years agoRegister "integration" as a custom pytest marker
Daan De Meyer [Tue, 5 Apr 2022 13:09:32 +0000 (15:09 +0200)] 
Register "integration" as a custom pytest marker

Silences pytest warning message.

3 years agoAdd interface name to interface not found error message
Daan De Meyer [Tue, 5 Apr 2022 13:01:44 +0000 (15:01 +0200)] 
Add interface name to interface not found error message

Helps with debugging

3 years agoShorten interface names to 12 characters
Daan De Meyer [Tue, 5 Apr 2022 13:00:45 +0000 (15:00 +0200)] 
Shorten interface names to 12 characters

Off by one bug, interface names can only be 15 characters instead
of 16 characters so we need to limit the name to 12 characters
instead of 13.

3 years agoSet SSH timeout to 4 minutes for integration tests
Daan De Meyer [Tue, 5 Apr 2022 13:03:27 +0000 (15:03 +0200)] 
Set SSH timeout to 4 minutes for integration tests

3 years agoOnly build test images in bootable mode when using the qemu verb
Daan De Meyer [Tue, 5 Apr 2022 13:03:01 +0000 (15:03 +0200)] 
Only build test images in bootable mode when using the qemu verb

3 years agoci: Fix variable usage with sudo
Daan De Meyer [Tue, 5 Apr 2022 13:02:45 +0000 (15:02 +0200)] 
ci: Fix variable usage with sudo

The variable assignments should be part of the command passed to sudo,
otherwise they'll be ignored.

3 years agotest: squelch asyncio io warning
Joerg Behrmann [Thu, 14 Apr 2022 11:33:31 +0000 (13:33 +0200)] 
test: squelch asyncio io warning

This silences the deprecation warning

     The 'asyncio_mode' default value will change to 'strict' in
     future, please explicitly use 'asyncio_mode=strict' or
     'asyncio_mode=auto' in pytest configuration file.

The difference is whether pytest considers async tests to be
asyncio-driven even when they are not marked @pytest.mark.asyncio
with 'auto' meaning yes, consider them even when not marked, and
'strict' requiring the marking.

This doesn't really make a difference for us, since we don't have
any async tests, but it's nevertheless nice to silence the warning.

3 years agoRun dracut for unified kernel images instead of objcopy
Daan De Meyer [Fri, 8 Apr 2022 15:11:41 +0000 (17:11 +0200)] 
Run dracut for unified kernel images instead of objcopy

objcopy is faster but it doesn't apply any changes in installed
files when running in incremental mode which is a regression. Let's
run dracut again to fix that regression.

We can if needed add an option later to use objcopy instead of dracut
if users would want that.

3 years agoAdd option to run nspawn in current unit
Rémi Palancher [Mon, 24 Jan 2022 08:59:29 +0000 (09:59 +0100)] 
Add option to run nspawn in current unit

This commit adds --nspawn-keep-unit option to add --keep-unit option to
underlying systemd-nspawn commands. This makes systemd-nspawn uses the
current unit scope and allocated ressources. This can be notably useful
when mkosi is run by a system service.

3 years agoFix bootstrapping RPM distro on Debian
Luca Boccassi [Tue, 29 Mar 2022 00:43:40 +0000 (01:43 +0100)] 
Fix bootstrapping RPM distro on Debian

The Debian rpm/dnf packages store the db in the home directory, so
the bootstrapped image has a broken rpm database.
Move it to the right place if it happens.

See: https://bugs.debian.org/1004863

Fixes https://github.com/systemd/mkosi/issues/934

3 years agoMerge pull request #945 from DaanDeMeyer/dnf-vars-stream
Jörg Behrmann [Mon, 4 Apr 2022 16:48:59 +0000 (18:48 +0200)] 
Merge pull request #945 from DaanDeMeyer/dnf-vars-stream

centos: Write stream dnf variable file when a stream release is used

3 years agocentos: Write stream dnf variable file when a stream release is used 945/head
Daan De Meyer [Mon, 4 Apr 2022 12:50:53 +0000 (14:50 +0200)] 
centos: Write stream dnf variable file when a stream release is used

CentOS Stream SIGs use the $stream variable in their repo files to
identify the current CentOS Stream version. Let's make sure we write
this file so that SIG repo files can be copied into mkosi.reposdir
as is without requiring modifications to make them work.

Example SIG repo file using $stream:
https://git.centos.org/rpms/centos-release-hyperscale/blob/c8s-sig-hyperscale/f/SOURCES/CentOS-Stream-Hyperscale.repo

3 years agoConfigure pacman with ParallelDownloads = 5
Daan De Meyer [Thu, 31 Mar 2022 10:56:00 +0000 (12:56 +0200)] 
Configure pacman with ParallelDownloads = 5

Let's include the new ParallelDownloads option from pacman v6 with
the same default value used by pacman itself.

3 years agoAdd --repository-directory option
Daan De Meyer [Wed, 30 Mar 2022 14:00:04 +0000 (16:00 +0200)] 
Add --repository-directory option

The repository directory can contain extra repositories to be
used when installing packages. If mkosi.reposdir/ exists, it's
used as the repository directory unless it's explicitly
specified.

Only supported for rpm based distros and Arch for now. We don't
support Ubuntu/Debian atm because we can't point apt to the
extra repositories directory because apt runs inside the image
compared to dnf and pacman which run outside of the image.

3 years agoMerge pull request #942 from DaanDeMeyer/cache-reuse-machine-id
Jörg Behrmann [Wed, 30 Mar 2022 14:07:13 +0000 (16:07 +0200)] 
Merge pull request #942 from DaanDeMeyer/cache-reuse-machine-id

Reuse machine ID when re-using a cached image

3 years agoReuse machine ID when re-using a cached image 942/head
Daan De Meyer [Wed, 30 Mar 2022 07:58:15 +0000 (09:58 +0200)] 
Reuse machine ID when re-using a cached image

4fb53aea9e04b931cccedf1545831e426d6ec2f7 broke incremental builds
for bootable Fedora images because when building the cached image,
the initrd is installed to "/efi/<machine-id>/...", and when doing
a cached build, a new machine ID is generated inside mkosi (but not
written to /etc/machine-id), making gen_kernel_images() unable to
find the initrd.

Let's fix the issue by re-using the machine ID from /etc/machine-id
when doing a cached build.

In the future, we can use the new entry-token feature of bootctl to
have kernel-install write to directory in /efi that's not tied to
the machine ID but until that's widely available this will have to
do.

3 years agoMerge pull request #941 from DaanDeMeyer/fixes
Daan De Meyer [Tue, 29 Mar 2022 16:24:41 +0000 (18:24 +0200)] 
Merge pull request #941 from DaanDeMeyer/fixes

Two small fixes

3 years agoMake sure --source-file-transfer-final works without a build script 941/head
Daan De Meyer [Tue, 29 Mar 2022 14:32:58 +0000 (16:32 +0200)] 
Make sure --source-file-transfer-final works without a build script

3 years agocentos: Rebuild the rpm db in bdb format on older centos releases
Daan De Meyer [Tue, 29 Mar 2022 14:30:16 +0000 (16:30 +0200)] 
centos: Rebuild the rpm db in bdb format on older centos releases

When building centos stream 8 images from Fedora, the resulting rpmdb
in the image is written in the sqlite format. The rpm version available
in centos stream 8 only supports reading the sqlite format but not writing
to it, which effectively makes installing rpm packages in the resulting
image impossible.

As a temporary workaround, we run rpm --rebuilddb inside the image to rebuild
the db in the older bdb format. Ideally we'd use the rpm from the host for this
but rpm has removed bdb support in newer versions so this isn't possible.

Luckily, we can remove this hack once we remove support for centos stream 8
and lower.

3 years agoMerge pull request #939 from behrmann/envrefactor
Daan De Meyer [Mon, 28 Mar 2022 08:58:20 +0000 (10:58 +0200)] 
Merge pull request #939 from behrmann/envrefactor

Make MkosiArgs.environment a dictionary

3 years agomake MkosiArgs.environment a dictionary 939/head
Joerg Behrmann [Sat, 26 Mar 2022 15:09:49 +0000 (16:09 +0100)] 
make MkosiArgs.environment a dictionary

3 years agorelax accepted types for run_work_space command
Joerg Behrmann [Sat, 26 Mar 2022 15:04:16 +0000 (16:04 +0100)] 
relax accepted types for run_work_space command

3 years agoAdd missing environments to prepare und postinst scripts 938/head
Joerg Behrmann [Sat, 26 Mar 2022 13:41:43 +0000 (14:41 +0100)] 
Add missing environments to prepare und postinst scripts

Fixes: #937
3 years agoci: Add back shellcheck
Daan De Meyer [Fri, 25 Mar 2022 12:18:15 +0000 (13:18 +0100)] 
ci: Add back shellcheck

Turns out the globbing wasn't done quite right. Fixed the globbing
so it applies to all shell scripts in the mkosi repository.

3 years agoci: Remove shellcheck step
Daan De Meyer [Fri, 25 Mar 2022 11:50:15 +0000 (12:50 +0100)] 
ci: Remove shellcheck step

We don't have any scripts to check anymore.

3 years agoMerge pull request #923 from DaanDeMeyer/remove-dracut-uki-script
Daan De Meyer [Fri, 25 Mar 2022 10:46:35 +0000 (11:46 +0100)] 
Merge pull request #923 from DaanDeMeyer/remove-dracut-uki-script

Remove dracut unified kernel image kernel-install script

3 years agoReplace dracut unified kernel image kernel-install script with objcopy 923/head
Daan De Meyer [Sat, 5 Mar 2022 15:51:21 +0000 (15:51 +0000)] 
Replace dracut unified kernel image kernel-install script with objcopy

When using objcopy, we can generate the initrd in the install phase
which is cached which speeds up builds of incremental images. We use
objcopy from the host system to avoid having to install binutils in
all generated images.

We also call kernel-install manually in opensuse, debian and ubuntu
builds to make sure we can find an initrd image to pass to objcopy.
By calling kernel-install, we also make sure that
--without-unified-kernel-images now works for these distros as well.

3 years agoFix unreachable code mypy typing error
Daan De Meyer [Tue, 22 Mar 2022 15:39:31 +0000 (16:39 +0100)] 
Fix unreachable code mypy typing error

3 years agoMerging CI tests with MkosiMachineTest class
gsegatti [Thu, 10 Mar 2022 17:38:10 +0000 (09:38 -0800)] 
Merging CI tests with MkosiMachineTest class

- Removing the usage of the file at /tests/pexpect/boot.py
- Replacing the build/boot process ownership to the mkosi/machine.py file.
- All tests will attempt to build a MkosiMachineTestCase class and run the test functions.
- We leverage the load_args() function from __init__.py in order to replace the if's from the ci.yml file.
- If a set of options is invalid, we skip such test.
- We also define a specific exception for a invalid combination of arguments to be parsed, named "MkosiNotSupportedException".
- MkosiNotSupportedException inherits MkosiException.

3 years agoRemove uneeded "name=" from EPEL repo definition
Justin Vreeland [Thu, 3 Mar 2022 00:09:03 +0000 (16:09 -0800)] 
Remove uneeded "name=" from EPEL repo definition

setup_dnf provides name= already

Before:

CentOS-8-stream - Plus                                                                    10 kB/s | 3.0 kB     00:00
CentOS-8-stream - PowerTools                                                              19 kB/s | 4.4 kB     00:00
name=Extra Packages for Enterprise Linux 8 - x86_64                                       10 kB/s | 4.7 kB     00:00

After:

CentOS-8-stream - Plus                                                                   5.3 kB/s | 3.0 kB     00:00
CentOS-8-stream - PowerTools                                                             8.1 kB/s | 4.4 kB     00:00
Extra Packages for Enterprise Linux 8 - x86_64                                           9.4 kB/s | 4.7 kB     00:00

Signed-off-by: Justin Vreeland <vreeland.justin@gmail.com>