Blob Blame History Raw
Name:           mkosi
Version:        20
Release:        %autorelease
Summary:        Create bespoke OS images

License:        LGPL-2.1-or-later
URL:            https://github.com/systemd/mkosi
Source:         https://github.com/systemd/mkosi/archive/v%{version}/%{name}-%{version}.tar.gz

BuildArch:      noarch
BuildRequires:  python3-devel
BuildRequires:  pyproject-rpm-macros
BuildRequires:  python3-pytest
BuildRequires:  pandoc

%bcond tests 1

# mkosi wants the uncompressed man page to show via 'mkosi documentation'
%global __brp_compress true

Requires:       python3
Requires:       bubblewrap
Requires:       coreutils

# for completion
Recommends:     python3dist(argcomplete)

# for various image building tools (systemd-hwdb, systemd-sysusers, ...)
Recommends:     systemd

# for systemd-nspawn
Recommends:     systemd-container >= 254

# for bootable images (systemd-udev ships bootctl)
Recommends:     systemd-udev >= 254
Recommends:     systemd-ukify >= 254

# for disk images
Recommends:     systemd-repart >= 254

# for the --acl option to allow removing directories generated by mkosi
Recommends:     acl

# for when kernels are installed and we need to run depmod
Recommends:     kmod

# for signing
Recommends:     openssl
Recommends:     sbsigntools
Recommends:     gnupg

# for building specific distributions
Recommends:     (dnf5 or dnf)
Recommends:     apt
Recommends:     debian-keyring
Recommends:     pacman
Recommends:     archlinux-keyring
Recommends:     zypper

# for various filesystems
Recommends:     btrfs-progs
Recommends:     e2fsprogs
Recommends:     dosfstools
Recommends:     mtools
Recommends:     erofs-utils
Recommends:     xfsprogs
Recommends:     squashfs-tools

# for various output formats
Recommends:     cpio
Recommends:     tar

# for mkosi qemu
Recommends:     qemu-kvm-core
Recommends:     edk2-ovmf
Recommends:     swtpm

# for mkosi ssh
Recommends:     openssh-clients
Recommends:     socat

# for output compression
Recommends:     zstd
Recommends:     xz

%description
A fancy wrapper around "dnf --installroot", "apt-get", "pacman", "zypper", and
"emerge" to generate disk images with a number of bells and whistles.

Generated images are tailored to the purpose. This means GPT disk labels are
used and only systemd-based images may be generated.

%prep
%autosetup -p1

%generate_buildrequires
%pyproject_buildrequires

%build
tools/make-man-page.sh

%pyproject_wheel

%install
%pyproject_install
%pyproject_save_files mkosi

mkdir -p %{buildroot}%{_mandir}/man1
ln -s -t %{buildroot}%{_mandir}/man1/ \
         ../../../..%{python3_sitelib}/mkosi/resources/mkosi.1

%files -f %pyproject_files
%license LICENSE
%doc README.md
%_bindir/mkosi
%_mandir/man1/mkosi.1*

%check
%if %{with tests}
%pytest tests/ -v

# just a smoke test for syntax or import errors
%py3_test_envvars %{buildroot}%{_bindir}/mkosi --help >/dev/null
%endif

%changelog
%autochangelog