# COPR spec for retch. See packaging/aur/PKGBUILD for the sibling packaging target.
#
# This spec is written for COPR with "Enable internet access during builds" ON, so
# `cargo build` resolves crates.io at build time and there is no vendor tarball.
# Two consequences, both deliberate:
# 1. --locked is load-bearing. With network access and no vendoring it is the only
# thing pinning what gets resolved to what was actually tested. Never drop it.
# 2. This will NOT build in koji. Fedora proper requires offline builds, so shipping
# there would need a vendor tarball as Source1 (and rusqlite's "bundled" feature
# replaced with system sqlite). COPR is the endpoint; see NOTES.md.
#
# Version tracks the last RELEASED tag, not Cargo.toml, because Source0 is a tag tarball
# that must exist. This mirrors packaging/aur/PKGBUILD's pkgver and drifts by one command
# at release time, not by releases.
Name: retch
Version: 0.9.10
Release: 1%{?dist}
Summary: A fast, feature-rich system information fetcher written in Rust
License: GPL-3.0-or-later
URL: https://github.com/l1a/retch
Source0: %{url}/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
ExclusiveArch: x86_64 aarch64
BuildRequires: cargo
BuildRequires: rust
# rusqlite is pinned to features = ["bundled"], so libsqlite3-sys compiles SQLite from
# bundled C source via the cc crate. This is why gcc is required and why this package
# would not pass Fedora's no-bundling guidelines.
BuildRequires: gcc
# Every probe below is OPTIONAL: retch reports the field as absent when the binary is
# missing, it never fails. Split by weight rather than listing them all as Recommends,
# which dnf installs by default and would drag a desktop stack onto a server install.
Recommends: chafa
Recommends: curl
Recommends: iproute
Recommends: dmidecode
Suggests: NetworkManager
Suggests: bluez
Suggests: iw
Suggests: btrfs-progs
Suggests: fontconfig
Suggests: glib2
Suggests: wmctrl
Suggests: xrandr
%description
retch is a system information fetcher in the style of fastfetch and
neofetch. It runs hardware and system probes concurrently (GPU, display,
network, audio, Bluetooth, media and more) and renders themed output,
including graphical distribution logos via the Kitty, iTerm2 and Sixel
protocols.
%prep
%autosetup -n %{name}-%{version}
%build
# Keep cargo's state inside the build tree rather than $HOME.
export CARGO_HOME=%{_builddir}/cargo-home
# Fedora's own rustc flags, from rust-srpm-macros. Three reasons to use them rather than
# cargo's defaults:
# 1. Hardening and codegen policy the distro expects: -Cforce-frame-pointers=yes (usable
# backtraces and profiling), -Ccodegen-units=1, -Copt-level=3.
# 2. They carry -Cdebuginfo=2 -Cstrip=none, which is what makes rpm's debuginfo extraction
# work. Without them a Rust release build has no DWARF, rpm finds nothing, and the
# build fails on an empty debuginfo package -- the reason this spec previously set
# `%%global debug_package %%{nil}` and stripped by hand.
# 3. This is NOT "shipping a debug build". -Copt-level=3 is right there; rpm moves the
# symbols into separate retch-debuginfo/retch-debugsource subpackages and strips the
# binary in the main package. Users get an optimised, stripped binary either way.
# Deliberately NOT using rust-packaging's %%cargo_prep/%%cargo_build: those assume Fedora's
# offline, vendored-dependency workflow and write a cargo config with offline = true, which
# would fight the network-enabled build this spec is designed around.
export RUSTFLAGS="%{build_rustflags}"
cargo build --release --locked
%install
# Not stripped here: with debuginfo present, rpm's own pass extracts the symbols into the
# debuginfo subpackage and strips this binary. Stripping first would leave that empty.
install -Dpm0755 target/release/retch %{buildroot}%{_bindir}/retch
# The committed docs/retch.1 is installed as-is; it is NOT regenerated with mandown.
# Regenerating made the packaged page depend on which mandown build ran, and the
# sed pipeline it replaced was broken in two silent ways -- see packaging/aur/PKGBUILD.
install -Dpm0644 docs/retch.1 %{buildroot}%{_mandir}/man1/retch.1
# Generated by the binary just built, so they cannot disagree with its actual CLI.
# Safe because COPR builds each arch natively; a cross-build would need a host binary.
install -d %{buildroot}%{bash_completions_dir}
install -d %{buildroot}%{zsh_completions_dir}
install -d %{buildroot}%{fish_completions_dir}
target/release/retch --completions bash > %{buildroot}%{bash_completions_dir}/retch
target/release/retch --completions zsh > %{buildroot}%{zsh_completions_dir}/_retch
target/release/retch --completions fish > %{buildroot}%{fish_completions_dir}/retch.fish
%check
export CARGO_HOME=%{_builddir}/cargo-home
cargo test --release --locked --workspace
%files
%license LICENSE
%doc README.md
%{_bindir}/retch
# The glob is load-bearing: rpm compresses man pages on install, so the packaged path is
# retch.1.gz. Asserting the uncompressed name reports it missing when it is present --
# the same trap the AUR CI job hit with makepkg's zipman.
%{_mandir}/man1/retch.1*
%{bash_completions_dir}/retch
%{zsh_completions_dir}/_retch
%{fish_completions_dir}/retch.fish
%changelog
* Tue Sep 01 2026 Ken Tobias <634380+l1a@users.noreply.github.com> - 0.9.10-1
- Update to 0.9.10
* Mon Aug 31 2026 Ken Tobias <634380+l1a@users.noreply.github.com> - 0.9.7-1
- Update to 0.9.7
* Mon Aug 31 2026 Ken Tobias <634380+l1a@users.noreply.github.com> - 0.9.4-1
- Initial COPR packaging