commit 8f4c6576bd8b3a2133bbdfb047a137137731c862 Author: tigro Date: Mon Jan 15 22:23:55 2024 +0300 import rust-rd-agent-2.1.2-7.el9 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c273060 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +SOURCES/rd-agent-2.1.2-vendor.tar.gz +SOURCES/linux-5.8.11.tar.xz diff --git a/.rust-rd-agent.metadata b/.rust-rd-agent.metadata new file mode 100644 index 0000000..9fec122 --- /dev/null +++ b/.rust-rd-agent.metadata @@ -0,0 +1,2 @@ +e862cb1a476c73af832e662fe4efa7e94e0e7d2d SOURCES/rd-agent-2.1.2-vendor.tar.gz +3c88f4eb9b877148e02480409aaf8973a22f8f3a SOURCES/linux-5.8.11.tar.xz diff --git a/SOURCES/rd-agent-2.1.2.crate b/SOURCES/rd-agent-2.1.2.crate new file mode 100644 index 0000000..8b1ba08 Binary files /dev/null and b/SOURCES/rd-agent-2.1.2.crate differ diff --git a/SOURCES/rd-agent.fc b/SOURCES/rd-agent.fc new file mode 100644 index 0000000..f8a1a5c --- /dev/null +++ b/SOURCES/rd-agent.fc @@ -0,0 +1,4 @@ +/usr/bin/rd-agent -- gen_context(system_u:object_r:resctl_demo_exec_t,s0) + +/var/lib/resctl-demo/misc-bin(/.*)? gen_context(system_u:object_r:var_lib_resctl_demo_bin_t,s0) +/var/lib/resctl-demo/sideload-bin(/.*)? gen_context(system_u:object_r:var_lib_resctl_demo_bin_t,s0) diff --git a/SOURCES/rd-agent.if b/SOURCES/rd-agent.if new file mode 100644 index 0000000..2e81779 --- /dev/null +++ b/SOURCES/rd-agent.if @@ -0,0 +1,2 @@ +## +rd-agentd interface diff --git a/SOURCES/rd-agent.te b/SOURCES/rd-agent.te new file mode 100644 index 0000000..2940ea0 --- /dev/null +++ b/SOURCES/rd-agent.te @@ -0,0 +1,23 @@ +policy_module(rd-agent, 1.0.0) + +######################################## +# +# Declarations +# + +type resctl_demo_t; +type resctl_demo_exec_t; +init_daemon_domain(resctl_demo_t, resctl_demo_exec_t); + +type var_lib_resctl_demo_bin_t; +files_type(var_lib_resctl_demo_bin_t); + +######################################## +# +# rd-agent local policy +# + +allow resctl_demo_exec_t var_lib_resctl_demo_bin_t:file execute; + +manage_dirs_pattern(resctl_demo_exec_t, var_lib_resctl_demo_bin_t, var_lib_resctl_demo_bin_t); +manage_files_pattern(resctl_demo_exec_t, var_lib_resctl_demo_bin_t, var_lib_resctl_demo_bin_t); diff --git a/SPECS/rust-rd-agent.spec b/SPECS/rust-rd-agent.spec new file mode 100644 index 0000000..94a7326 --- /dev/null +++ b/SPECS/rust-rd-agent.spec @@ -0,0 +1,188 @@ +## START: Set by rpmautospec +## (rpmautospec version 0.3.1) +## RPMAUTOSPEC: autorelease, autochangelog +%define autorelease(e:s:pb:n) %{?-p:0.}%{lua: + release_number = 7; + base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}")); + print(release_number + base_release_number - 1); +}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}} +## END: Set by rpmautospec + +# Generated by rust2rpm 18 +%bcond_without check +%global __cargo_skip_build 0 + +%global crate rd-agent + +%if 0%{?el8} +# el8 doesn't have these macros +%global __crates_url https://crates.io/api/v1/crates/ +%global crates_source %{__crates_url}%{crate}/%{version}/download#/%{crate}-%{version}.crate +%global version_no_tilde %{version} +%endif + +%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 +# Vendored dependencies for EPEL, update with ./update-vendor-tarball.sh +Source2: %{crate}-%{version}-vendor.tar.gz +# SELinux policy +Source10: %{crate}.fc +Source11: %{crate}.if +Source12: %{crate}.te + +ExclusiveArch: %{rust_arches} + +%if 0%{?el8} +BuildRequires: rust-toolset +%else +BuildRequires: rust-packaging +%endif + +%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 + +%if 0%{?el8} +%cargo_prep -V 2 +%else +%cargo_prep + +%generate_buildrequires +%cargo_generate_buildrequires +%endif + +%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 +* Mon Jan 15 2024 Arkady L. Shane - 2.1.2-7 +- Rebuilt for MSVSphere 9.3 + +* Sat Jan 28 2023 Fabio Valentini - 2.1.2-7 +- Rebuild for CVE-2022-24765 and CVE-2022-29187 in libgit2 + +* Sat Jan 21 2023 Fedora Release Engineering - 2.1.2-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Sat Jul 23 2022 Fedora Release Engineering - 2.1.2-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Tue Feb 15 2022 Zbigniew Jędrzejewski-Szmek - 2.1.2-4 +- Rebuild with package notes + +* Fri Jan 21 2022 Fedora Release Engineering - 2.1.2-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Fri Oct 22 2021 Davide Cavalca - 2.1.2-2 +- Build for epel8 + +* Thu Oct 21 2021 Davide Cavalca - 2.1.2-1 +- Initial import; Fixes: RHBZ#1990930