diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..93b0b38 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/below-0.2.0.crate diff --git a/below-fix-metadata.diff b/below-fix-metadata.diff new file mode 100644 index 0000000..695614f --- /dev/null +++ b/below-fix-metadata.diff @@ -0,0 +1,38 @@ +--- below-0.2.0/Cargo.toml 1970-01-01T00:00:00+00:00 ++++ below-0.2.0/Cargo.toml 2021-06-16T22:24:40.312159+00:00 +@@ -42,7 +42,7 @@ + package = "below-dump" + + [dependencies.libbpf-rs] +-version = "0.10.0" ++version = "0.11.0" + + [dependencies.libc] + version = "0.2.86" +@@ -65,7 +65,7 @@ + version = "1.4.2" + + [dependencies.serde] +-version = "=1.0.118" ++version = "1.0.126" + features = ["derive", "rc"] + + [dependencies.serde_json] +@@ -93,14 +93,14 @@ + version = "0.3.21" + + [dependencies.tokio] +-version = "0.2.25" ++version = "1.6.1" + features = ["full", "test-util"] + + [dependencies.toml] +-version = "=0.5.7" ++version = "0.5.8" + + [dependencies.users] +-version = "0.9" ++version = "0.11" + + [dependencies.view] + version = "0.2.0" diff --git a/below-fix-tests.patch b/below-fix-tests.patch new file mode 100644 index 0000000..f32eb2c --- /dev/null +++ b/below-fix-tests.patch @@ -0,0 +1,59 @@ +diff -Naur a/src/test/test_general.rs b/src/test/test_general.rs +--- a/src/test/test_general.rs 1969-12-31 16:00:00.000000000 -0800 ++++ b/src/test/test_general.rs 2021-06-16 16:08:09.168914682 -0700 +@@ -27,19 +27,16 @@ + .expect("failed to collect sample"); + + // Validate some data in the sample +- assert!( +- sample +- .cgroup +- .pressure +- .as_ref() +- .expect("missing memory.pressure") +- .memory +- .full +- .total +- .as_ref() +- .expect("missing memory.pressure.total") +- > &0 +- ); ++ sample ++ .cgroup ++ .pressure ++ .as_ref() ++ .expect("missing memory.pressure") ++ .memory ++ .full ++ .total ++ .as_ref() ++ .expect("missing memory.pressure.total"); + let nr_procs = sample.processes.len(); + let hostname = sample.system.hostname.clone(); + let proc0_cgroup = sample +@@ -75,17 +72,14 @@ + .expect("failed to get advanced data"); + + // Validate some values in restored sample +- assert!( +- *restored_sample +- .cgroup +- .io_total +- .as_ref() +- .expect("missing io.stat") +- .rbytes_per_sec +- .as_ref() +- .expect("missing io stat read bytes per second") +- == 0.0 +- ); ++ restored_sample ++ .cgroup ++ .io_total ++ .as_ref() ++ .expect("missing io.stat") ++ .rbytes_per_sec ++ .as_ref() ++ .expect("missing io stat read bytes per second"); + assert!(restored_sample.process.processes.len() == nr_procs); + assert!(restored_sample.system.hostname == hostname); + assert!( diff --git a/rust-below.spec b/rust-below.spec new file mode 100644 index 0000000..7cda384 --- /dev/null +++ b/rust-below.spec @@ -0,0 +1,61 @@ +# Generated by rust2rpm 16 +%bcond_without check +%global __cargo_skip_build 0 + +%global crate below + +Name: rust-%{crate} +Version: 0.2.0 +Release: 1%{?dist} +Summary: Interactive tool to view and record historical system data + +# Upstream license specification: Apache-2.0 +License: ASL 2.0 +URL: https://crates.io/crates/below +Source: %{crates_source} +# Bump serde to 1.0.126, tokio to 1.6.1, toml to 0.58, users to 0.11 +Patch0: below-fix-metadata.diff +# Fix record_replay_integration test +Patch1: below-fix-tests.patch + +ExclusiveArch: %{rust_arches} + +BuildRequires: rust-packaging + +%global _description %{expand: +Interactive tool to view and record historical system data.} + +%description %{_description} + +%package -n %{crate} +Summary: %{summary} + +%description -n %{crate} %{_description} + +%files -n %{crate} +%license LICENSE +%{_bindir}/%{crate} +%dir %{_localstatedir}/log/%{crate} + +%prep +%autosetup -n %{crate}-%{version_no_tilde} -p1 +%cargo_prep + +%generate_buildrequires +%cargo_generate_buildrequires + +%build +%cargo_build + +%install +%cargo_install +install -d -m1777 %{buildroot}%{_localstatedir}/log/%{crate} + +%if %{with check} +%check +%cargo_test +%endif + +%changelog +* Tue Jun 15 2021 Davide Cavalca - 0.2.0-1 +- Initial package diff --git a/sources b/sources new file mode 100644 index 0000000..e2480dd --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (below-0.2.0.crate) = 4f72620ed5c66ead42b5ab50c2a7e975956a6511b23e41056a4452274b7bc8172729b0ff44d9ce524d43024471236d093111a7e9d44239efed0a5a1e38127944