Merge branch 'epel10' into a10s-epel10

This commit is contained in:
eabdullin 2025-06-16 10:35:10 +03:00
commit 5209f06b59
3 changed files with 176 additions and 67 deletions

View File

@ -1,8 +1,8 @@
## START: Set by rpmautospec ## START: Set by rpmautospec
## (rpmautospec version 0.7.2) ## (rpmautospec version 0.7.3)
## RPMAUTOSPEC: autorelease, autochangelog ## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua: %define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
release_number = 1; release_number = 11;
base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}")); base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
print(release_number + base_release_number - 1); print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}.alma.1 }%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}.alma.1
@ -20,13 +20,22 @@
%bcond bootstrap 0 %bcond bootstrap 0
%bcond tests 1 %bcond tests 1
# Which packages to mask and which tests to do with native wrappers
# While bootstrapping, ignore manpages %global wrapped_pkgs pygit2 rpm
%bcond manpages %{without bootstrap} %global wrappers_relevant_tests tests/rpmautospec/test_pkg_history.py tests/rpmautospec/subcommands/
# The pytest-xdist package is not available when bootstrapping or on RHEL # The pytest-xdist package is not available when bootstrapping or on RHEL
%bcond xdist %[%{without bootstrap} && %{undefined rhel}] %bcond xdist %[%{without bootstrap} && %{undefined rhel}]
# Whether to build only the minimal package for RHEL buildroot
%bcond minimal %[%{defined rhel} && %{undefined epel}]
# While bootstrapping or building the minimal package, ignore manpages
%bcond manpages %[%{without bootstrap} && %{without minimal}]
# While building the minimal package, ignore shell completions
%bcond completions %{without minimal}
# Package the placeholder rpm-macros (moved to redhat-rpm-config in F40) # Package the placeholder rpm-macros (moved to redhat-rpm-config in F40)
%if ! (0%{?fedora} >= 40 || 0%{?rhel} >= 10) %if ! (0%{?fedora} >= 40 || 0%{?rhel} >= 10)
%bcond rpmmacropkg 1 %bcond rpmmacropkg 1
@ -34,26 +43,25 @@
%bcond rpmmacropkg 0 %bcond rpmmacropkg 0
%endif %endif
%if %{with bootstrap} # Appease old versions of hatchling
%bcond poetry 0 %if ! 0%{?fedora}%{?rhel} || 0%{?fedora} >= 41 || 0%{?rhel} >= 10
%bcond old_hatchling 0
%else %else
%if ! 0%{?fedora}%{?rhel} || 0%{?fedora} || 0%{?epel} >= 9 %bcond old_hatchling 1
%bcond poetry 1
# Appease old Poetry versions (<1.2.0a2)
%if ! 0%{?fedora}%{?rhel} || 0%{?fedora} >= 38 || 0%{?rhel} >= 10
%bcond old_poetry 0
%else
%bcond old_poetry 1
%endif
%else
%bcond poetry 0
%endif
%endif %endif
# Although this supports a range of libgit2 and librpm versions upstream,
# we want to ensure newer versions dont accidentally break all packages using this.
# Hence we artificially restrict the Required version to what was tested during the build.
# When libgit2/librpm soname is bumped, this package needs to be rebuilt (and tested).
%define libgit2_lower_bound 1.7
%define libgit2_upper_bound 1.10
%define libgit2_requires %(rpm -q --provides libgit2 | grep '^libgit2\.so\.' | sed 's/()(64bit)$//' | head -n 1)
%global srcname rpmautospec %global srcname rpmautospec
Name: python-%{srcname} Name: python-%{srcname}
Version: 0.7.3 Version: 0.8.1
%if %{with bootstrap} %if %{with bootstrap}
Release: 0%{?dist} Release: 0%{?dist}
@ -61,9 +69,10 @@ Release: 0%{?dist}
Release: %autorelease Release: %autorelease
%endif %endif
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 AND GPL-2.0-only WITH GCC-exception-2.0 AND (MIT OR GPL-2.0-or-later WITH GCC-exception-2.0)
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: %{pypi_source %{srcname}}
Source1: rpmautospec.in
Patch1: 0001-Added-AlmaLinux-change-identifier-0.7.3.patch Patch1: 0001-Added-AlmaLinux-change-identifier-0.7.3.patch
@ -72,10 +81,12 @@ Patch1: 0001-Added-AlmaLinux-change-identifier-0.7.3.patch
%endif %endif
BuildArch: noarch BuildArch: noarch
BuildRequires: findutils
BuildRequires: git BuildRequires: git
# the langpacks are needed for tests # the langpacks are needed for tests
BuildRequires: glibc-langpack-de BuildRequires: glibc-langpack-de
BuildRequires: glibc-langpack-en BuildRequires: glibc-langpack-en
BuildRequires: python3-devel >= 3.9.0 BuildRequires: python3-devel >= 3.9.0
# Needed to build man pages # Needed to build man pages
%if %{with manpages} %if %{with manpages}
@ -85,39 +96,57 @@ BuildRequires: python3dist(click-man)
%if %{with tests} %if %{with tests}
# The dependencies needed for testing dont get auto-generated. # The dependencies needed for testing dont get auto-generated.
BuildRequires: python3dist(pytest) BuildRequires: python3dist(pytest)
BuildRequires: python3dist(pyyaml)
%if %{with xdist} %if %{with xdist}
BuildRequires: python3dist(pytest-xdist) BuildRequires: python3dist(pytest-xdist)
%endif %endif
%endif %endif
BuildRequires: python3dist(pyyaml)
BuildRequires: sed BuildRequires: sed
%if %{without poetry} BuildRequires: (libgit2 >= %libgit2_lower_bound with libgit2 < %libgit2_upper_bound)
BuildRequires: python3dist(babel) BuildRequires: rpm-libs
BuildRequires: python3dist(click) BuildRequires: rpm-build-libs
BuildRequires: python3dist(click-plugins)
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.}
%description %_description %description %_description
%if %{without minimal}
%package -n python3-%{srcname} %package -n python3-%{srcname}
Summary: %{summary} Summary: %{summary}
%{?python_provide:%python_provide python3-%{srcname}} %{?python_provide:%python_provide python3-%{srcname}}
%description -n python3-%{srcname} %_description %description -n python3-%{srcname} %_description
%pyproject_extras_subpkg -n python3-%{srcname} click
%pyproject_extras_subpkg -n python3-%{srcname} pygit2
%pyproject_extras_subpkg -n python3-%{srcname} rpm
%pyproject_extras_subpkg -n python3-%{srcname} all
%endif
%package -n %{srcname} %package -n %{srcname}
Summary: CLI tool for generating RPM releases and changelogs Summary: CLI tool for generating RPM releases and changelogs
Requires: python3-%{srcname} = %{version}-%{release}
Provides: bundled(python3dist(rpmautospec)) = %{version}
Provides: bundled(python3dist(rpmautospec-core)) = %((rpm -q python3-rpmautospec-core --qf '%%{version}\n' || echo 0) | tail -n1)
%if "%libgit2_requires" != ""
Requires: (%{libgit2_requires}()(64bit) or %{libgit2_requires})
Suggests: %{libgit2_requires}()(64bit)
%else
Requires: this-is-broken-libgit2-missing-during-build
%endif
Requires: rpm-libs
Requires: rpm-build-libs
%if %{without minimal}
Recommends: python3-%{srcname} = %{version}-%{release}
Recommends: python3-%{srcname}+click = %{version}-%{release}
Recommends: python3-%{srcname}+pygit2 = %{version}-%{release}
Recommends: python3-%{srcname}+rpm = %{version}-%{release}
%endif
%description -n %{srcname} %description -n %{srcname}
CLI tool for generating RPM releases and changelogs CLI tool for generating RPM releases and changelogs
@ -133,44 +162,23 @@ enabled packages locally.
%endif %endif
%generate_buildrequires %generate_buildrequires
%if %{with poetry} %pyproject_buildrequires %{!?with_minimal:-x all}
%pyproject_buildrequires
%endif
%prep %prep
%autosetup -n %{srcname}-%{version} -p1 %autosetup -n %{srcname}-%{version} -p1
%if %{without poetry} %if %{with old_hatchling}
sed -i -e 's/\[project\]/#\&/g' pyproject.toml sed -i -e 's/license-files = \(\[.*\]\)/license-files = {globs = \1}/' pyproject.toml
%endif
%if %{with old_poetry}
sed -i \
-e 's/\[tool\.poetry\.group\.dev\.dependencies\]/[tool.poetry.dev-dependencies]/g' \
pyproject.toml
%endif %endif
# https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_linters # https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_linters
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.
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
%if %{with manpages} %if %{with manpages}
# Man pages # Man pages
@ -182,9 +190,10 @@ install -m644 man/*.1 %{buildroot}%{_mandir}/man1
# RPM macros # RPM macros
%if %{with rpmmacropkg} %if %{with rpmmacropkg}
mkdir -p %{buildroot}%{rpmmacrodir} mkdir -p %{buildroot}%{rpmmacrodir}
install -m 644 rpm/macros.d/macros.rpmautospec %{buildroot}%{rpmmacrodir}/ install -m 644 rpm_macros.d/macros.rpmautospec %{buildroot}%{rpmmacrodir}/
%endif %endif
%if %{with completions}
# Shell completion # Shell completion
for shell_path in \ for shell_path in \
bash:%{bash_completions_dir}/rpmautospec \ bash:%{bash_completions_dir}/rpmautospec \
@ -202,36 +211,88 @@ for shell_path in \
"import sys; sys.argv[0] = 'rpmautospec'; from rpmautospec.cli import cli; sys.exit(cli())" \ "import sys; sys.argv[0] = 'rpmautospec'; from rpmautospec.cli import cli; sys.exit(cli())" \
> "%{buildroot}${path}" > "%{buildroot}${path}"
done done
%endif
# Fill in the real version for the fallback method
touch -r %{buildroot}%{python3_sitelib}/rpmautospec/version.py timestamp
sed -i -e 's|0\.0\.0|%{version}|g' %{buildroot}%{python3_sitelib}/rpmautospec/version.py
touch -r timestamp %{buildroot}%{python3_sitelib}/rpmautospec/version.py
# Install bootstrapping copies of rpmautospec, rpmautospec_core packages
mkdir -p %{buildroot}%{_datadir}/rpmautospec-fallback
cp -r %{python3_sitelib}/rpmautospec_core %{buildroot}%{_datadir}/rpmautospec-fallback/
cp -r %{buildroot}%{python3_sitelib}/rpmautospec %{buildroot}%{_datadir}/rpmautospec-fallback/
find %{buildroot}%{_datadir}/rpmautospec-fallback \
-depth -type d -a -name __pycache__ -exec rm -r {} \;
# Override the standard executable with a custom one that knows how to fall back
sed -e 's|@PYTHON3@|%{python3} -%{py3_shebang_flags}|g; s|@DATADIR@|%{_datadir}|g' \
< %{S:1} \
> %{buildroot}%{_bindir}/rpmautospec
chmod 755 %{buildroot}%{_bindir}/rpmautospec
touch -r %{S:1} %{buildroot}%{_bindir}/rpmautospec
%check %check
# Always run the import checks, even when other tests are disabled # Always run the import checks, even when other tests are disabled
%if %{with poetry} %pyproject_check_import %{?with_minimal:-e '*click*'}
%pyproject_check_import
%else
%py3_check_import rpmautospec rpmautospec.cli
%endif
%if %{with tests} %if %{with tests}
%pytest -v \ %if %{without minimal}
%pytest \
%if %{with xdist} %if %{with xdist}
--numprocesses=auto --numprocesses=auto
%endif %endif
%endif %endif
%if ! 0%{?rhel} || 0%{?rhel} >= 10
# And redo tests that are relevant for native bindings, but with the direct native wrappers, but not
# on EL <= 9 because the tests somehow run out of file descriptors.
# Poison the official package names…
mkdir -p poison-pill
for mod in %wrapped_pkgs; do
echo "raise ImportError" > "poison-pill/${mod}.py"
if PYTHONPATH="$PWD/poison-pill:$PYTHONPATH" %__python3 -c "import ${mod}" 2>/dev/null; then
echo "Failed to poison-pill ${mod}!" >&2
exit 1
fi
done
%py3_test_envvars \
PYTHONPATH="$PWD/poison-pill:$PYTHONPATH" \
%__pytest \
%if %{with xdist}
--numprocesses=auto \
%endif
%wrappers_relevant_tests
%endif
%endif
%if %{without minimal}
%files -n python3-%{srcname} -f %{pyproject_files} %files -n python3-%{srcname} -f %{pyproject_files}
%doc README.rst %doc README.rst
%endif
%files -n %{srcname} %files -n %{srcname}
%{_bindir}/rpmautospec %{_bindir}/rpmautospec
%{_datadir}/rpmautospec-fallback
%if %{with manpages} %if %{with manpages}
%{_mandir}/man1/rpmautospec*.1* %{_mandir}/man1/rpmautospec*.1*
%endif %endif
%if %{with completions}
%dir %{bash_completions_dir} %dir %{bash_completions_dir}
%{bash_completions_dir}/rpmautospec %{bash_completions_dir}/rpmautospec
%dir %{fish_completions_dir} %dir %{fish_completions_dir}
%{fish_completions_dir}/rpmautospec.fish %{fish_completions_dir}/rpmautospec.fish
%dir %{zsh_completions_dir} %dir %{zsh_completions_dir}
%{zsh_completions_dir}/_rpmautospec %{zsh_completions_dir}/_rpmautospec
%endif
%if %{with minimal}
%license licenses/*
%exclude %{python3_sitelib}
%endif
%if %{with rpmmacropkg} %if %{with rpmmacropkg}
%files -n rpmautospec-rpm-macros %files -n rpmautospec-rpm-macros
@ -240,9 +301,45 @@ done
%changelog %changelog
## START: Generated by rpmautospec ## START: Generated by rpmautospec
* Thu Apr 17 2025 Eduard Abdullin <eabdullin@almalinux.org> - 0.7.3-1 * Mon Jun 16 2025 Eduard Abdullin <eabdullin@almalinux.org> - 0.8.1-8.alma.1
- AlmaLinux change: Add AlmaLinux OS change identifier - AlmaLinux change: Add AlmaLinux OS change identifier
* Wed Apr 16 2025 Miro Hrončok <miro@hroncok.cz> - 0.8.1-8
- Generate BuildRequires for extras, drop unused click-plugins dependency
* Wed Apr 16 2025 Miro Hrončok <miro@hroncok.cz> - 0.8.1-7
- On RHEL, only build the minimal package
* Wed Apr 16 2025 Miro Hrončok <miro@hroncok.cz> - 0.8.1-6
- Make sure only one libgit2 package is BuildRequired during the build
* Tue Apr 15 2025 Miro Hrončok <miro@hroncok.cz> - 0.8.1-5
- Add bundled() provides for bundled self and rpmautospec-core
* Tue Apr 15 2025 Yaakov Selkowitz <yselkowi@redhat.com> - 0.8.1-4
- Drop pyproject_macros conditional
* Mon Apr 14 2025 Nils Philippsen <nils@redhat.com> - 0.8.1-2
- Pin libgit2 to soname version tested during build
* Tue Apr 08 2025 Nils Philippsen <nils@redhat.com> - 0.8.1-1
- Update to 0.8.1
* Tue Apr 08 2025 Miro Hrončok <miro@hroncok.cz> - 0.8.0-4
- Stop trying to Require libraries with %%_isa
* Tue Apr 08 2025 Miro Hrončok <miro@hroncok.cz> - 0.8.0-3
- Add missing flags to /usr/bin/rpmautospec shebang
* Tue Apr 08 2025 Nils Philippsen <nils@redhat.com> - 0.8.0-1
- Update to 0.8.0
- Update license
- Make using click, pygit2, rpm Python packages optional and enable
fallbacks
* Sat Jan 18 2025 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild
* Fri Oct 11 2024 Nils Philippsen <nils@redhat.com> - 0.7.3-1 * Fri Oct 11 2024 Nils Philippsen <nils@redhat.com> - 0.7.3-1
- Update to 0.7.3 - Update to 0.7.3

12
rpmautospec.in Executable file
View File

@ -0,0 +1,12 @@
#!@PYTHON3@
import sys
try:
from rpmautospec import cli
except ImportError:
sys.path.insert(0, "@DATADIR@/rpmautospec-fallback")
sys.dont_write_bytecode = True
from rpmautospec import cli
sys.exit(cli.cli())

View File

@ -1 +1 @@
e1d88a616228dad805b1bdec5a74d3287057b997 rpmautospec-0.7.3.tar.gz 6734e148a6eb2b18742570a008e13a2eb70df976 rpmautospec-0.8.1.tar.gz