File hatop.spec of Package hatop
# norootforbuild
Name: hatop
Version: 0.8.2
Release: 0
#
License: GPL-3.0-or-later
Group: Productivity/Networking/Web/Proxy
#
BuildArch: noarch
BuildRequires: python3
%if %{defined suse_version} || %{defined sle_version}
Requires: python3-curses
%endif
%if %{defined centos_version} || %{defined rhel_version}
Requires: python3
%endif
#
Url: https://github.com/jhunt/hatop
Source: https://github.com/jhunt/hatop/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Conflicts: haproxy < 1.4
#
Summary: Interactive ncurses client for the HAProxy unix socket
%description
HATop's appearance is similar to top(1). It supports various modes
for detailed statistics of all configured proxies and services in near
realtime. In addition, it features an interactive CLI for the haproxy
unix socket. This allows administrators to control the given haproxy
instance (change server weight, put servers into maintenance mode, ...)
directly out of hatop and monitor the results immediately.
%package doc
Summary: Documentation for %{name}
Group: Productivity/Networking/Web/Proxy
Requires: %{name} = %{version}
%description doc
HATop's appearance is similar to top(1). It supports various modes
for detailed statistics of all configured proxies and services in near
realtime. In addition, it features an interactive CLI for the haproxy
unix socket. This allows administrators to control the given haproxy
instance (change server weight, put servers into maintenance mode, ...)
directly out of hatop and monitor the results immediately.
This package contains additional documentation for %{name}, under
%{_docdir}/%{name}/docs/
%prep
%autosetup -p1 -n %{name}-%{version}
%build
# change shebang to use __python3 instead of /usr/bin/env python:
%__sed -i -r '1s|^#!/usr/bin/env python(.*)$|#!%__python3|' bin/hatop
%install
%{__install} -D -m 0755 bin/hatop %{buildroot}%{_sbindir}/hatop
%__install -D -m0644 man/hatop.1 "%{buildroot}%{_mandir}/man1/hatop.1"
>docfiles.main.lst
%__install -d "%{buildroot}%{_docdir}/%{name}"
for f in CHANGES.rst HACKING KEYBINDS LICENSE README.rst ; do
%__install -m0644 "$f" "%{buildroot}%{_docdir}/%{name}/"
ff=$(basename "$f")
echo "%doc %{_docdir}/%{name}/$ff" >>docfiles.main.lst
done
%__rm -f doc/Makefile doc/*.py
%__rm -rf doc/build doc/templates
>docfiles.doc.lst
for x in doc/*; do
[ -e "$x" ] || continue
xx=$(basename "$x")
%__cp -a "$x" "%{buildroot}%{_docdir}/%{name}/"
echo "%doc %{_docdir}/%{name}/$xx" >>docfiles.doc.lst
done
%files -f docfiles.main.lst
%defattr(-,root,root,-)
%{_sbindir}/hatop
%doc %{_mandir}/man1/hatop.1%{ext_man}
%dir %{_docdir}/%{name}
%files doc -f docfiles.doc.lst
%defattr(-,root,root,-)
%dir %{_docdir}/%{name}
%changelog