mkosi/mkosi.spec
Sebastian Wagner a9a98c5b9b Accepting request 1190476 from home:afeijoo:branches:Virtualization
- Update to 24.3:
  * Check for $HOME environment variable as well
  * Look for $USER for the username before reading /etc/passwd
  * completion: fix bash completion script
  * Add some documentation on how to implement a new distribution
  * Add missing init.py to mkosi/initrd/resources
  * Handle dangling symlinks in rmtree() and run_clean()
  * Handle failure to detect the distribution in test_parse_config()
  * The default kernel command line of `console=ttyS0` (or equivalent for
    other architectures) has been removed. The required `console=`
    argument to have the kernel output to the serial console has to be
    added manually from `v24` onwards.
  * Support for installing local packages located in directories in
    `BuildSources=` was dropped. Instead, the packages can be made
    available for installation via `PackageManagerTrees=`.
  * Configuration parsing was reworked to remove the need for the `@`
    specifier and to streamline building multiple images with
    `mkosi.images/`. If you were building multiple images with
    `mkosi.images/`, you'll need to adapt your configuration to the
    rework. Read the **Building multiple images** section in the
    documentation for more information.
  * mkosi has gained the option to generate completion scripts for bash,
    fish and zsh. Packagers should generate the scripts during packaging
    and ship them in the appropriate places.
  * Added support for CentOS Stream 10.
  * mkosi now installs a separate `mkosi-initrd` script that can be used
    to build initramfs images intended for use on the local system.
    - Distribution configuration is installed in /usr/lib/mkosi-initrd.
    - Custom configuration can be added in /etc/mkosi-initrd.
    - See mkosi-initrd(1) for more information.
  * We do not automatically append `centos-stream` or `fedora` anymore to
    CentOS (and derivatives) and Fedora mirrors specified with `Mirror=`
    as not all mirrors store the repository metadata under these
    subdirectories. Users are now required to add these subdirectories
    themselves in `Mirror=`. If the EPEL repositories are enabled for
    CentOS Stream (and derivatives) and `Mirror=` is used, we look for the
    EPEL repositories in `../fedora` relative to the mirror specified in
    `Mirror=`.
  * We now support compressed tar archives wherever we already accept tar
    archives as input.
  * We now always rerun the build if `Format=none` and don't remove
    previous outputs in that case (unless `--force` is specified). This
    allows using `mkosi -t none` to rerun the build scripts without
    removing the previous image. This can then be combined with
    `RuntimeBuildSources=yes` to make the build script outputs available
    in a booted container or virtual machine so they can be installed
    without having to rebuild the image.
  * We now use `virtconsole` to provide the serial console when booting
    with `qemu`.
  * `root=PARTUUID` and `mount.usr=PARTUUID` on the kernel command line
    are now automatically extended with the actual PARTUUID of the
    corresponding partition.
  * All available OpenSUSE repositories are now supported and can be
    enabled with `Repositories=`.
  * Building OpenSUSE `aarch64` images is now supported
  * `mkosi dependencies` was beefed up to handle more scenarios properly
  * The default list of kernel modules that are always added to the
    initramfs was extended with various virtualization modules.
  * Added a `Repositories=` match.
  * Cached images are now invalidated if packages specified via
    `PackageDirectories=` change.
  * Added `VolatilePackageDirectories=` which can be used to provide local
    packages that do not invalidate cached images.
  * `mkosi.pkgmngr` is now used as the default path for
    `PackageManagerTrees=`.
  * The package directory that build scripts can use to make built
    packages available for installation (`$PACKAGEDIR`) is now shared
    between all image builds. This means that packages built in earlier
    images and stored in `$PACKAGEDIR` become available for installation
    in all subsequent image builds.
  * The default tools tree distribution is now chosen based on the host
    distribution instead of the target distribution.
  * mkosi can now be invoked from the initramfs.

OBS-URL: https://build.opensuse.org/request/show/1190476
OBS-URL: https://build.opensuse.org/package/show/Virtualization/mkosi?expand=0&rev=39
2024-08-01 13:19:06 +00:00

133 lines
4.0 KiB
RPMSpec

#
# spec file for package mkosi
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define pythons python3
Name: mkosi
Version: 24.3
Release: 0
Summary: Build bespoke OS Images
License: LGPL-2.1-or-later
Group: System/Management
URL: https://github.com/systemd/mkosi
Source: https://github.com/systemd/mkosi/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1: mkosi-initrd.conf
BuildRequires: %{python_module pip}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module wheel}
BuildRequires: %{pythons}
BuildRequires: fdupes
BuildRequires: pandoc
BuildRequires: python-rpm-macros
Requires: bubblewrap
Requires: python3 >= 3.9
Requires: zypper
Recommends: btrfsprogs
Recommends: cpio
Recommends: dosfstools
Recommends: dpkg
Recommends: edk2-ovmf
Recommends: gnupg
Recommends: squashfs
Recommends: tar
Recommends: xz
Recommends: zstd
BuildArch: noarch
ExclusiveArch: x86_64 aarch64
%description
A fancy wrapper around "dnf --installroot", "apt", "pacman", and "zypper" that
generates disk images with a number of bells and whistles.
Generated images are tailored to the purpose: GPT partitions,
systemd-boot or grub2, images for containers, VMs, initrd, and extensions.
mkosi can boot an image via QEMU or systemd-nspawn, or simply start a shell in
chroot, burn the image to a device, connect to a running VM via ssh, extract
logs and coredumps, and also serve an image over HTTP.
See https://mkosi.systemd.io/ for documentation.
%package initrd
Summary: Build initrds locally using mkosi
Requires: %{name} = %{version}-%{release}
Requires: coreutils
%description initrd
This package provides the mkosi-initrd wrapper and a plugin for kernel-install
to build initrds with mkosi locally. After the package is installed, the plugin
can be enabled by writing 'initrd_generator=mkosi-initrd' to
'/etc/kernel/install.conf'.
%prep
%autosetup -p1
%build
tools/make-man-page.sh
%pyproject_wheel
%install
%pyproject_install
%python_expand %fdupes %{buildroot}/%{$python_sitelib}/mkosi
mkdir -p %{buildroot}%{_mandir}/man1
cp %{buildroot}%{python3_sitelib}/mkosi/resources/mkosi.1* %{buildroot}%{_mandir}/man1/
cp %{buildroot}%{python3_sitelib}/mkosi/initrd/resources/mkosi-initrd.1* %{buildroot}%{_mandir}/man1/
# Install the kernel-install plugin
install -Dt %{buildroot}%{_prefix}/lib/kernel/install.d/ \
kernel-install/50-mkosi.install
mkdir -p %{buildroot}%{_prefix}/lib/mkosi-initrd
install -m 644 %{SOURCE1} %{buildroot}%{_prefix}/lib/mkosi-initrd/mkosi.conf
mkdir -p %{buildroot}%{_sysconfdir}/mkosi-initrd
%post initrd
if [ ! -e %{_sysconfdir}/mkosi-initrd/mkosi.conf ]; then
cat >> %{_sysconfdir}/mkosi-initrd/mkosi.conf<<EOF
# Write here your own configuration.
# See man mkosi(1) for details.
[Content]
#ExtraTrees=
#KernelModulesInclude=
#KernelModulesExclude=
EOF
fi
%check
%pytest
%files
%doc mkosi.md README.md
%license LICENSE
%{_bindir}/mkosi
%{_mandir}/man1/mkosi.1*
%{python3_sitelib}/mkosi
%{python3_sitelib}/mkosi-%{version}.dist-info
%files initrd
%{_bindir}/mkosi-initrd
%{_mandir}/man1/mkosi-initrd.1*
%dir %{_prefix}/lib/kernel
%dir %{_prefix}/lib/kernel/install.d
%{_prefix}/lib/kernel/install.d/50-mkosi.install
%dir %{_prefix}/lib/mkosi-initrd
%{_prefix}/lib/mkosi-initrd/mkosi.conf
%dir %{_sysconfdir}/mkosi-initrd
%changelog