# Generated by rust2rpm 18 %bcond_without check %global __cargo_skip_build 0 %global crate rd-agent %global selinuxtype targeted %bcond_without selinux Name: rust-%{crate} Version: 2.1.2 Release: %autorelease Summary: Management agent for resctl-demo # Upstream license specification: Apache-2.0 License: ASL 2.0 and MIT URL: https://crates.io/crates/rd-agent Source: %{crates_source} # Used as a data file by rd-agent for the compile sideload Source1: https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.8.11.tar.xz # SELinux policy Source10: %{crate}.fc Source11: %{crate}.if Source12: %{crate}.te ExclusiveArch: %{rust_arches} BuildRequires: rust-packaging %if 0%{?with_selinux} BuildRequires: selinux-policy-devel %endif %global _description %{expand: Management agent for resctl-demo.} %description %{_description} %package -n %{crate} Summary: %{summary} %if 0%{?with_selinux} Requires: (%{crate}-selinux if selinux-policy-%{selinuxtype}) %endif Recommends: rd-hashd = %{version} Recommends: %{crate}-data = %{version}-%{release} Recommends: bcc Recommends: fio Recommends: oomd Recommends: stress Recommends: tar Recommends: wget Recommends: xz %description -n %{crate} %{_description} %files -n %{crate} %license LICENSE %doc README.md %{_bindir}/rd-agent %attr(2775, root, wheel) %dir %{_sharedstatedir}/resctl-demo %package -n %{crate}-data Summary: Data files for %{crate} BuildArch: noarch %description -n %{crate}-data This package contains data files for %{crate}. %files -n %{crate}-data %{_datadir}/resctl-demo %if 0%{?with_selinux} %package -n %{crate}-selinux Summary: SELinux policy for %{crate} BuildArch: noarch Requires: selinux-policy-%{selinuxtype} Requires(post): selinux-policy-%{selinuxtype} %{?selinux_requires} %description -n %{crate}-selinux This package contains the SELinux policy for %{crate}. %pre -n %{crate}-selinux %selinux_relabel_pre -s %{selinuxtype} %post -n %{crate}-selinux %selinux_modules_install -s %{selinuxtype} %{_datadir}/selinux/packages/%{selinuxtype}/%{crate}.pp.bz2 %selinux_relabel_post -s %{selinuxtype} %postun -n %{crate}-selinux if [ $1 -eq 0 ]; then %selinux_modules_uninstall -s %{selinuxtype} %{crate} %selinux_relabel_post -s %{selinuxtype} fi %files -n %{crate}-selinux %{_datadir}/selinux/packages/%{selinuxtype}/%{crate}.pp.* %ghost %verify(not md5 size mtime) %{_sharedstatedir}/selinux/%{selinuxtype}/active/modules/200/%{crate} %endif %prep %autosetup -n %{crate}-%{version_no_tilde} -p1 %if 0%{?with_selinux} mkdir selinux cp -p %{SOURCE10} %{SOURCE11} %{SOURCE12} selinux %endif %cargo_prep %generate_buildrequires %cargo_generate_buildrequires %build %cargo_build %if 0%{?with_selinux} make -C selinux -f %{_datadir}/selinux/devel/Makefile %{crate}.pp bzip2 -9 selinux/%{crate}.pp %endif %install %cargo_install install -Dpm0644 %SOURCE1 %{buildroot}%{_datadir}/resctl-demo/linux.tar.xz mkdir -p %{buildroot}%{_sharedstatedir}/resctl-demo %if 0%{?with_selinux} install -Dm0644 selinux/%{crate}.pp.bz2 \ %{buildroot}%{_datadir}/selinux/packages/%{selinuxtype}/%{crate}.pp.bz2 %endif %if %{with check} %check %cargo_test %endif %changelog %autochangelog