From 4e05541782edeb06b51d691dadf52648df24c940 Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Wed, 27 Oct 2021 12:10:02 +0300 Subject: [PATCH] python3: bump to version 3.10.0 Manually re-applied: 008-distutils-use-python-sysroot.patch 016-adjust-config-paths.patch Drop patch: 003-do-not-run-distutils-tests.patch There is now a configure option '--disable-test-modules' And seems we left the '_ctypes_test' around for quite some time. Dropped now. Refs: https://bugs.python.org/issue27640 https://bugs.python.org/issue43282 Drop patch: 013-getbuildinfo-date-time-source-date-epoch.patch Python build honors SOURCE_DATE_EPOCH pretty well now. Drop setuptools patches. Setuptools should be reproducible with Python 3.6+ according to a mention here: https://github.com/pypa/setuptools/pull/1690#issuecomment-536517456 It's time to let upstream fix Setuptools reproduce-ability. Drop patch: 010-do-not-add-rt-lib-dirs-when-cross-compiling.patch I can't seem to fully remember why it's there. And it seem to build fine without it. Drop patch: 015-abort-on-failed-modules.patch Python build supports a similar PYTHONSTRICTEXTENSIONBUILD=1 env-var option. Add patch: 026-openssl-feature-flags.patch We need to keep this in our tree for a while. See: https://bugs.python.org/issue45627 Backport patch: 027-bpo-43158-Use-configure-values-for-building-_uuid-ex.patch Link: https://github.com/python/cpython/pull/29353 Fixes the build for uuid C module. Add patch: 028-host-python-support-ssl-with-libressl.patch We need the _ssl module working on the host-side with LibreSSL for pip to work to download from https://pypi.org Refs: https://github.com/openwrt/openwrt/pull/4749 Add patch: 029-disable-deprecation-warning.patch Fixes apparmor build. The warning causes a configure error. Refreshed the rest of patches. Some old build-flags were removed. They don't seem to be necessary anymore. Split python3-uuid from python3-light. To better manage the libuuid library (if needed). Also, fixing the uuid C module build. Seems this was failing, and was falling back to using hashlib. Signed-off-by: Alexandru Ardelean --- lang/python/python3-version.mk | 4 +- lang/python/python3/Makefile | 28 ++-- .../python3/files/python3-package-ctypes.mk | 1 - .../python3/files/python3-package-uuid.mk | 17 ++ .../python3/patches-setuptools/.placeholder | 0 .../patches-setuptools/001-reproducible.patch | 16 -- .../002-sorted-requires.patch | 16 -- .../003-PKG-INFO-output-reproducible.patch | 14 -- .../python3/patches/001-enable-zlib.patch | 2 +- .../003-do-not-run-distutils-tests.patch | 18 --- .../004-do-not-write-bytes-codes.patch | 2 +- ...multiarch-paths-when-cross-compiling.patch | 2 +- .../008-distutils-use-python-sysroot.patch | 42 ++--- ...add-rt-lib-dirs-when-cross-compiling.patch | 13 -- ...uildinfo-date-time-source-date-epoch.patch | 28 ---- .../014-remove-platform-so-suffix.patch | 4 +- .../patches/015-abort-on-failed-modules.patch | 10 -- .../patches/016-adjust-config-paths.patch | 30 ++-- .../025-choose-python-config-version.patch | 2 +- .../patches/026-openssl-feature-flags.patch | 12 ++ ...nfigure-values-for-building-_uuid-ex.patch | 151 ++++++++++++++++++ ...ost-python-support-ssl-with-libressl.patch | 117 ++++++++++++++ .../029-disable-deprecation-warning.patch | 10 ++ 23 files changed, 363 insertions(+), 176 deletions(-) create mode 100644 lang/python/python3/files/python3-package-uuid.mk create mode 100644 lang/python/python3/patches-setuptools/.placeholder delete mode 100644 lang/python/python3/patches-setuptools/001-reproducible.patch delete mode 100644 lang/python/python3/patches-setuptools/002-sorted-requires.patch delete mode 100644 lang/python/python3/patches-setuptools/003-PKG-INFO-output-reproducible.patch delete mode 100644 lang/python/python3/patches/003-do-not-run-distutils-tests.patch delete mode 100644 lang/python/python3/patches/010-do-not-add-rt-lib-dirs-when-cross-compiling.patch delete mode 100644 lang/python/python3/patches/013-getbuildinfo-date-time-source-date-epoch.patch delete mode 100644 lang/python/python3/patches/015-abort-on-failed-modules.patch create mode 100644 lang/python/python3/patches/026-openssl-feature-flags.patch create mode 100644 lang/python/python3/patches/027-bpo-43158-Use-configure-values-for-building-_uuid-ex.patch create mode 100644 lang/python/python3/patches/028-host-python-support-ssl-with-libressl.patch create mode 100644 lang/python/python3/patches/029-disable-deprecation-warning.patch diff --git a/lang/python/python3-version.mk b/lang/python/python3-version.mk index b0772218b0..ec09b14e78 100644 --- a/lang/python/python3-version.mk +++ b/lang/python/python3-version.mk @@ -7,8 +7,8 @@ # Note: keep in sync with setuptools & pip PYTHON3_VERSION_MAJOR:=3 -PYTHON3_VERSION_MINOR:=9 -PYTHON3_VERSION_MICRO:=7 +PYTHON3_VERSION_MINOR:=10 +PYTHON3_VERSION_MICRO:=0 PYTHON3_VERSION:=$(PYTHON3_VERSION_MAJOR).$(PYTHON3_VERSION_MINOR) diff --git a/lang/python/python3/Makefile b/lang/python/python3/Makefile index 619a08a56b..e83f2a5731 100644 --- a/lang/python/python3/Makefile +++ b/lang/python/python3/Makefile @@ -11,13 +11,13 @@ include $(TOPDIR)/rules.mk include ../python3-version.mk PKG_NAME:=python3 -PKG_RELEASE:=2 +PKG_RELEASE:=1 PKG_VERSION:=$(PYTHON3_VERSION).$(PYTHON3_VERSION_MICRO) PKG_SOURCE:=Python-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=https://www.python.org/ftp/python/$(PKG_VERSION) # FIXME: if updating, get rid of [1] & [2] asap -PKG_HASH:=f8145616e68c00041d1a6399b76387390388f8359581abc24432bb969b5e3c57 +PKG_HASH:=5a99f8e7a6a11a7b98b4e75e0d1303d3832cada5534068f69c7b6222a7b1b002 PKG_MAINTAINER:=Alexandru Ardelean , Jeffery To PKG_LICENSE:=Python/2.0 @@ -91,7 +91,7 @@ endef define Package/python3-light $(call Package/python3/Default) TITLE:=Python $(PYTHON3_VERSION) light installation - DEPENDS:=+python3-base +libffi +libbz2 +libuuid + DEPENDS:=+python3-base +libffi +libbz2 endef define Package/python3-light/config @@ -136,18 +136,13 @@ define Package/python3/description It's python3-light + all other packages. endef -TARGET_CONFIGURE_OPTS+= \ - READELF="$(TARGET_CROSS)readelf" - -MAKE_FLAGS+=\ - LD="$(TARGET_CC)" - -EXTRA_CFLAGS+= \ - -DNDEBUG -fno-inline EXTRA_LDFLAGS+= \ -L$(PKG_BUILD_DIR) \ -L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib +MAKE_VARS += \ + PYTHONSTRICTEXTENSIONBUILD=1 + CONFIGURE_ARGS+= \ --enable-optimizations \ --enable-shared \ @@ -155,6 +150,7 @@ CONFIGURE_ARGS+= \ --without-cxx-main \ --without-ensurepip \ --without-pymalloc \ + --disable-test-modules \ $(if $(CONFIG_IPV6),--enable-ipv6) \ $(if $(findstring mips,$(CONFIG_ARCH)),,--with-lto) \ CONFIG_SITE="$(PKG_BUILD_DIR)/config.site" \ @@ -320,6 +316,10 @@ HOST_LDFLAGS += \ -Wl,--no-as-needed -lrt endif +# Would be nice to be able to do this, but hosts are very fiddly +# HOST_MAKE_VARS += \ +# PYTHONSTRICTEXTENSIONBUILD=1 + ifeq ($(HOST_OS),Darwin) HOST_CONFIGURE_VARS += \ ac_cv_header_libintl_h=no @@ -327,12 +327,18 @@ HOST_MAKE_VARS += \ USE_PYTHON_CONFIG_PY=1 endif +# FIXME: remove when removing patch '028-host-python-support-ssl-with-libressl.patch' +HOST_CFLAGS += \ + -DOPENWRT_HOST_BUILD + HOST_CONFIGURE_ARGS+= \ --enable-optimizations \ --with-ensurepip=upgrade \ --with-system-expat=$(STAGING_DIR_HOSTPKG) \ + --with-ssl-default-suites=openssl \ --without-cxx-main \ --without-pymalloc \ + --disable-test-modules \ CONFIG_SITE= define Host/Configure diff --git a/lang/python/python3/files/python3-package-ctypes.mk b/lang/python/python3/files/python3-package-ctypes.mk index f38e0118c9..90e8cefedc 100644 --- a/lang/python/python3/files/python3-package-ctypes.mk +++ b/lang/python/python3/files/python3-package-ctypes.mk @@ -14,5 +14,4 @@ endef $(eval $(call Py3BasePackage,python3-ctypes, \ /usr/lib/python$(PYTHON3_VERSION)/ctypes \ /usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_ctypes.$(PYTHON3_SO_SUFFIX) \ - /usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_ctypes_test.$(PYTHON3_SO_SUFFIX) \ )) diff --git a/lang/python/python3/files/python3-package-uuid.mk b/lang/python/python3/files/python3-package-uuid.mk new file mode 100644 index 0000000000..ef05c5902d --- /dev/null +++ b/lang/python/python3/files/python3-package-uuid.mk @@ -0,0 +1,17 @@ +# +# Copyright (C) 2021 Alexandru Ardelean +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define Package/python3-uuid +$(call Package/python3/Default) + TITLE:=Python $(PYTHON3_VERSION) UUID module + DEPENDS:=+python3-light +libuuid +endef + +$(eval $(call Py3BasePackage,python3-uuid, \ + /usr/lib/python$(PYTHON3_VERSION)/uuid.py \ + /usr/lib/python$(PYTHON3_VERSION)/lib-dynload/_uuid.$(PYTHON3_SO_SUFFIX) \ +)) diff --git a/lang/python/python3/patches-setuptools/.placeholder b/lang/python/python3/patches-setuptools/.placeholder new file mode 100644 index 0000000000..e69de29bb2 diff --git a/lang/python/python3/patches-setuptools/001-reproducible.patch b/lang/python/python3/patches-setuptools/001-reproducible.patch deleted file mode 100644 index a4e80103f8..0000000000 --- a/lang/python/python3/patches-setuptools/001-reproducible.patch +++ /dev/null @@ -1,16 +0,0 @@ -https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=848136 -https://sources.debian.org/patches/python-setuptools/40.8.0-1/reproducible.diff/ - -Index: b/setuptools/command/easy_install.py -=================================================================== ---- a/setuptools/command/easy_install.py -+++ b/setuptools/command/easy_install.py -@@ -423,7 +423,7 @@ class easy_install(Command): - for spec in self.args: - self.easy_install(spec, not self.no_deps) - if self.record: -- outputs = self.outputs -+ outputs = list(sorted(self.outputs)) - if self.root: # strip any package prefix - root_len = len(self.root) - for counter in range(len(outputs)): diff --git a/lang/python/python3/patches-setuptools/002-sorted-requires.patch b/lang/python/python3/patches-setuptools/002-sorted-requires.patch deleted file mode 100644 index 9e48f523ef..0000000000 --- a/lang/python/python3/patches-setuptools/002-sorted-requires.patch +++ /dev/null @@ -1,16 +0,0 @@ -https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=804249 -https://sources.debian.org/patches/python-setuptools/40.8.0-1/sorted-requires.diff/ - -Index: b/setuptools/command/egg_info.py -=================================================================== ---- a/setuptools/command/egg_info.py -+++ b/setuptools/command/egg_info.py -@@ -641,7 +641,7 @@ def _write_requirements(stream, reqs): - - def append_cr(line): - return line + '\n' -- lines = map(append_cr, lines) -+ lines = map(append_cr, sorted(lines)) - stream.writelines(lines) - - diff --git a/lang/python/python3/patches-setuptools/003-PKG-INFO-output-reproducible.patch b/lang/python/python3/patches-setuptools/003-PKG-INFO-output-reproducible.patch deleted file mode 100644 index f1b6ca169a..0000000000 --- a/lang/python/python3/patches-setuptools/003-PKG-INFO-output-reproducible.patch +++ /dev/null @@ -1,14 +0,0 @@ -https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=894215 -https://sources.debian.org/patches/python-setuptools/40.8.0-1/PKG-INFO-output-reproducible.diff/ - ---- a/setuptools/dist.py -+++ b/setuptools/dist.py -@@ -193,7 +193,7 @@ def write_pkg_file(self, file): - self.long_description_content_type - ) - if self.provides_extras: -- for extra in self.provides_extras: -+ for extra in sorted(self.provides_extras): - write_field('Provides-Extra', extra) - - diff --git a/lang/python/python3/patches/001-enable-zlib.patch b/lang/python/python3/patches/001-enable-zlib.patch index 76e83087aa..75766ee196 100644 --- a/lang/python/python3/patches/001-enable-zlib.patch +++ b/lang/python/python3/patches/001-enable-zlib.patch @@ -1,6 +1,6 @@ --- a/Modules/Setup +++ b/Modules/Setup -@@ -338,7 +338,7 @@ _symtable symtablemodule.c +@@ -343,7 +343,7 @@ _symtable symtablemodule.c # Andrew Kuchling's zlib module. # This require zlib 1.1.3 (or later). # See http://www.gzip.org/zlib/ diff --git a/lang/python/python3/patches/003-do-not-run-distutils-tests.patch b/lang/python/python3/patches/003-do-not-run-distutils-tests.patch deleted file mode 100644 index 544fdbed8a..0000000000 --- a/lang/python/python3/patches/003-do-not-run-distutils-tests.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- a/Makefile.pre.in -+++ b/Makefile.pre.in -@@ -1546,6 +1546,7 @@ libinstall: build_all $(srcdir)/Modules/ - $(INSTALL_DATA) `cat pybuilddir.txt`/_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH).py \ - $(DESTDIR)$(LIBDEST); \ - $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt -+ifeq (@COMPILE_ALL_TESTS@,yes) - if test -d $(DESTDIR)$(LIBDEST)/distutils/tests; then \ - $(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \ - $(DESTDIR)$(LIBDEST)/distutils/tests ; \ -@@ -1581,6 +1582,7 @@ libinstall: build_all $(srcdir)/Modules/ - $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/Grammar.txt - -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ - $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/PatternGrammar.txt -+endif - - # bpo-21536: Misc/python-config.sh is generated in the build directory - # from $(srcdir)Misc/python-config.sh.in. diff --git a/lang/python/python3/patches/004-do-not-write-bytes-codes.patch b/lang/python/python3/patches/004-do-not-write-bytes-codes.patch index edd375ea3e..eec149b3ce 100644 --- a/lang/python/python3/patches/004-do-not-write-bytes-codes.patch +++ b/lang/python/python3/patches/004-do-not-write-bytes-codes.patch @@ -1,6 +1,6 @@ --- a/Python/initconfig.c +++ b/Python/initconfig.c -@@ -158,7 +158,7 @@ int Py_NoSiteFlag = 0; /* Suppress 'impo +@@ -155,7 +155,7 @@ int Py_NoSiteFlag = 0; /* Suppress 'impo int Py_BytesWarningFlag = 0; /* Warn on str(bytes) and str(buffer) */ int Py_FrozenFlag = 0; /* Needed by getpath.c */ int Py_IgnoreEnvironmentFlag = 0; /* e.g. PYTHONPATH, PYTHONHOME */ diff --git a/lang/python/python3/patches/006-do-not-add-multiarch-paths-when-cross-compiling.patch b/lang/python/python3/patches/006-do-not-add-multiarch-paths-when-cross-compiling.patch index 733340fd03..76c8f8c9cc 100644 --- a/lang/python/python3/patches/006-do-not-add-multiarch-paths-when-cross-compiling.patch +++ b/lang/python/python3/patches/006-do-not-add-multiarch-paths-when-cross-compiling.patch @@ -1,6 +1,6 @@ --- a/setup.py +++ b/setup.py -@@ -737,7 +737,8 @@ class PyBuildExt(build_ext): +@@ -816,7 +816,8 @@ class PyBuildExt(build_ext): # only change this for cross builds for 3.3, issues on Mageia if CROSS_COMPILING: self.add_cross_compiling_paths() diff --git a/lang/python/python3/patches/008-distutils-use-python-sysroot.patch b/lang/python/python3/patches/008-distutils-use-python-sysroot.patch index f218c46d54..26f22d7df1 100644 --- a/lang/python/python3/patches/008-distutils-use-python-sysroot.patch +++ b/lang/python/python3/patches/008-distutils-use-python-sysroot.patch @@ -17,7 +17,7 @@ third-party Python modules. Signed-off-by: Thomas Petazzoni --- Lib/distutils/command/build_ext.py | 5 ++++- - Lib/distutils/sysconfig.py | 15 +++++++++++---- + Lib/sysconfig.py | 15 +++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) --- a/Lib/distutils/command/build_ext.py @@ -34,27 +34,27 @@ Signed-off-by: Thomas Petazzoni else: # building python standard extensions self.library_dirs.append('.') ---- a/Lib/distutils/sysconfig.py -+++ b/Lib/distutils/sysconfig.py -@@ -17,10 +17,17 @@ import sys - from .errors import DistutilsPlatformError - - # These are needed in a couple of spots, so just compute them once. --PREFIX = os.path.normpath(sys.prefix) --EXEC_PREFIX = os.path.normpath(sys.exec_prefix) --BASE_PREFIX = os.path.normpath(sys.base_prefix) --BASE_EXEC_PREFIX = os.path.normpath(sys.base_exec_prefix) +--- a/Lib/sysconfig.py ++++ b/Lib/sysconfig.py +@@ -123,10 +123,17 @@ _SCHEME_KEYS = ('stdlib', 'platstdlib', + _PY_VERSION = sys.version.split()[0] + _PY_VERSION_SHORT = f'{sys.version_info[0]}.{sys.version_info[1]}' + _PY_VERSION_SHORT_NO_DOT = f'{sys.version_info[0]}{sys.version_info[1]}' +-_PREFIX = os.path.normpath(sys.prefix) +-_BASE_PREFIX = os.path.normpath(sys.base_prefix) +-_EXEC_PREFIX = os.path.normpath(sys.exec_prefix) +-_BASE_EXEC_PREFIX = os.path.normpath(sys.base_exec_prefix) +if "_python_sysroot" in os.environ: + _sysroot=os.environ.get('_python_sysroot') -+ PREFIX = os.path.normpath(_sysroot + os.environ.get('_python_prefix')) -+ EXEC_PREFIX = os.path.normpath(_sysroot + os.environ.get('_python_exec_prefix')) -+ BASE_PREFIX = PREFIX -+ BASE_EXEC_PREFIX = EXEC_PREFIX ++ _PREFIX = os.path.normpath(_sysroot + os.environ.get('_python_prefix')) ++ _EXEC_PREFIX = os.path.normpath(_sysroot + os.environ.get('_python_exec_prefix')) ++ _BASE_PREFIX = _PREFIX ++ _BASE_EXEC_PREFIX = _EXEC_PREFIX +else: -+ PREFIX = os.path.normpath(sys.prefix) -+ EXEC_PREFIX = os.path.normpath(sys.exec_prefix) -+ BASE_PREFIX = os.path.normpath(sys.base_prefix) -+ BASE_EXEC_PREFIX = os.path.normpath(sys.base_exec_prefix) ++ _PREFIX = os.path.normpath(sys.prefix) ++ _EXEC_PREFIX = os.path.normpath(sys.exec_prefix) ++ _BASE_PREFIX = os.path.normpath(sys.base_prefix) ++ _BASE_EXEC_PREFIX = os.path.normpath(sys.base_exec_prefix) + _CONFIG_VARS = None + _USER_BASE = None - # Path to the base directory of the project. On Windows the binary may - # live in project/PCbuild/win32 or project/PCbuild/amd64. diff --git a/lang/python/python3/patches/010-do-not-add-rt-lib-dirs-when-cross-compiling.patch b/lang/python/python3/patches/010-do-not-add-rt-lib-dirs-when-cross-compiling.patch deleted file mode 100644 index ee0c8124ee..0000000000 --- a/lang/python/python3/patches/010-do-not-add-rt-lib-dirs-when-cross-compiling.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/setup.py -+++ b/setup.py -@@ -714,8 +714,9 @@ class PyBuildExt(build_ext): - # directly since an inconsistently reproducible issue comes up where - # the environment variable is not set even though the value were passed - # into configure and stored in the Makefile (issue found on OS X 10.3). -+ rt_lib_dirs = [] if CROSS_COMPILING else self.compiler.runtime_library_dirs - for env_var, arg_name, dir_list in ( -- ('LDFLAGS', '-R', self.compiler.runtime_library_dirs), -+ ('LDFLAGS', '-R', rt_lib_dirs), - ('LDFLAGS', '-L', self.compiler.library_dirs), - ('CPPFLAGS', '-I', self.compiler.include_dirs)): - env_val = sysconfig.get_config_var(env_var) diff --git a/lang/python/python3/patches/013-getbuildinfo-date-time-source-date-epoch.patch b/lang/python/python3/patches/013-getbuildinfo-date-time-source-date-epoch.patch deleted file mode 100644 index 0a987d6b4d..0000000000 --- a/lang/python/python3/patches/013-getbuildinfo-date-time-source-date-epoch.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- a/Makefile.pre.in -+++ b/Makefile.pre.in -@@ -774,6 +774,16 @@ regen-all: regen-opcode regen-opcode-tar - ############################################################################ - # Special rules for object files - -+DATE_FMT = %b %d %Y -+TIME_FMT = %H:%M:%S -+ifdef SOURCE_DATE_EPOCH -+ BUILD_DATE ?= $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" "+$(DATE_FMT)" 2>/dev/null || date -u -r "$(SOURCE_DATE_EPOCH)" "+$(DATE_FMT)" 2>/dev/null || date -u "+$(DATE_FMT)") -+ BUILD_TIME ?= $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" "+$(TIME_FMT)" 2>/dev/null || date -u -r "$(SOURCE_DATE_EPOCH)" "+$(TIME_FMT)" 2>/dev/null || date -u "+$(TIME_FMT)") -+else -+ BUILD_DATE ?= $(shell date "+$(DATE_FMT)") -+ BUILD_TIME ?= $(shell date "+$(TIME_FMT)") -+endif -+ - Modules/getbuildinfo.o: $(PARSER_OBJS) \ - $(OBJECT_OBJS) \ - $(PYTHON_OBJS) \ -@@ -782,6 +792,8 @@ Modules/getbuildinfo.o: $(PARSER_OBJS) \ - $(DTRACE_OBJS) \ - $(srcdir)/Modules/getbuildinfo.c - $(CC) -c $(PY_CORE_CFLAGS) \ -+ -DDATE="\"$(BUILD_DATE)\"" \ -+ -DTIME="\"$(BUILD_TIME)\"" \ - -DGITVERSION="\"`LC_ALL=C $(GITVERSION)`\"" \ - -DGITTAG="\"`LC_ALL=C $(GITTAG)`\"" \ - -DGITBRANCH="\"`LC_ALL=C $(GITBRANCH)`\"" \ diff --git a/lang/python/python3/patches/014-remove-platform-so-suffix.patch b/lang/python/python3/patches/014-remove-platform-so-suffix.patch index 39166073fb..db9c3f3992 100644 --- a/lang/python/python3/patches/014-remove-platform-so-suffix.patch +++ b/lang/python/python3/patches/014-remove-platform-so-suffix.patch @@ -1,6 +1,6 @@ --- a/configure +++ b/configure -@@ -15390,7 +15390,7 @@ $as_echo_n "checking ABIFLAGS... " >&6; +@@ -15407,7 +15407,7 @@ $as_echo_n "checking ABIFLAGS... " >&6; $as_echo "$ABIFLAGS" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking SOABI" >&5 $as_echo_n "checking SOABI... " >&6; } @@ -11,7 +11,7 @@ --- a/configure.ac +++ b/configure.ac -@@ -4800,7 +4800,7 @@ AC_SUBST(SOABI) +@@ -4798,7 +4798,7 @@ AC_SUBST(SOABI) AC_MSG_CHECKING(ABIFLAGS) AC_MSG_RESULT($ABIFLAGS) AC_MSG_CHECKING(SOABI) diff --git a/lang/python/python3/patches/015-abort-on-failed-modules.patch b/lang/python/python3/patches/015-abort-on-failed-modules.patch deleted file mode 100644 index bd367a0a7b..0000000000 --- a/lang/python/python3/patches/015-abort-on-failed-modules.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/setup.py -+++ b/setup.py -@@ -521,6 +521,7 @@ class PyBuildExt(build_ext): - print("Failed to build these modules:") - print_three_column(failed) - print() -+ if CROSS_COMPILING: sys.exit(1) - - if self.failed_on_import: - failed = self.failed_on_import[:] diff --git a/lang/python/python3/patches/016-adjust-config-paths.patch b/lang/python/python3/patches/016-adjust-config-paths.patch index 338892d883..c6583bea98 100644 --- a/lang/python/python3/patches/016-adjust-config-paths.patch +++ b/lang/python/python3/patches/016-adjust-config-paths.patch @@ -1,26 +1,16 @@ ---- a/Lib/distutils/sysconfig.py -+++ b/Lib/distutils/sysconfig.py -@@ -451,6 +451,7 @@ def _init_posix(): - platform=sys.platform, - multiarch=getattr(sys.implementation, '_multiarch', ''), - )) -+ name = '_sysconfigdata' - _temp = __import__(name, globals(), locals(), ['build_time_vars'], 0) - build_time_vars = _temp.build_time_vars - global _config_vars --- a/Lib/sysconfig.py +++ b/Lib/sysconfig.py -@@ -352,6 +352,7 @@ def get_makefile_filename(): +@@ -407,6 +407,7 @@ def get_makefile_filename(): def _get_sysconfigdata_name(): + return '_sysconfigdata' - return os.environ.get('_PYTHON_SYSCONFIGDATA_NAME', - '_sysconfigdata_{abi}_{platform}_{multiarch}'.format( - abi=sys.abiflags, + multiarch = getattr(sys.implementation, '_multiarch', '') + return os.environ.get( + '_PYTHON_SYSCONFIGDATA_NAME', --- a/Makefile.pre.in +++ b/Makefile.pre.in -@@ -1555,7 +1555,7 @@ libinstall: build_all $(srcdir)/Modules/ +@@ -1594,7 +1594,7 @@ libinstall: build_all $(srcdir)/Modules/ esac; \ done; \ done @@ -28,8 +18,8 @@ + $(INSTALL_DATA) `cat pybuilddir.txt`/_sysconfigdata*.py \ $(DESTDIR)$(LIBDEST); \ $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt - ifeq (@COMPILE_ALL_TESTS@,yes) -@@ -1713,7 +1713,7 @@ sharedinstall: sharedmods + if test -d $(DESTDIR)$(LIBDEST)/distutils/tests; then \ +@@ -1752,7 +1752,7 @@ sharedinstall: sharedmods --install-scripts=$(BINDIR) \ --install-platlib=$(DESTSHARED) \ --root=$(DESTDIR)/ @@ -40,7 +30,7 @@ # Here are a couple of targets for MacOSX again, to install a full --- a/configure +++ b/configure -@@ -2979,7 +2979,7 @@ $as_echo_n "checking for python interpre +@@ -3009,7 +3009,7 @@ $as_echo_n "checking for python interpre fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $interp" >&5 $as_echo "$interp" >&6; } @@ -49,7 +39,7 @@ fi elif test "$cross_compiling" = maybe; then as_fn_error $? "Cross compiling required --host=HOST-TUPLE and --build=ARCH" "$LINENO" 5 -@@ -15460,7 +15460,7 @@ fi +@@ -15477,7 +15477,7 @@ fi @@ -69,7 +59,7 @@ fi elif test "$cross_compiling" = maybe; then AC_MSG_ERROR([Cross compiling required --host=HOST-TUPLE and --build=ARCH]) -@@ -4858,7 +4858,7 @@ fi], +@@ -4856,7 +4856,7 @@ fi], dnl define LIBPL after ABIFLAGS and LDVERSION is defined. AC_SUBST(PY_ENABLE_SHARED) diff --git a/lang/python/python3/patches/025-choose-python-config-version.patch b/lang/python/python3/patches/025-choose-python-config-version.patch index cfca3236f2..7b9ee1e6b3 100644 --- a/lang/python/python3/patches/025-choose-python-config-version.patch +++ b/lang/python/python3/patches/025-choose-python-config-version.patch @@ -1,6 +1,6 @@ --- a/Makefile.pre.in +++ b/Makefile.pre.in -@@ -1607,7 +1607,7 @@ python-config: $(srcdir)/Misc/python-con +@@ -1644,7 +1644,7 @@ python-config: $(srcdir)/Misc/python-con @ # On Darwin, always use the python version of the script, the shell @ # version doesn't use the compiler customizations that are provided @ # in python (_osx_support.py). diff --git a/lang/python/python3/patches/026-openssl-feature-flags.patch b/lang/python/python3/patches/026-openssl-feature-flags.patch new file mode 100644 index 0000000000..398012ae40 --- /dev/null +++ b/lang/python/python3/patches/026-openssl-feature-flags.patch @@ -0,0 +1,12 @@ +--- a/Modules/_hashopenssl.c ++++ b/Modules/_hashopenssl.c +@@ -43,7 +43,9 @@ + #define PY_OPENSSL_HAS_SCRYPT 1 + #define PY_OPENSSL_HAS_SHA3 1 + #define PY_OPENSSL_HAS_SHAKE 1 ++#ifndef OPENSSL_NO_BLAKE2 + #define PY_OPENSSL_HAS_BLAKE2 1 ++#endif + + static PyModuleDef _hashlibmodule; + diff --git a/lang/python/python3/patches/027-bpo-43158-Use-configure-values-for-building-_uuid-ex.patch b/lang/python/python3/patches/027-bpo-43158-Use-configure-values-for-building-_uuid-ex.patch new file mode 100644 index 0000000000..c58e10537a --- /dev/null +++ b/lang/python/python3/patches/027-bpo-43158-Use-configure-values-for-building-_uuid-ex.patch @@ -0,0 +1,151 @@ +From bab9f2f21b6b27563fe53ae30ba4bf05934ed6f9 Mon Sep 17 00:00:00 2001 +From: Christian Heimes +Date: Mon, 1 Nov 2021 12:52:04 +0100 +Subject: [PATCH] bpo-43158: Use configure values for building _uuid extension + +Signed-off-by: Christian Heimes +--- + .../2021-11-01-12-51-46.bpo-43158.fghS6w.rst | 2 + + configure | 69 +++++++++++++++++++ + configure.ac | 7 +- + pyconfig.h.in | 3 + + setup.py | 12 ++-- + 5 files changed, 86 insertions(+), 7 deletions(-) + create mode 100644 Misc/NEWS.d/next/Build/2021-11-01-12-51-46.bpo-43158.fghS6w.rst + +--- /dev/null ++++ b/Misc/NEWS.d/next/Build/2021-11-01-12-51-46.bpo-43158.fghS6w.rst +@@ -0,0 +1,2 @@ ++``setup.py`` now uses values from configure script to build the ``_uuid`` ++extension module. Configure now detects util-linux's ``libuuid``, too. +--- a/configure ++++ b/configure +@@ -10038,6 +10038,75 @@ $as_echo "no" >&6; } + fi + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ++save_LIBS=$LIBS ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing uuid_generate_time_safe" >&5 ++$as_echo_n "checking for library containing uuid_generate_time_safe... " >&6; } ++if ${ac_cv_search_uuid_generate_time_safe+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ ac_func_search_save_LIBS=$LIBS ++cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++ ++/* Override any GCC internal prototype to avoid an error. ++ Use char because int might match the return type of a GCC ++ builtin and then its argument prototype would still apply. */ ++#ifdef __cplusplus ++extern "C" ++#endif ++char uuid_generate_time_safe (); ++int ++main () ++{ ++return uuid_generate_time_safe (); ++ ; ++ return 0; ++} ++_ACEOF ++for ac_lib in '' uuid; do ++ if test -z "$ac_lib"; then ++ ac_res="none required" ++ else ++ ac_res=-l$ac_lib ++ LIBS="-l$ac_lib $ac_func_search_save_LIBS" ++ fi ++ if ac_fn_c_try_link "$LINENO"; then : ++ ac_cv_search_uuid_generate_time_safe=$ac_res ++fi ++rm -f core conftest.err conftest.$ac_objext \ ++ conftest$ac_exeext ++ if ${ac_cv_search_uuid_generate_time_safe+:} false; then : ++ break ++fi ++done ++if ${ac_cv_search_uuid_generate_time_safe+:} false; then : ++ ++else ++ ac_cv_search_uuid_generate_time_safe=no ++fi ++rm conftest.$ac_ext ++LIBS=$ac_func_search_save_LIBS ++fi ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_uuid_generate_time_safe" >&5 ++$as_echo "$ac_cv_search_uuid_generate_time_safe" >&6; } ++ac_res=$ac_cv_search_uuid_generate_time_safe ++if test "$ac_res" != no; then : ++ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" ++ ++ ++$as_echo "#define HAVE_LIBUUID 1" >>confdefs.h ++, ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 ++$as_echo "yes" >&6; } ++ ++else ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++ ++fi ++ ++LIBS=$save_LIBS ++ + # AIX provides support for RFC4122 (uuid) in libc.a starting with AIX 6.1 (anno 2007) + # FreeBSD and OpenBSD provides support as well + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uuid_create" >&5 +--- a/configure.ac ++++ b/configure.ac +@@ -2859,8 +2859,13 @@ void *x = uuid_generate_time_safe + [AC_MSG_RESULT(no)] + ) + ++# check for libuuid from util-linux ++save_LIBS=$LIBS ++AC_CHECK_LIB([uuid], [uuid_generate_time]) ++LIBS=$save_LIBS ++ + # AIX provides support for RFC4122 (uuid) in libc.a starting with AIX 6.1 (anno 2007) +-# FreeBSD and OpenBSD provides support as well ++# FreeBSD and OpenBSD provides support in libc as well. + AC_MSG_CHECKING(for uuid_create) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[ + #ifndef uuid_create +--- a/pyconfig.h.in ++++ b/pyconfig.h.in +@@ -628,6 +628,9 @@ + /* Define to 1 if you have the header file. */ + #undef HAVE_LIBUTIL_H + ++/* Define you have libuuid. */ ++#undef HAVE_LIBUUID ++ + /* Define if you have the 'link' function. */ + #undef HAVE_LINK + +--- a/setup.py ++++ b/setup.py +@@ -1850,15 +1850,15 @@ class PyBuildExt(build_ext): + + def detect_uuid(self): + # Build the _uuid module if possible +- uuid_incs = find_file("uuid.h", self.inc_dirs, ["/usr/include/uuid"]) +- if uuid_incs is not None: +- if self.compiler.find_library_file(self.lib_dirs, 'uuid'): +- uuid_libs = ['uuid'] ++ uuid_h = sysconfig.get_config_var("HAVE_UUID_H") ++ uuid_uuid_h = sysconfig.get_config_var("HAVE_UUID_UUID_H") ++ if uuid_h or uuid_uuid_h: ++ if sysconfig.get_config_var("HAVE_LIBUUID"): ++ uuid_libs = ["uuid"] + else: + uuid_libs = [] + self.add(Extension('_uuid', ['_uuidmodule.c'], +- libraries=uuid_libs, +- include_dirs=uuid_incs)) ++ libraries=uuid_libs)) + else: + self.missing.append('_uuid') + diff --git a/lang/python/python3/patches/028-host-python-support-ssl-with-libressl.patch b/lang/python/python3/patches/028-host-python-support-ssl-with-libressl.patch new file mode 100644 index 0000000000..759b66292d --- /dev/null +++ b/lang/python/python3/patches/028-host-python-support-ssl-with-libressl.patch @@ -0,0 +1,117 @@ +--- a/Modules/_ssl.c ++++ b/Modules/_ssl.c +@@ -67,7 +67,18 @@ + # error "OPENSSL_THREADS is not defined, Python requires thread-safe OpenSSL" + #endif + ++#ifdef OPENWRT_HOST_BUILD ++#undef TLS1_3_VERSION ++static STACK_OF(X509) *SSL_get0_verified_chain(const SSL *s) ++{ ++ return NULL; ++} + ++static int SSL_CTX_get_security_level(const SSL_CTX *ctx) ++{ ++ return 0; ++} ++#endif + + struct py_ssl_error_code { + const char *mnemonic; +@@ -291,8 +302,10 @@ typedef struct { + int post_handshake_auth; + #endif + PyObject *msg_cb; ++#ifndef OPENWRT_HOST_BUILD + PyObject *keylog_filename; + BIO *keylog_bio; ++#endif + /* Cached module state, also used in SSLSocket and SSLSession code. */ + _sslmodulestate *state; + } PySSLContext; +@@ -2346,8 +2359,14 @@ _ssl__SSLSocket_write_impl(PySSLSocket * + + do { + PySSL_BEGIN_ALLOW_THREADS ++#ifdef OPENWRT_HOST_BUILD ++ retval = SSL_write(self->ssl, b->buf, (int)b->len); ++ if (retval > 0) count = retval; ++ err = _PySSL_errno(retval <= 0, self->ssl, retval); ++#else + retval = SSL_write_ex(self->ssl, b->buf, (size_t)b->len, &count); + err = _PySSL_errno(retval == 0, self->ssl, retval); ++#endif + PySSL_END_ALLOW_THREADS + self->err = err; + +@@ -2498,8 +2517,14 @@ _ssl__SSLSocket_read_impl(PySSLSocket *s + + do { + PySSL_BEGIN_ALLOW_THREADS ++#ifdef OPENWRT_HOST_BUILD ++ retval = SSL_read(self->ssl, mem, len); ++ if (retval > 0) count = retval; ++ err = _PySSL_errno(retval <= 0, self->ssl, retval); ++#else + retval = SSL_read_ex(self->ssl, mem, (size_t)len, &count); + err = _PySSL_errno(retval == 0, self->ssl, retval); ++#endif + PySSL_END_ALLOW_THREADS + self->err = err; + +@@ -3062,8 +3087,10 @@ _ssl__SSLContext_impl(PyTypeObject *type + self->hostflags = X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS; + self->protocol = proto_version; + self->msg_cb = NULL; ++#ifndef OPENWRT_HOST_BUILD + self->keylog_filename = NULL; + self->keylog_bio = NULL; ++#endif + self->alpn_protocols = NULL; + self->set_sni_cb = NULL; + self->state = get_ssl_state(module); +@@ -3187,6 +3214,7 @@ context_clear(PySSLContext *self) + { + Py_CLEAR(self->set_sni_cb); + Py_CLEAR(self->msg_cb); ++#ifndef OPENWRT_HOST_BUILD + Py_CLEAR(self->keylog_filename); + if (self->keylog_bio != NULL) { + PySSL_BEGIN_ALLOW_THREADS +@@ -3194,6 +3222,7 @@ context_clear(PySSLContext *self) + PySSL_END_ALLOW_THREADS + self->keylog_bio = NULL; + } ++#endif + return 0; + } + +@@ -4603,8 +4632,10 @@ static PyGetSetDef context_getsetlist[] + (setter) set_minimum_version, NULL}, + {"maximum_version", (getter) get_maximum_version, + (setter) set_maximum_version, NULL}, ++#ifndef OPENWRT_HOST_BUILD + {"keylog_filename", (getter) _PySSLContext_get_keylog_filename, + (setter) _PySSLContext_set_keylog_filename, NULL}, ++#endif + {"_msg_callback", (getter) _PySSLContext_get_msg_callback, + (setter) _PySSLContext_set_msg_callback, NULL}, + {"sni_callback", (getter) get_sni_callback, +--- a/Modules/_ssl/debughelpers.c ++++ b/Modules/_ssl/debughelpers.c +@@ -114,6 +114,8 @@ _PySSLContext_set_msg_callback(PySSLCont + return 0; + } + ++#ifndef OPENWRT_HOST_BUILD ++ + static void + _PySSL_keylog_callback(const SSL *ssl, const char *line) + { +@@ -217,3 +219,5 @@ _PySSLContext_set_keylog_filename(PySSLC + SSL_CTX_set_keylog_callback(self->ctx, _PySSL_keylog_callback); + return 0; + } ++ ++#endif diff --git a/lang/python/python3/patches/029-disable-deprecation-warning.patch b/lang/python/python3/patches/029-disable-deprecation-warning.patch new file mode 100644 index 0000000000..fd638d4b5a --- /dev/null +++ b/lang/python/python3/patches/029-disable-deprecation-warning.patch @@ -0,0 +1,10 @@ +--- a/Lib/distutils/__init__.py ++++ b/Lib/distutils/__init__.py +@@ -16,5 +16,5 @@ __version__ = sys.version[:sys.version.i + _DEPRECATION_MESSAGE = ("The distutils package is deprecated and slated for " + "removal in Python 3.12. Use setuptools or check " + "PEP 632 for potential alternatives") +-warnings.warn(_DEPRECATION_MESSAGE, +- DeprecationWarning, 2) ++#warnings.warn(_DEPRECATION_MESSAGE, ++# DeprecationWarning, 2)