2023-06-23 17:31:25 +00:00
|
|
|
# Generated by rust2rpm 24
|
2020-06-23 17:55:52 +00:00
|
|
|
%bcond_without check
|
2018-08-28 18:41:40 +00:00
|
|
|
|
2023-05-16 00:13:52 +00:00
|
|
|
# RHEL does not have packages for Rust dependencies
|
|
|
|
%if 0%{?rhel}
|
|
|
|
%global bundled_rust_deps 1
|
|
|
|
%else
|
|
|
|
%global bundled_rust_deps 0
|
|
|
|
%endif
|
|
|
|
|
2018-08-28 18:41:40 +00:00
|
|
|
%global crate zram-generator
|
|
|
|
|
2023-06-23 17:31:25 +00:00
|
|
|
Name: rust-zram-generator
|
2022-03-28 08:33:56 +00:00
|
|
|
Version: 1.1.2
|
2021-10-25 08:54:07 +00:00
|
|
|
Release: %autorelease
|
2020-06-18 07:28:52 +00:00
|
|
|
Summary: Systemd unit generator for zram swap devices
|
2018-08-28 18:41:40 +00:00
|
|
|
|
|
|
|
License: MIT
|
2019-03-09 14:00:52 +00:00
|
|
|
URL: https://crates.io/crates/zram-generator
|
2023-06-23 17:31:25 +00:00
|
|
|
Source0: %{crates_source}
|
2020-06-18 09:32:09 +00:00
|
|
|
Source1: zram-generator.conf
|
2023-05-16 00:13:52 +00:00
|
|
|
# To create the vendor tarball:
|
|
|
|
# tar xf %%{crate}-%%{version}.crate ; pushd %%{crate}-%%{version} ; \
|
|
|
|
# cargo vendor && tar Jcvf ../%%{crate}-%%{version}-vendor.tar.xz vendor/ ; popd
|
|
|
|
Source2: %{crate}-%{version}-vendor.tar.xz
|
2018-08-28 18:41:40 +00:00
|
|
|
|
2023-05-16 00:13:52 +00:00
|
|
|
%if 0%{?bundled_rust_deps}
|
|
|
|
BuildRequires: rust-toolset
|
|
|
|
BuildRequires: make
|
|
|
|
BuildRequires: /usr/bin/ronn
|
2023-06-23 17:31:25 +00:00
|
|
|
BuildRequires: pkgconfig(systemd)
|
2023-05-16 00:13:52 +00:00
|
|
|
BuildRequires: systemd-rpm-macros
|
|
|
|
%else
|
2023-06-23 17:31:25 +00:00
|
|
|
BuildRequires: rust-packaging >= 21
|
2023-05-16 00:13:52 +00:00
|
|
|
%endif
|
2019-03-09 14:00:52 +00:00
|
|
|
|
2019-07-22 19:31:22 +00:00
|
|
|
%global _description %{expand:
|
2020-06-18 09:30:24 +00:00
|
|
|
This is a systemd unit generator that enables swap on zram.
|
2021-11-16 20:07:01 +00:00
|
|
|
(With zram, there is no physical swap device. Part of the available RAM
|
2020-06-18 09:30:24 +00:00
|
|
|
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
|
|
|
|
2019-03-09 14:00:52 +00:00
|
|
|
%description %{_description}
|
|
|
|
|
2018-08-28 18:41:40 +00:00
|
|
|
%package -n %{crate}
|
|
|
|
Summary: %{summary}
|
2023-06-23 17:31:25 +00:00
|
|
|
# Apache-2.0 OR MIT
|
2020-06-18 07:28:52 +00:00
|
|
|
# MIT
|
2023-06-23 17:31:25 +00:00
|
|
|
# MIT OR Apache-2.0
|
|
|
|
License: MIT AND (Apache-2.0 OR MIT)
|
2022-03-28 07:59:07 +00:00
|
|
|
Recommends: %{_sbindir}/zramctl
|
2018-08-28 18:41:40 +00:00
|
|
|
|
2019-07-22 19:31:22 +00:00
|
|
|
%description -n %{crate} %{_description}
|
2018-08-28 18:41:40 +00:00
|
|
|
|
2019-03-09 14:00:52 +00:00
|
|
|
%files -n %{crate}
|
|
|
|
%license LICENSE
|
2023-06-23 17:31:25 +00:00
|
|
|
%license LICENSE.dependencies
|
2024-02-01 18:46:56 +00:00
|
|
|
%if 0%{?bundled_rust_deps}
|
|
|
|
%license cargo-vendor.txt
|
|
|
|
%endif
|
2019-03-09 14:00:52 +00:00
|
|
|
%doc zram-generator.conf.example
|
2020-07-04 15:39:14 +00:00
|
|
|
%doc README.md
|
2019-03-09 14:00:52 +00:00
|
|
|
%{_systemdgeneratordir}/zram-generator
|
2021-01-13 15:58:19 +00:00
|
|
|
%{_unitdir}/systemd-zram-setup@.service
|
2020-06-23 17:55:52 +00:00
|
|
|
%{_mandir}/man8/zram-generator.8*
|
2020-11-23 13:40:46 +00:00
|
|
|
%{_mandir}/man5/zram-generator.conf.5*
|
2020-06-18 09:32:09 +00:00
|
|
|
|
2020-06-18 09:30:24 +00:00
|
|
|
%package -n %{crate}-defaults
|
2020-06-18 09:32:09 +00:00
|
|
|
Summary: Default configuration for %{crate}
|
2020-06-18 10:21:09 +00:00
|
|
|
Requires: %{crate} = %{version}-%{release}
|
2020-07-06 14:51:08 +00:00
|
|
|
Obsoletes: zram < 0.4-2
|
2020-06-18 09:32:09 +00:00
|
|
|
BuildArch: noarch
|
|
|
|
|
2020-06-18 09:30:24 +00:00
|
|
|
%description -n %{crate}-defaults
|
2020-06-18 09:32:09 +00:00
|
|
|
%{summary}.
|
|
|
|
|
2020-06-18 09:30:24 +00:00
|
|
|
%files -n %{crate}-defaults
|
2020-06-18 09:32:09 +00:00
|
|
|
%{_prefix}/lib/systemd/zram-generator.conf
|
2020-06-18 07:28:52 +00:00
|
|
|
|
2023-05-16 00:13:52 +00:00
|
|
|
%if ! 0%{?bundled_rust_deps}
|
2020-06-18 07:28:52 +00:00
|
|
|
%package devel
|
2020-11-23 13:40:46 +00:00
|
|
|
Summary: %{summary}
|
2020-06-18 07:28:52 +00:00
|
|
|
BuildArch: noarch
|
|
|
|
|
|
|
|
%description devel %{_description}
|
|
|
|
|
2021-11-29 13:48:04 +00:00
|
|
|
This package contains library source intended for building other packages which
|
|
|
|
use the "%{crate}" crate.
|
2020-06-18 07:28:52 +00:00
|
|
|
|
|
|
|
%files devel
|
2023-06-23 17:31:25 +00:00
|
|
|
%license %{crate_instdir}/LICENSE
|
|
|
|
%doc %{crate_instdir}/README.md
|
|
|
|
%{crate_instdir}/
|
2020-06-18 07:28:52 +00:00
|
|
|
|
|
|
|
%package -n %{name}+default-devel
|
2020-11-23 13:40:46 +00:00
|
|
|
Summary: %{summary}
|
2020-06-18 07:28:52 +00:00
|
|
|
BuildArch: noarch
|
|
|
|
|
|
|
|
%description -n %{name}+default-devel %{_description}
|
|
|
|
|
2023-06-23 17:31:25 +00:00
|
|
|
This package contains library source intended for building other packages which
|
|
|
|
use the "default" feature of the "%{crate}" crate.
|
2020-06-18 07:28:52 +00:00
|
|
|
|
|
|
|
%files -n %{name}+default-devel
|
2023-06-23 17:31:25 +00:00
|
|
|
%ghost %{crate_instdir}/Cargo.toml
|
2023-05-16 00:13:52 +00:00
|
|
|
%endif
|
2019-03-09 14:00:52 +00:00
|
|
|
|
2018-08-28 18:41:40 +00:00
|
|
|
%prep
|
2024-02-01 18:46:56 +00:00
|
|
|
%autosetup -n %{crate}-%{version_no_tilde} -p1 %{?bundled_rust_deps:-a2}
|
2020-06-18 09:32:09 +00:00
|
|
|
cp -a %{S:1} .
|
2023-05-16 00:13:52 +00:00
|
|
|
%if 0%{?bundled_rust_deps}
|
2024-02-01 18:46:56 +00:00
|
|
|
%cargo_prep -v vendor
|
2023-05-16 00:13:52 +00:00
|
|
|
%else
|
2018-08-28 18:41:40 +00:00
|
|
|
%cargo_prep
|
|
|
|
|
2019-07-22 19:31:22 +00:00
|
|
|
%generate_buildrequires
|
|
|
|
%cargo_generate_buildrequires
|
2021-01-13 15:58:19 +00:00
|
|
|
echo '/usr/bin/make'
|
|
|
|
echo '/usr/bin/ronn'
|
2023-06-23 17:31:25 +00:00
|
|
|
echo 'pkgconfig(systemd)'
|
2021-01-23 12:23:55 +00:00
|
|
|
echo 'systemd-rpm-macros'
|
2023-05-16 00:13:52 +00:00
|
|
|
%endif
|
2019-07-22 19:31:22 +00:00
|
|
|
|
2018-08-28 18:41:40 +00:00
|
|
|
%build
|
2021-03-21 10:19:16 +00:00
|
|
|
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
|
2024-02-01 18:46:56 +00:00
|
|
|
%cargo_license_summary
|
|
|
|
%{cargo_license} > LICENSE.dependencies
|
|
|
|
%if 0%{?bundled_rust_deps}
|
|
|
|
%cargo_vendor_manifest
|
|
|
|
%endif
|
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
|
2021-03-21 10:19:16 +00:00
|
|
|
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
|
2021-10-26 15:32:49 +00:00
|
|
|
%make_install SYSTEMD_SYSTEM_UNIT_DIR=%{_unitdir} SYSTEMD_SYSTEM_GENERATOR_DIR=%{_systemdgeneratordir} \
|
|
|
|
NOBUILD=1
|
2021-10-25 12:39:02 +00:00
|
|
|
|
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
|
2021-03-21 10:19:16 +00:00
|
|
|
export SYSTEMD_UTIL_DIR=%{_systemd_util_dir}
|
2018-08-28 18:41:40 +00:00
|
|
|
%cargo_test
|
2021-10-26 15:32:49 +00:00
|
|
|
|
|
|
|
: ==============================================================================
|
|
|
|
%{buildroot}%{_systemdgeneratordir}/zram-generator --help
|
|
|
|
: ==============================================================================
|
|
|
|
%{buildroot}%{_systemdgeneratordir}/zram-generator --help | grep -q %{_systemd_util_dir}/systemd-makefs
|
2018-08-28 18:41:40 +00:00
|
|
|
%endif
|
|
|
|
|
|
|
|
%changelog
|
2021-10-25 08:54:07 +00:00
|
|
|
%autochangelog
|