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-09 20:22:15.431229996 +1100
+++ Parser/parsetok.c 2022-10-09 20:22:57.981822483 +1100
--- Python-2.5.6/Parser/parsetok.c 2022-10-09 20:22:15.431229996 +1100
+++ Python-2.5.6/Parser/parsetok.c 2022-10-09 20:22:57.981822483 +1100
@@ -8,7 +8,6 @@
#include "parser.h"
#include "parsetok.h"

View file

@ -56,7 +56,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
@ -71,7 +71,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

@ -6,8 +6,8 @@ frozenset() is a feature only added in Python 2.5, but we are
building Python 2.5, so we must bypass this logic. (It is not
critical, so we can just remove it).
--- Lib/keyword.py 2022-10-11 12:51:13.050744758 +1100
+++ Lib/keyword.py 2022-10-11 12:52:05.946372559 +1100
--- Python-2.5.6/Lib/keyword.py 2022-10-11 12:51:13.050744758 +1100
+++ Python-2.5.6/Lib/keyword.py 2022-10-11 12:52:05.946372559 +1100
@@ -10,7 +10,7 @@
python Lib/keyword.py
"""

View file

@ -7,8 +7,8 @@ Don't ignore pgen error (on "make Parser/pgen.stamp")
diff --git a/Makefile.pre.in b/Makefile.pre.in
index 25a82aff01..03f85fd04b 100644
--- Makefile.pre.in
+++ Makefile.pre.in
--- Python-2.5.6/Makefile.pre.in
+++ Python-2.5.6/Makefile.pre.in
@@ -471,10 +471,12 @@ Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
Modules/python.o: $(srcdir)/Modules/python.c
$(MAINCC) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/python.c

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 2.5.6 was released.
--- Modules/posixmodule.c 2022-10-05 18:38:46.718131893 +1100
+++ Modules/posixmodule.c 2022-10-05 18:39:07.049250312 +1100
--- Python-2.5.6/Modules/posixmodule.c 2022-10-05 18:38:46.718131893 +1100
+++ Python-2.5.6/Modules/posixmodule.c 2022-10-05 18:39:07.049250312 +1100
@@ -5208,12 +5208,12 @@
}

View file

@ -4,8 +4,8 @@ SPDX-License-Identifier: PSF-2.0
Disable creation of pyc files.
--- Lib/py_compile.py 2024-01-22 11:28:44.333395804 +1100
+++ Lib/py_compile.py 2024-01-22 11:28:53.703636809 +1100
--- Python-2.5.6/Lib/py_compile.py 2024-01-22 11:28:44.333395804 +1100
+++ Python-2.5.6/Lib/py_compile.py 2024-01-22 11:28:53.703636809 +1100
@@ -112,6 +112,7 @@
directories).
@ -14,8 +14,8 @@ Disable creation of pyc files.
f = open(file, 'U')
try:
timestamp = long(os.fstat(f.fileno()).st_mtime)
--- Python/import.c 2024-01-22 12:24:59.390701654 +1100
+++ Python/import.c 2024-01-22 12:25:18.643222249 +1100
--- Python-2.5.6/Python/import.c 2024-01-22 12:24:59.390701654 +1100
+++ Python-2.5.6/Python/import.c 2024-01-22 12:25:18.643222249 +1100
@@ -869,6 +869,7 @@
static void
write_compiled_module(PyCodeObject *co, char *cpathname, time_t mtime)

View file

@ -8,8 +8,8 @@ We cannot use .sort(), as it doesn't support the key= parameter.
Instead we just use a basic custom selection sort to sort it ourselves
using a custom key.
--- Tools/compiler/astgen.py.bak 2022-07-11 09:24:59.600238862 +1000
+++ Tools/compiler/astgen.py 2022-07-11 09:32:25.814974174 +1000
--- Python-2.5.6/Tools/compiler/astgen.py.bak 2022-07-11 09:24:59.600238862 +1000
+++ Python-2.5.6/Tools/compiler/astgen.py 2022-07-11 09:32:25.814974174 +1000
@@ -215,7 +215,15 @@
# some extra code for a Node's __init__ method
name = mo.group(1)

View file

@ -8,8 +8,8 @@ which is not available when we are building Python 2.5.
Sorting is absolutely unnessecary when generating defines for a
header file so we can just remove it.
--- Lib/sre_constants.py 2004-08-25 12:22:30.000000000 +1000
+++ Lib/sre_constants.py 2022-10-09 20:18:40.332233858 +1100
--- Python-2.5.6/Lib/sre_constants.py 2004-08-25 12:22:30.000000000 +1000
+++ Python-2.5.6/Lib/sre_constants.py 2022-10-09 20:18:40.332233858 +1100
@@ -219,7 +219,6 @@
if __name__ == "__main__":
def dump(f, d, prefix):