diff --git a/.gitignore b/.gitignore index 7055dfd..1dfba3c 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ /below-0.4.1-vendor.tar.gz /below-0.5.0.crate /below-0.5.0-vendor.tar.gz +/below-0.6.3.crate diff --git a/README-epel.md b/README-epel.md deleted file mode 100644 index 6ef3d03..0000000 --- a/README-epel.md +++ /dev/null @@ -1,12 +0,0 @@ -# Note for EPEL users - -The stock EL8 (RHEL/CentOS/CentOS Stream) kernel has PSI support compiled -into the kernel but disabled by default. - -You will need to pass `psi=1` on the kernel command line, see -https://facebookmicrosites.github.io/psi/docs/overview.html#prerequisites - -To persist, add this to `/etc/default/grub` to the `GRUB_CMDLINE_LINUX` -string and rebuild the GRUB config by running this as root: - -`grub2-mkconfig -o /etc/grub2-efi.cfg` diff --git a/README-upstream.md b/README-upstream.md deleted file mode 100644 index b213dca..0000000 --- a/README-upstream.md +++ /dev/null @@ -1,91 +0,0 @@ -![below](img/below_logo_horizontal.png) - -[![CI](https://github.com/facebookincubator/below/workflows/CI/badge.svg)](https://github.com/facebookincubator/below/actions?query=workflow%3ACI+branch%3Amain+) -[![Matrix chat](https://img.shields.io/matrix/below:matrix.org)](https://matrix.to/#/!SrWxtbLuRUMrDbftgA:matrix.org?via=matrix.org) - -`below` is an interactive tool to view and record historical system data. It -has support for: - -* information regarding hardware resource utilization -* viewing the cgroup hierarchy -* cgroup and process information -* pressure stall information (PSI) -* `record` mode to record system data -* `replay` mode to replay historical system data -* `live` mode to view live system data -* `dump` subcommand to report script-friendly information (eg JSON and CSV) - -below does **not** have support for cgroup1. - -The name "below" stems from the fact that the below developers rejected many -of [atop](https://linux.die.net/man/1/atop)'s design and style decisions. - -## Demo - - - - - -## Installing - -`below` is packaged in Fedora as of Fedora 34, and can be installed with: - -```shell -sudo dnf install below -``` - -Optionally, the systemd service for persistent data collection can also be -enabled with: - -```shell -sudo systemctl enable --now below -``` - -## Installing from source - -First, install dependencies listed in [building.md](docs/building.md). - -```shell -$ cargo install below -$ below --help -``` - -For convenience, we also provide a Dockerfile and -[pre-built images](https://hub.docker.com/r/below/below) on Docker Hub. -See [docker.md](docs/docker.md) for how to use them. - -## Quickstart - -Live view of system: - -```shell -$ sudo below live -``` - -Run recording daemon: - -```shell -$ sudo cp ~/.cargo/bin/below /bin/below # if using cargo-install -$ sudo cp resctl/below/etc/below.service /etc/systemd/system -$ sudo systemctl daemon-reload -$ sudo systemctl start below -``` - -Replay historical data: - -```shell -$ below replay -t "3m ago" -``` - -## Comparison with alternative tools - -See [comparison.md](docs/comparison.md) for a feature comparison -with alternative tools. - -## Contributing - -See the [CONTRIBUTING](CONTRIBUTING.md) file for how to help out. - -## License - -See [LICENSE](LICENSE) file. diff --git a/below-fix-metadata.diff b/below-fix-metadata.diff index 4948087..79450c2 100644 --- a/below-fix-metadata.diff +++ b/below-fix-metadata.diff @@ -1,21 +1,11 @@ -diff '--color=auto' -ruN below-0.5.0/Cargo.toml below-0.5.0-fix-metadata/Cargo.toml ---- below-0.5.0/Cargo.toml 1969-12-31 16:00:01.000000000 -0800 -+++ below-0.5.0-fix-metadata/Cargo.toml 2022-02-17 22:51:13.480645198 -0800 -@@ -112,3 +112,17 @@ +--- below-0.6.3/Cargo.toml 1970-01-01T00:00:01+00:00 ++++ below-0.6.3/Cargo.toml 2023-01-26T19:04:17.646384+00:00 +@@ -51,7 +51,7 @@ + package = "below-config" + + [dependencies.cursive] +-version = "0.19.0" ++version = "0.20.0" + features = ["crossterm-backend"] + default-features = false - [features] - enable_backtrace = [] -+ -+[patch.crates-io] -+cgroupfs = { path = "patched-crates/cgroupfs" } -+common = { path = "patched-crates/below-common", package = "below-common" } -+config = { path = "patched-crates/below-config", package = "below-config" } -+derive = { path = "patched-crates/below_derive", package = "below_derive" } -+dump = { path = "patched-crates/below-dump", package = "below-dump" } -+libbpf-rs = { path = "patched-crates/libbpf-rs" } -+libbpf-cargo = { path = "patched-crates/libbpf-cargo" } -+model = { path = "patched-crates/below-model", package = "below-model" } -+procfs = { path = "patched-crates/fb_procfs", package = "fb_procfs" } -+render = { path = "patched-crates/below-render", package = "below-render" } -+store = { path = "patched-crates/below-store", package = "below-store" } -+view = { path = "patched-crates/below-view", package = "below-view" } diff --git a/rust-below.spec b/rust-below.spec index e69b7ad..a48e4f7 100644 --- a/rust-below.spec +++ b/rust-below.spec @@ -1,60 +1,26 @@ -# Generated by rust2rpm 20 +# Generated by rust2rpm 23 %bcond_without check %global crate below -%if 0%{?el8} -# disabling this as it chokes on the vendored dependencies -%undefine __brp_mangle_shebangs -# 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 forgeurl https://github.com/facebookincubator/below -Name: rust-%{crate} -Version: 0.5.0 +Name: rust-below +Version: 0.6.3 Release: %autorelease Summary: Interactive tool to view and record historical system data -# Upstream license specification: Apache-2.0 -License: ASL 2.0 +License: Apache-2.0 URL: https://crates.io/crates/below Source: %{crates_source} -# Initial patched metadata -# Downgrade edition to 2018 and patch a number of crates to use the ones -# distributed in the vendor tarball; this is meant to to be applied only for -# EPEL builds -Patch0: below-fix-metadata.diff - # Get these from the repo as they aren't included in the crate Source1: %{forgeurl}/raw/v%{version}/etc/below.service Source2: %{forgeurl}/raw/v%{version}/etc/logrotate.conf -Source3: %{forgeurl}/raw/v%{version}/README.md#/README-upstream.md -# patched crates and vendored dependencies for EPEL -# update with ./update-vendor-tarball.sh after bumping the specfile version -Source4: %{crate}-%{version}-vendor.tar.gz -# EPEL specific doc -Source5: README-epel.md - -ExclusiveArch: %{rust_arches} - -%if 0%{?el8} -BuildRequires: rust-toolset -BuildRequires: sed -# for libbpf-sys -BuildRequires: kernel-headers -BuildRequires: elfutils-libelf-devel -BuildRequires: libbpf-devel -BuildRequires: zlib-devel -# for libbpf-cargo -BuildRequires: clang -BuildRequires: rustfmt -%else -BuildRequires: rust-packaging -%endif +# Manually created patch for downstream crate metadata changes +# * bump cursive from 0.19.0 to 0.20.0 +Patch: below-fix-metadata.diff + +BuildRequires: rust-packaging >= 21 BuildRequires: systemd-rpm-macros %global _description %{expand: @@ -79,19 +45,8 @@ atop's design and style decisions.} %package -n %{crate} Summary: %{summary} -# for i in $(rpm -qa | grep "rust-.*-devel"); do -# rpm -q $i --qf "%%{LICENSE}\n"; -# done | sort | uniq -# -# ASL 2.0 -# ASL 2.0 or Boost -# ASL 2.0 or MIT -# BSD -# MIT -# MIT or ASL 2.0 -# MPLv2.0 or MIT or ASL 2.0 -# Unlicense or MIT -License: ASL 2.0 and BSD and MIT +License: Apache-2.0 AND (Apache-2.0 OR MIT) AND Unicode-DFS-2016 AND (Apache-2.0 OR BSL-1.0) AND BSD-2-Clause AND (Apache-2.0 OR BSD-3-Clause OR MIT) AND (BSD-2-Clause OR LGPL-2.1) AND MIT AND (MPL-2.0 OR MIT OR Apache-2.0) AND (Unlicense OR MIT) +# LICENSE.dependencies contains a full license breakdown Recommends: logrotate @@ -99,10 +54,10 @@ Recommends: logrotate %files -n %{crate} %license LICENSE -%doc README.md -%if 0%{?el8} -%doc README-epel.md +%if 0%{?fedora} +%license LICENSE.dependencies %endif +%doc README.md %{_bindir}/below %{_unitdir}/%{crate}.service %dir %{_sysconfdir}/logrotate.d @@ -119,27 +74,17 @@ Recommends: logrotate %systemd_postun_with_restart %{crate}.service %prep -%setup -q -n %{crate}-%{version_no_tilde} -%if 0%{?el8} -%cargo_prep -V 4 -%patch0 -p1 -cp -p %{SOURCE5} README-epel.md -%ifarch s390x -# drop opt-level generation to fix s390x OOM problems -sed -i 's/opt-level=3/opt-level=1/' .cargo/config -%endif -%else +%autosetup -n %{crate}-%{version_no_tilde} -p1 %cargo_prep -%endif -cp -p %{SOURCE3} README.md -%if 0%{?fedora} %generate_buildrequires %cargo_generate_buildrequires -%endif %build %cargo_build +%if 0%{?fedora} +%{cargo_license} > LICENSE.dependencies +%endif %install %cargo_install diff --git a/sources b/sources index d7f78ea..27f0e8c 100644 --- a/sources +++ b/sources @@ -1,2 +1 @@ -SHA512 (below-0.5.0.crate) = 7fd12aae0b912756a5ac3cee289d1b8390349f046cbf18a32dc61b7b41ab0809154133eff63cd04637f0d2ae3cdb25b5c7e2016452ed840205f5b7db57403c61 -SHA512 (below-0.5.0-vendor.tar.gz) = 61d9bfcb0243c08f6fe4f16f4dcbebafb946b1e62857d4182aaa99325bf72e7ecc8209c6ddd05c0e120f0bcc3cff128fe60ad9fb33cd560a996cb424ad74a7ed +SHA512 (below-0.6.3.crate) = 4326bb87ba7d2f378fb8e7ecd68332574ef03f6d9f2fdd7994c8813817aeddf649fc5935b46328bc7a4c08ed3f292a881455b8de88fab424c613adb305a75a5e diff --git a/update-vendor-tarball.sh b/update-vendor-tarball.sh deleted file mode 100755 index b86f03f..0000000 --- a/update-vendor-tarball.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/sh - -if [ "$1" == --prepare ]; then - PREPARE=1 -fi - -name='below' -specfile="rust-${name}.spec" -version=$(rpm -q --qf '%{VERSION}\n' --specfile "$specfile" | head -1) -nv="${name}-${version}" -crate="${nv}.crate" -vendor_tarball="${nv}-vendor.tar.gz" - -if [ -f "$vendor_tarball" ]; then - echo "${vendor_tarball} already exists, aborting" - exit 1 -fi - -[ -f "$crate" ] || spectool -g "$specfile" -tardir="$PWD" -workdir=$(mktemp -d) -if [ ! -n "$PREPARE" ]; then - trap 'rm -rf "$workdir"' EXIT -fi - -# libbpf-rs and libbpf-cargo transitively depend on libbpf 0.5.0, and -# el8 ships 0.4.0. -# -# So we cheat: -# - below-fix-metadata.diff (which is applied in %prep) -# sets up all the other crates to be replaced with patched -# versions under patched-crates/ -# - below-patched-crates.patch contains the actual modifications of the patched -# crates (mostly the edition downgrades, a few pins and a couple of build -# fixes) -# -# We then build the vendored tarball as follows: -# - unpack the below crate and vendor -# - foreach patched crate, move it from vendor/ to patched-crates/ -# - delete vendor/ as it's no longer needed, and so we can vendor again later -# - apply the two patches, to fix the below metadata and the patched crates -# - run vendor again, and then tar up *both* patched-crates/ and vendor/ -tar xvzf "$tardir/$crate" -C "$workdir" -(cd "${workdir}/${nv}" && cargo vendor) -mkdir "${workdir}/${nv}/patched-crates" -for c in below_derive below-common below-config below-dump below-model below-render below-store below-view cgroupfs fb_procfs libbpf-cargo libbpf-rs; do - mv "${workdir}/${nv}/vendor/${c}" "${workdir}/${nv}/patched-crates/" -done -rm -r "${workdir}/${nv}/vendor" -(cd "${workdir}/${nv}" && patch -p1 < ${tardir}/below-fix-metadata.diff) -if [ -n "$PREPARE" ]; then - echo "Go to ${workdir} and update the patch" - exit 1 -else - (cd "${workdir}/${nv}" && \ - ([ -f ${tardir}/below-patched-crates.patch ] && \ - patch -p1 < ${tardir}/below-patched-crates.patch); \ - cargo vendor && \ - tar cvzf "${tardir}/${vendor_tarball}" patched-crates/ vendor/) -fi - -exit 0