Update to 0.6.5

- Install man page

Additionally, enable building without poetry and add fill-in for %bcond
macro for platforms where poetry is missing.

Signed-off-by: Nils Philippsen <nils@redhat.com>
This commit is contained in:
Nils Philippsen 2024-02-19 10:43:03 +01:00
parent f4f18b88d7
commit 2e0a1b7cfc
2 changed files with 62 additions and 5 deletions

View File

@ -1,3 +1,11 @@
# Polyfill %%bcond() macro for platforms without it
%if 0%{!?bcond:1}
%define bcond() %[ (%2)\
? "%{expand:%%{!?_without_%{1}:%%global with_%{1} 1}}"\
: "%{expand:%%{?_with_%{1}:%%global with_%{1} 1}}"\
]
%endif
# The pytest-xdist package is not available when bootstrapping or for EL builds # The pytest-xdist package is not available when bootstrapping or for EL builds
%bcond xdist %{undefined rhel} %bcond xdist %{undefined rhel}
@ -8,24 +16,40 @@
%bcond rpmmacropkg 0 %bcond rpmmacropkg 0
%endif %endif
%if ! 0%{?fedora}%{?rhel} || 0%{?fedora} || 0%{?epel} >= 9
%bcond poetry 1
# Appease old Poetry versions (<1.2.0a2) # Appease old Poetry versions (<1.2.0a2)
%if ! 0%{?fedora}%{?rhel} || 0%{?fedora} >= 38 || 0%{?rhel} >= 10 %if ! 0%{?fedora}%{?rhel} || 0%{?fedora} >= 38 || 0%{?rhel} >= 10
%bcond oldpoetry 0 %bcond old_poetry 0
%else %else
%bcond oldpoetry 1 %bcond old_poetry 1
%endif
%else
%bcond poetry 0
%endif
%if ! 0%{?fedora}%{?rhel} || 0%{?fedora} || 0%{?epel} >= 9 || 0%{?rhel} >= 10
%bcond manpage_manual_title 1
%else
%bcond manpage_manual_title 0
%endif %endif
%global srcname rpmautospec %global srcname rpmautospec
Name: python-%{srcname} Name: python-%{srcname}
Version: 0.6.1 Version: 0.6.5
Release: %autorelease Release: %autorelease
Summary: Package and CLI tool to generate release fields and changelogs Summary: Package and CLI tool to generate release fields and changelogs
License: MIT License: MIT
URL: https://github.com/fedora-infra/%{srcname} URL: https://github.com/fedora-infra/%{srcname}
Source0: https://github.com/fedora-infra/%{srcname}/releases/download/%{version}/%{srcname}-%{version}.tar.gz Source0: https://github.com/fedora-infra/%{srcname}/releases/download/%{version}/%{srcname}-%{version}.tar.gz
%if 0%{!?pyproject_files:1}
%global pyproject_files %{_builddir}/%{name}-%{version}-%{release}.%{_arch}-pyproject-files
%endif
BuildArch: noarch BuildArch: noarch
BuildRequires: argparse-manpage
BuildRequires: git BuildRequires: git
# the langpacks are needed for tests # the langpacks are needed for tests
BuildRequires: glibc-langpack-de BuildRequires: glibc-langpack-de
@ -39,6 +63,15 @@ BuildRequires: python3dist(pytest-xdist)
BuildRequires: python3dist(pyyaml) BuildRequires: python3dist(pyyaml)
BuildRequires: sed BuildRequires: sed
%if %{without poetry}
BuildRequires: python3dist(babel)
BuildRequires: python3dist(pygit2)
BuildRequires: python3dist(rpm)
BuildRequires: python3dist(rpmautospec-core)
BuildRequires: python3dist(setuptools)
%{?python_provide:%python_provide python3-%{srcname}}
%endif
%global _description %{expand: %global _description %{expand:
A package and CLI tool to generate RPM release fields and changelogs.} A package and CLI tool to generate RPM release fields and changelogs.}
@ -68,11 +101,13 @@ enabled packages locally.
%endif %endif
%generate_buildrequires %generate_buildrequires
%if %{with poetry}
%pyproject_buildrequires %pyproject_buildrequires
%endif
%prep %prep
%autosetup -n %{srcname}-%{version} %autosetup -n %{srcname}-%{version}
%if %{with oldpoetry} %if %{with old_poetry}
sed -i \ sed -i \
-e 's/\[tool\.poetry\.group\.dev\.dependencies\]/[tool.poetry.dev-dependencies]/g' \ -e 's/\[tool\.poetry\.group\.dev\.dependencies\]/[tool.poetry.dev-dependencies]/g' \
pyproject.toml pyproject.toml
@ -82,13 +117,34 @@ sed -i \
sed -i -e '/pytest-cov/d; /addopts.*--cov/d' pyproject.toml sed -i -e '/pytest-cov/d; /addopts.*--cov/d' pyproject.toml
%build %build
%if %{with poetry}
%pyproject_wheel %pyproject_wheel
%else
%py3_build
%endif
%install %install
%if %{with poetry}
%pyproject_install %pyproject_install
%pyproject_save_files %{srcname} %pyproject_save_files %{srcname}
# Work around poetry not listing license files as such in package metadata. # Work around poetry not listing license files as such in package metadata.
sed -i -e 's|^\(.*/LICENSE\)|%%license \1|g' %{pyproject_files} sed -i -e 's|^\(.*/LICENSE\)|%%license \1|g' %{pyproject_files}
%else
%py3_install
cat << EOF > %{pyproject_files}
%{python3_sitelib}/%{srcname}/
%{python3_sitelib}/*.egg-info/
EOF
%endif
install -d %{buildroot}%{_mandir}/man1
PYTHONPATH=%{buildroot}%{python3_sitelib} argparse-manpage \
%if %{with manpage_manual_title}
--manual-title "User Commands" \
%endif
--project-name rpmautospec \
--module rpmautospec.cli \
--function get_arg_parser > %{buildroot}%{_mandir}/man1/rpmautospec.1
%if %{with rpmmacropkg} %if %{with rpmmacropkg}
mkdir -p %{buildroot}%{rpmmacrodir} mkdir -p %{buildroot}%{rpmmacrodir}
@ -106,6 +162,7 @@ install -m 644 rpm/macros.d/macros.rpmautospec %{buildroot}%{rpmmacrodir}/
%files -n %{srcname} %files -n %{srcname}
%{_bindir}/rpmautospec %{_bindir}/rpmautospec
%{_mandir}/man1/rpmautospec.1*
%if %{with rpmmacropkg} %if %{with rpmmacropkg}
%files -n rpmautospec-rpm-macros %files -n rpmautospec-rpm-macros

View File

@ -1 +1 @@
SHA512 (rpmautospec-0.6.1.tar.gz) = c16cb4cebde455cd4ef997dd7ae1c8a08dcb62fa8de3c84644e4994506f65f991dfab4c11350594971e68fbdd8ace9bb7ef7ceddf562c4756680a95cf1a89439 SHA512 (rpmautospec-0.6.5.tar.gz) = 4740a471d25896314cbb37ab7a34d24fa7d3b6512ea4d5d7444528e0669bca79cb23a180b8a591378a40e832df4a6673ac20930f38672d268d9c70fb49748771