rust-zram-generator/rust-zram-generator.spec

129 lines
3.2 KiB
RPMSpec
Raw Normal View History

2021-10-25 12:39:02 +00:00
# Generated by rust2rpm 18
%bcond_without check
2018-08-28 18:41:40 +00:00
%global crate zram-generator
Name: rust-%{crate}
2021-10-25 12:39:02 +00:00
Version: 1.0.1
2021-10-25 08:54:07 +00:00
Release: %autorelease
Summary: Systemd unit generator for zram swap devices
2018-08-28 18:41:40 +00:00
# Upstream license specification: MIT
2018-08-28 18:41:40 +00:00
License: MIT
URL: https://crates.io/crates/zram-generator
Source: %{crates_source}
Source1: zram-generator.conf
2018-08-28 18:41:40 +00:00
2021-10-26 14:38:13 +00:00
Patch1: 0001-make-test-that-the-config-variables-are-not-empty.patch
Patch2: 0002-make-print-executed-commands.patch
2018-08-28 18:41:40 +00:00
ExclusiveArch: %{rust_arches}
%if %{__cargo_skip_build}
BuildArch: noarch
%endif
2018-08-28 18:41:40 +00:00
BuildRequires: rust-packaging
%global _description %{expand:
2020-06-18 09:30:24 +00:00
This is a systemd unit generator that enables swap on zram.
(With zram, there is no physical swap device. Part of the avaialable RAM
is used to store compressed pages, essentially trading CPU cycles for memory.)
To activate, install %{crate}-defaults subpackage.}
2018-08-28 18:41:40 +00:00
%description %{_description}
%if ! %{__cargo_skip_build}
2018-08-28 18:41:40 +00:00
%package -n %{crate}
Summary: %{summary}
# MIT
# MIT or ASL 2.0
License: MIT
Recommends: /usr/bin/zramctl
2018-08-28 18:41:40 +00:00
%description -n %{crate} %{_description}
2018-08-28 18:41:40 +00:00
%files -n %{crate}
%license LICENSE
%doc zram-generator.conf.example
%doc README.md
%{_systemdgeneratordir}/zram-generator
%{_unitdir}/systemd-zram-setup@.service
%{_mandir}/man8/zram-generator.8*
2020-11-23 13:40:46 +00:00
%{_mandir}/man5/zram-generator.conf.5*
2020-06-18 09:30:24 +00:00
%package -n %{crate}-defaults
Summary: Default configuration for %{crate}
Requires: %{crate} = %{version}-%{release}
Obsoletes: zram < 0.4-2
BuildArch: noarch
2020-06-18 09:30:24 +00:00
%description -n %{crate}-defaults
%{summary}.
2020-06-18 09:30:24 +00:00
%files -n %{crate}-defaults
%{_prefix}/lib/systemd/zram-generator.conf
%endif
%package devel
2020-11-23 13:40:46 +00:00
Summary: %{summary}
BuildArch: noarch
%description devel %{_description}
This package contains library source intended for building other packages
which use "%{crate}" crate.
%files devel
%license LICENSE
%doc README.md
%{cargo_registry}/%{crate}-%{version_no_tilde}/
%package -n %{name}+default-devel
2020-11-23 13:40:46 +00:00
Summary: %{summary}
BuildArch: noarch
%description -n %{name}+default-devel %{_description}
This package contains library source intended for building other packages
which use "default" feature of "%{crate}" crate.
%files -n %{name}+default-devel
%ghost %{cargo_registry}/%{crate}-%{version_no_tilde}/Cargo.toml
2018-08-28 18:41:40 +00:00
%prep
%autosetup -n %{crate}-%{version_no_tilde} -p1
cp -a %{S:1} .
2018-08-28 18:41:40 +00:00
%cargo_prep
%generate_buildrequires
%cargo_generate_buildrequires
echo '/usr/bin/make'
echo '/usr/bin/ronn'
echo 'systemd-rpm-macros'
2018-08-28 18:41:40 +00:00
%build
export SYSTEMD_UTIL_DIR=%{_systemd_util_dir}
2021-10-25 12:39:02 +00:00
export LC_ALL=C.UTF-8
2018-08-28 18:41:40 +00:00
%cargo_build
2021-10-25 12:39:02 +00:00
%make_build SYSTEMD_SYSTEM_UNIT_DIR=%{_unitdir} SYSTEMD_SYSTEM_GENERATOR_DIR=%{_systemdgeneratordir} \
systemd-service man
2018-08-28 18:41:40 +00:00
%install
export SYSTEMD_UTIL_DIR=%{_systemd_util_dir}
2018-08-28 18:41:40 +00:00
%cargo_install
2021-10-25 12:39:02 +00:00
rm %{buildroot}%{_bindir}/zram-generator
%make_install SYSTEMD_SYSTEM_UNIT_DIR=%{_unitdir} SYSTEMD_SYSTEM_GENERATOR_DIR=%{_systemdgeneratordir}
2021-01-27 16:08:05 +00:00
install -Dpm0644 -t %{buildroot}%{_prefix}/lib/systemd %{SOURCE1}
2018-08-28 18:41:40 +00:00
%if %{with check}
%check
export SYSTEMD_UTIL_DIR=%{_systemd_util_dir}
2018-08-28 18:41:40 +00:00
%cargo_test
%endif
%changelog
2021-10-25 08:54:07 +00:00
%autochangelog