2024-02-19 09:43:03 +00:00
|
|
|
|
# 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
|
|
|
|
|
|
2024-02-09 10:37:50 +00:00
|
|
|
|
# The pytest-xdist package is not available when bootstrapping or for EL builds
|
2023-05-24 18:03:48 +00:00
|
|
|
|
%bcond xdist %{undefined rhel}
|
2022-05-15 11:38:39 +00:00
|
|
|
|
|
2023-11-13 19:07:57 +00:00
|
|
|
|
# Package the placeholder rpm-macros (moved to redhat-rpm-config in F40)
|
|
|
|
|
%if ! (0%{?fedora} >= 40 || 0%{?rhel} >= 10)
|
|
|
|
|
%bcond rpmmacropkg 1
|
|
|
|
|
%else
|
|
|
|
|
%bcond rpmmacropkg 0
|
|
|
|
|
%endif
|
2020-04-02 13:32:04 +00:00
|
|
|
|
|
2024-02-19 09:43:03 +00:00
|
|
|
|
%if ! 0%{?fedora}%{?rhel} || 0%{?fedora} || 0%{?epel} >= 9
|
|
|
|
|
%bcond poetry 1
|
2023-11-14 13:11:32 +00:00
|
|
|
|
# Appease old Poetry versions (<1.2.0a2)
|
|
|
|
|
%if ! 0%{?fedora}%{?rhel} || 0%{?fedora} >= 38 || 0%{?rhel} >= 10
|
2024-02-19 09:43:03 +00:00
|
|
|
|
%bcond old_poetry 0
|
|
|
|
|
%else
|
|
|
|
|
%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
|
2023-11-14 13:11:32 +00:00
|
|
|
|
%else
|
2024-02-19 09:43:03 +00:00
|
|
|
|
%bcond manpage_manual_title 0
|
2023-11-14 13:11:32 +00:00
|
|
|
|
%endif
|
|
|
|
|
|
2023-11-13 19:07:57 +00:00
|
|
|
|
%global srcname rpmautospec
|
|
|
|
|
|
2024-02-09 10:37:50 +00:00
|
|
|
|
Name: python-%{srcname}
|
2024-02-19 09:43:03 +00:00
|
|
|
|
Version: 0.6.5
|
2023-11-13 19:07:57 +00:00
|
|
|
|
Release: %autorelease
|
|
|
|
|
Summary: Package and CLI tool to generate release fields and changelogs
|
|
|
|
|
License: MIT
|
2024-02-09 10:37:50 +00:00
|
|
|
|
URL: https://github.com/fedora-infra/%{srcname}
|
|
|
|
|
Source0: https://github.com/fedora-infra/%{srcname}/releases/download/%{version}/%{srcname}-%{version}.tar.gz
|
2023-11-13 19:07:57 +00:00
|
|
|
|
|
2024-11-07 09:13:59 +00:00
|
|
|
|
Patch1001: 0001-Added-AlmaLinux-change-identifier-0.6.5.patch
|
|
|
|
|
|
2024-02-19 09:43:03 +00:00
|
|
|
|
%if 0%{!?pyproject_files:1}
|
|
|
|
|
%global pyproject_files %{_builddir}/%{name}-%{version}-%{release}.%{_arch}-pyproject-files
|
|
|
|
|
%endif
|
|
|
|
|
|
2023-11-13 19:07:57 +00:00
|
|
|
|
BuildArch: noarch
|
2024-02-19 09:43:03 +00:00
|
|
|
|
BuildRequires: argparse-manpage
|
2023-11-13 19:07:57 +00:00
|
|
|
|
BuildRequires: git
|
2022-04-25 12:12:32 +00:00
|
|
|
|
# the langpacks are needed for tests
|
2023-11-13 19:07:57 +00:00
|
|
|
|
BuildRequires: glibc-langpack-de
|
|
|
|
|
BuildRequires: glibc-langpack-en
|
|
|
|
|
BuildRequires: python3-devel >= 3.9.0
|
|
|
|
|
# The dependencies needed for testing don’t get auto-generated.
|
|
|
|
|
BuildRequires: python3dist(pytest)
|
2022-05-15 11:38:39 +00:00
|
|
|
|
%if %{with xdist}
|
2023-11-13 19:07:57 +00:00
|
|
|
|
BuildRequires: python3dist(pytest-xdist)
|
2022-05-15 11:38:39 +00:00
|
|
|
|
%endif
|
2023-11-13 19:07:57 +00:00
|
|
|
|
BuildRequires: python3dist(pyyaml)
|
|
|
|
|
BuildRequires: sed
|
2021-05-27 15:25:34 +00:00
|
|
|
|
|
2024-02-19 09:43:03 +00:00
|
|
|
|
%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
|
|
|
|
|
|
2020-04-02 13:32:04 +00:00
|
|
|
|
%global _description %{expand:
|
|
|
|
|
A package and CLI tool to generate RPM release fields and changelogs.}
|
|
|
|
|
|
|
|
|
|
%description %_description
|
|
|
|
|
|
2024-02-09 10:37:50 +00:00
|
|
|
|
%package -n python3-%{srcname}
|
2023-11-13 19:07:57 +00:00
|
|
|
|
Summary: %{summary}
|
2020-04-02 13:32:04 +00:00
|
|
|
|
%{?python_provide:%python_provide python3-%{srcname}}
|
|
|
|
|
|
2024-02-09 10:37:50 +00:00
|
|
|
|
%description -n python3-%{srcname} %_description
|
2020-04-02 13:32:04 +00:00
|
|
|
|
|
2024-02-09 10:37:50 +00:00
|
|
|
|
%package -n %{srcname}
|
2020-04-02 13:32:04 +00:00
|
|
|
|
Summary: CLI tool for generating RPM releases and changelogs
|
2024-02-09 10:37:50 +00:00
|
|
|
|
Requires: python3-%{srcname} = %{version}-%{release}
|
2020-04-02 13:32:04 +00:00
|
|
|
|
|
2024-02-09 10:37:50 +00:00
|
|
|
|
%description -n %{srcname}
|
2020-04-02 13:32:04 +00:00
|
|
|
|
CLI tool for generating RPM releases and changelogs
|
|
|
|
|
|
2023-11-13 19:07:57 +00:00
|
|
|
|
%if %{with rpmmacropkg}
|
2020-04-09 11:55:00 +00:00
|
|
|
|
%package -n rpmautospec-rpm-macros
|
|
|
|
|
Summary: Rpmautospec RPM macros for local rpmbuild
|
|
|
|
|
Requires: rpm
|
|
|
|
|
|
|
|
|
|
%description -n rpmautospec-rpm-macros
|
2023-11-13 19:07:57 +00:00
|
|
|
|
This package contains RPM macros with placeholders for building rpmautospec
|
|
|
|
|
enabled packages locally.
|
2023-08-22 20:07:06 +00:00
|
|
|
|
%endif
|
2020-04-09 11:55:00 +00:00
|
|
|
|
|
2023-11-13 19:07:57 +00:00
|
|
|
|
%generate_buildrequires
|
2024-02-19 09:43:03 +00:00
|
|
|
|
%if %{with poetry}
|
2023-11-13 19:07:57 +00:00
|
|
|
|
%pyproject_buildrequires
|
2024-02-19 09:43:03 +00:00
|
|
|
|
%endif
|
2020-04-02 13:32:04 +00:00
|
|
|
|
|
|
|
|
|
%prep
|
2024-11-07 09:13:59 +00:00
|
|
|
|
%autosetup -n %{srcname}-%{version} -p1
|
2024-02-19 09:43:03 +00:00
|
|
|
|
%if %{with old_poetry}
|
2024-02-09 09:43:22 +00:00
|
|
|
|
sed -i \
|
|
|
|
|
-e 's/\[tool\.poetry\.group\.dev\.dependencies\]/[tool.poetry.dev-dependencies]/g' \
|
|
|
|
|
pyproject.toml
|
2023-11-14 13:11:32 +00:00
|
|
|
|
%endif
|
2020-04-02 13:32:04 +00:00
|
|
|
|
|
2023-12-03 03:59:28 +00:00
|
|
|
|
# https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_linters
|
2024-01-11 14:18:41 +00:00
|
|
|
|
sed -i -e '/pytest-cov/d; /addopts.*--cov/d' pyproject.toml
|
2023-12-03 03:59:28 +00:00
|
|
|
|
|
2020-04-02 13:32:04 +00:00
|
|
|
|
%build
|
2024-02-19 09:43:03 +00:00
|
|
|
|
%if %{with poetry}
|
2023-11-13 19:07:57 +00:00
|
|
|
|
%pyproject_wheel
|
2024-02-19 09:43:03 +00:00
|
|
|
|
%else
|
|
|
|
|
%py3_build
|
|
|
|
|
%endif
|
2020-04-02 13:32:04 +00:00
|
|
|
|
|
|
|
|
|
%install
|
2024-02-19 09:43:03 +00:00
|
|
|
|
%if %{with poetry}
|
2023-11-13 19:07:57 +00:00
|
|
|
|
%pyproject_install
|
|
|
|
|
%pyproject_save_files %{srcname}
|
|
|
|
|
# Work around poetry not listing license files as such in package metadata.
|
|
|
|
|
sed -i -e 's|^\(.*/LICENSE\)|%%license \1|g' %{pyproject_files}
|
2024-02-19 09:43:03 +00:00
|
|
|
|
%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
|
2023-11-13 19:07:57 +00:00
|
|
|
|
|
|
|
|
|
%if %{with rpmmacropkg}
|
2020-04-09 11:55:00 +00:00
|
|
|
|
mkdir -p %{buildroot}%{rpmmacrodir}
|
|
|
|
|
install -m 644 rpm/macros.d/macros.rpmautospec %{buildroot}%{rpmmacrodir}/
|
2023-08-22 20:07:06 +00:00
|
|
|
|
%endif
|
2020-04-09 11:55:00 +00:00
|
|
|
|
|
2020-04-02 13:32:04 +00:00
|
|
|
|
%check
|
2023-02-23 13:50:36 +00:00
|
|
|
|
%pytest -v \
|
2022-05-15 11:38:39 +00:00
|
|
|
|
%if %{with xdist}
|
|
|
|
|
--numprocesses=auto
|
|
|
|
|
%endif
|
|
|
|
|
|
2024-02-09 10:37:50 +00:00
|
|
|
|
%files -n python3-%{srcname} -f %{pyproject_files}
|
2023-11-13 19:07:57 +00:00
|
|
|
|
%doc README.rst
|
|
|
|
|
|
2024-02-09 10:37:50 +00:00
|
|
|
|
%files -n %{srcname}
|
2023-11-13 19:07:57 +00:00
|
|
|
|
%{_bindir}/rpmautospec
|
2024-02-19 09:43:03 +00:00
|
|
|
|
%{_mandir}/man1/rpmautospec.1*
|
2023-11-13 19:07:57 +00:00
|
|
|
|
|
|
|
|
|
%if %{with rpmmacropkg}
|
|
|
|
|
%files -n rpmautospec-rpm-macros
|
|
|
|
|
%{rpmmacrodir}/macros.rpmautospec
|
|
|
|
|
%endif
|
2020-04-02 13:32:04 +00:00
|
|
|
|
|
|
|
|
|
%changelog
|
2022-11-10 09:04:59 +00:00
|
|
|
|
%autochangelog
|