diff --git a/.gitignore b/.gitignore index 4c47732..6195b17 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ /linux-5.8.11.tar.xz /rd-agent-2.1.2.crate /rd-agent-2.1.2-vendor.tar.gz -/rd-agent-2.2.5.crate diff --git a/README.md b/README.md new file mode 100644 index 0000000..5131718 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# rust-rd-agent + +The rust-rd-agent package diff --git a/rd-agent-enum-iterator.patch b/rd-agent-enum-iterator.patch deleted file mode 100644 index 3e64a9c..0000000 --- a/rd-agent-enum-iterator.patch +++ /dev/null @@ -1,68 +0,0 @@ -diff --git a/src/report.rs b/src/report.rs -index 4d825fd9..cebdfd7f 100644 ---- a/src/report.rs -+++ b/src/report.rs -@@ -2,7 +2,6 @@ - use anyhow::{anyhow, bail, Result}; - use chrono::prelude::*; - use crossbeam::channel::{self, select, Receiver, Sender}; --use enum_iterator::IntoEnumIterator; - use log::{debug, error, info, trace, warn}; - use nix::sys::signal::{kill, Signal}; - use nix::unistd::Pid; -@@ -266,7 +265,7 @@ impl UsageTracker { - }; - - us.usages.insert(ROOT_SLICE.into(), Default::default()); -- for slice in Slice::into_enum_iter() { -+ for slice in enum_iterator::all::() { - us.usages.insert(slice.name().into(), Default::default()); - } - -@@ -281,7 +280,7 @@ impl UsageTracker { - - let (us, cpu_total) = read_system_usage(self.devnr)?; - usages.insert(ROOT_SLICE.into(), us); -- for slice in Slice::into_enum_iter() { -+ for slice in enum_iterator::all::() { - usages.insert( - slice.name().to_string(), - read_cgroup_usage(slice.cgrp(), self.devnr), -diff --git a/src/slices.rs b/src/slices.rs -index 2053e7bb..b575cc8b 100644 ---- a/src/slices.rs -+++ b/src/slices.rs -@@ -1,6 +1,5 @@ - // Copyright (c) Facebook, Inc. and its affiliates. - use anyhow::{Context, Result}; --use enum_iterator::IntoEnumIterator; - use glob::glob; - use log::{debug, error, info, trace, warn}; - use scan_fmt::scan_fmt; -@@ -246,7 +245,7 @@ pub fn apply_slices(knobs: &mut SliceKnobs, hashd_mem_size: u64, cfg: &Config) - - } - - let mut updated = false; -- for slice in Slice::into_enum_iter() { -+ for slice in enum_iterator::all::() { - let enforce_mem = slice_enforce_mem(&cfg.enforce, slice); - - if !cfg.enforce.cpu && !enforce_mem && !cfg.enforce.io { -@@ -353,7 +352,7 @@ fn clear_one_slice(slice: Slice, ecfg: &EnforceConfig) -> Result { - - pub fn clear_slices(ecfg: &EnforceConfig) -> Result<()> { - let mut updated = false; -- for slice in Slice::into_enum_iter() { -+ for slice in enum_iterator::all::() { - let enforce_mem = slice_enforce_mem(ecfg, slice); - - if !ecfg.cpu && !enforce_mem && !ecfg.io { -@@ -597,7 +596,7 @@ pub fn verify_and_fix_slices( - - let recursive_mem_prot = cfg.memcg_recursive_prot(); - -- for slice in Slice::into_enum_iter() { -+ for slice in enum_iterator::all::() { - let sk = knobs.slices.get(slice.name()).unwrap(); - - let path = slice.cgrp(); diff --git a/rd-agent-fix-metadata.diff b/rd-agent-fix-metadata.diff deleted file mode 100644 index f15bc30..0000000 --- a/rd-agent-fix-metadata.diff +++ /dev/null @@ -1,20 +0,0 @@ ---- rd-agent-2.2.5/Cargo.toml 1970-01-01T00:00:01+00:00 -+++ rd-agent-2.2.5/Cargo.toml 2026-01-05T10:01:01.383431+00:00 -@@ -30,7 +30,7 @@ - version = "0.8" - - [dependencies.enum-iterator] --version = "0.7" -+version = "2.0" - - [dependencies.glob] - version = "0.3" -@@ -61,7 +61,7 @@ - version = "0.3" - - [dependencies.procfs] --version = "0.16" -+version = ">=0.16, <0.19" - - [dependencies.rd-agent-intf] - version = "2.2.5" diff --git a/rust-rd-agent.spec b/rust-rd-agent.spec index 88b45fe..1d80f74 100644 --- a/rust-rd-agent.spec +++ b/rust-rd-agent.spec @@ -1,37 +1,46 @@ -# Generated by rust2rpm 28 -%bcond check 1 +# Generated by rust2rpm 18 +%bcond_without check +%global __cargo_skip_build 0 %global crate rd-agent -%global selinuxtype targeted -%bcond selinux 1 +%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 -Name: rust-rd-agent -Version: 2.2.5 +%global selinuxtype targeted +%bcond_without selinux + +Name: rust-%{crate} +Version: 2.1.2 Release: %autorelease Summary: Management agent for resctl-demo -License: Apache-2.0 +# 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 -Source: https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.8.11.tar.xz -# Manually created patch for downstream crate metadata changes -# * bump enum-iterator to 2.0 -# * allow procfs 0.17, -# https://github.com/facebookexperimental/resctl-demo/pull/326, and 0.18, -# https://github.com/facebookexperimental/resctl-demo/pull/335 -Patch: rd-agent-fix-metadata.diff -# https://github.com/facebookexperimental/resctl-demo/commit/f65eedf9017332255ef0a48649664c26b45b9c07 -Patch: rd-agent-enum-iterator.patch +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 -BuildRequires: cargo-rpm-macros >= 24 +ExclusiveArch: %{rust_arches} -%if %{with selinux} +%if 0%{?el8} +BuildRequires: rust-toolset +%else +BuildRequires: rust-packaging +%endif + +%if 0%{?with_selinux} BuildRequires: selinux-policy-devel %endif @@ -42,22 +51,8 @@ Management agent for resctl-demo.} %package -n %{crate} Summary: %{summary} -# (MIT OR Apache-2.0) AND Unicode-DFS-2016 -# 0BSD -# 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-2-Clause OR Apache-2.0 OR MIT -# MIT -# MIT OR Apache-2.0 -# MIT OR Zlib OR Apache-2.0 -# Unlicense OR MIT -License: 0BSD AND Apache-2.0 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 (BSD-2-Clause OR Apache-2.0 OR MIT) AND (MIT OR Zlib OR Apache-2.0) AND (Unlicense OR MIT) -# LICENSE.dependencies contains a full license breakdown -%if %{with selinux} +%if 0%{?with_selinux} Requires: (%{crate}-selinux if selinux-policy-%{selinuxtype}) %endif Recommends: rd-hashd = %{version} @@ -74,7 +69,6 @@ Recommends: xz %files -n %{crate} %license LICENSE -%license LICENSE.dependencies %doc README.md %{_bindir}/rd-agent %attr(2775, root, wheel) %dir %{_sharedstatedir}/resctl-demo @@ -89,7 +83,7 @@ This package contains data files for %{crate}. %files -n %{crate}-data %{_datadir}/resctl-demo -%if %{with selinux} +%if 0%{?with_selinux} %package -n %{crate}-selinux Summary: SELinux policy for %{crate} BuildArch: noarch @@ -119,21 +113,26 @@ fi %endif %prep -%autosetup -n %{crate}-%{version} -p1 -%cargo_prep -%if %{with selinux} +%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 -%{cargo_license_summary} -%{cargo_license} > LICENSE.dependencies -%if %{with selinux} + +%if 0%{?with_selinux} make -C selinux -f %{_datadir}/selinux/devel/Makefile %{crate}.pp bzip2 -9 selinux/%{crate}.pp %endif @@ -143,7 +142,7 @@ bzip2 -9 selinux/%{crate}.pp install -Dpm0644 %SOURCE1 %{buildroot}%{_datadir}/resctl-demo/linux.tar.xz mkdir -p %{buildroot}%{_sharedstatedir}/resctl-demo -%if %{with selinux} +%if 0%{?with_selinux} install -Dm0644 selinux/%{crate}.pp.bz2 \ %{buildroot}%{_datadir}/selinux/packages/%{selinuxtype}/%{crate}.pp.bz2 %endif diff --git a/sources b/sources index 15a40ce..314aeaa 100644 --- a/sources +++ b/sources @@ -1,2 +1,3 @@ -SHA512 (rd-agent-2.2.5.crate) = c06d65a1b6bc94e3dea8b006a5418d2d336b0521e24caa1bbfa4b75375249d47487e379383a9a303236f40ab8e494a1b78d8c1bb80182f587bb105407cad6e81 +SHA512 (rd-agent-2.1.2.crate) = 15dae4e8d6cb2466130eeb208e387e5cc2bc1c0179dd1261057f657738c7f1dc5b54cb29d4a37074aba7196d535b91ee5058b90403c27a12115dfa1ce87712d0 SHA512 (linux-5.8.11.tar.xz) = bb6994f09aabfb0076f3023dd8359c5c569a4b398d3a3c3c8d6b27052092cab56ad675f45dd6ceba7fe431f2a6a587858f3c21415b5a00adb346bd2c68d85b0f +SHA512 (rd-agent-2.1.2-vendor.tar.gz) = 67bbbd761c7788c3689f1d67e720e4cafc38442b2f64e3ff384927a90ccad458b0e648224e1fa46c41550a554e17819cc7a23606d2598d1e40589fe02377ed39