# 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.
#
# THIS IS A TEMPLATE. `@VERSION@` is filled in by scripts/render_packaging.py, which
# .copr/Makefile runs when it builds the SRPM -- so the version comes from Cargo.toml in
# the checkout COPR cloned, and nothing in this file records a release. It used to: the
# `Version:` here tracked the last released tag, was bumped by hand at release time, and
# had to be kept in step with three other files by a guard each. See
# scripts/render_packaging.py for why that is the wrong shape.
#
# Source0 is a LOCAL tarball, not a URL. .copr/Makefile builds it from the checkout with
# `tar`, so this spec needs neither a published tag nor network access to find its source:
# - a PR can build its own SRPM, which it could not while Source0 pinned a tag tarball
# that only exists after a release;
# - the built package is the code COPR actually cloned, rather than a re-download that is
# merely expected to match it.
# The rendered %changelog entry is generated in the same pass as Version:, so the two
# cannot disagree (rpmlint's incoherent-version-in-changelog).
Name: retch
Version: @VERSION@
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: %{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
# NOTICE is %license, not %doc: it carries the MIT attribution for the adapted Fastfetch
# logos, which must ship with every copy rather than be strippable as documentation.
%license LICENSE NOTICE
%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
* Thu Sep 10 2026 Ken Tobias <634380+l1a@users.noreply.github.com> - 0.17.3-1
- Update to 0.17.3
* Thu Sep 10 2026 Ken Tobias <634380+l1a@users.noreply.github.com> - 0.13.2-1
- Update to 0.13.2
* Wed Sep 09 2026 Ken Tobias <634380+l1a@users.noreply.github.com> - 0.11.6-1
- Update to 0.11.6
* Wed Sep 09 2026 Ken Tobias <634380+l1a@users.noreply.github.com> - 0.11.2-1
- Update to 0.11.2
* Mon Sep 07 2026 Ken Tobias <634380+l1a@users.noreply.github.com> - 0.10.0-1
- Update to 0.10.0
* 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