## START: Set by rpmautospec
## (rpmautospec version 0.7.3)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 1;
    base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
    print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec

%global nagiospluginsdir %{_libdir}/nagios/plugins
Name:           nagios-plugins-systemd
Version:        4.1.1
Release:        %autorelease
Summary:        Nagios Plugin - check_systemd

License:        LGPL-2.1-only
URL:            https://exchange.icinga.com/joseffriedrich/check_systemd
Source:         https://github.com/Josef-Friedrich/check_systemd/archive/v%{version}/%{name}-%{version}.tar.gz

BuildRequires:  python3-devel

# Require the package that owns the plugins dir, as we install the plugin there.
Requires: nagios-common

# The package does not contain any architecture-dependent things, but installs
# into an arch-dependend directory. Thus, it cannot be noarch, but it does not
# provide any debuginfo.
%global debug_package %{nil}

%description
This systemd check for nagios compatible monitoring systems will report a
degraded systemd to your monitoring solution. It can also be used to monitor
individual systemd services and timers units.

%prep
%autosetup -p1 -n check_systemd-%{version}
# Do not pin test dependencies to exact versions; we cannot respect these!
sed -r -i 's/==/>=/' tox.ini


%generate_buildrequires
%pyproject_buildrequires -t


%build
%pyproject_wheel


%install
%pyproject_install

%pyproject_save_files check_systemd

# The nagios plugin binaries must be in the nagiospluginsdir.
mkdir -p %{buildroot}/%{nagiospluginsdir}
mv %{buildroot}/%{_bindir}/check_systemd %{buildroot}/%{nagiospluginsdir}


%check
PYTHONPATH=%{buildroot}/%{nagiospluginsdir}:${PYTHONPATH} PATH=%{buildroot}/%{nagiospluginsdir}:${PATH} %tox


%files -f %{pyproject_files}
%doc README.*
%license LICENSE
%{nagiospluginsdir}/check_systemd


%changelog
## START: Generated by rpmautospec
* Thu Dec 26 2024 Till Hofmann <thofmann@fedoraproject.org> - 4.1.1-1
- Update to 4.1.1

* Sun Aug 11 2024 Till Hofmann <hofmann@kbsg.rwth-aachen.de> - 4.1.0-1
- Update to 4.1.0

* Fri May 31 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 3.0.0-4
- Do not pin test dependencies to exact versions

* Thu Jan 25 2024 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Sun Jan 21 2024 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Sun Nov 19 2023 Till Hofmann <thofmann@fedoraproject.org> - 3.0.0-1
- Update to 3.0.0

* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 2.3.1-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

* Wed Jun 14 2023 Python Maint <python-maint@redhat.com> - 2.3.1-8
- Rebuilt for Python 3.12

* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 2.3.1-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

* Mon Nov 07 2022 Till Hofmann <hofmann@kbsg.rwth-aachen.de> - 2.3.1-6
- Add sources

* Mon Nov 07 2022 Till Hofmann <thofmann@fedoraproject.org> - 2.3.1-5
- Install python module into python sitelib directory

* Mon Nov 07 2022 Till Hofmann <thofmann@fedoraproject.org> - 2.3.1-4
- Change summary to match commonly used pattern for nagios plugins

* Mon Nov 07 2022 Till Hofmann <thofmann@fedoraproject.org> - 2.3.1-3
- Require nagios-common instead of using a file dependency

* Mon Nov 07 2022 Till Hofmann <thofmann@fedoraproject.org> - 2.3.1-2
- Require the package that owns the plugin dir

* Mon Nov 07 2022 Till Hofmann <thofmann@fedoraproject.org> - 2.3.1-1
- Rename package to nagios-plugins-systemd
## END: Generated by rpmautospec