Make patches relative to where tarballs are extracted

Ever since an old patch version, it has (for reasonable security
reasons) not supported patched with ../ in the filename.
Many of our patches have been relying on this behaviour being OK,
because we start off with an ancient patch version that didn't perform
such checks. As soon as we need this behaviour after we build a newer
patch though, we will have problems.

So, let's change the policy.
Patches are relative to where tarballs are extracted, rather than the
"working directory" - e.g. have patches for `coreutils-9.4/src/cp.c`
instead of `src/cp.c`.
Keeping this consistent has a few implications;
- patches are applied from the build/ directory in bash era now, with
  `-p0`
- when patches are manually applied in the bash era, use `-p` as
  required, usually `-p1`
- in kaem era where patches are always manually applied, `-p1` is used
This commit is contained in:
fosslinux 2024-12-21 16:50:23 +11:00
parent 749b2bfe37
commit a67db8fcbd
156 changed files with 1265 additions and 1263 deletions

View file

@ -10,8 +10,8 @@ graminit.h.
We apply this patch before regen-ing graminit.h and revert it
afterward.
--- Parser/parsetok.c 2022-10-11 14:11:29.522466304 +1100
+++ Parser/parsetok.c 2022-10-11 14:11:42.786627172 +1100
--- Python-3.1.5/Parser/parsetok.c 2022-10-11 14:11:29.522466304 +1100
+++ Python-3.1.5/Parser/parsetok.c 2022-10-11 14:11:42.786627172 +1100
@@ -8,7 +8,6 @@
#include "parser.h"
#include "parsetok.h"

View file

@ -9,8 +9,8 @@ files.
We only apply this to the first build.
--- Tools/unicode/makeunicodedata.py 2012-04-10 09:25:37.000000000 +1000
+++ Tools/unicode/makeunicodedata.py 2022-07-13 14:13:37.864821008 +1000
--- Python-3.1.5/Tools/unicode/makeunicodedata.py 2012-04-10 09:25:37.000000000 +1000
+++ Python-3.1.5/Tools/unicode/makeunicodedata.py 2022-07-13 14:13:37.864821008 +1000
@@ -67,7 +67,7 @@
def maketables(trace=0):
@ -448,8 +448,8 @@ We only apply this to the first build.
if __debug__:
# exhaustively verify that the decomposition is correct
mask = ~((~0) << shift) # i.e., low-bit mask of shift bits
--- Lib/token.py 2012-04-10 09:25:36.000000000 +1000
+++ Lib/token.py 2022-07-13 14:13:37.893821468 +1000
--- Python-3.1.5/Lib/token.py 2012-04-10 09:25:36.000000000 +1000
+++ Python-3.1.5/Lib/token.py 2022-07-13 14:13:37.893821468 +1000
@@ -93,11 +93,7 @@
outFileName = "Lib/token.py"
if len(args) > 1:

View file

@ -5,7 +5,7 @@
src_prepare() {
default
patch -Np0 -i py2.patch
patch -Np1 -i py2.patch
# Delete generated files
rm Include/Python-ast.h Python/Python-ast.c
@ -50,7 +50,7 @@ src_configure() {
src_compile() {
# Temporarily break include cycle
patch -Np0 -i graminit-regen.patch
patch -Np1 -i graminit-regen.patch
# Build pgen
make "${MAKEJOBS}" Parser/pgen
# Regen graminit.c and graminit.h
@ -65,7 +65,7 @@ src_compile() {
python token.py
# Undo change
patch -Np0 -R -i graminit-regen.patch
patch -Np1 -R -i graminit-regen.patch
# Now build the main program
make "${MAKEJOBS}" CFLAGS="-U__DATE__ -U__TIME__"
}

View file

@ -55,7 +55,7 @@ src_configure() {
src_compile() {
# Temporarily break include cycle
patch -Np0 -i graminit-regen.patch
patch -Np1 -i graminit-regen.patch
# Build pgen
PYTHONDONTWRITEBYTECODE=1 make "${MAKEJOBS}" Parser/pgen
# Regen graminit.c and graminit.h
@ -70,7 +70,7 @@ src_compile() {
python -B token.py
# Undo change
patch -Np0 -R -i graminit-regen.patch
patch -Np1 -R -i graminit-regen.patch
# Now build the main program
PYTHONDONTWRITEBYTECODE=1 make "${MAKEJOBS}" CFLAGS="-U__DATE__ -U__TIME__"
}

View file

@ -5,8 +5,8 @@ SPDX-License-Identifier: PSF-2.0
Install libraries with 755 instead of 555 so we can strip them. (This
is what is in modern versions of python).
--- Makefile.pre.in 2023-03-15 21:49:08.274186777 +1100
+++ Makefile.pre.in 2023-03-15 21:50:02.466143662 +1100
--- Python-3.1.5/Makefile.pre.in 2023-03-15 21:49:08.274186777 +1100
+++ Python-3.1.5/Makefile.pre.in 2023-03-15 21:50:02.466143662 +1100
@@ -54,8 +54,7 @@
INSTALL_DATA= @INSTALL_DATA@
# Shared libraries must be installed with executable mode on some systems;

View file

@ -5,8 +5,8 @@ SPDX-License-Identifier: PSF-2.0
openssl is too new for this version of Python. Tell Python build system
we don't have openssl.
--- setup.py 2022-12-19 10:51:49.749157041 +1100
+++ setup.py 2022-12-19 10:52:37.223748681 +1100
--- Python-3.1.5/setup.py 2022-12-19 10:51:49.749157041 +1100
+++ Python-3.1.5/setup.py 2022-12-19 10:52:37.223748681 +1100
@@ -712,7 +712,7 @@
#print('openssl_ver = 0x%08x' % openssl_ver)

View file

@ -5,8 +5,8 @@ SPDX-License-Identifier: PSF-2.0
musl (correctly) implements the POSIX posix_close function, however
this was added after Python 3.1.5 was released.
--- Modules/posixmodule.c 2022-10-15 10:20:33.311399832 +1100
+++ Modules/posixmodule.c 2022-10-15 10:21:03.522921510 +1100
--- Python-3.1.5/Modules/posixmodule.c 2022-10-15 10:20:33.311399832 +1100
+++ Python-3.1.5/Modules/posixmodule.c 2022-10-15 10:21:03.522921510 +1100
@@ -4993,12 +4993,12 @@
}