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

%bcond_without check

Name:           rust2rpm
Version:        27.0.1
Release:        %autorelease
Summary:        Generate RPM spec files for Rust crates
License:        MIT

URL:            https://pagure.io/fedora-rust/rust2rpm
Source:         %{url}/archive/v%{version}/rust2rpm-%{version}.tar.gz

BuildArch:      noarch

BuildRequires:  python3-devel
BuildRequires:  /usr/bin/asciidoctor

%if %{with check}
BuildRequires:  cargo
BuildRequires:  rust2rpm-helper >= 0.1.2
%endif

Requires:       cargo
Requires:       cargo-rpm-macros
Recommends:     rust2rpm-helper >= 0.1.2

# obsolete old provides (removed in Fedora 38)
Obsoletes:      cargo-inspector < 24

# obsolete and / or provide removed Python subpackages (removed in Fedora 38)
%py_provides    python3-rust2rpm
Obsoletes:      python3-rust2rpm < 24
Obsoletes:      python3-rust2rpm-core < 24

%description
rust2rpm is a tool that automates the generation of RPM spec files for
Rust crates.

%prep
%autosetup -p1

%generate_buildrequires
%pyproject_buildrequires %{?with_check:-t}

%build
%pyproject_wheel
# build man pages
pushd docs
asciidoctor -b manpage rust2rpm.1.asciidoc
asciidoctor -b manpage rust2rpm.conf.5.asciidoc
asciidoctor -b manpage rust2rpm.toml.5.asciidoc
popd

%install
%pyproject_install
%pyproject_save_files rust2rpm
# install man pages
install -Dpm 644 docs/rust2rpm.1 -t %{buildroot}/%{_mandir}/man1/
install -Dpm 644 docs/rust2rpm.conf.5 -t %{buildroot}/%{_mandir}/man5/
install -Dpm 644 docs/rust2rpm.toml.5 -t %{buildroot}/%{_mandir}/man5/

%check
%pyproject_check_import
%if %{with check}
%tox
%endif

%files -f %{pyproject_files}
%doc README.md
%doc CHANGELOG.md
%{_bindir}/rust2rpm
%{_mandir}/man1/rust2rpm.1*
%{_mandir}/man5/rust2rpm.{conf,toml}.5*

%changelog
## START: Generated by rpmautospec
* Sat Dec 07 2024 Fabio Valentini <decathorpe@gmail.com> - 27.0.1-1
- Update to version 27.0.1; Fixes RHBZ#2330964

* Tue Nov 26 2024 Fabio Valentini <decathorpe@gmail.com> - 27.0.0-1
- Update to version 27.0.0; Fixes RHBZ#2329065

* Mon Oct 28 2024 Fabio Valentini <decathorpe@gmail.com> - 26.2.0-1
- Update to version 26.2.0; Fixes RHBZ#2322010

* Sat Jul 20 2024 Fedora Release Engineering <releng@fedoraproject.org> - 26.1.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild

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

* Thu May 16 2024 Fabio Valentini <decathorpe@gmail.com> - 26.1.1-1
- Update to version 26.1.1

* Fri Apr 12 2024 Fabio Valentini <decathorpe@gmail.com> - 26.1.0-1
- Update to version 26.1.0; Fixes RHBZ#2274732

* Sat Mar 09 2024 Fabio Valentini <decathorpe@gmail.com> - 26.0.0-1
- Update to version 26.0.0; Fixes RHBZ#2268637

* Wed Feb 21 2024 Fabio Valentini <decathorpe@gmail.com> - 25.1.0-1
- Update to version 25.1.0; Fixes RHBZ#2265329

* Sat Jan 27 2024 Fedora Release Engineering <releng@fedoraproject.org> - 25.0.4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Fri Dec 08 2023 Fabio Valentini <decathorpe@gmail.com> - 25.0.4-1
- Update to version 25.0.4; Fixes RHBZ#2253476

* Fri Dec 01 2023 Fabio Valentini <decathorpe@gmail.com> - 25.0.3-1
- Update to version 25.0.3; Fixes RHBZ#2252419

* Sun Nov 19 2023 Fabio Valentini <decathorpe@gmail.com> - 25.0.2-1
- Update to version 25.0.2; Fixes RHBZ#2250386

* Wed Oct 18 2023 Fabio Valentini <decathorpe@gmail.com> - 25.0.1-1
- Update to version 25.0.1; Fixes RHBZ#2244803

* Tue Oct 10 2023 Fabio Valentini <decathorpe@gmail.com> - 25.0.0-1
- Update to version 25.0.0; Fixes RHBZ#2242982

* Sat Sep 30 2023 Fabio Valentini <decathorpe@gmail.com> - 24.4.2-1
- Update to version 24.4.2; Fixes RHBZ#2241494

* Thu Aug 10 2023 Fabio Valentini <decathorpe@gmail.com> - 24.4.0-1
- Update to version 24.4.0; Fixes RHBZ#2230003

* Sat Jul 22 2023 Fedora Release Engineering <releng@fedoraproject.org> - 24.3.3-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

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

* Wed May 17 2023 Fabio Valentini <decathorpe@gmail.com> - 24.3.3-1
- Update to version 24.3.3; Fixes RHBZ#2208046

* Wed Apr 19 2023 Fabio Valentini <decathorpe@gmail.com> - 24.3.1-1
- Update to version 24.3.1; Fixes RHBZ#2188097

* Sun Apr 02 2023 Fabio Valentini <decathorpe@gmail.com> - 24.3.0-1
- Update to version 24.3.0; Fixes RHBZ#2183736

* Tue Mar 21 2023 Fabio Valentini <decathorpe@gmail.com> - 24.2.0-1
- Update to version 24.2.0; Fixes RHBZ#2180212

* Mon Mar 06 2023 Fabio Valentini <decathorpe@gmail.com> - 24.1.0-1
- Update to version 24.1.0; Fixes RHBZ#2175278

* Thu Feb 16 2023 Fabio Valentini <decathorpe@gmail.com> - 24.0.2-1
- Update to version 24.0.2

* Thu Feb 16 2023 Fabio Valentini <decathorpe@gmail.com> - 24.0.1-1
- Update to version 24.0.1

* Thu Feb 16 2023 Fabio Valentini <decathorpe@gmail.com> - 24.0.0-1
- Initial import (#2170204)
## END: Generated by rpmautospec