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

%global nagiospluginsdir %{_libdir}/nagios/plugins
Name:           python-nagios-plugins-check_systemd
Version:        2.3.1
Release:        %autorelease
Summary:        Nagios plugin to check systemd

License:        LGPLv2+
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

# 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}

%global _description %{expand:
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.}

%description %_description

%package -n python3-nagios-plugins-check_systemd
Summary:        Nagios plugin to check systemd

%description -n python3-nagios-plugins-check_systemd %_description


%prep
%autosetup -p1 -n check_systemd-%{version}


%generate_buildrequires
%pyproject_buildrequires -t


%build
%pyproject_wheel


%install
%pyproject_install

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


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


%files -n python3-nagios-plugins-check_systemd
%doc README.*
%license LICENSE
%{nagiospluginsdir}/*
%{python3_sitelib}/check_systemd-%{version}.dist-info


%changelog
* Sun May 08 2022 Till Hofmann <thofmann@fedoraproject.org> 2.3.1-2
- Uncommitted changes

* Sun May 08 2022 Till Hofmann <thofmann@fedoraproject.org> 2.3.1-1
- Initial package