From ce435e569bddf05dd846fb62f41d2c9b5b8a36b4 Mon Sep 17 00:00:00 2001 From: Chongyun Lee <45286352+licy183@users.noreply.github.com> Date: Fri, 12 Jan 2024 00:58:21 +0800 Subject: [PATCH] python3.8: rename and sort patches --- .../{fix-paths.patch => 0001-fix-paths.patch} | 49 +++++++++++++------ ...ers.patch => 0002-no-setuid-servers.patch} | 10 ++-- ...c.patch => 0003-impl-getprotobyname.patch} | 5 +- ...up.py.patch => 0004-use-android-log.patch} | 5 +- ...ssing.patch => 0005-multiprocessing.patch} | 25 ++++------ ...ursesmodule-do-not-include-langinfo.patch} | 5 +- tur/python3.8/0007-do-not-use-link.patch | 11 +++++ tur/python3.8/0008-build-with-fPIC.patch | 11 +++++ tur/python3.8/Lib-subprocess.py.patch | 14 ------ tur/python3.8/Lib-tmpfile.py.patch | 12 ----- tur/python3.8/configure.patch | 21 -------- 11 files changed, 76 insertions(+), 92 deletions(-) rename tur/python3.8/{fix-paths.patch => 0001-fix-paths.patch} (57%) rename tur/python3.8/{no-setuid-servers.patch => 0002-no-setuid-servers.patch} (66%) rename tur/python3.8/{Modules-socketmodule.c.patch => 0003-impl-getprotobyname.patch} (89%) rename tur/python3.8/{setup.py.patch => 0004-use-android-log.patch} (70%) rename tur/python3.8/{multiprocessing.patch => 0005-multiprocessing.patch} (75%) rename tur/python3.8/{_cursesmodule.c.patch => 0006-_cursesmodule-do-not-include-langinfo.patch} (57%) create mode 100644 tur/python3.8/0007-do-not-use-link.patch create mode 100644 tur/python3.8/0008-build-with-fPIC.patch delete mode 100644 tur/python3.8/Lib-subprocess.py.patch delete mode 100644 tur/python3.8/Lib-tmpfile.py.patch delete mode 100644 tur/python3.8/configure.patch diff --git a/tur/python3.8/fix-paths.patch b/tur/python3.8/0001-fix-paths.patch similarity index 57% rename from tur/python3.8/fix-paths.patch rename to tur/python3.8/0001-fix-paths.patch index 5738ee0793..93c93f086d 100644 --- a/tur/python3.8/fix-paths.patch +++ b/tur/python3.8/0001-fix-paths.patch @@ -1,6 +1,5 @@ -diff -uNr Python-3.6.2/Lib/aifc.py Python-3.6.2.mod/Lib/aifc.py ---- Python-3.6.2/Lib/aifc.py 2017-07-08 06:33:27.000000000 +0300 -+++ Python-3.6.2.mod/Lib/aifc.py 2017-09-15 15:09:08.092797061 +0300 +--- a/Lib/aifc.py ++++ b/Lib/aifc.py @@ -920,7 +920,7 @@ if __name__ == '__main__': import sys @@ -10,9 +9,8 @@ diff -uNr Python-3.6.2/Lib/aifc.py Python-3.6.2.mod/Lib/aifc.py fn = sys.argv[1] with open(fn, 'r') as f: print("Reading", fn) -diff -uNr Python-3.6.2/Lib/mailcap.py Python-3.6.2.mod/Lib/mailcap.py ---- Python-3.6.2/Lib/mailcap.py 2017-07-08 06:33:27.000000000 +0300 -+++ Python-3.6.2.mod/Lib/mailcap.py 2017-09-15 15:08:41.312797081 +0300 +--- a/Lib/mailcap.py ++++ b/Lib/mailcap.py @@ -55,7 +55,8 @@ # Don't bother with getpwuid() home = '.' # Last resort @@ -23,9 +21,8 @@ diff -uNr Python-3.6.2/Lib/mailcap.py Python-3.6.2.mod/Lib/mailcap.py return mailcaps -diff -uNr Python-3.6.2/Lib/mimetypes.py Python-3.6.2.mod/Lib/mimetypes.py ---- Python-3.6.2/Lib/mimetypes.py 2017-07-08 06:33:27.000000000 +0300 -+++ Python-3.6.2.mod/Lib/mimetypes.py 2017-09-15 15:08:05.522797106 +0300 +--- a/Lib/mimetypes.py ++++ b/Lib/mimetypes.py @@ -49,6 +49,7 @@ "/usr/local/lib/netscape/mime.types", "/usr/local/etc/httpd/conf/mime.types", # Apache 1.2 @@ -34,9 +31,8 @@ diff -uNr Python-3.6.2/Lib/mimetypes.py Python-3.6.2.mod/Lib/mimetypes.py ] inited = False -diff -uNr Python-3.6.2/Lib/posixpath.py Python-3.6.2.mod/Lib/posixpath.py ---- Python-3.6.2/Lib/posixpath.py 2017-07-08 06:33:27.000000000 +0300 -+++ Python-3.6.2.mod/Lib/posixpath.py 2017-09-15 15:07:20.872797138 +0300 +--- a/Lib/posixpath.py ++++ b/Lib/posixpath.py @@ -32,7 +32,7 @@ extsep = '.' sep = '/' @@ -46,9 +42,8 @@ diff -uNr Python-3.6.2/Lib/posixpath.py Python-3.6.2.mod/Lib/posixpath.py altsep = None devnull = '/dev/null' -diff -uNr Python-3.6.2/Lib/uuid.py Python-3.6.2.mod/Lib/uuid.py ---- Python-3.6.2/Lib/uuid.py 2017-07-08 06:33:27.000000000 +0300 -+++ Python-3.6.2.mod/Lib/uuid.py 2017-09-15 15:06:36.372797170 +0300 +--- a/Lib/uuid.py ++++ b/Lib/uuid.py @@ -306,7 +306,7 @@ import os, shutil, subprocess executable = shutil.which(command) @@ -58,3 +53,27 @@ diff -uNr Python-3.6.2/Lib/uuid.py Python-3.6.2.mod/Lib/uuid.py executable = shutil.which(command, path=path) if executable is None: return None +--- a/Lib/subprocess.py ++++ b/Lib/subprocess.py +@@ -1389,9 +1389,7 @@ + args = list(args) + + if shell: +- # On Android the default shell is at '/system/bin/sh'. +- unix_shell = ('/system/bin/sh' if +- hasattr(sys, 'getandroidapilevel') else '/bin/sh') ++ unix_shell = ('@TERMUX_PREFIX@/bin/sh') + args = [unix_shell, "-c"] + args + if executable: + args[0] = executable +--- a/Lib/tempfile.py ++++ b/Lib/tempfile.py +@@ -124,7 +124,7 @@ + if _os.name == 'nt': + dirlist.extend([ r'c:\temp', r'c:\tmp', r'\temp', r'\tmp' ]) + else: +- dirlist.extend([ '/tmp', '/var/tmp', '/usr/tmp' ]) ++ dirlist.extend([ '@TERMUX_PREFIX@/tmp' ]) + + # As a last resort, the current directory. + try: diff --git a/tur/python3.8/no-setuid-servers.patch b/tur/python3.8/0002-no-setuid-servers.patch similarity index 66% rename from tur/python3.8/no-setuid-servers.patch rename to tur/python3.8/0002-no-setuid-servers.patch index e7cc8ce971..1be01d43f8 100644 --- a/tur/python3.8/no-setuid-servers.patch +++ b/tur/python3.8/0002-no-setuid-servers.patch @@ -1,6 +1,5 @@ -diff -uNr Python-3.9.2/Lib/http/server.py Python-3.9.2.mod/Lib/http/server.py ---- Python-3.9.2/Lib/http/server.py 2021-02-19 14:31:44.000000000 +0200 -+++ Python-3.9.2.mod/Lib/http/server.py 2021-03-20 16:08:34.173543081 +0200 +--- a/Lib/http/server.py ++++ b/Lib/http/server.py @@ -1165,10 +1165,6 @@ return # Child @@ -12,9 +11,8 @@ diff -uNr Python-3.9.2/Lib/http/server.py Python-3.9.2.mod/Lib/http/server.py os.dup2(self.rfile.fileno(), 0) os.dup2(self.wfile.fileno(), 1) os.execve(scriptfile, args, env) -diff -uNr Python-3.9.2/Lib/smtpd.py Python-3.9.2.mod/Lib/smtpd.py ---- Python-3.9.2/Lib/smtpd.py 2021-02-19 14:31:44.000000000 +0200 -+++ Python-3.9.2.mod/Lib/smtpd.py 2021-03-20 16:11:48.785629393 +0200 +--- a/Lib/smtpd.py ++++ b/Lib/smtpd.py @@ -9,7 +9,8 @@ -n This program generally tries to setuid `nobody', unless this flag is diff --git a/tur/python3.8/Modules-socketmodule.c.patch b/tur/python3.8/0003-impl-getprotobyname.patch similarity index 89% rename from tur/python3.8/Modules-socketmodule.c.patch rename to tur/python3.8/0003-impl-getprotobyname.patch index 79c282c39c..86dc57b7f4 100644 --- a/tur/python3.8/Modules-socketmodule.c.patch +++ b/tur/python3.8/0003-impl-getprotobyname.patch @@ -1,6 +1,5 @@ -diff -u -r ../Python-3.6.5/Modules/socketmodule.c ./Modules/socketmodule.c ---- ../Python-3.6.5/Modules/socketmodule.c 2018-03-28 11:19:31.000000000 +0200 -+++ ./Modules/socketmodule.c 2018-06-08 03:28:51.003730525 +0200 +--- a/Modules/socketmodule.c ++++ b/Modules/socketmodule.c @@ -5373,17 +5373,74 @@ This only returns the protocol number, since the other info is already known or not useful (like the list of aliases). */ diff --git a/tur/python3.8/setup.py.patch b/tur/python3.8/0004-use-android-log.patch similarity index 70% rename from tur/python3.8/setup.py.patch rename to tur/python3.8/0004-use-android-log.patch index 8c55a9fe3c..f0f221015c 100644 --- a/tur/python3.8/setup.py.patch +++ b/tur/python3.8/0004-use-android-log.patch @@ -1,6 +1,5 @@ -diff -uNr Python-3.8.0/setup.py Python-3.8.0.mod/setup.py ---- Python-3.8.0/setup.py 2019-10-14 16:34:47.000000000 +0300 -+++ Python-3.8.0.mod/setup.py 2019-11-17 21:16:46.524157731 +0200 +--- a/setup.py ++++ b/setup.py @@ -824,7 +824,8 @@ # Lance Ellinghaus's syslog module diff --git a/tur/python3.8/multiprocessing.patch b/tur/python3.8/0005-multiprocessing.patch similarity index 75% rename from tur/python3.8/multiprocessing.patch rename to tur/python3.8/0005-multiprocessing.patch index bc76ee0062..6f97249356 100644 --- a/tur/python3.8/multiprocessing.patch +++ b/tur/python3.8/0005-multiprocessing.patch @@ -1,6 +1,5 @@ -diff -uNr Python-3.9.13/Lib/multiprocessing/heap.py Python-3.9.13.mod/Lib/multiprocessing/heap.py ---- Python-3.9.13/Lib/multiprocessing/heap.py 2022-05-17 19:12:56.000000000 +0800 -+++ Python-3.9.13.mod/Lib/multiprocessing/heap.py 2022-07-05 11:30:43.134657200 +0800 +--- a/Lib/multiprocessing/heap.py ++++ b/Lib/multiprocessing/heap.py @@ -70,7 +70,7 @@ """ @@ -10,9 +9,8 @@ diff -uNr Python-3.9.13/Lib/multiprocessing/heap.py Python-3.9.13.mod/Lib/multip else: _dir_candidates = [] -diff -uNr Python-3.9.13/Modules/_multiprocessing/multiprocessing.c Python-3.9.13.mod/Modules/_multiprocessing/multiprocessing.c ---- Python-3.9.13/Modules/_multiprocessing/multiprocessing.c 2022-05-17 19:12:56.000000000 +0800 -+++ Python-3.9.13.mod/Modules/_multiprocessing/multiprocessing.c 2022-07-05 11:31:01.456088500 +0800 +--- a/Modules/_multiprocessing/multiprocessing.c ++++ b/Modules/_multiprocessing/multiprocessing.c @@ -128,7 +128,7 @@ {"recv", multiprocessing_recv, METH_VARARGS, ""}, {"send", multiprocessing_send, METH_VARARGS, ""}, @@ -22,9 +20,8 @@ diff -uNr Python-3.9.13/Modules/_multiprocessing/multiprocessing.c Python-3.9.13 {"sem_unlink", _PyMp_sem_unlink, METH_VARARGS, ""}, #endif {NULL} -diff -uNr Python-3.9.13/Modules/_multiprocessing/posix-shm-extension.c Python-3.9.13.mod/Modules/_multiprocessing/posix-shm-extension.c ---- Python-3.9.13/Modules/_multiprocessing/posix-shm-extension.c 1970-01-01 08:00:00.000000000 +0800 -+++ Python-3.9.13.mod/Modules/_multiprocessing/posix-shm-extension.c 2022-07-05 11:32:24.029768300 +0800 +--- a/Modules/_multiprocessing/posix-shm-extension.c ++++ b/Modules/_multiprocessing/posix-shm-extension.c @@ -0,0 +1,76 @@ +/* This file is a port of posix shared memory for Python3 on Termux Android, + based on musl-libc which is licensed under the following standard MIT @@ -102,9 +99,8 @@ diff -uNr Python-3.9.13/Modules/_multiprocessing/posix-shm-extension.c Python-3. + if (!(name = __shm_mapname(name, buf))) return -1; + return unlink(name); +} -diff -uNr Python-3.9.13/Modules/_multiprocessing/posixshmem.c Python-3.9.13.mod/Modules/_multiprocessing/posixshmem.c ---- Python-3.9.13/Modules/_multiprocessing/posixshmem.c 2022-05-17 19:12:56.000000000 +0800 -+++ Python-3.9.13.mod/Modules/_multiprocessing/posixshmem.c 2022-07-05 11:31:30.857914500 +0800 +--- a/Modules/_multiprocessing/posixshmem.c ++++ b/Modules/_multiprocessing/posixshmem.c @@ -11,6 +11,9 @@ #include #endif @@ -115,9 +111,8 @@ diff -uNr Python-3.9.13/Modules/_multiprocessing/posixshmem.c Python-3.9.13.mod/ /*[clinic input] module _posixshmem [clinic start generated code]*/ -diff -uNr Python-3.9.13/setup.py Python-3.9.13.mod/setup.py ---- Python-3.9.13/setup.py 2022-05-17 19:12:56.000000000 +0800 -+++ Python-3.9.13.mod/setup.py 2022-07-05 11:34:12.035464200 +0800 +--- a/setup.py ++++ b/setup.py @@ -1760,7 +1760,8 @@ multiprocessing_srcs.append('_multiprocessing/semaphore.c') if (sysconfig.get_config_var('HAVE_SHM_OPEN') and diff --git a/tur/python3.8/_cursesmodule.c.patch b/tur/python3.8/0006-_cursesmodule-do-not-include-langinfo.patch similarity index 57% rename from tur/python3.8/_cursesmodule.c.patch rename to tur/python3.8/0006-_cursesmodule-do-not-include-langinfo.patch index b4740fd2b8..d6a0700931 100644 --- a/tur/python3.8/_cursesmodule.c.patch +++ b/tur/python3.8/0006-_cursesmodule-do-not-include-langinfo.patch @@ -1,9 +1,8 @@ We use libandroid-support when building Python, but Python does not use LDFLAGS when building modules (and not much point in this case). -diff -u -r ../Python-3.4.1/Modules/_cursesmodule.c ./Modules/_cursesmodule.c ---- ../Python-3.4.1/Modules/_cursesmodule.c 2014-05-19 07:19:39.000000000 +0200 -+++ ./Modules/_cursesmodule.c 2014-06-04 08:56:50.441097925 +0200 +--- a/Modules/_cursesmodule.c ++++ b/Modules/_cursesmodule.c @@ -121,7 +121,7 @@ #include #endif diff --git a/tur/python3.8/0007-do-not-use-link.patch b/tur/python3.8/0007-do-not-use-link.patch new file mode 100644 index 0000000000..0b3a48cf10 --- /dev/null +++ b/tur/python3.8/0007-do-not-use-link.patch @@ -0,0 +1,11 @@ +--- a/configure ++++ b/configure +@@ -11293,8 +11293,6 @@ + _ACEOF + if ac_fn_c_try_compile "$LINENO"; then : + +-$as_echo "#define HAVE_LINK 1" >>confdefs.h +- + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + $as_echo "yes" >&6; } + else diff --git a/tur/python3.8/0008-build-with-fPIC.patch b/tur/python3.8/0008-build-with-fPIC.patch new file mode 100644 index 0000000000..4790ee53c9 --- /dev/null +++ b/tur/python3.8/0008-build-with-fPIC.patch @@ -0,0 +1,11 @@ +--- a/configure ++++ b/configure +@@ -9295,7 +9295,7 @@ + then CCSHARED="-fPIC"; + else CCSHARED="+z"; + fi;; +- Linux-android*) ;; ++ Linux-android*) CCSHARED="-fPIC";; + Linux*|GNU*) CCSHARED="-fPIC";; + BSD/OS*/4*) CCSHARED="-fpic";; + FreeBSD*|NetBSD*|OpenBSD*|DragonFly*) CCSHARED="-fPIC";; diff --git a/tur/python3.8/Lib-subprocess.py.patch b/tur/python3.8/Lib-subprocess.py.patch deleted file mode 100644 index bea4bbf233..0000000000 --- a/tur/python3.8/Lib-subprocess.py.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff -u -r ../Python-3.7.1/Lib/subprocess.py ./Lib/subprocess.py ---- ../Python-3.7.1/Lib/subprocess.py 2018-10-20 06:04:19.000000000 +0000 -+++ ./Lib/subprocess.py 2018-10-20 20:17:50.157206343 +0000 -@@ -1389,9 +1389,7 @@ - args = list(args) - - if shell: -- # On Android the default shell is at '/system/bin/sh'. -- unix_shell = ('/system/bin/sh' if -- hasattr(sys, 'getandroidapilevel') else '/bin/sh') -+ unix_shell = ('@TERMUX_PREFIX@/bin/sh') - args = [unix_shell, "-c"] + args - if executable: - args[0] = executable diff --git a/tur/python3.8/Lib-tmpfile.py.patch b/tur/python3.8/Lib-tmpfile.py.patch deleted file mode 100644 index ec6a2e80cf..0000000000 --- a/tur/python3.8/Lib-tmpfile.py.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -u -r ../Python-3.4.3/Lib/tempfile.py ./Lib/tempfile.py ---- ../Python-3.4.3/Lib/tempfile.py 2015-02-25 06:27:44.000000000 -0500 -+++ ./Lib/tempfile.py 2015-07-21 19:58:07.631659902 -0400 -@@ -124,7 +124,7 @@ - if _os.name == 'nt': - dirlist.extend([ r'c:\temp', r'c:\tmp', r'\temp', r'\tmp' ]) - else: -- dirlist.extend([ '/tmp', '/var/tmp', '/usr/tmp' ]) -+ dirlist.extend([ '@TERMUX_PREFIX@/tmp' ]) - - # As a last resort, the current directory. - try: diff --git a/tur/python3.8/configure.patch b/tur/python3.8/configure.patch deleted file mode 100644 index 88ce4e8ae1..0000000000 --- a/tur/python3.8/configure.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff -u -r ../Python-3.6.1/configure ./configure ---- ../Python-3.6.1/configure 2017-03-21 07:32:38.000000000 +0100 -+++ ./configure 2017-03-23 23:42:47.210898734 +0100 -@@ -9295,7 +9295,7 @@ - then CCSHARED="-fPIC"; - else CCSHARED="+z"; - fi;; -- Linux-android*) ;; -+ Linux-android*) CCSHARED="-fPIC";; - Linux*|GNU*) CCSHARED="-fPIC";; - BSD/OS*/4*) CCSHARED="-fpic";; - FreeBSD*|NetBSD*|OpenBSD*|DragonFly*) CCSHARED="-fPIC";; -@@ -11293,8 +11293,6 @@ - _ACEOF - if ac_fn_c_try_compile "$LINENO"; then : - --$as_echo "#define HAVE_LINK 1" >>confdefs.h -- - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 - $as_echo "yes" >&6; } - else