Refresh for latest Rust package template; update license tag for SPDX

The package was last generated from an old Rust package template (v16),
the latest version is v25.

- The `%__cargo_skip_build` macro is unused and no longer has any effect.
- SPDX license expressions are the default since rust2rpm v22 (and in
  Fedora in general).
- The `%rust_arches` macro is unused and no longer has any effect.
- The `%cargo_license` and `%cargo_license_summary` macros can be used
  to generate a correct and up-to-date license summary (not available
  in RHEL).

I made some additional small changes:

- Replaced a `%define` with a `%global`. There didn't seem to be a
  reason for using `%define`, and if there's no reason, `%global` should
  be used instead.
- Replaced the expanded form of `%{crates_source}` with the actual
  macro. It's available everywhere.
- Dropped a stray additional newline at the end of the `%_description`.
- Moved package definitions into one place instead of both *before*
  **and** *after* the scriptlets.
- Dropped the workaround for the test SIGSEGV on s390x (RHBZ#1883457),
  which is no longer needed.
- Made some entries in the `%files` lists less overly globby, which is
  discouraged in the Packaging Guidelines.
This commit is contained in:
Fabio Valentini 2023-10-19 21:28:35 +02:00 committed by Jonathan Lebon
parent 4a3792be12
commit ee428baede

View File

@ -1,37 +1,36 @@
# Originally generated by rust2rpm 16
%define dracutlibdir %{_prefix}/lib/dracut
# Generated by rust2rpm 25
%bcond_without check
%global __cargo_skip_build 0
# The library is for internal code reuse and is not a public API
%global __cargo_is_lib 0
%global dracutlibdir %{_prefix}/lib/dracut
%global dracutcommit a4be31dde8cfb3e5d579c3c5cef9205a704d03b5
%global dracutshortcommit %(c=%{dracutcommit}; echo ${c:0:7})
%global crate coreos-installer
Name: rust-%{crate}
Name: rust-coreos-installer
Version: 0.20.0
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Installer for Fedora CoreOS and RHEL CoreOS
# Upstream license specification: Apache-2.0
License: ASL 2.0
License: Apache-2.0
URL: https://crates.io/crates/coreos-installer
Source0: https://crates.io/api/v1/crates/%{crate}/%{version}/download#/%{crate}-%{version}.crate
Source0: %{crates_source}
# not used on Fedora
Source1: https://github.com/coreos/%{crate}/releases/download/v%{version}/%{crate}-%{version}-vendor.tar.gz
Source2: https://github.com/coreos/coreos-installer-dracut/archive/%{dracutcommit}/coreos-installer-dracut-%{dracutshortcommit}.tar.gz
ExclusiveArch: %{rust_arches}
%if 0%{?rhel}
BuildRequires: rust-toolset
BuildRequires: openssl-devel
# To ensure we're not bundling system libraries
BuildRequires: xz-devel
%else
BuildRequires: rust-packaging
BuildRequires: cargo-rpm-macros >= 24
%endif
BuildRequires: systemd-rpm-macros
BuildRequires: libzstd-devel
# For tests
@ -39,25 +38,34 @@ BuildRequires: gnupg2
%global _description %{expand:
coreos-installer installs Fedora CoreOS or RHEL CoreOS to bare-metal
machines (or, occasionally, to virtual machines).
}
machines (or, occasionally, to virtual machines).}
%description %{_description}
%package -n %{crate}
Summary: %{summary}
# ASL 2.0
# ASL 2.0 or Boost
# (Apache-2.0 OR MIT) AND BSD-3-Clause
# (MIT OR Apache-2.0) AND Unicode-DFS-2016
# 0BSD OR MIT OR Apache-2.0
# Apache-2.0
# Apache-2.0 OR BSL-1.0
# Apache-2.0 OR MIT
# Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT
# BSD-3-Clause
# MIT
# MIT or ASL 2.0
# Unlicense or MIT
# zlib
License: ASL 2.0 and MIT and zlib
# MIT OR Apache-2.0
# MIT OR Apache-2.0 OR Zlib
# MIT OR Zlib OR Apache-2.0
# Unlicense OR MIT
# Zlib OR Apache-2.0 OR MIT
License: Apache-2.0 AND BSD-3-Clause AND MIT AND Unicode-DFS-2016 AND (0BSD OR MIT OR Apache-2.0) AND (Apache-2.0 OR BSL-1.0) AND (Apache-2.0 OR MIT) AND (Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT) AND (MIT OR Apache-2.0 OR Zlib) AND (Unlicense OR MIT)
# LICENSE.dependencies contains a full license breakdown
Requires: gnupg
Requires: kpartx
Requires: systemd-udev
Requires: util-linux
%ifarch s390x
# This should be spelled "s390utils-core" but some of the binaries are
# still moving over from s390utils-base
@ -78,6 +86,63 @@ Obsoletes: coreos-installer-dracut < 0.0.1
%description -n %{crate} %{_description}
%files -n %{crate}
%license LICENSE
%if !0%{?rhel}
%license LICENSE.dependencies
%endif
%doc README.md
%{_bindir}/coreos-installer
%{_mandir}/man8/coreos-installer*
%dir %{_datadir}/coreos-installer
%{_datadir}/coreos-installer/example-config.yaml
%package -n %{crate}-bootinfra
Summary: %{crate} boot-time infrastructure for use on Fedora/RHEL CoreOS
# (Apache-2.0 OR MIT) AND BSD-3-Clause
# (MIT OR Apache-2.0) AND Unicode-DFS-2016
# 0BSD OR MIT OR Apache-2.0
# Apache-2.0
# Apache-2.0 OR BSL-1.0
# Apache-2.0 OR MIT
# Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT
# BSD-3-Clause
# MIT
# MIT OR Apache-2.0
# MIT OR Apache-2.0 OR Zlib
# MIT OR Zlib OR Apache-2.0
# Unlicense OR MIT
# Zlib OR Apache-2.0 OR MIT
License: Apache-2.0 AND BSD-3-Clause AND MIT AND Unicode-DFS-2016 AND (0BSD OR MIT OR Apache-2.0) AND (Apache-2.0 OR BSL-1.0) AND (Apache-2.0 OR MIT) AND (Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT) AND (MIT OR Apache-2.0 OR Zlib) AND (Unlicense OR MIT)
# LICENSE.dependencies contains a full license breakdown
Requires: %{crate}%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
# Package was renamed from coreos-installer-systemd when rdcore was added
Provides: %{crate}-systemd = %{version}-%{release}
Obsoletes: %{crate}-systemd <= 0.3.0-3
%description -n %{crate}-bootinfra
This subpackage contains boot-time infrastructure for Fedora CoreOS and
RHEL CoreOS. It is not needed on other platforms.
%files -n %{crate}-bootinfra
%{dracutlibdir}/modules.d/50rdcore/
%{_libexecdir}/coreos-installer-*
%{_unitdir}/coreos-installer*.{service,target}
%{_systemdgeneratordir}/coreos-installer-generator
%package -n %{crate}-dracut
Summary: Dracut module for running coreos-installer in the initrd in IoT/Edge
Requires: %{crate} = %{version}-%{release}
%description -n %{crate}-dracut
This subpackage contains files and configuration to run coreos-installer
from the initramfs in IoT/Edge and is supported by the community.
%files -n %{crate}-dracut
%{dracutlibdir}/modules.d/51coreos-installer/
%prep
%autosetup -n %{crate}-%{version} -a 2 -p1
%if 0%{?rhel}
@ -87,9 +152,6 @@ sed -i '/^\[features\]/a \ \ default = ["rdcore"]' Cargo.toml
%else
%cargo_prep
%endif
# Fix SIGSEGV in tests on s390x
# https://bugzilla.redhat.com/show_bug.cgi?id=1883457
sed -i 's/"-Ccodegen-units=1",//' .cargo/config
%if !0%{?rhel}
%generate_buildrequires
@ -101,6 +163,8 @@ sed -i 's/"-Ccodegen-units=1",//' .cargo/config
%cargo_build
%else
%cargo_build -f rdcore
%{cargo_license_summary -f rdcore}
%{cargo_license -f rdcore} > LICENSE.dependencies
%endif
%install
@ -120,50 +184,6 @@ mv %{buildroot}%{_bindir}/rdcore %{buildroot}%{dracutlibdir}/modules.d/50rdcore/
# 51coreos-installer for coreos-installer-dracut
%make_install -C coreos-installer-dracut-%{dracutcommit}
%package -n %{crate}-bootinfra
Summary: %{crate} boot-time infrastructure for use on Fedora/RHEL CoreOS
Requires: %{crate}%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
# ASL 2.0
# ASL 2.0 or Boost
# MIT
# MIT or ASL 2.0
# Unlicense or MIT
# zlib
License: ASL 2.0 and MIT and zlib
# Package was renamed from coreos-installer-systemd when rdcore was added
Provides: %{crate}-systemd = %{version}-%{release}
Obsoletes: %{crate}-systemd <= 0.3.0-3
%description -n %{crate}-bootinfra
This subpackage contains boot-time infrastructure for Fedora CoreOS and
RHEL CoreOS. It is not needed on other platforms.
%files -n %{crate}-bootinfra
%{dracutlibdir}/modules.d/50rdcore
%{_libexecdir}/*
%{_unitdir}/*
%{_systemdgeneratordir}/*
%package -n %{crate}-dracut
Summary: Dracut module for running coreos-installer in the initrd in IoT/Edge
Requires: %{crate} = %{version}-%{release}
%description -n %{crate}-dracut
This subpackage contains files and configuration to run coreos-installer
from the initramfs in IoT/Edge and is supported by the community.
%files -n %{crate}-dracut
%{dracutlibdir}/modules.d/51coreos-installer
%files -n %{crate}
%license LICENSE
%doc README.md
%{_bindir}/coreos-installer
%{_mandir}/man8/*
%dir %{_datadir}/coreos-installer
%{_datadir}/coreos-installer/example-config.yaml
%if %{with check}
%check
%if 0%{?rhel}
@ -174,6 +194,9 @@ from the initramfs in IoT/Edge and is supported by the community.
%endif
%changelog
* Tue Jan 09 2024 Fabio Valentini <decathorpe@gmail.com> - 0.20.0-2
- Refresh for latest Rust package template; update license tag for SPDX.
* Wed Dec 20 2023 Packit <hello@packit.dev> - 0.20.0-1
- New upstream release