Use %autosetup with git am

Patch 189 is still applied conditionally, so we need to use %autosetup with -N,
to prevent automatic patch application.

Later, the patches are applied automatically up to 188 (with -M for maximum),
patch 189 is applied conditionally,
and finally patches from 190 up are applied (with -m for minimum).

Once patch 189 is reworked to be applicable at all times (or removed), this can be dropped.

While not necessary shorter, this no longer requires adding/removing %patch XYZ
when adding/removing patches.

While at it, we also use git am to apply the patches
since they are all generated from git anyway.
This makes it easier if we ever patch binary files.
This commit is contained in:
Miro Hrončok 2020-07-15 17:12:02 +02:00
parent efdda005ea
commit 0a760f01ca
1 changed files with 14 additions and 15 deletions

View File

@ -177,6 +177,7 @@ BuildRequires: gcc-c++
%if %{with gdbm}
BuildRequires: gdbm-devel
%endif
BuildRequires: git-core
BuildRequires: glibc-all-langpacks
BuildRequires: glibc-devel
BuildRequires: gmp-devel
@ -620,7 +621,19 @@ version once Python %{pybasever} is stable.
%prep
%gpgverify -k2 -s1 -d0
%setup -q -n Python-%{upstream_version}
%autosetup -S git_am -N -n Python-%{upstream_version}
# Apply patches up to 188
%autopatch -M 188
%if %{with rpmwheels}
%apply_patch -q %{PATCH189}
rm Lib/ensurepip/_bundled/*.whl
%endif
# Apply the remaining patches
%autopatch -m 190
# Remove all exe files to ensure we are not shipping prebuilt binaries
# note that those are only used to create Microsoft Windows installers
# and that functionality is broken on Linux anyway
@ -629,20 +642,6 @@ find -name '*.exe' -print -delete
# Remove bundled libraries to ensure that we're using the system copy.
rm -r Modules/expat
#
# Apply patches:
#
%patch1 -p1
%patch111 -p1
%if %{with rpmwheels}
%patch189 -p1
rm Lib/ensurepip/_bundled/*.whl
%endif
%patch251 -p1
%patch274 -p1
%patch328 -p1
# Remove files that should be generated by the build