Skip to content

Commit

Permalink
Merge pull request #3691 from citrus-it/pythonr50
Browse files Browse the repository at this point in the history
python and expat update (r151050)
  • Loading branch information
hadfl authored Sep 10, 2024
2 parents 1cb9d0e + 75c4578 commit f3447f0
Show file tree
Hide file tree
Showing 12 changed files with 98 additions and 29 deletions.
2 changes: 1 addition & 1 deletion build/expat/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
. ../../lib/build.sh

PROG=expat
VER=2.6.2
VER=2.6.3
PKG=library/expat
SUMMARY="XML parser library"
DESC="Fast streaming XML parser written in C"
Expand Down
2 changes: 1 addition & 1 deletion build/expat/patches/no_link_libm.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
diff -wpruN --no-dereference '--exclude=*.orig' a~/m4/libtool.m4 a/m4/libtool.m4
--- a~/m4/libtool.m4 1970-01-01 00:00:00
+++ a/m4/libtool.m4 1970-01-01 00:00:00
@@ -3887,7 +3887,7 @@ case $host in
@@ -3882,7 +3882,7 @@ case $host in
AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
;;
*)
Expand Down
2 changes: 1 addition & 1 deletion build/python312/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
. ../../lib/build.sh

PROG=Python
VER=3.12.4
VER=3.12.6
PKG=runtime/python-312
MVER=${VER%.*}
SUMMARY="$PROG $MVER"
Expand Down
63 changes: 45 additions & 18 deletions build/python312/patches/default-lib-path.patch
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
This patch was developed in-house. It has been submitted upstream:
http://bugs.python.org/issue23287

diff -wpruN --no-dereference '--exclude=*.orig' a~/Lib/ctypes/util.py a/Lib/ctypes/util.py
--- a~/Lib/ctypes/util.py 1970-01-01 00:00:00
+++ a/Lib/ctypes/util.py 1970-01-01 00:00:00
@@ -229,34 +229,15 @@ elif os.name == "posix":

@@ -230,43 +230,55 @@ elif os.name == "posix":
elif sys.platform == "sunos5":

- def _findLib_crle(name, is64):
def _findLib_crle(name, is64):
- if not os.path.exists('/usr/bin/crle'):
- return None
+ def _findLib_path(name, is64):

-
env = dict(os.environ)
env['LC_ALL'] = 'C'

+ paths = []
+
if is64:
- args = ('/usr/bin/crle', '-64')
+ paths = "/lib/64:/usr/lib/64"
+ var = 'LD_LIBRARY_PATH_64'
else:
- args = ('/usr/bin/crle',)
-
+ var = 'LD_LIBRARY_PATH_32'

- paths = None
- try:
- proc = subprocess.Popen(args,
Expand All @@ -35,19 +33,48 @@ diff -wpruN --no-dereference '--exclude=*.orig' a~/Lib/ctypes/util.py a/Lib/ctyp
- line = line.strip()
- if line.startswith(b'Default Library Path (ELF):'):
- paths = os.fsdecode(line).split()[4]
-
- if not paths:
- return None
+ paths = "/lib:/usr/lib"
+ if (lp := env.get(var)) or (lp := env.get('LD_LIBRARY_PATH')):
+ paths.extend(lp.split(':'))
+
+ if os.path.exists('/usr/bin/crle'):
+ args = ['/usr/bin/crle']
+ if is64:
+ args.append('-64')
+ var = 'LD_CONFIG_64'
+ else:
+ var = 'LD_CONFIG_32'
+
+ if (cfg := env.get(var)) or (cfg := env.get('LD_CONFIG')):
+ args.extend(['-c', cfg])
+
+ try:
+ with subprocess.Popen(args,
+ stdout=subprocess.PIPE, stderr=subprocess.DEVNULL,
+ env=env) as proc:
+ for line in proc.stdout:
+ line = line.strip()
+ if line.startswith(b'Default Library Path (ELF):'):
+ paths.extend(
+ os.fsdecode(line).split()[4].split(':'))
+ break
+ except OSError: # E.g. bad executable
+ pass

if not paths:
return None

- for dir in paths.split(":"):
- libfile = os.path.join(dir, "lib%s.so" % name)
+ for dir in paths:
+ libfile = os.path.join(dir, f'lib{name}.so')
if os.path.exists(libfile):
return libfile

for dir in paths.split(":"):
libfile = os.path.join(dir, "lib%s.so" % name)
@@ -266,7 +247,7 @@ elif os.name == "posix":
return None

def find_library(name, is64 = False):
- return _get_soname(_findLib_crle(name, is64) or _findLib_gcc(name))
+ return _get_soname(_findLib_path(name, is64) or _findLib_gcc(name))
+ return _get_soname(_findLib_crle(name, is64))

else:

42 changes: 42 additions & 0 deletions build/python312/patches/gethostbyname.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
Attempting to detect whether we have a gethostbyname_r() with 6 arguments
is fatal with gcc14. We jump straight to the 5 argument check which is
correct when building with XPG6.

diff -wpruN --no-dereference '--exclude=*.orig' a~/configure.ac a/configure.ac
--- a~/configure.ac 1970-01-01 00:00:00
+++ a/configure.ac 1970-01-01 00:00:00
@@ -5564,26 +5564,8 @@ AH_TEMPLATE([HAVE_GETHOSTBYNAME_R],

AC_CHECK_FUNC([gethostbyname_r],
[AC_DEFINE([HAVE_GETHOSTBYNAME_R])
- AC_MSG_CHECKING([gethostbyname_r with 6 args])
OLD_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-# include <netdb.h>
- ]], [[
- char *name;
- struct hostent *he, *res;
- char buffer[2048];
- int buflen = 2048;
- int h_errnop;
-
- (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
- ]])],[
- AC_DEFINE([HAVE_GETHOSTBYNAME_R])
- AC_DEFINE([HAVE_GETHOSTBYNAME_R_6_ARG], [1],
- [Define this if you have the 6-arg version of gethostbyname_r().])
- AC_MSG_RESULT([yes])
- ],[
- AC_MSG_RESULT([no])
AC_MSG_CHECKING([gethostbyname_r with 5 args])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
# include <netdb.h>
@@ -5622,7 +5604,6 @@ AC_CHECK_FUNC([gethostbyname_r],
AC_MSG_RESULT([no])
])
])
- ])
CFLAGS=$OLD_CFLAGS
], [
AC_CHECK_FUNCS([gethostbyname])
4 changes: 2 additions & 2 deletions build/python312/patches/mod-posix-sched_priority.patch
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ However, -1 alongside EINVAL represents an error.
diff -wpruN --no-dereference '--exclude=*.orig' a~/Modules/posixmodule.c a/Modules/posixmodule.c
--- a~/Modules/posixmodule.c 1970-01-01 00:00:00
+++ a/Modules/posixmodule.c 1970-01-01 00:00:00
@@ -7813,7 +7813,11 @@ os_sched_get_priority_max_impl(PyObject
@@ -7815,7 +7815,11 @@ os_sched_get_priority_max_impl(PyObject
int max;

max = sched_get_priority_max(policy);
Expand All @@ -19,7 +19,7 @@ diff -wpruN --no-dereference '--exclude=*.orig' a~/Modules/posixmodule.c a/Modul
return posix_error();
return PyLong_FromLong(max);
}
@@ -7832,7 +7836,11 @@ os_sched_get_priority_min_impl(PyObject
@@ -7834,7 +7838,11 @@ os_sched_get_priority_min_impl(PyObject
/*[clinic end generated code: output=7595c1138cc47a6d input=21bc8fa0d70983bf]*/
{
int min = sched_get_priority_min(policy);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ diff -wpruN --no-dereference '--exclude=*.orig' a~/Modules/posixmodule.c a/Modul
default: {
PyErr_SetString(PyExc_TypeError,
"Unknown file_actions identifier");
@@ -16503,6 +16524,9 @@ all_ins(PyObject *m)
@@ -16505,6 +16526,9 @@ all_ins(PyObject *m)
if (PyModule_AddIntConstant(m, "POSIX_SPAWN_OPEN", POSIX_SPAWN_OPEN)) return -1;
if (PyModule_AddIntConstant(m, "POSIX_SPAWN_CLOSE", POSIX_SPAWN_CLOSE)) return -1;
if (PyModule_AddIntConstant(m, "POSIX_SPAWN_DUP2", POSIX_SPAWN_DUP2)) return -1;
Expand Down
2 changes: 1 addition & 1 deletion build/python312/patches/series
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ strxfrm-fix.patch
encoding-alias.patch
locale-encoding.patch
cgiserver.patch
static-assert.patch
pyc-timestamp.patch
asyncio-watcher.patch
py_db.patch
Expand Down Expand Up @@ -40,3 +39,4 @@ revert-makedirs.patch
#
# Do not add ustack.patch to this file, it is used to build the debug
# variant of python, see build.sh
gethostbyname.patch
2 changes: 1 addition & 1 deletion build/python312/patches/test-metadata.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ true on OmniOS.
diff -wpruN --no-dereference '--exclude=*.orig' a~/Lib/test/test_importlib/test_metadata_api.py a/Lib/test/test_importlib/test_metadata_api.py
--- a~/Lib/test/test_importlib/test_metadata_api.py 1970-01-01 00:00:00
+++ a/Lib/test/test_importlib/test_metadata_api.py 1970-01-01 00:00:00
@@ -58,7 +58,7 @@ class APITests(
@@ -59,7 +59,7 @@ class APITests(
assert distribution(name).metadata['Name'] == 'pkg.dot'

def test_prefix_not_matched(self):
Expand Down
2 changes: 1 addition & 1 deletion build/python312/patches/test-pkgutil.patch
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ it may well have if it's an IPS image.
diff -wpruN --no-dereference '--exclude=*.orig' a~/Lib/test/test_pkgutil.py a/Lib/test/test_pkgutil.py
--- a~/Lib/test/test_pkgutil.py 1970-01-01 00:00:00
+++ a/Lib/test/test_pkgutil.py 1970-01-01 00:00:00
@@ -546,22 +546,22 @@ class NestedNamespacePackageTest(unittes
@@ -582,22 +582,22 @@ class NestedNamespacePackageTest(unittes
pkgutil_boilerplate = (
'import pkgutil; '
'__path__ = pkgutil.extend_path(__path__, __name__)')
Expand Down
2 changes: 1 addition & 1 deletion build/python312/patches/test-tarfile.patch
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Convert both timestamps to integer before comparing.
diff -wpruN --no-dereference '--exclude=*.orig' a~/Lib/test/test_tarfile.py a/Lib/test/test_tarfile.py
--- a~/Lib/test/test_tarfile.py 1970-01-01 00:00:00
+++ a/Lib/test/test_tarfile.py 1970-01-01 00:00:00
@@ -3188,7 +3188,7 @@ class NoneInfoExtractTests(ReadTest):
@@ -3230,7 +3230,7 @@ class NoneInfoExtractTests(ReadTest):
if not path.is_symlink():
raise
else:
Expand Down
2 changes: 1 addition & 1 deletion build/python312/testsuite.log
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@

455 tests OK.

Total tests: run=41,580 (filtered) skipped=1,419
Total tests: run=41,886 (filtered) skipped=1,425
Total test files: run=481/489 (filtered) skipped=26 resource_denied=8
Result: SUCCESS

0 comments on commit f3447f0

Please sign in to comment.