## START: Set by rpmautospec
## (rpmautospec version 0.7.3)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-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*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec

%global srcname b4

%if 0%{?fedora} || 0%{?el10}
%bcond_without attest
%else
# some attestation dependencies not in EPEL
%bcond_with attest
%endif

Name:           python-%{srcname}
Version:        0.14.2
Release:        %autorelease
Summary:        A helper tool to work with public-inbox and patch series
License:        GPL-2.0-or-later
URL:            https://git.kernel.org/pub/scm/utils/%{srcname}/%{srcname}.git
Source0:        https://mirrors.edge.kernel.org/pub/software/devel/%{srcname}/%{srcname}-%{version}.tar.xz
Source1:        https://mirrors.edge.kernel.org/pub/software/devel/%{srcname}/%{srcname}-%{version}.tar.sign
# https://git.kernel.org/pub/scm/utils/b4/b4.git/plain/.keys/openpgp/linuxfoundation.org/konstantin/default
Source2:        gpgkey-DE0E66E32F1FDD0902666B96E63EDCA9329DD07E.asc

BuildArch:      noarch

BuildRequires:  gnupg2
BuildRequires:  python%{python3_pkgversion}-devel
BuildRequires:  python3dist(pytest)

%global _description %{expand:
B4 is a helper utility to work with patches made available via a public-inbox
archive like lore.kernel.org. It is written to make it easier to participate in
a patch-based workflows, like those used in the Linux kernel development.}

%description %{_description}


%package -n %{srcname}
Summary:        %{summary}
Provides:       python%{python3_pkgversion}-%{srcname} = %{version}-%{release}

%description -n %{srcname} %{_description}


%prep
xz -dc '%{SOURCE0}' | %{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data=-
%autosetup -p1 -n %{srcname}-%{version}

# Disable attestation (only applicable to EPEL)
%if %{without attest}
sed -Ei -e '/^# These are optional, needed for attestation/d' \
    -e "/^ *'?(dnspython|dkimpy|patatt)/d" requirements.in
%endif


%generate_buildrequires
%pyproject_buildrequires -r requirements.in


%build
%pyproject_wheel


%install
%pyproject_install
%pyproject_save_files %{srcname}
install -m644 -Dt %{buildroot}%{_mandir}/man5/ src/b4/man/b4.5


%check
%pyproject_check_import
%pytest


%files -n %{srcname} -f %{pyproject_files}
%doc README.rst
%{_bindir}/%{srcname}
%{_mandir}/man5/%{srcname}.5.*


%changelog
## START: Generated by rpmautospec
* Fri Dec 06 2024 Michel Lind <salimma@fedoraproject.org> - 0.14.2-2
- Enable attestation support on EL10

* Mon Sep 23 2024 Michel Lind <salimma@fedoraproject.org> - 0.14.2-1
- Update to version 0.14.2; Fixes: RHBZ#2312862

* Fri Aug 16 2024 Maxime Ripard <mripard@kernel.org> - 0.14.1-1
- b4: Update to 0.14.1

* Fri Aug 02 2024 Yaakov Selkowitz <yselkowi@redhat.com> - 0.14.0-2
- Fix EPEL build

* Wed Jul 17 2024 Maxime Ripard <mripard@kernel.org> - 0.14.0-1
- b4: Update to 0.14

* Sat Jun 08 2024 Python Maint <python-maint@redhat.com> - 0.13.0-2
- Rebuilt for Python 3.13

* Tue Mar 12 2024 Michel Lind <salimma@fedoraproject.org> - 0.13.0-1
- Update to 0.13.0 (rhbz#2245336)

* Fri Jan 26 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.12.3-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

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

* Wed Jul 26 2023 Michel Alexandre Salim <salimma@fedoraproject.org> - 0.12.3-4
- Skip test affected by Python 3.12b4 regression (rhbz#2226159)
- Also run %%%%pyproject_check_import

* Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.12.3-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

* Tue Jun 27 2023 Python Maint <python-maint@redhat.com> - 0.12.3-2
- Rebuilt for Python 3.12

* Mon Jun 26 2023 Michel Alexandre Salim <salimma@fedoraproject.org> - 0.12.3-1
- Update to 0.12.3 (closes: rhbz#2217072)

* Thu Jun 15 2023 Python Maint <python-maint@redhat.com> - 0.12.2-2
- Rebuilt for Python 3.12

* Thu May 18 2023 Michel Alexandre Salim <salimma@fedoraproject.org> - 0.12.2-1
- Update to 0.12.2

* Thu Feb 16 2023 Michel Alexandre Salim <salimma@fedoraproject.org> - 0.12.1-1
- Update to 0.12.1
- Patch to allow tests to run without a Git checkout
- Switch to SPDX license identifier
- Correct license, should be GPLv2+ / GPL-2.0-or-later

* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.10.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

* Mon Oct 03 2022 Todd Zullinger <tmz@pobox.com> - 0.10.1-1
- update to 0.10.1

* Mon Oct 03 2022 Todd Zullinger <tmz@pobox.com> - 0.10.0-1
- update to 0.10.0

* Fri Sep 23 2022 Todd Zullinger <tmz@pobox.com> - 0.8.0-8
- verify signature of source tarball

* Tue Sep 20 2022 Todd Zullinger <tmz@pobox.com> - 0.8.0-7
- do not conditionalize patches

* Fri Jul 22 2022 Michel Alexandre Salim <salimma@fedoraproject.org> - 0.8.0-6
- Disable attestation on EPEL

* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.8.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

* Tue Jun 14 2022 Python Maint <python-maint@redhat.com> - 0.8.0-4
- Rebuilt for Python 3.11

* Tue Mar 08 2022 Lumir Balhar <lbalhar@redhat.com> - 0.8.0-3
- Unpin dependency on dnspython

* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.8.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

* Wed Dec 15 2021 Michel Alexandre Salim <salimma@fedoraproject.org> - 0.8.0-1
- Initial Fedora package
## END: Generated by rpmautospec