Name:			pbench-agent
Version:		0.72.0
Release:		5%{?dist}
Summary:		The Pbench Agent CLI & default configuration
License:		GPLv3+
URL:			https://github.com/distributed-system-analysis/pbench
Source0:		https://pravins.fedorapeople.org/pbench-agent-0.72.0.tar.gz
Source1:		replace_install_dir
BuildArch:		noarch

BuildRequires:	python3-devel

Requires:		python3-psutil
Requires:		python3-bottle, python3-cffi, python3-click
Requires:		python3-ifaddr, python3-jinja2, python3-daemon, python3-redis
Requires:		python3-requests, python3-sh, python3-docutils
Requires:		perl, perl-Data-UUID, perl-JSON
Requires:		perl-Time-HiRes,  perl-JSON-XS
Requires:		bc, bzip2, hostname, iproute, iputils, net-tools, numactl
Requires:		openssh-clients, openssh-server, procps-ng, psmisc, redis
Requires:		rpmdevtools, rsync, screen, sos, tar, xz

%global _description %{expand:
The Pbench Agent - wraps benchmark workloads to collect 
specified tool and configuration data.}

%description %_description

%prep
%autosetup %{name}-%{version}
cp -p %{SOURCE1} .
# script to replace old paths to new once
chmod 755 replace_install_dir
./replace_install_dir

%build
#nothing

%install
mkdir -p %{buildroot}/%{_datadir}/%{name}/
cp -a agent/{base,bench-scripts,lib,tool-scripts,util-scripts,profile} %{buildroot}/%{_datadir}/%{name}/
mkdir -p %{buildroot}/%{_sysconfdir}/%{name}/
cp -a agent/config/ %{buildroot}/%{_sysconfdir}/%{name}/

%post
# link the pbench profile, so it'll automatically be sourced on login
ln -sf %{_datadir}/%{name}/profile /etc/profile.d/%{name}.sh

%preun
# If uninstalling, rather than updating, delete the link
rm -f /etc/profile.d/%{name}.sh


%files
%doc agent/VERSION
%config(noreplace) %{_sysconfdir}/%{name}/
%{_datadir}/%{name}/

%changelog
* Thu Sep 29 2022 Vishal Vijayraghavan<vishalvvr@fedoraproject.org> - 0.72.0-5
- add profile script to install
- update replace script to make changes to config path
- remove python-hiredis dependency not packaged in fedora
- add preun section to remove profile script before uninstall

* Thu Sep 29 2022 Vishal Vijayraghavan<vishalvvr@fedoraproject.org> - 0.72.0-4
- add script to replace old install dir to new location in all source file
- add config macro

* Wed Sep 28 2022 Vishal Vijayraghavan<vishalvvr@fedoraproject.org> - 0.72.0-3
- update dependencies list
- update source tarball link

* Wed Sep 28 2022 Pravin Satpute <psatpute@redhat.com> - 0.72.0-2
- update install section to use standard install dir and confing dir

* Wed Sep 28 2022 Vishal Vijayraghavan<vishalvvr@fedoraproject.org> - 0.72.0-1
- Initial fedora build.