## START: Set by rpmautospec
## (rpmautospec version 0.6.0)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 11;
    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

%{!?dnf_lowest_compatible: %global dnf_lowest_compatible 4.2.23}
%global srcname perfmetrics

%global _description %{expand:
This plug-in will record performance metrics for DNF and store them in JSON
files under /var/log/dnf/perfmetrics.}

Name:           dnf-plugin-%{srcname}
Version:        1.0
Release:        %autorelease
Summary:        DNF plugin for Performance Metrics
License:        GPL-2.0-or-later
BuildArch:      noarch
URL:            https://github.com/filbranden/dnf-plugins-perfmetrics
Source0:        %{url}/archive/v%{version}/dnf-plugins-%{srcname}-%{version}.tar.gz
# Don't use the deprecated Python distutils module in CMake
Patch0:         %{url}/commit/9243a252c1d8bf64bc71afdf5de378eca4236ea5.patch

BuildRequires:  cmake
BuildRequires:  python3-devel
BuildRequires:  python3-dnf >= %{dnf_lowest_compatible}
BuildRequires:  python3-psutil

%description    %{_description}

%package -n     python3-%{name}
Summary:        %{summary}
Requires:       python3-dnf >= %{dnf_lowest_compatible}
Requires:       python3-psutil

%description -n python3-%{name} %{_description}

%prep
%autosetup -n dnf-plugins-%{srcname}-%{version} -p1

%build
%cmake
%cmake_build

%install
%cmake_install
install -Ddpm0755 %{buildroot}%{_localstatedir}/log/dnf/perfmetrics

%files -n       python3-%{name}
%license COPYING
%doc README.md
%{python3_sitelib}/dnf-plugins/%{srcname}.py
%{python3_sitelib}/dnf-plugins/__pycache__/*
%config(noreplace) %{_sysconfdir}/dnf/plugins/%{srcname}.conf
%dir %{_localstatedir}/log/dnf/perfmetrics

%changelog
## START: Generated by rpmautospec
* Thu Feb 29 2024 Davide Cavalca <dcavalca@fedoraproject.org> - 1.0-11
- Explicitly require psutil

* Thu Feb 29 2024 Davide Cavalca <dcavalca@fedoraproject.org> - 1.0-10
- Convert license tag to SPDX

* Wed Jan 24 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.0-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Fri Jan 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.0-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Wed Jul 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.0-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

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

* Mon Jan 30 2023 Davide Cavalca <dcavalca@fedoraproject.org> - 1.0-5
- Don't use the deprecated Python distutils module in CMake; Fixes:
  RHBZ#2165545

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

* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

* Wed Jun 15 2022 Python Maint <python-maint@redhat.com> - 1.0-2
- Rebuilt for Python 3.11

* Mon Jan 31 2022 Davide Cavalca <dcavalca@fedoraproject.org> - 1.0-1
- Initial import; Fixes: RHBZ#2047976
## END: Generated by rpmautospec