Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] New package: python3-legacy 3.11.6
@ 2023-10-12  3:02 ahesford
  2023-10-12  3:05 ` Vaelatern
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: ahesford @ 2023-10-12  3:02 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 3128 bytes --]

There is a new pull request by ahesford against master on the void-packages repository

https://github.com/ahesford/void-packages py-legacy
https://github.com/void-linux/void-packages/pull/46631

New package: python3-legacy 3.11.6
Python minor upgrades are all-or-nothing commitments to Void. Working through revbumps and runtime tests uncover a lot of incompatibilities, but runtime testing is limited to whatever testers happen to use. We are all familiar with the post-upgrade press to fix the tens of broken packages that shake out once the broader community gets the packages.

Even worse, large and sometimes important projects (`firefox`, `chromium` and `electron*`) use Python for their build processes and tend to slip past the upgrade testing procedure. These packages generally FTBFS and can require extensive patching of a litany of vendored Python packages. This is a painful process but, if we waited for upstream fixes for everything, we might lag behind several Python minor cycles. (Firefox *still* requires patching for Python 3.11.)

To make this upgrade easier in the future, I propose to provide the `python3-legacy` package, which will lag behind `python3` by at least one minor version. This package (and its `-devel` subpackage) provide us a few nice advantages:
1. It is sufficient to bootstrap a virtual environment. Users that have packages fundamentally incompatible with new Python can install `python3-legacy` and create an older venv that will provide some consistency.
2. It can live alongside the system `python3`, so users that have existing virtual environments which link against the prior Python libraries can be kept functional by installing `python3-legacy`. (Right now, any existing venvs will break on upgrade because the requisite shared library will be removed.)
3. Our `firefox`, `electron19` and `electron24` packages can use the legacy version for builds, so we avoid breaking these major packages without being forced to patch them. (I have started builds of `electron*` and watched them continue through ~7k files so far, and I've watched `firefox` for the first several minutes. I'll need to actually run through the complete builds to be sure.)

Note that `python3-legacy` is NOT intended to be an alternative to the system Python. It is a minimal installation ONLY and its sole purpose for end users is to create virtual environments. We should NEVER allow any package in the repository to provide files in the `site-packages` tree for this version or link against its `libpython`. (To enforce this, I am deliberately leaving `python3-legacy` out of `common/shlibs`.) Any future upgrade of `python3` must still ensure that *every* Python package at least installes in the new `$py3_sitelib`.

I've left `idle` out of this package but kept `tkinter` built in, although we can drop `tkinter` or add `idle` if others think there is merit in doing so.

#### Testing the changes
- I tested the changes in this PR: **IN PROCESS**

[ci skip]

cc: @void-linux/pkg-committers 

A patch file from https://github.com/void-linux/void-packages/pull/46631.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-py-legacy-46631.patch --]
[-- Type: text/x-diff, Size: 17172 bytes --]

From 837959d961b392c3a020020ebeb757a48d3b258d Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Wed, 11 Oct 2023 22:26:59 -0400
Subject: [PATCH 1/4] New package: python3-legacy-3.11.6

---
 srcpkgs/python3-legacy-devel                  |   1 +
 .../python3-legacy/files/EXTERNALLY-MANAGED   |  29 ++++
 srcpkgs/python3-legacy/files/cross.patch      |  21 +++
 .../patches/musl-find_library.patch           |  44 ++++++
 .../python3-legacy/patches/ppc-fixes.patch    |  45 ++++++
 srcpkgs/python3-legacy/template               | 144 ++++++++++++++++++
 srcpkgs/python3-legacy/update                 |   3 +
 7 files changed, 287 insertions(+)
 create mode 120000 srcpkgs/python3-legacy-devel
 create mode 100644 srcpkgs/python3-legacy/files/EXTERNALLY-MANAGED
 create mode 100644 srcpkgs/python3-legacy/files/cross.patch
 create mode 100644 srcpkgs/python3-legacy/patches/musl-find_library.patch
 create mode 100644 srcpkgs/python3-legacy/patches/ppc-fixes.patch
 create mode 100644 srcpkgs/python3-legacy/template
 create mode 100644 srcpkgs/python3-legacy/update

diff --git a/srcpkgs/python3-legacy-devel b/srcpkgs/python3-legacy-devel
new file mode 120000
index 0000000000000..ee8afabeedc6b
--- /dev/null
+++ b/srcpkgs/python3-legacy-devel
@@ -0,0 +1 @@
+python3-legacy
\ No newline at end of file
diff --git a/srcpkgs/python3-legacy/files/EXTERNALLY-MANAGED b/srcpkgs/python3-legacy/files/EXTERNALLY-MANAGED
new file mode 100644
index 0000000000000..22743f8d51db5
--- /dev/null
+++ b/srcpkgs/python3-legacy/files/EXTERNALLY-MANAGED
@@ -0,0 +1,29 @@
+[externally-managed]
+Error=
+ This system-wide Python installation is managed by the Void Linux package
+ manager, XBPS. Installation of Python packages from other sources is not
+ normally allowed.
+
+ To install a Python package not offered by Void Linux, consider using a virtual
+ environment, e.g.:
+
+   python3 -m venv /path/to/venv
+   /path/to/venv/pip install <package>
+
+ Appending the flag --system-site-packages to the first command will give the
+ virtual environment access to any Python package installed via XBPS.
+
+ Invoking python, pip, and executables installed by pip in /path/to/venv/bin
+ should automatically use the virtual environment. Alternatively, source its
+ activation script to add the environment to the command search path for a shell:
+
+   . /path/to/venv/activate
+
+ After activation, running
+
+   deactivate
+
+ will remove the environment from the search path without destroying it.
+
+ The XBPS package python3-pipx provides pipx, a convenient tool to automatically
+ manage virtual environments for individual Python applications.
diff --git a/srcpkgs/python3-legacy/files/cross.patch b/srcpkgs/python3-legacy/files/cross.patch
new file mode 100644
index 0000000000000..40925d1ec1bfa
--- /dev/null
+++ b/srcpkgs/python3-legacy/files/cross.patch
@@ -0,0 +1,21 @@
+diff -ur a/Makefile.pre.in b/Makefile.pre.in
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -1901,8 +1901,6 @@
+ 			upgrade) ensurepip="--upgrade" ;; \
+ 			install|*) ensurepip="" ;; \
+ 		esac; \
+-		$(RUNSHARED) $(PYTHON_FOR_BUILD) -m ensurepip \
+-			$$ensurepip --root=$(DESTDIR)/ ; \
+ 	fi
+ 
+ .PHONY: altinstall
+@@ -1912,8 +1910,6 @@
+ 			upgrade) ensurepip="--altinstall --upgrade" ;; \
+ 			install|*) ensurepip="--altinstall" ;; \
+ 		esac; \
+-		$(RUNSHARED) $(PYTHON_FOR_BUILD) -m ensurepip \
+-			$$ensurepip --root=$(DESTDIR)/ ; \
+ 	fi
+ 
+ .PHONY: commoninstall
diff --git a/srcpkgs/python3-legacy/patches/musl-find_library.patch b/srcpkgs/python3-legacy/patches/musl-find_library.patch
new file mode 100644
index 0000000000000..879f912462721
--- /dev/null
+++ b/srcpkgs/python3-legacy/patches/musl-find_library.patch
@@ -0,0 +1,44 @@
+--- a/Lib/ctypes/util.py
++++ b/Lib/ctypes/util.py
+@@ -265,6 +265,41 @@
+         def find_library(name, is64 = False):
+             return _get_soname(_findLib_crle(name, is64) or _findLib_gcc(name))
+ 
++    elif True:
++
++        # Patched for Alpine Linux / musl - search manually system paths
++        def _is_elf(filepath):
++            try:
++                with open(filepath, 'rb') as fh:
++                    return fh.read(4) == b'\x7fELF'
++            except:
++                return False
++
++        def find_library(name):
++            from glob import glob
++            # absolute name?
++            if os.path.isabs(name):
++                return name
++            # special case for libm, libcrypt and libpthread and musl
++            if name in ['m', 'crypt', 'pthread']:
++                name = 'c'
++            elif name in ['libm.so', 'libcrypt.so', 'libpthread.so']:
++                name = 'libc.so'
++            # search in standard locations (musl order)
++            paths = ['/lib', '/usr/local/lib', '/usr/lib']
++            if 'LD_LIBRARY_PATH' in os.environ:
++                paths = os.environ['LD_LIBRARY_PATH'].split(':') + paths
++            for d in paths:
++                f = os.path.join(d, name)
++                if _is_elf(f):
++                    return os.path.basename(f)
++
++                prefix = os.path.join(d, 'lib'+name)
++                for suffix in ['.so', '.so.*']:
++                    for f in glob('{0}{1}'.format(prefix, suffix)):
++                        if _is_elf(f):
++                            return os.path.basename(f)
++
+     else:
+ 
+         def _findSoname_ldconfig(name):
diff --git a/srcpkgs/python3-legacy/patches/ppc-fixes.patch b/srcpkgs/python3-legacy/patches/ppc-fixes.patch
new file mode 100644
index 0000000000000..fc5937725162e
--- /dev/null
+++ b/srcpkgs/python3-legacy/patches/ppc-fixes.patch
@@ -0,0 +1,45 @@
+diff -ur a/configure b/configure
+--- a/configure
++++ b/configure
+@@ -5952,6 +5952,14 @@
+ printf "%s\n" "$ac_cv_path_EGREP" >&6; }
+  EGREP="$ac_cv_path_EGREP"
+ 
++if test x$MULTIARCH = xpowerpc-linux-musl
++then
++	MULTIARCH="powerpc-linux-gnu"
++fi
++if test x$MULTIARCH = xpowerpcle-linux-musl
++then
++	MULTIARCH="powerpcle-linux-gnu"
++fi
+ 
+ 
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for CC compiler name" >&5
+@@ -6859,7 +6867,11 @@
+         powerpc64-linux-gnu
+ #  endif
+ # elif defined(__powerpc__)
++#  if defined(__LITTLE_ENDIAN__)
++        powerpcle-linux-gnu
++#  else
+         powerpc-linux-gnu
++#  endif
+ # elif defined(__s390x__)
+         s390x-linux-gnu
+ # elif defined(__s390__)
+diff -ur a/configure.ac b/configure.ac
+--- a/configure.ac
++++ b/configure.ac
+@@ -1039,7 +1039,11 @@
+         powerpc64-linux-gnu
+ #  endif
+ # elif defined(__powerpc__)
++#  if defined(__LITTLE_ENDIAN__)
++        powerpcle-linux-gnu
++#  else
+         powerpc-linux-gnu
++#  endif
+ # elif defined(__s390x__)
+         s390x-linux-gnu
+ # elif defined(__s390__)
diff --git a/srcpkgs/python3-legacy/template b/srcpkgs/python3-legacy/template
new file mode 100644
index 0000000000000..46fee2f3b3fd8
--- /dev/null
+++ b/srcpkgs/python3-legacy/template
@@ -0,0 +1,144 @@
+# Template file for 'python3-legacy'
+pkgname=python3-legacy
+version=3.11.6
+revision=1
+build_style="gnu-configure"
+configure_args="--enable-shared --enable-ipv6 --enable-optimizations
+ --enable-loadable-sqlite-extensions --with-computed-gotos
+ --with-dbmliborder=gdbm:ndbm --with-system-expat --with-system-ffi
+ --without-ensurepip ac_cv_working_tzset=yes"
+hostmakedepends="pkgconf"
+makedepends="libffi-devel readline-devel gdbm-devel openssl-devel
+ expat-devel sqlite-devel bzip2-devel zlib-devel liblzma-devel"
+depends="ca-certificates"
+checkdepends="$depends iana-etc"
+short_desc="Python programming language (${version%.*} series)"
+maintainer="Andrew J. Hesford <ajh@sideband.org>"
+license="Python-2.0"
+homepage="https://www.python.org"
+_bluez="bluez-5.64"
+distfiles="
+ https://www.python.org/ftp/python/${version%rc*}/Python-${version}.tar.xz
+ ${KERNEL_SITE}/bluetooth/${_bluez}.tar.xz
+"
+checksum="0fab78fa7f133f4f38210c6260d90d7c0d5c7198446419ce057ec7ac2e6f5f38
+ ae437e65b6b3070c198bc5b0109fe9cdeb9eaa387380e2072f9de65fe8a1de34"
+skip_extraction="${_bluez}.tar.xz"
+
+if [ "$CROSS_BUILD" ]; then
+	hostmakedepends+=" python3-legacy"
+	configure_args+=" --with-build-python=python${version%.*}"
+	configure_args+=" ac_cv_broken_sem_getvalue=no"
+fi
+
+post_extract() {
+	# Ensure that the internal copy of expat is not used
+	rm -r Modules/expat
+
+	# Extract Bluetooth headers
+	local _srcdistdir="${XBPS_SRCDISTDIR}/${sourcepkg}-${version}"
+	mkdir External
+	bsdtar -C External --strip-components=1 -x \
+		-f "${_srcdistdir}/${_bluez}.tar.xz" "${_bluez}/lib/*.h"
+	mv External/lib External/bluetooth
+}
+
+post_patch() {
+	if [ -n "$CROSS_BUILD" ]; then
+		patch -Np1 -i ${FILESDIR}/cross.patch
+	fi
+}
+
+do_configure() {
+	# If these are set, distutils will default to cc and attempt to pass
+	# `-R<path>` to the compiler for every compiled extension that sets an
+	# rpath rather than the '-Wl,-R<path>' argument that GCC requires
+	unset GCC CC CXX CPP LD AR AS RANLIB
+
+	# Make sure configure can find Bluetooth headers
+	CFLAGS+=" -I./External"
+	CPPFLAGS+=" -I./External"
+	./configure ${configure_args}
+}
+
+do_check() {
+	local opts
+
+	# relies on sane group membership not found in xbps-src
+	opts="-i test_chown_*"
+	# expects shadow passwd db unreadable by user
+	opts+=" -i test_getspnam_exception"
+	# expects functionality patched out for musl
+	opts+=" -i test_find_library_with_*"
+	# SSL advertises unexpected ciphers
+	opts+=" -i test_shared_ciphers"
+	# requires in-tree expat, which we removed
+	opts+=" -i test_freeze_simple_script"
+	# anomalies in SSL session handling
+	opts+=" -i test_session*"
+	# overflow in datetime.time.mktime
+	opts+=" -i test_localtime_daylight_*_dst_true"
+
+	if [ "${XBPS_TARGET_LIBC}" = "musl" ]; then
+		# musl doesn't work with locales
+		opts+=" -i test_locale* -i test_c_locale* -i test__locale"
+		opts+=" -i test_fpathconf"
+	fi
+
+	make ${makejobs} EXTRATESTOPTS="${opts}" quicktest
+}
+
+do_install() {
+	make DESTDIR=${DESTDIR} install maninstall
+
+	# Put the license in the usual location and remove from the libdir
+	# to prevent the XBPS trigger from attempting to byte-compile it
+	vlicense LICENSE
+	rm ${DESTDIR}/usr/lib/python${version%.*}/LICENSE.txt
+
+	# Remove major-only components that conflict with python3 packages
+	rm ${DESTDIR}/usr/bin/{pydoc3,python3,2to3,python3-config}
+	rm ${DESTDIR}/usr/lib/libpython3.so
+	rm ${DESTDIR}/usr/lib/pkgconfig/python3{,-embed}.pc
+	rm ${DESTDIR}/usr/share/man/man1/python3.1
+
+	# Remove files that belong to idle
+	rm ${DESTDIR}/usr/bin/idle3*
+	rm -r ${DESTDIR}/usr/lib/python${version%.*}/idlelib
+
+	# Remove test module and tests that fail to be byte-compiled.
+	rm -r ${DESTDIR}/usr/lib/python${version%.*}/test
+	rm -r ${DESTDIR}/usr/lib/python${version%.*}/lib2to3/tests
+
+	# Remove references to the install(1) wrapper.
+	sed -e "s,${XBPS_WRAPPERDIR},/usr/bin,g" -i \
+		${DESTDIR}/usr/lib/python${version%.*}/_sysconfigdata_*_*.py \
+		${DESTDIR}/usr/lib/python${version%.*}/config-${version%.*}*/Makefile
+
+	if [ "$CROSS_BUILD" ]; then
+		# Remove references to cross toolchain.
+		sed -i "s/$XBPS_CROSS_TRIPLET-//g" \
+			${DESTDIR}/usr/lib/python${version%.*}/_sysconfigdata_*_*.py \
+			${DESTDIR}/usr/lib/python${version%.*}/config-${version%.*}*/Makefile
+		sed -i -e "s,$XBPS_CROSS_BASE,,g" \
+			${DESTDIR}/usr/bin/python${version%.*}-config
+	fi
+
+	# https://peps.python.org/pep-0668/
+	vinstall ${FILESDIR}/EXTERNALLY-MANAGED 644 usr/lib/python${version%.*}
+}
+
+python3-legacy-devel_package() {
+	short_desc+=" - development files"
+	depends="${sourcepkg}-${version}_${revision}"
+	pkg_install() {
+		vmove usr/bin/python*-config
+		vmove usr/lib/pkgconfig
+		vmove usr/include
+		mv ${DESTDIR}/usr/lib/python${version%.*}/config-${version%.*}*/libpython${version%.*}*.a \
+			${PKGDESTDIR}/usr/lib
+		mkdir -p ${DESTDIR}/usr/include/python${version%.*}
+		mv ${PKGDESTDIR}/usr/include/python${version%.*}/pyconfig.h \
+			${DESTDIR}/usr/include/python${version%.*}
+	}
+}
diff --git a/srcpkgs/python3-legacy/update b/srcpkgs/python3-legacy/update
new file mode 100644
index 0000000000000..0e358debe1d47
--- /dev/null
+++ b/srcpkgs/python3-legacy/update
@@ -0,0 +1,3 @@
+pkgname=Python
+site="${homepage}/downloads/source/"
+pattern='Python-\K3\.11\.[0-9]+(?=\.tgz)'

From 9a16a6e48c3a99d49b6bef59d1e804c8c763e6b4 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Wed, 11 Oct 2023 22:42:13 -0400
Subject: [PATCH 2/4] firefox: use python3-legacy to build

---
 srcpkgs/firefox/template | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/firefox/template b/srcpkgs/firefox/template
index 1a499c52aa2d1..e94decc1375ec 100644
--- a/srcpkgs/firefox/template
+++ b/srcpkgs/firefox/template
@@ -15,8 +15,8 @@ checksum=d0f996116ae234dc7bd59e0d77ddefe268179d7500d16a9488309c826547c97c
 
 lib32disabled=yes
 
-hostmakedepends="autoconf213 unzip zip pkg-config perl python3 yasm rust cargo
- llvm clang lld nodejs cbindgen nasm which tar"
+hostmakedepends="autoconf213 unzip zip pkg-config perl python3-legacy yasm
+ rust cargo llvm clang lld nodejs cbindgen nasm which tar"
 makedepends="nss-devel libjpeg-turbo-devel gtk+3-devel icu-devel
  pixman-devel libevent-devel libnotify-devel libvpx-devel libwebp-devel
  libXrender-devel libXcomposite-devel libSM-devel libXt-devel rust-std
@@ -63,6 +63,8 @@ post_patch() {
 }
 
 do_build() {
+	ln -s "/usr/bin/python3.11" "${XBPS_WRAPPERDIR}/python3"
+
 	if [ "$build_option_clang" ]; then
 		export CC=clang
 		export CXX=clang++

From 3f355d64e6012b189cfae4a37a583f85c21ac398 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Wed, 11 Oct 2023 22:45:01 -0400
Subject: [PATCH 3/4] electron19: use python3-legacy to build

---
 srcpkgs/electron19/template | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/electron19/template b/srcpkgs/electron19/template
index 3093248588438..f705136099371 100644
--- a/srcpkgs/electron19/template
+++ b/srcpkgs/electron19/template
@@ -12,7 +12,7 @@ hostmakedepends="$(vopt_if clang "clang lld") python pkgconf perl gperf bison ni
  pciutils-devel ffmpeg-devel libxml2-devel libglib-devel yarn openjdk libxslt-devel
  opus-devel libXcursor-devel libXcomposite-devel libXtst-devel libXrandr-devel libXScrnSaver-devel
  alsa-lib-devel re2-devel snappy-devel mit-krb5-devel $(vopt_if pulseaudio pulseaudio-devel)
- $(vopt_if sndio sndio-devel) jq"
+ $(vopt_if sndio sndio-devel) jq python3-legacy"
 makedepends="libpng-devel gtk+-devel gtk+3-devel nss-devel pciutils-devel
  libXi-devel libgcrypt-devel libgnome-keyring-devel cups-devel elfutils-devel
  libXcomposite-devel speech-dispatcher-devel libXrandr-devel mit-krb5-devel
@@ -190,6 +190,8 @@ post_patch() {
 }
 
 pre_configure() {
+	ln -s "/usr/bin/python3.11" "${XBPS_WRAPPERDIR}/python3"
+
 	cd "$wrksrc/$build_wrksrc"
 
 	# https://groups.google.com/a/chromium.org/d/topic/chromium-packagers/9JX1N2nf4PU/discussion
@@ -262,8 +264,8 @@ pre_configure() {
 
 
 	msg_normal "Replacing gn files\n"
-	python3 build/linux/unbundle/replace_gn_files.py --system-libraries \
-		$use_system
+	python3.11 build/linux/unbundle/replace_gn_files.py \
+		--system-libraries $use_system
 	third_party/libaddressinput/chromium/tools/update-strings.py
 }
 

From 531d1b2fe09e8ebcda874382bed46c8ee20589bb Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Wed, 11 Oct 2023 22:45:20 -0400
Subject: [PATCH 4/4] electron24: use python3-legacy to build

---
 srcpkgs/electron24/template | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/electron24/template b/srcpkgs/electron24/template
index 431ba6b0f8301..9ad2cc849c30d 100644
--- a/srcpkgs/electron24/template
+++ b/srcpkgs/electron24/template
@@ -12,7 +12,7 @@ hostmakedepends="$(vopt_if clang "clang lld") python pkgconf perl gperf bison ni
  pciutils-devel ffmpeg-devel libxml2-devel libglib-devel yarn openjdk libxslt-devel
  opus-devel libXcursor-devel libXcomposite-devel libXtst-devel libXrandr-devel libXScrnSaver-devel
  alsa-lib-devel re2-devel snappy-devel mit-krb5-devel $(vopt_if pulseaudio pulseaudio-devel)
- $(vopt_if sndio sndio-devel) jq"
+ $(vopt_if sndio sndio-devel) jq python3-legacy"
 makedepends="libpng-devel gtk+-devel gtk+3-devel nss-devel pciutils-devel
  libXi-devel libgcrypt-devel libgnome-keyring-devel cups-devel elfutils-devel
  libXcomposite-devel speech-dispatcher-devel libXrandr-devel mit-krb5-devel
@@ -206,6 +206,8 @@ post_patch() {
 }
 
 pre_configure() {
+	ln -s "/usr/bin/python3.11" "${XBPS_WRAPPERDIR}/python3"
+
 	cd "$wrksrc/$build_wrksrc"
 
 	# https://groups.google.com/a/chromium.org/d/topic/chromium-packagers/9JX1N2nf4PU/discussion
@@ -275,8 +277,8 @@ pre_configure() {
 
 
 	msg_normal "Replacing gn files\n"
-	python3 build/linux/unbundle/replace_gn_files.py --system-libraries \
-		$use_system
+	python3.11 build/linux/unbundle/replace_gn_files.py \
+		--system-libraries $use_system
 	third_party/libaddressinput/chromium/tools/update-strings.py
 
 	# Satisfy some scripts that use git describe to figure out the electron version

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: New package: python3-legacy 3.11.6
  2023-10-12  3:02 [PR PATCH] New package: python3-legacy 3.11.6 ahesford
@ 2023-10-12  3:05 ` Vaelatern
  2023-10-12  3:16 ` [PR PATCH] [Updated] " ahesford
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Vaelatern @ 2023-10-12  3:05 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 402 bytes --]

New comment by Vaelatern on void-packages repository

https://github.com/void-linux/void-packages/pull/46631#issuecomment-1758840726

Comment:
This seems cool, so long as users do not think they are getting a full install

```
short_desc="Python programming language (${version%.*} series)"
```

Maybe something like "Python programing language provided as a break-glass ( ${version%.*} series)"

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PR PATCH] [Updated] New package: python3-legacy 3.11.6
  2023-10-12  3:02 [PR PATCH] New package: python3-legacy 3.11.6 ahesford
  2023-10-12  3:05 ` Vaelatern
@ 2023-10-12  3:16 ` ahesford
  2023-10-12  3:17 ` ahesford
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: ahesford @ 2023-10-12  3:16 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 3133 bytes --]

There is an updated pull request by ahesford against master on the void-packages repository

https://github.com/ahesford/void-packages py-legacy
https://github.com/void-linux/void-packages/pull/46631

New package: python3-legacy 3.11.6
Python minor upgrades are all-or-nothing commitments to Void. Working through revbumps and runtime tests uncover a lot of incompatibilities, but runtime testing is limited to whatever testers happen to use. We are all familiar with the post-upgrade press to fix the tens of broken packages that shake out once the broader community gets the packages.

Even worse, large and sometimes important projects (`firefox`, `chromium` and `electron*`) use Python for their build processes and tend to slip past the upgrade testing procedure. These packages generally FTBFS and can require extensive patching of a litany of vendored Python packages. This is a painful process but, if we waited for upstream fixes for everything, we might lag behind several Python minor cycles. (Firefox *still* requires patching for Python 3.11.)

To make this upgrade easier in the future, I propose to provide the `python3-legacy` package, which will lag behind `python3` by at least one minor version. This package (and its `-devel` subpackage) provide us a few nice advantages:
1. It is sufficient to bootstrap a virtual environment. Users that have packages fundamentally incompatible with new Python can install `python3-legacy` and create an older venv that will provide some consistency.
2. It can live alongside the system `python3`, so users that have existing virtual environments which link against the prior Python libraries can be kept functional by installing `python3-legacy`. (Right now, any existing venvs will break on upgrade because the requisite shared library will be removed.)
3. Our `firefox`, `electron19` and `electron24` packages can use the legacy version for builds, so we avoid breaking these major packages without being forced to patch them. (I have started builds of `electron*` and watched them continue through ~7k files so far, and I've watched `firefox` for the first several minutes. I'll need to actually run through the complete builds to be sure.)

Note that `python3-legacy` is NOT intended to be an alternative to the system Python. It is a minimal installation ONLY and its sole purpose for end users is to create virtual environments. We should NEVER allow any package in the repository to provide files in the `site-packages` tree for this version or link against its `libpython`. (To enforce this, I am deliberately leaving `python3-legacy` out of `common/shlibs`.) Any future upgrade of `python3` must still ensure that *every* Python package at least installes in the new `$py3_sitelib`.

I've left `idle` out of this package but kept `tkinter` built in, although we can drop `tkinter` or add `idle` if others think there is merit in doing so.

#### Testing the changes
- I tested the changes in this PR: **IN PROCESS**

[ci skip]

cc: @void-linux/pkg-committers 

A patch file from https://github.com/void-linux/void-packages/pull/46631.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-py-legacy-46631.patch --]
[-- Type: text/x-diff, Size: 17029 bytes --]

From c00d29693f99ad1f724f54aa43320cafc43764cd Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Wed, 11 Oct 2023 22:26:59 -0400
Subject: [PATCH 1/4] New package: python3.11-3.11.6

---
 srcpkgs/python3.11-devel                      |   1 +
 srcpkgs/python3.11/files/EXTERNALLY-MANAGED   |  29 ++++
 srcpkgs/python3.11/files/cross.patch          |  21 +++
 .../patches/musl-find_library.patch           |  44 ++++++
 srcpkgs/python3.11/patches/ppc-fixes.patch    |  45 ++++++
 srcpkgs/python3.11/template                   | 144 ++++++++++++++++++
 srcpkgs/python3.11/update                     |   3 +
 7 files changed, 287 insertions(+)
 create mode 120000 srcpkgs/python3.11-devel
 create mode 100644 srcpkgs/python3.11/files/EXTERNALLY-MANAGED
 create mode 100644 srcpkgs/python3.11/files/cross.patch
 create mode 100644 srcpkgs/python3.11/patches/musl-find_library.patch
 create mode 100644 srcpkgs/python3.11/patches/ppc-fixes.patch
 create mode 100644 srcpkgs/python3.11/template
 create mode 100644 srcpkgs/python3.11/update

diff --git a/srcpkgs/python3.11-devel b/srcpkgs/python3.11-devel
new file mode 120000
index 0000000000000..6e7f3c7dd2248
--- /dev/null
+++ b/srcpkgs/python3.11-devel
@@ -0,0 +1 @@
+python3.11
\ No newline at end of file
diff --git a/srcpkgs/python3.11/files/EXTERNALLY-MANAGED b/srcpkgs/python3.11/files/EXTERNALLY-MANAGED
new file mode 100644
index 0000000000000..22743f8d51db5
--- /dev/null
+++ b/srcpkgs/python3.11/files/EXTERNALLY-MANAGED
@@ -0,0 +1,29 @@
+[externally-managed]
+Error=
+ This system-wide Python installation is managed by the Void Linux package
+ manager, XBPS. Installation of Python packages from other sources is not
+ normally allowed.
+
+ To install a Python package not offered by Void Linux, consider using a virtual
+ environment, e.g.:
+
+   python3 -m venv /path/to/venv
+   /path/to/venv/pip install <package>
+
+ Appending the flag --system-site-packages to the first command will give the
+ virtual environment access to any Python package installed via XBPS.
+
+ Invoking python, pip, and executables installed by pip in /path/to/venv/bin
+ should automatically use the virtual environment. Alternatively, source its
+ activation script to add the environment to the command search path for a shell:
+
+   . /path/to/venv/activate
+
+ After activation, running
+
+   deactivate
+
+ will remove the environment from the search path without destroying it.
+
+ The XBPS package python3-pipx provides pipx, a convenient tool to automatically
+ manage virtual environments for individual Python applications.
diff --git a/srcpkgs/python3.11/files/cross.patch b/srcpkgs/python3.11/files/cross.patch
new file mode 100644
index 0000000000000..40925d1ec1bfa
--- /dev/null
+++ b/srcpkgs/python3.11/files/cross.patch
@@ -0,0 +1,21 @@
+diff -ur a/Makefile.pre.in b/Makefile.pre.in
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -1901,8 +1901,6 @@
+ 			upgrade) ensurepip="--upgrade" ;; \
+ 			install|*) ensurepip="" ;; \
+ 		esac; \
+-		$(RUNSHARED) $(PYTHON_FOR_BUILD) -m ensurepip \
+-			$$ensurepip --root=$(DESTDIR)/ ; \
+ 	fi
+ 
+ .PHONY: altinstall
+@@ -1912,8 +1910,6 @@
+ 			upgrade) ensurepip="--altinstall --upgrade" ;; \
+ 			install|*) ensurepip="--altinstall" ;; \
+ 		esac; \
+-		$(RUNSHARED) $(PYTHON_FOR_BUILD) -m ensurepip \
+-			$$ensurepip --root=$(DESTDIR)/ ; \
+ 	fi
+ 
+ .PHONY: commoninstall
diff --git a/srcpkgs/python3.11/patches/musl-find_library.patch b/srcpkgs/python3.11/patches/musl-find_library.patch
new file mode 100644
index 0000000000000..879f912462721
--- /dev/null
+++ b/srcpkgs/python3.11/patches/musl-find_library.patch
@@ -0,0 +1,44 @@
+--- a/Lib/ctypes/util.py
++++ b/Lib/ctypes/util.py
+@@ -265,6 +265,41 @@
+         def find_library(name, is64 = False):
+             return _get_soname(_findLib_crle(name, is64) or _findLib_gcc(name))
+ 
++    elif True:
++
++        # Patched for Alpine Linux / musl - search manually system paths
++        def _is_elf(filepath):
++            try:
++                with open(filepath, 'rb') as fh:
++                    return fh.read(4) == b'\x7fELF'
++            except:
++                return False
++
++        def find_library(name):
++            from glob import glob
++            # absolute name?
++            if os.path.isabs(name):
++                return name
++            # special case for libm, libcrypt and libpthread and musl
++            if name in ['m', 'crypt', 'pthread']:
++                name = 'c'
++            elif name in ['libm.so', 'libcrypt.so', 'libpthread.so']:
++                name = 'libc.so'
++            # search in standard locations (musl order)
++            paths = ['/lib', '/usr/local/lib', '/usr/lib']
++            if 'LD_LIBRARY_PATH' in os.environ:
++                paths = os.environ['LD_LIBRARY_PATH'].split(':') + paths
++            for d in paths:
++                f = os.path.join(d, name)
++                if _is_elf(f):
++                    return os.path.basename(f)
++
++                prefix = os.path.join(d, 'lib'+name)
++                for suffix in ['.so', '.so.*']:
++                    for f in glob('{0}{1}'.format(prefix, suffix)):
++                        if _is_elf(f):
++                            return os.path.basename(f)
++
+     else:
+ 
+         def _findSoname_ldconfig(name):
diff --git a/srcpkgs/python3.11/patches/ppc-fixes.patch b/srcpkgs/python3.11/patches/ppc-fixes.patch
new file mode 100644
index 0000000000000..fc5937725162e
--- /dev/null
+++ b/srcpkgs/python3.11/patches/ppc-fixes.patch
@@ -0,0 +1,45 @@
+diff -ur a/configure b/configure
+--- a/configure
++++ b/configure
+@@ -5952,6 +5952,14 @@
+ printf "%s\n" "$ac_cv_path_EGREP" >&6; }
+  EGREP="$ac_cv_path_EGREP"
+ 
++if test x$MULTIARCH = xpowerpc-linux-musl
++then
++	MULTIARCH="powerpc-linux-gnu"
++fi
++if test x$MULTIARCH = xpowerpcle-linux-musl
++then
++	MULTIARCH="powerpcle-linux-gnu"
++fi
+ 
+ 
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for CC compiler name" >&5
+@@ -6859,7 +6867,11 @@
+         powerpc64-linux-gnu
+ #  endif
+ # elif defined(__powerpc__)
++#  if defined(__LITTLE_ENDIAN__)
++        powerpcle-linux-gnu
++#  else
+         powerpc-linux-gnu
++#  endif
+ # elif defined(__s390x__)
+         s390x-linux-gnu
+ # elif defined(__s390__)
+diff -ur a/configure.ac b/configure.ac
+--- a/configure.ac
++++ b/configure.ac
+@@ -1039,7 +1039,11 @@
+         powerpc64-linux-gnu
+ #  endif
+ # elif defined(__powerpc__)
++#  if defined(__LITTLE_ENDIAN__)
++        powerpcle-linux-gnu
++#  else
+         powerpc-linux-gnu
++#  endif
+ # elif defined(__s390x__)
+         s390x-linux-gnu
+ # elif defined(__s390__)
diff --git a/srcpkgs/python3.11/template b/srcpkgs/python3.11/template
new file mode 100644
index 0000000000000..96ac7bedd4f58
--- /dev/null
+++ b/srcpkgs/python3.11/template
@@ -0,0 +1,144 @@
+# Template file for 'python3.11'
+pkgname=python3.11
+version=3.11.6
+revision=1
+build_style="gnu-configure"
+configure_args="--enable-shared --enable-ipv6 --enable-optimizations
+ --enable-loadable-sqlite-extensions --with-computed-gotos
+ --with-dbmliborder=gdbm:ndbm --with-system-expat --with-system-ffi
+ --without-ensurepip ac_cv_working_tzset=yes"
+hostmakedepends="pkgconf"
+makedepends="libffi-devel readline-devel gdbm-devel openssl-devel
+ expat-devel sqlite-devel bzip2-devel zlib-devel liblzma-devel"
+depends="ca-certificates"
+checkdepends="$depends iana-etc"
+short_desc="Python programming language (limited install, ${version%.*} series)"
+maintainer="Andrew J. Hesford <ajh@sideband.org>"
+license="Python-2.0"
+homepage="https://www.python.org"
+_bluez="bluez-5.64"
+distfiles="
+ https://www.python.org/ftp/python/${version%rc*}/Python-${version}.tar.xz
+ ${KERNEL_SITE}/bluetooth/${_bluez}.tar.xz
+"
+checksum="0fab78fa7f133f4f38210c6260d90d7c0d5c7198446419ce057ec7ac2e6f5f38
+ ae437e65b6b3070c198bc5b0109fe9cdeb9eaa387380e2072f9de65fe8a1de34"
+skip_extraction="${_bluez}.tar.xz"
+
+if [ "$CROSS_BUILD" ]; then
+	hostmakedepends+=" python3.11"
+	configure_args+=" --with-build-python=python${version%.*}"
+	configure_args+=" ac_cv_broken_sem_getvalue=no"
+fi
+
+post_extract() {
+	# Ensure that the internal copy of expat is not used
+	rm -r Modules/expat
+
+	# Extract Bluetooth headers
+	local _srcdistdir="${XBPS_SRCDISTDIR}/${sourcepkg}-${version}"
+	mkdir External
+	bsdtar -C External --strip-components=1 -x \
+		-f "${_srcdistdir}/${_bluez}.tar.xz" "${_bluez}/lib/*.h"
+	mv External/lib External/bluetooth
+}
+
+post_patch() {
+	if [ -n "$CROSS_BUILD" ]; then
+		patch -Np1 -i ${FILESDIR}/cross.patch
+	fi
+}
+
+do_configure() {
+	# If these are set, distutils will default to cc and attempt to pass
+	# `-R<path>` to the compiler for every compiled extension that sets an
+	# rpath rather than the '-Wl,-R<path>' argument that GCC requires
+	unset GCC CC CXX CPP LD AR AS RANLIB
+
+	# Make sure configure can find Bluetooth headers
+	CFLAGS+=" -I./External"
+	CPPFLAGS+=" -I./External"
+	./configure ${configure_args}
+}
+
+do_check() {
+	local opts
+
+	# relies on sane group membership not found in xbps-src
+	opts="-i test_chown_*"
+	# expects shadow passwd db unreadable by user
+	opts+=" -i test_getspnam_exception"
+	# expects functionality patched out for musl
+	opts+=" -i test_find_library_with_*"
+	# SSL advertises unexpected ciphers
+	opts+=" -i test_shared_ciphers"
+	# requires in-tree expat, which we removed
+	opts+=" -i test_freeze_simple_script"
+	# anomalies in SSL session handling
+	opts+=" -i test_session*"
+	# overflow in datetime.time.mktime
+	opts+=" -i test_localtime_daylight_*_dst_true"
+
+	if [ "${XBPS_TARGET_LIBC}" = "musl" ]; then
+		# musl doesn't work with locales
+		opts+=" -i test_locale* -i test_c_locale* -i test__locale"
+		opts+=" -i test_fpathconf"
+	fi
+
+	make ${makejobs} EXTRATESTOPTS="${opts}" quicktest
+}
+
+do_install() {
+	make DESTDIR=${DESTDIR} install maninstall
+
+	# Put the license in the usual location and remove from the libdir
+	# to prevent the XBPS trigger from attempting to byte-compile it
+	vlicense LICENSE
+	rm ${DESTDIR}/usr/lib/python${version%.*}/LICENSE.txt
+
+	# Remove major-only components that conflict with python3 packages
+	rm ${DESTDIR}/usr/bin/{pydoc3,python3,2to3,python3-config}
+	rm ${DESTDIR}/usr/lib/libpython3.so
+	rm ${DESTDIR}/usr/lib/pkgconfig/python3{,-embed}.pc
+	rm ${DESTDIR}/usr/share/man/man1/python3.1
+
+	# Remove files that belong to idle
+	rm ${DESTDIR}/usr/bin/idle3*
+	rm -r ${DESTDIR}/usr/lib/python${version%.*}/idlelib
+
+	# Remove test module and tests that fail to be byte-compiled.
+	rm -r ${DESTDIR}/usr/lib/python${version%.*}/test
+	rm -r ${DESTDIR}/usr/lib/python${version%.*}/lib2to3/tests
+
+	# Remove references to the install(1) wrapper.
+	sed -e "s,${XBPS_WRAPPERDIR},/usr/bin,g" -i \
+		${DESTDIR}/usr/lib/python${version%.*}/_sysconfigdata_*_*.py \
+		${DESTDIR}/usr/lib/python${version%.*}/config-${version%.*}*/Makefile
+
+	if [ "$CROSS_BUILD" ]; then
+		# Remove references to cross toolchain.
+		sed -i "s/$XBPS_CROSS_TRIPLET-//g" \
+			${DESTDIR}/usr/lib/python${version%.*}/_sysconfigdata_*_*.py \
+			${DESTDIR}/usr/lib/python${version%.*}/config-${version%.*}*/Makefile
+		sed -i -e "s,$XBPS_CROSS_BASE,,g" \
+			${DESTDIR}/usr/bin/python${version%.*}-config
+	fi
+
+	# https://peps.python.org/pep-0668/
+	vinstall ${FILESDIR}/EXTERNALLY-MANAGED 644 usr/lib/python${version%.*}
+}
+
+python3.11-devel_package() {
+	short_desc+=" - development files"
+	depends="${sourcepkg}-${version}_${revision}"
+	pkg_install() {
+		vmove usr/bin/python*-config
+		vmove usr/lib/pkgconfig
+		vmove usr/include
+		mv ${DESTDIR}/usr/lib/python${version%.*}/config-${version%.*}*/libpython${version%.*}*.a \
+			${PKGDESTDIR}/usr/lib
+		mkdir -p ${DESTDIR}/usr/include/python${version%.*}
+		mv ${PKGDESTDIR}/usr/include/python${version%.*}/pyconfig.h \
+			${DESTDIR}/usr/include/python${version%.*}
+	}
+}
diff --git a/srcpkgs/python3.11/update b/srcpkgs/python3.11/update
new file mode 100644
index 0000000000000..0e358debe1d47
--- /dev/null
+++ b/srcpkgs/python3.11/update
@@ -0,0 +1,3 @@
+pkgname=Python
+site="${homepage}/downloads/source/"
+pattern='Python-\K3\.11\.[0-9]+(?=\.tgz)'

From c8c1d2286d3dd1e01a46715f755a162082c77547 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Wed, 11 Oct 2023 22:42:13 -0400
Subject: [PATCH 2/4] firefox: use python3.11 to build

---
 srcpkgs/firefox/template | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/firefox/template b/srcpkgs/firefox/template
index 1a499c52aa2d1..7cffc5dfdf1e6 100644
--- a/srcpkgs/firefox/template
+++ b/srcpkgs/firefox/template
@@ -15,8 +15,8 @@ checksum=d0f996116ae234dc7bd59e0d77ddefe268179d7500d16a9488309c826547c97c
 
 lib32disabled=yes
 
-hostmakedepends="autoconf213 unzip zip pkg-config perl python3 yasm rust cargo
- llvm clang lld nodejs cbindgen nasm which tar"
+hostmakedepends="autoconf213 unzip zip pkg-config perl python3.11 yasm rust
+ cargo llvm clang lld nodejs cbindgen nasm which tar"
 makedepends="nss-devel libjpeg-turbo-devel gtk+3-devel icu-devel
  pixman-devel libevent-devel libnotify-devel libvpx-devel libwebp-devel
  libXrender-devel libXcomposite-devel libSM-devel libXt-devel rust-std
@@ -63,6 +63,8 @@ post_patch() {
 }
 
 do_build() {
+	ln -s "/usr/bin/python3.11" "${XBPS_WRAPPERDIR}/python3"
+
 	if [ "$build_option_clang" ]; then
 		export CC=clang
 		export CXX=clang++

From 9af4a81df2dfe17744a9b4d8157a5ba7afc18a86 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Wed, 11 Oct 2023 22:45:01 -0400
Subject: [PATCH 3/4] electron19: use python3.11 to build

---
 srcpkgs/electron19/template | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/electron19/template b/srcpkgs/electron19/template
index 3093248588438..ab5cdd2a31c03 100644
--- a/srcpkgs/electron19/template
+++ b/srcpkgs/electron19/template
@@ -12,7 +12,7 @@ hostmakedepends="$(vopt_if clang "clang lld") python pkgconf perl gperf bison ni
  pciutils-devel ffmpeg-devel libxml2-devel libglib-devel yarn openjdk libxslt-devel
  opus-devel libXcursor-devel libXcomposite-devel libXtst-devel libXrandr-devel libXScrnSaver-devel
  alsa-lib-devel re2-devel snappy-devel mit-krb5-devel $(vopt_if pulseaudio pulseaudio-devel)
- $(vopt_if sndio sndio-devel) jq"
+ $(vopt_if sndio sndio-devel) jq python3.11"
 makedepends="libpng-devel gtk+-devel gtk+3-devel nss-devel pciutils-devel
  libXi-devel libgcrypt-devel libgnome-keyring-devel cups-devel elfutils-devel
  libXcomposite-devel speech-dispatcher-devel libXrandr-devel mit-krb5-devel
@@ -190,6 +190,8 @@ post_patch() {
 }
 
 pre_configure() {
+	ln -s "/usr/bin/python3.11" "${XBPS_WRAPPERDIR}/python3"
+
 	cd "$wrksrc/$build_wrksrc"
 
 	# https://groups.google.com/a/chromium.org/d/topic/chromium-packagers/9JX1N2nf4PU/discussion
@@ -262,8 +264,8 @@ pre_configure() {
 
 
 	msg_normal "Replacing gn files\n"
-	python3 build/linux/unbundle/replace_gn_files.py --system-libraries \
-		$use_system
+	python3.11 build/linux/unbundle/replace_gn_files.py \
+		--system-libraries $use_system
 	third_party/libaddressinput/chromium/tools/update-strings.py
 }
 

From 0ca361003071626eeb96077cdb3bb1d81789921d Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Wed, 11 Oct 2023 22:45:20 -0400
Subject: [PATCH 4/4] electron24: use python3.11 to build

---
 srcpkgs/electron24/template | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/electron24/template b/srcpkgs/electron24/template
index 431ba6b0f8301..27c4f1aebd9e1 100644
--- a/srcpkgs/electron24/template
+++ b/srcpkgs/electron24/template
@@ -12,7 +12,7 @@ hostmakedepends="$(vopt_if clang "clang lld") python pkgconf perl gperf bison ni
  pciutils-devel ffmpeg-devel libxml2-devel libglib-devel yarn openjdk libxslt-devel
  opus-devel libXcursor-devel libXcomposite-devel libXtst-devel libXrandr-devel libXScrnSaver-devel
  alsa-lib-devel re2-devel snappy-devel mit-krb5-devel $(vopt_if pulseaudio pulseaudio-devel)
- $(vopt_if sndio sndio-devel) jq"
+ $(vopt_if sndio sndio-devel) jq python3.11"
 makedepends="libpng-devel gtk+-devel gtk+3-devel nss-devel pciutils-devel
  libXi-devel libgcrypt-devel libgnome-keyring-devel cups-devel elfutils-devel
  libXcomposite-devel speech-dispatcher-devel libXrandr-devel mit-krb5-devel
@@ -206,6 +206,8 @@ post_patch() {
 }
 
 pre_configure() {
+	ln -s "/usr/bin/python3.11" "${XBPS_WRAPPERDIR}/python3"
+
 	cd "$wrksrc/$build_wrksrc"
 
 	# https://groups.google.com/a/chromium.org/d/topic/chromium-packagers/9JX1N2nf4PU/discussion
@@ -275,8 +277,8 @@ pre_configure() {
 
 
 	msg_normal "Replacing gn files\n"
-	python3 build/linux/unbundle/replace_gn_files.py --system-libraries \
-		$use_system
+	python3.11 build/linux/unbundle/replace_gn_files.py \
+		--system-libraries $use_system
 	third_party/libaddressinput/chromium/tools/update-strings.py
 
 	# Satisfy some scripts that use git describe to figure out the electron version

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: New package: python3-legacy 3.11.6
  2023-10-12  3:02 [PR PATCH] New package: python3-legacy 3.11.6 ahesford
  2023-10-12  3:05 ` Vaelatern
  2023-10-12  3:16 ` [PR PATCH] [Updated] " ahesford
@ 2023-10-12  3:17 ` ahesford
  2023-10-12  3:18 ` ahesford
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: ahesford @ 2023-10-12  3:17 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 249 bytes --]

New comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/46631#issuecomment-1758848837

Comment:
Early feedback: rename to `python3.11` (from sgn), added `limited install` to `short_desc` from Vaelatern.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: New package: python3-legacy 3.11.6
  2023-10-12  3:02 [PR PATCH] New package: python3-legacy 3.11.6 ahesford
                   ` (2 preceding siblings ...)
  2023-10-12  3:17 ` ahesford
@ 2023-10-12  3:18 ` ahesford
  2023-10-12  7:26 ` New package: python3.11 3.11.6 classabbyamp
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: ahesford @ 2023-10-12  3:18 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 251 bytes --]

New comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/46631#issuecomment-1758848837

Comment:
Early feedback: rename to `python3.11` (from sgn), added `limited install` to `short_desc` (from Vaelatern).

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: New package: python3.11 3.11.6
  2023-10-12  3:02 [PR PATCH] New package: python3-legacy 3.11.6 ahesford
                   ` (3 preceding siblings ...)
  2023-10-12  3:18 ` ahesford
@ 2023-10-12  7:26 ` classabbyamp
  2023-10-12 11:44 ` [PR PATCH] [Updated] " ahesford
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: classabbyamp @ 2023-10-12  7:26 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 280 bytes --]

New comment by classabbyamp on void-packages repository

https://github.com/void-linux/void-packages/pull/46631#issuecomment-1759077859

Comment:
looks like this will be useful for qt5-webengine too https://github.com/void-linux/void-packages/issues/38229#issuecomment-1759024573

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PR PATCH] [Updated] New package: python3.11 3.11.6
  2023-10-12  3:02 [PR PATCH] New package: python3-legacy 3.11.6 ahesford
                   ` (4 preceding siblings ...)
  2023-10-12  7:26 ` New package: python3.11 3.11.6 classabbyamp
@ 2023-10-12 11:44 ` ahesford
  2023-10-12 11:46 ` ahesford
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: ahesford @ 2023-10-12 11:44 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 3129 bytes --]

There is an updated pull request by ahesford against master on the void-packages repository

https://github.com/ahesford/void-packages py-legacy
https://github.com/void-linux/void-packages/pull/46631

New package: python3.11 3.11.6
Python minor upgrades are all-or-nothing commitments to Void. Working through revbumps and runtime tests uncover a lot of incompatibilities, but runtime testing is limited to whatever testers happen to use. We are all familiar with the post-upgrade press to fix the tens of broken packages that shake out once the broader community gets the packages.

Even worse, large and sometimes important projects (`firefox`, `chromium` and `electron*`) use Python for their build processes and tend to slip past the upgrade testing procedure. These packages generally FTBFS and can require extensive patching of a litany of vendored Python packages. This is a painful process but, if we waited for upstream fixes for everything, we might lag behind several Python minor cycles. (Firefox *still* requires patching for Python 3.11.)

To make this upgrade easier in the future, I propose to provide the `python3-legacy` package, which will lag behind `python3` by at least one minor version. This package (and its `-devel` subpackage) provide us a few nice advantages:
1. It is sufficient to bootstrap a virtual environment. Users that have packages fundamentally incompatible with new Python can install `python3-legacy` and create an older venv that will provide some consistency.
2. It can live alongside the system `python3`, so users that have existing virtual environments which link against the prior Python libraries can be kept functional by installing `python3-legacy`. (Right now, any existing venvs will break on upgrade because the requisite shared library will be removed.)
3. Our `firefox`, `electron19` and `electron24` packages can use the legacy version for builds, so we avoid breaking these major packages without being forced to patch them. (I have started builds of `electron*` and watched them continue through ~7k files so far, and I've watched `firefox` for the first several minutes. I'll need to actually run through the complete builds to be sure.)

Note that `python3-legacy` is NOT intended to be an alternative to the system Python. It is a minimal installation ONLY and its sole purpose for end users is to create virtual environments. We should NEVER allow any package in the repository to provide files in the `site-packages` tree for this version or link against its `libpython`. (To enforce this, I am deliberately leaving `python3-legacy` out of `common/shlibs`.) Any future upgrade of `python3` must still ensure that *every* Python package at least installes in the new `$py3_sitelib`.

I've left `idle` out of this package but kept `tkinter` built in, although we can drop `tkinter` or add `idle` if others think there is merit in doing so.

#### Testing the changes
- I tested the changes in this PR: **IN PROCESS**

[ci skip]

cc: @void-linux/pkg-committers 

A patch file from https://github.com/void-linux/void-packages/pull/46631.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-py-legacy-46631.patch --]
[-- Type: text/x-diff, Size: 17368 bytes --]

From c00d29693f99ad1f724f54aa43320cafc43764cd Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Wed, 11 Oct 2023 22:26:59 -0400
Subject: [PATCH 1/4] New package: python3.11-3.11.6

---
 srcpkgs/python3.11-devel                      |   1 +
 srcpkgs/python3.11/files/EXTERNALLY-MANAGED   |  29 ++++
 srcpkgs/python3.11/files/cross.patch          |  21 +++
 .../patches/musl-find_library.patch           |  44 ++++++
 srcpkgs/python3.11/patches/ppc-fixes.patch    |  45 ++++++
 srcpkgs/python3.11/template                   | 144 ++++++++++++++++++
 srcpkgs/python3.11/update                     |   3 +
 7 files changed, 287 insertions(+)
 create mode 120000 srcpkgs/python3.11-devel
 create mode 100644 srcpkgs/python3.11/files/EXTERNALLY-MANAGED
 create mode 100644 srcpkgs/python3.11/files/cross.patch
 create mode 100644 srcpkgs/python3.11/patches/musl-find_library.patch
 create mode 100644 srcpkgs/python3.11/patches/ppc-fixes.patch
 create mode 100644 srcpkgs/python3.11/template
 create mode 100644 srcpkgs/python3.11/update

diff --git a/srcpkgs/python3.11-devel b/srcpkgs/python3.11-devel
new file mode 120000
index 0000000000000..6e7f3c7dd2248
--- /dev/null
+++ b/srcpkgs/python3.11-devel
@@ -0,0 +1 @@
+python3.11
\ No newline at end of file
diff --git a/srcpkgs/python3.11/files/EXTERNALLY-MANAGED b/srcpkgs/python3.11/files/EXTERNALLY-MANAGED
new file mode 100644
index 0000000000000..22743f8d51db5
--- /dev/null
+++ b/srcpkgs/python3.11/files/EXTERNALLY-MANAGED
@@ -0,0 +1,29 @@
+[externally-managed]
+Error=
+ This system-wide Python installation is managed by the Void Linux package
+ manager, XBPS. Installation of Python packages from other sources is not
+ normally allowed.
+
+ To install a Python package not offered by Void Linux, consider using a virtual
+ environment, e.g.:
+
+   python3 -m venv /path/to/venv
+   /path/to/venv/pip install <package>
+
+ Appending the flag --system-site-packages to the first command will give the
+ virtual environment access to any Python package installed via XBPS.
+
+ Invoking python, pip, and executables installed by pip in /path/to/venv/bin
+ should automatically use the virtual environment. Alternatively, source its
+ activation script to add the environment to the command search path for a shell:
+
+   . /path/to/venv/activate
+
+ After activation, running
+
+   deactivate
+
+ will remove the environment from the search path without destroying it.
+
+ The XBPS package python3-pipx provides pipx, a convenient tool to automatically
+ manage virtual environments for individual Python applications.
diff --git a/srcpkgs/python3.11/files/cross.patch b/srcpkgs/python3.11/files/cross.patch
new file mode 100644
index 0000000000000..40925d1ec1bfa
--- /dev/null
+++ b/srcpkgs/python3.11/files/cross.patch
@@ -0,0 +1,21 @@
+diff -ur a/Makefile.pre.in b/Makefile.pre.in
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -1901,8 +1901,6 @@
+ 			upgrade) ensurepip="--upgrade" ;; \
+ 			install|*) ensurepip="" ;; \
+ 		esac; \
+-		$(RUNSHARED) $(PYTHON_FOR_BUILD) -m ensurepip \
+-			$$ensurepip --root=$(DESTDIR)/ ; \
+ 	fi
+ 
+ .PHONY: altinstall
+@@ -1912,8 +1910,6 @@
+ 			upgrade) ensurepip="--altinstall --upgrade" ;; \
+ 			install|*) ensurepip="--altinstall" ;; \
+ 		esac; \
+-		$(RUNSHARED) $(PYTHON_FOR_BUILD) -m ensurepip \
+-			$$ensurepip --root=$(DESTDIR)/ ; \
+ 	fi
+ 
+ .PHONY: commoninstall
diff --git a/srcpkgs/python3.11/patches/musl-find_library.patch b/srcpkgs/python3.11/patches/musl-find_library.patch
new file mode 100644
index 0000000000000..879f912462721
--- /dev/null
+++ b/srcpkgs/python3.11/patches/musl-find_library.patch
@@ -0,0 +1,44 @@
+--- a/Lib/ctypes/util.py
++++ b/Lib/ctypes/util.py
+@@ -265,6 +265,41 @@
+         def find_library(name, is64 = False):
+             return _get_soname(_findLib_crle(name, is64) or _findLib_gcc(name))
+ 
++    elif True:
++
++        # Patched for Alpine Linux / musl - search manually system paths
++        def _is_elf(filepath):
++            try:
++                with open(filepath, 'rb') as fh:
++                    return fh.read(4) == b'\x7fELF'
++            except:
++                return False
++
++        def find_library(name):
++            from glob import glob
++            # absolute name?
++            if os.path.isabs(name):
++                return name
++            # special case for libm, libcrypt and libpthread and musl
++            if name in ['m', 'crypt', 'pthread']:
++                name = 'c'
++            elif name in ['libm.so', 'libcrypt.so', 'libpthread.so']:
++                name = 'libc.so'
++            # search in standard locations (musl order)
++            paths = ['/lib', '/usr/local/lib', '/usr/lib']
++            if 'LD_LIBRARY_PATH' in os.environ:
++                paths = os.environ['LD_LIBRARY_PATH'].split(':') + paths
++            for d in paths:
++                f = os.path.join(d, name)
++                if _is_elf(f):
++                    return os.path.basename(f)
++
++                prefix = os.path.join(d, 'lib'+name)
++                for suffix in ['.so', '.so.*']:
++                    for f in glob('{0}{1}'.format(prefix, suffix)):
++                        if _is_elf(f):
++                            return os.path.basename(f)
++
+     else:
+ 
+         def _findSoname_ldconfig(name):
diff --git a/srcpkgs/python3.11/patches/ppc-fixes.patch b/srcpkgs/python3.11/patches/ppc-fixes.patch
new file mode 100644
index 0000000000000..fc5937725162e
--- /dev/null
+++ b/srcpkgs/python3.11/patches/ppc-fixes.patch
@@ -0,0 +1,45 @@
+diff -ur a/configure b/configure
+--- a/configure
++++ b/configure
+@@ -5952,6 +5952,14 @@
+ printf "%s\n" "$ac_cv_path_EGREP" >&6; }
+  EGREP="$ac_cv_path_EGREP"
+ 
++if test x$MULTIARCH = xpowerpc-linux-musl
++then
++	MULTIARCH="powerpc-linux-gnu"
++fi
++if test x$MULTIARCH = xpowerpcle-linux-musl
++then
++	MULTIARCH="powerpcle-linux-gnu"
++fi
+ 
+ 
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for CC compiler name" >&5
+@@ -6859,7 +6867,11 @@
+         powerpc64-linux-gnu
+ #  endif
+ # elif defined(__powerpc__)
++#  if defined(__LITTLE_ENDIAN__)
++        powerpcle-linux-gnu
++#  else
+         powerpc-linux-gnu
++#  endif
+ # elif defined(__s390x__)
+         s390x-linux-gnu
+ # elif defined(__s390__)
+diff -ur a/configure.ac b/configure.ac
+--- a/configure.ac
++++ b/configure.ac
+@@ -1039,7 +1039,11 @@
+         powerpc64-linux-gnu
+ #  endif
+ # elif defined(__powerpc__)
++#  if defined(__LITTLE_ENDIAN__)
++        powerpcle-linux-gnu
++#  else
+         powerpc-linux-gnu
++#  endif
+ # elif defined(__s390x__)
+         s390x-linux-gnu
+ # elif defined(__s390__)
diff --git a/srcpkgs/python3.11/template b/srcpkgs/python3.11/template
new file mode 100644
index 0000000000000..96ac7bedd4f58
--- /dev/null
+++ b/srcpkgs/python3.11/template
@@ -0,0 +1,144 @@
+# Template file for 'python3.11'
+pkgname=python3.11
+version=3.11.6
+revision=1
+build_style="gnu-configure"
+configure_args="--enable-shared --enable-ipv6 --enable-optimizations
+ --enable-loadable-sqlite-extensions --with-computed-gotos
+ --with-dbmliborder=gdbm:ndbm --with-system-expat --with-system-ffi
+ --without-ensurepip ac_cv_working_tzset=yes"
+hostmakedepends="pkgconf"
+makedepends="libffi-devel readline-devel gdbm-devel openssl-devel
+ expat-devel sqlite-devel bzip2-devel zlib-devel liblzma-devel"
+depends="ca-certificates"
+checkdepends="$depends iana-etc"
+short_desc="Python programming language (limited install, ${version%.*} series)"
+maintainer="Andrew J. Hesford <ajh@sideband.org>"
+license="Python-2.0"
+homepage="https://www.python.org"
+_bluez="bluez-5.64"
+distfiles="
+ https://www.python.org/ftp/python/${version%rc*}/Python-${version}.tar.xz
+ ${KERNEL_SITE}/bluetooth/${_bluez}.tar.xz
+"
+checksum="0fab78fa7f133f4f38210c6260d90d7c0d5c7198446419ce057ec7ac2e6f5f38
+ ae437e65b6b3070c198bc5b0109fe9cdeb9eaa387380e2072f9de65fe8a1de34"
+skip_extraction="${_bluez}.tar.xz"
+
+if [ "$CROSS_BUILD" ]; then
+	hostmakedepends+=" python3.11"
+	configure_args+=" --with-build-python=python${version%.*}"
+	configure_args+=" ac_cv_broken_sem_getvalue=no"
+fi
+
+post_extract() {
+	# Ensure that the internal copy of expat is not used
+	rm -r Modules/expat
+
+	# Extract Bluetooth headers
+	local _srcdistdir="${XBPS_SRCDISTDIR}/${sourcepkg}-${version}"
+	mkdir External
+	bsdtar -C External --strip-components=1 -x \
+		-f "${_srcdistdir}/${_bluez}.tar.xz" "${_bluez}/lib/*.h"
+	mv External/lib External/bluetooth
+}
+
+post_patch() {
+	if [ -n "$CROSS_BUILD" ]; then
+		patch -Np1 -i ${FILESDIR}/cross.patch
+	fi
+}
+
+do_configure() {
+	# If these are set, distutils will default to cc and attempt to pass
+	# `-R<path>` to the compiler for every compiled extension that sets an
+	# rpath rather than the '-Wl,-R<path>' argument that GCC requires
+	unset GCC CC CXX CPP LD AR AS RANLIB
+
+	# Make sure configure can find Bluetooth headers
+	CFLAGS+=" -I./External"
+	CPPFLAGS+=" -I./External"
+	./configure ${configure_args}
+}
+
+do_check() {
+	local opts
+
+	# relies on sane group membership not found in xbps-src
+	opts="-i test_chown_*"
+	# expects shadow passwd db unreadable by user
+	opts+=" -i test_getspnam_exception"
+	# expects functionality patched out for musl
+	opts+=" -i test_find_library_with_*"
+	# SSL advertises unexpected ciphers
+	opts+=" -i test_shared_ciphers"
+	# requires in-tree expat, which we removed
+	opts+=" -i test_freeze_simple_script"
+	# anomalies in SSL session handling
+	opts+=" -i test_session*"
+	# overflow in datetime.time.mktime
+	opts+=" -i test_localtime_daylight_*_dst_true"
+
+	if [ "${XBPS_TARGET_LIBC}" = "musl" ]; then
+		# musl doesn't work with locales
+		opts+=" -i test_locale* -i test_c_locale* -i test__locale"
+		opts+=" -i test_fpathconf"
+	fi
+
+	make ${makejobs} EXTRATESTOPTS="${opts}" quicktest
+}
+
+do_install() {
+	make DESTDIR=${DESTDIR} install maninstall
+
+	# Put the license in the usual location and remove from the libdir
+	# to prevent the XBPS trigger from attempting to byte-compile it
+	vlicense LICENSE
+	rm ${DESTDIR}/usr/lib/python${version%.*}/LICENSE.txt
+
+	# Remove major-only components that conflict with python3 packages
+	rm ${DESTDIR}/usr/bin/{pydoc3,python3,2to3,python3-config}
+	rm ${DESTDIR}/usr/lib/libpython3.so
+	rm ${DESTDIR}/usr/lib/pkgconfig/python3{,-embed}.pc
+	rm ${DESTDIR}/usr/share/man/man1/python3.1
+
+	# Remove files that belong to idle
+	rm ${DESTDIR}/usr/bin/idle3*
+	rm -r ${DESTDIR}/usr/lib/python${version%.*}/idlelib
+
+	# Remove test module and tests that fail to be byte-compiled.
+	rm -r ${DESTDIR}/usr/lib/python${version%.*}/test
+	rm -r ${DESTDIR}/usr/lib/python${version%.*}/lib2to3/tests
+
+	# Remove references to the install(1) wrapper.
+	sed -e "s,${XBPS_WRAPPERDIR},/usr/bin,g" -i \
+		${DESTDIR}/usr/lib/python${version%.*}/_sysconfigdata_*_*.py \
+		${DESTDIR}/usr/lib/python${version%.*}/config-${version%.*}*/Makefile
+
+	if [ "$CROSS_BUILD" ]; then
+		# Remove references to cross toolchain.
+		sed -i "s/$XBPS_CROSS_TRIPLET-//g" \
+			${DESTDIR}/usr/lib/python${version%.*}/_sysconfigdata_*_*.py \
+			${DESTDIR}/usr/lib/python${version%.*}/config-${version%.*}*/Makefile
+		sed -i -e "s,$XBPS_CROSS_BASE,,g" \
+			${DESTDIR}/usr/bin/python${version%.*}-config
+	fi
+
+	# https://peps.python.org/pep-0668/
+	vinstall ${FILESDIR}/EXTERNALLY-MANAGED 644 usr/lib/python${version%.*}
+}
+
+python3.11-devel_package() {
+	short_desc+=" - development files"
+	depends="${sourcepkg}-${version}_${revision}"
+	pkg_install() {
+		vmove usr/bin/python*-config
+		vmove usr/lib/pkgconfig
+		vmove usr/include
+		mv ${DESTDIR}/usr/lib/python${version%.*}/config-${version%.*}*/libpython${version%.*}*.a \
+			${PKGDESTDIR}/usr/lib
+		mkdir -p ${DESTDIR}/usr/include/python${version%.*}
+		mv ${PKGDESTDIR}/usr/include/python${version%.*}/pyconfig.h \
+			${DESTDIR}/usr/include/python${version%.*}
+	}
+}
diff --git a/srcpkgs/python3.11/update b/srcpkgs/python3.11/update
new file mode 100644
index 0000000000000..0e358debe1d47
--- /dev/null
+++ b/srcpkgs/python3.11/update
@@ -0,0 +1,3 @@
+pkgname=Python
+site="${homepage}/downloads/source/"
+pattern='Python-\K3\.11\.[0-9]+(?=\.tgz)'

From c8c1d2286d3dd1e01a46715f755a162082c77547 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Wed, 11 Oct 2023 22:42:13 -0400
Subject: [PATCH 2/4] firefox: use python3.11 to build

---
 srcpkgs/firefox/template | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/firefox/template b/srcpkgs/firefox/template
index 1a499c52aa2d1..7cffc5dfdf1e6 100644
--- a/srcpkgs/firefox/template
+++ b/srcpkgs/firefox/template
@@ -15,8 +15,8 @@ checksum=d0f996116ae234dc7bd59e0d77ddefe268179d7500d16a9488309c826547c97c
 
 lib32disabled=yes
 
-hostmakedepends="autoconf213 unzip zip pkg-config perl python3 yasm rust cargo
- llvm clang lld nodejs cbindgen nasm which tar"
+hostmakedepends="autoconf213 unzip zip pkg-config perl python3.11 yasm rust
+ cargo llvm clang lld nodejs cbindgen nasm which tar"
 makedepends="nss-devel libjpeg-turbo-devel gtk+3-devel icu-devel
  pixman-devel libevent-devel libnotify-devel libvpx-devel libwebp-devel
  libXrender-devel libXcomposite-devel libSM-devel libXt-devel rust-std
@@ -63,6 +63,8 @@ post_patch() {
 }
 
 do_build() {
+	ln -s "/usr/bin/python3.11" "${XBPS_WRAPPERDIR}/python3"
+
 	if [ "$build_option_clang" ]; then
 		export CC=clang
 		export CXX=clang++

From 673e385fe708228dcaa6377405fb8da7d694f770 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Wed, 11 Oct 2023 22:45:01 -0400
Subject: [PATCH 3/4] electron19: use python3.11 to build

---
 srcpkgs/electron19/template | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/electron19/template b/srcpkgs/electron19/template
index 3093248588438..ee888e1dceb79 100644
--- a/srcpkgs/electron19/template
+++ b/srcpkgs/electron19/template
@@ -12,7 +12,7 @@ hostmakedepends="$(vopt_if clang "clang lld") python pkgconf perl gperf bison ni
  pciutils-devel ffmpeg-devel libxml2-devel libglib-devel yarn openjdk libxslt-devel
  opus-devel libXcursor-devel libXcomposite-devel libXtst-devel libXrandr-devel libXScrnSaver-devel
  alsa-lib-devel re2-devel snappy-devel mit-krb5-devel $(vopt_if pulseaudio pulseaudio-devel)
- $(vopt_if sndio sndio-devel) jq"
+ $(vopt_if sndio sndio-devel) jq python3.11"
 makedepends="libpng-devel gtk+-devel gtk+3-devel nss-devel pciutils-devel
  libXi-devel libgcrypt-devel libgnome-keyring-devel cups-devel elfutils-devel
  libXcomposite-devel speech-dispatcher-devel libXrandr-devel mit-krb5-devel
@@ -190,6 +190,8 @@ post_patch() {
 }
 
 pre_configure() {
+	ln -s "/usr/bin/python3.11" "${XBPS_WRAPPERDIR}/python3"
+
 	cd "$wrksrc/$build_wrksrc"
 
 	# https://groups.google.com/a/chromium.org/d/topic/chromium-packagers/9JX1N2nf4PU/discussion
@@ -262,8 +264,8 @@ pre_configure() {
 
 
 	msg_normal "Replacing gn files\n"
-	python3 build/linux/unbundle/replace_gn_files.py --system-libraries \
-		$use_system
+	python3.11 build/linux/unbundle/replace_gn_files.py \
+		--system-libraries $use_system
 	third_party/libaddressinput/chromium/tools/update-strings.py
 }
 
@@ -399,6 +401,10 @@ do_build() {
 		export BUILD_AR="$AR_host"
 		export BUILD_NM="$NM_host"
 	fi
+
+	# Prevent ERR_OSSL_EVP_UNSUPPORTED
+	export NODE_OPTIONS=--openssl-legacy-provider
+
 	msg_normal "Ninja turtles GO!\n"
 	ninja ${makejobs} -C out/$_buildtype electron third_party/electron_node:headers
 	# finish rest of the build

From c025d889477db27431516e30d78de9eb91b72e1d Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Wed, 11 Oct 2023 22:45:20 -0400
Subject: [PATCH 4/4] electron24: use python3.11 to build

---
 srcpkgs/electron24/template | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/electron24/template b/srcpkgs/electron24/template
index 431ba6b0f8301..27c4f1aebd9e1 100644
--- a/srcpkgs/electron24/template
+++ b/srcpkgs/electron24/template
@@ -12,7 +12,7 @@ hostmakedepends="$(vopt_if clang "clang lld") python pkgconf perl gperf bison ni
  pciutils-devel ffmpeg-devel libxml2-devel libglib-devel yarn openjdk libxslt-devel
  opus-devel libXcursor-devel libXcomposite-devel libXtst-devel libXrandr-devel libXScrnSaver-devel
  alsa-lib-devel re2-devel snappy-devel mit-krb5-devel $(vopt_if pulseaudio pulseaudio-devel)
- $(vopt_if sndio sndio-devel) jq"
+ $(vopt_if sndio sndio-devel) jq python3.11"
 makedepends="libpng-devel gtk+-devel gtk+3-devel nss-devel pciutils-devel
  libXi-devel libgcrypt-devel libgnome-keyring-devel cups-devel elfutils-devel
  libXcomposite-devel speech-dispatcher-devel libXrandr-devel mit-krb5-devel
@@ -206,6 +206,8 @@ post_patch() {
 }
 
 pre_configure() {
+	ln -s "/usr/bin/python3.11" "${XBPS_WRAPPERDIR}/python3"
+
 	cd "$wrksrc/$build_wrksrc"
 
 	# https://groups.google.com/a/chromium.org/d/topic/chromium-packagers/9JX1N2nf4PU/discussion
@@ -275,8 +277,8 @@ pre_configure() {
 
 
 	msg_normal "Replacing gn files\n"
-	python3 build/linux/unbundle/replace_gn_files.py --system-libraries \
-		$use_system
+	python3.11 build/linux/unbundle/replace_gn_files.py \
+		--system-libraries $use_system
 	third_party/libaddressinput/chromium/tools/update-strings.py
 
 	# Satisfy some scripts that use git describe to figure out the electron version

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: New package: python3.11 3.11.6
  2023-10-12  3:02 [PR PATCH] New package: python3-legacy 3.11.6 ahesford
                   ` (5 preceding siblings ...)
  2023-10-12 11:44 ` [PR PATCH] [Updated] " ahesford
@ 2023-10-12 11:46 ` ahesford
  2023-10-12 11:49 ` leahneukirchen
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: ahesford @ 2023-10-12 11:46 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 352 bytes --]

New comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/46631#issuecomment-1759451931

Comment:
electron24 and firefox build for x86_64 with these changes. electron19 is more than halfway through; seems the OSSL 3 update triggered an unrelated build failure that can be worked around with `NODE_OPTIONS`. 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: New package: python3.11 3.11.6
  2023-10-12  3:02 [PR PATCH] New package: python3-legacy 3.11.6 ahesford
                   ` (6 preceding siblings ...)
  2023-10-12 11:46 ` ahesford
@ 2023-10-12 11:49 ` leahneukirchen
  2023-10-12 13:05 ` [PR PATCH] [Updated] " ahesford
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: leahneukirchen @ 2023-10-12 11:49 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 311 bytes --]

New comment by leahneukirchen on void-packages repository

https://github.com/void-linux/void-packages/pull/46631#issuecomment-1759455443

Comment:
Firefox tracking bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1857515

Chromium tracking bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1487454

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PR PATCH] [Updated] New package: python3.11 3.11.6
  2023-10-12  3:02 [PR PATCH] New package: python3-legacy 3.11.6 ahesford
                   ` (7 preceding siblings ...)
  2023-10-12 11:49 ` leahneukirchen
@ 2023-10-12 13:05 ` ahesford
  2023-10-13  1:50 ` [PR PATCH] [Closed]: " ahesford
  2023-10-13  1:50 ` ahesford
  10 siblings, 0 replies; 12+ messages in thread
From: ahesford @ 2023-10-12 13:05 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 3129 bytes --]

There is an updated pull request by ahesford against master on the void-packages repository

https://github.com/ahesford/void-packages py-legacy
https://github.com/void-linux/void-packages/pull/46631

New package: python3.11 3.11.6
Python minor upgrades are all-or-nothing commitments to Void. Working through revbumps and runtime tests uncover a lot of incompatibilities, but runtime testing is limited to whatever testers happen to use. We are all familiar with the post-upgrade press to fix the tens of broken packages that shake out once the broader community gets the packages.

Even worse, large and sometimes important projects (`firefox`, `chromium` and `electron*`) use Python for their build processes and tend to slip past the upgrade testing procedure. These packages generally FTBFS and can require extensive patching of a litany of vendored Python packages. This is a painful process but, if we waited for upstream fixes for everything, we might lag behind several Python minor cycles. (Firefox *still* requires patching for Python 3.11.)

To make this upgrade easier in the future, I propose to provide the `python3-legacy` package, which will lag behind `python3` by at least one minor version. This package (and its `-devel` subpackage) provide us a few nice advantages:
1. It is sufficient to bootstrap a virtual environment. Users that have packages fundamentally incompatible with new Python can install `python3-legacy` and create an older venv that will provide some consistency.
2. It can live alongside the system `python3`, so users that have existing virtual environments which link against the prior Python libraries can be kept functional by installing `python3-legacy`. (Right now, any existing venvs will break on upgrade because the requisite shared library will be removed.)
3. Our `firefox`, `electron19` and `electron24` packages can use the legacy version for builds, so we avoid breaking these major packages without being forced to patch them. (I have started builds of `electron*` and watched them continue through ~7k files so far, and I've watched `firefox` for the first several minutes. I'll need to actually run through the complete builds to be sure.)

Note that `python3-legacy` is NOT intended to be an alternative to the system Python. It is a minimal installation ONLY and its sole purpose for end users is to create virtual environments. We should NEVER allow any package in the repository to provide files in the `site-packages` tree for this version or link against its `libpython`. (To enforce this, I am deliberately leaving `python3-legacy` out of `common/shlibs`.) Any future upgrade of `python3` must still ensure that *every* Python package at least installes in the new `$py3_sitelib`.

I've left `idle` out of this package but kept `tkinter` built in, although we can drop `tkinter` or add `idle` if others think there is merit in doing so.

#### Testing the changes
- I tested the changes in this PR: **IN PROCESS**

[ci skip]

cc: @void-linux/pkg-committers 

A patch file from https://github.com/void-linux/void-packages/pull/46631.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-py-legacy-46631.patch --]
[-- Type: text/x-diff, Size: 17360 bytes --]

From 1214baf2eff1fb1dd087ad7f55fdb9f515a1b1a1 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Wed, 11 Oct 2023 22:26:59 -0400
Subject: [PATCH 1/4] New package: python3.11-3.11.6

---
 srcpkgs/python3.11-devel                      |   1 +
 srcpkgs/python3.11/files/EXTERNALLY-MANAGED   |  29 ++++
 srcpkgs/python3.11/files/cross.patch          |  21 +++
 .../patches/musl-find_library.patch           |  44 ++++++
 srcpkgs/python3.11/patches/ppc-fixes.patch    |  45 ++++++
 srcpkgs/python3.11/template                   | 144 ++++++++++++++++++
 srcpkgs/python3.11/update                     |   3 +
 7 files changed, 287 insertions(+)
 create mode 120000 srcpkgs/python3.11-devel
 create mode 100644 srcpkgs/python3.11/files/EXTERNALLY-MANAGED
 create mode 100644 srcpkgs/python3.11/files/cross.patch
 create mode 100644 srcpkgs/python3.11/patches/musl-find_library.patch
 create mode 100644 srcpkgs/python3.11/patches/ppc-fixes.patch
 create mode 100644 srcpkgs/python3.11/template
 create mode 100644 srcpkgs/python3.11/update

diff --git a/srcpkgs/python3.11-devel b/srcpkgs/python3.11-devel
new file mode 120000
index 0000000000000..6e7f3c7dd2248
--- /dev/null
+++ b/srcpkgs/python3.11-devel
@@ -0,0 +1 @@
+python3.11
\ No newline at end of file
diff --git a/srcpkgs/python3.11/files/EXTERNALLY-MANAGED b/srcpkgs/python3.11/files/EXTERNALLY-MANAGED
new file mode 100644
index 0000000000000..22743f8d51db5
--- /dev/null
+++ b/srcpkgs/python3.11/files/EXTERNALLY-MANAGED
@@ -0,0 +1,29 @@
+[externally-managed]
+Error=
+ This system-wide Python installation is managed by the Void Linux package
+ manager, XBPS. Installation of Python packages from other sources is not
+ normally allowed.
+
+ To install a Python package not offered by Void Linux, consider using a virtual
+ environment, e.g.:
+
+   python3 -m venv /path/to/venv
+   /path/to/venv/pip install <package>
+
+ Appending the flag --system-site-packages to the first command will give the
+ virtual environment access to any Python package installed via XBPS.
+
+ Invoking python, pip, and executables installed by pip in /path/to/venv/bin
+ should automatically use the virtual environment. Alternatively, source its
+ activation script to add the environment to the command search path for a shell:
+
+   . /path/to/venv/activate
+
+ After activation, running
+
+   deactivate
+
+ will remove the environment from the search path without destroying it.
+
+ The XBPS package python3-pipx provides pipx, a convenient tool to automatically
+ manage virtual environments for individual Python applications.
diff --git a/srcpkgs/python3.11/files/cross.patch b/srcpkgs/python3.11/files/cross.patch
new file mode 100644
index 0000000000000..40925d1ec1bfa
--- /dev/null
+++ b/srcpkgs/python3.11/files/cross.patch
@@ -0,0 +1,21 @@
+diff -ur a/Makefile.pre.in b/Makefile.pre.in
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -1901,8 +1901,6 @@
+ 			upgrade) ensurepip="--upgrade" ;; \
+ 			install|*) ensurepip="" ;; \
+ 		esac; \
+-		$(RUNSHARED) $(PYTHON_FOR_BUILD) -m ensurepip \
+-			$$ensurepip --root=$(DESTDIR)/ ; \
+ 	fi
+ 
+ .PHONY: altinstall
+@@ -1912,8 +1910,6 @@
+ 			upgrade) ensurepip="--altinstall --upgrade" ;; \
+ 			install|*) ensurepip="--altinstall" ;; \
+ 		esac; \
+-		$(RUNSHARED) $(PYTHON_FOR_BUILD) -m ensurepip \
+-			$$ensurepip --root=$(DESTDIR)/ ; \
+ 	fi
+ 
+ .PHONY: commoninstall
diff --git a/srcpkgs/python3.11/patches/musl-find_library.patch b/srcpkgs/python3.11/patches/musl-find_library.patch
new file mode 100644
index 0000000000000..879f912462721
--- /dev/null
+++ b/srcpkgs/python3.11/patches/musl-find_library.patch
@@ -0,0 +1,44 @@
+--- a/Lib/ctypes/util.py
++++ b/Lib/ctypes/util.py
+@@ -265,6 +265,41 @@
+         def find_library(name, is64 = False):
+             return _get_soname(_findLib_crle(name, is64) or _findLib_gcc(name))
+ 
++    elif True:
++
++        # Patched for Alpine Linux / musl - search manually system paths
++        def _is_elf(filepath):
++            try:
++                with open(filepath, 'rb') as fh:
++                    return fh.read(4) == b'\x7fELF'
++            except:
++                return False
++
++        def find_library(name):
++            from glob import glob
++            # absolute name?
++            if os.path.isabs(name):
++                return name
++            # special case for libm, libcrypt and libpthread and musl
++            if name in ['m', 'crypt', 'pthread']:
++                name = 'c'
++            elif name in ['libm.so', 'libcrypt.so', 'libpthread.so']:
++                name = 'libc.so'
++            # search in standard locations (musl order)
++            paths = ['/lib', '/usr/local/lib', '/usr/lib']
++            if 'LD_LIBRARY_PATH' in os.environ:
++                paths = os.environ['LD_LIBRARY_PATH'].split(':') + paths
++            for d in paths:
++                f = os.path.join(d, name)
++                if _is_elf(f):
++                    return os.path.basename(f)
++
++                prefix = os.path.join(d, 'lib'+name)
++                for suffix in ['.so', '.so.*']:
++                    for f in glob('{0}{1}'.format(prefix, suffix)):
++                        if _is_elf(f):
++                            return os.path.basename(f)
++
+     else:
+ 
+         def _findSoname_ldconfig(name):
diff --git a/srcpkgs/python3.11/patches/ppc-fixes.patch b/srcpkgs/python3.11/patches/ppc-fixes.patch
new file mode 100644
index 0000000000000..fc5937725162e
--- /dev/null
+++ b/srcpkgs/python3.11/patches/ppc-fixes.patch
@@ -0,0 +1,45 @@
+diff -ur a/configure b/configure
+--- a/configure
++++ b/configure
+@@ -5952,6 +5952,14 @@
+ printf "%s\n" "$ac_cv_path_EGREP" >&6; }
+  EGREP="$ac_cv_path_EGREP"
+ 
++if test x$MULTIARCH = xpowerpc-linux-musl
++then
++	MULTIARCH="powerpc-linux-gnu"
++fi
++if test x$MULTIARCH = xpowerpcle-linux-musl
++then
++	MULTIARCH="powerpcle-linux-gnu"
++fi
+ 
+ 
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for CC compiler name" >&5
+@@ -6859,7 +6867,11 @@
+         powerpc64-linux-gnu
+ #  endif
+ # elif defined(__powerpc__)
++#  if defined(__LITTLE_ENDIAN__)
++        powerpcle-linux-gnu
++#  else
+         powerpc-linux-gnu
++#  endif
+ # elif defined(__s390x__)
+         s390x-linux-gnu
+ # elif defined(__s390__)
+diff -ur a/configure.ac b/configure.ac
+--- a/configure.ac
++++ b/configure.ac
+@@ -1039,7 +1039,11 @@
+         powerpc64-linux-gnu
+ #  endif
+ # elif defined(__powerpc__)
++#  if defined(__LITTLE_ENDIAN__)
++        powerpcle-linux-gnu
++#  else
+         powerpc-linux-gnu
++#  endif
+ # elif defined(__s390x__)
+         s390x-linux-gnu
+ # elif defined(__s390__)
diff --git a/srcpkgs/python3.11/template b/srcpkgs/python3.11/template
new file mode 100644
index 0000000000000..abfe5f21a08e2
--- /dev/null
+++ b/srcpkgs/python3.11/template
@@ -0,0 +1,144 @@
+# Template file for 'python3.11'
+pkgname=python3.11
+version=3.11.6
+revision=1
+build_style="gnu-configure"
+configure_args="--enable-shared --enable-ipv6 --enable-optimizations
+ --enable-loadable-sqlite-extensions --with-computed-gotos
+ --with-dbmliborder=gdbm:ndbm --with-system-expat --with-system-ffi
+ --without-ensurepip ac_cv_working_tzset=yes"
+hostmakedepends="pkgconf"
+makedepends="libffi-devel readline-devel gdbm-devel openssl-devel
+ expat-devel sqlite-devel bzip2-devel zlib-devel liblzma-devel"
+depends="ca-certificates"
+checkdepends="$depends iana-etc"
+short_desc="Python ${version%.*} (limited install; not for regular use)"
+maintainer="Andrew J. Hesford <ajh@sideband.org>"
+license="Python-2.0"
+homepage="https://www.python.org"
+_bluez="bluez-5.64"
+distfiles="
+ https://www.python.org/ftp/python/${version%rc*}/Python-${version}.tar.xz
+ ${KERNEL_SITE}/bluetooth/${_bluez}.tar.xz
+"
+checksum="0fab78fa7f133f4f38210c6260d90d7c0d5c7198446419ce057ec7ac2e6f5f38
+ ae437e65b6b3070c198bc5b0109fe9cdeb9eaa387380e2072f9de65fe8a1de34"
+skip_extraction="${_bluez}.tar.xz"
+
+if [ "$CROSS_BUILD" ]; then
+	hostmakedepends+=" python3.11"
+	configure_args+=" --with-build-python=python${version%.*}"
+	configure_args+=" ac_cv_broken_sem_getvalue=no"
+fi
+
+post_extract() {
+	# Ensure that the internal copy of expat is not used
+	rm -r Modules/expat
+
+	# Extract Bluetooth headers
+	local _srcdistdir="${XBPS_SRCDISTDIR}/${sourcepkg}-${version}"
+	mkdir External
+	bsdtar -C External --strip-components=1 -x \
+		-f "${_srcdistdir}/${_bluez}.tar.xz" "${_bluez}/lib/*.h"
+	mv External/lib External/bluetooth
+}
+
+post_patch() {
+	if [ -n "$CROSS_BUILD" ]; then
+		patch -Np1 -i ${FILESDIR}/cross.patch
+	fi
+}
+
+do_configure() {
+	# If these are set, distutils will default to cc and attempt to pass
+	# `-R<path>` to the compiler for every compiled extension that sets an
+	# rpath rather than the '-Wl,-R<path>' argument that GCC requires
+	unset GCC CC CXX CPP LD AR AS RANLIB
+
+	# Make sure configure can find Bluetooth headers
+	CFLAGS+=" -I./External"
+	CPPFLAGS+=" -I./External"
+	./configure ${configure_args}
+}
+
+do_check() {
+	local opts
+
+	# relies on sane group membership not found in xbps-src
+	opts="-i test_chown_*"
+	# expects shadow passwd db unreadable by user
+	opts+=" -i test_getspnam_exception"
+	# expects functionality patched out for musl
+	opts+=" -i test_find_library_with_*"
+	# SSL advertises unexpected ciphers
+	opts+=" -i test_shared_ciphers"
+	# requires in-tree expat, which we removed
+	opts+=" -i test_freeze_simple_script"
+	# anomalies in SSL session handling
+	opts+=" -i test_session*"
+	# overflow in datetime.time.mktime
+	opts+=" -i test_localtime_daylight_*_dst_true"
+
+	if [ "${XBPS_TARGET_LIBC}" = "musl" ]; then
+		# musl doesn't work with locales
+		opts+=" -i test_locale* -i test_c_locale* -i test__locale"
+		opts+=" -i test_fpathconf"
+	fi
+
+	make ${makejobs} EXTRATESTOPTS="${opts}" quicktest
+}
+
+do_install() {
+	make DESTDIR=${DESTDIR} install maninstall
+
+	# Put the license in the usual location and remove from the libdir
+	# to prevent the XBPS trigger from attempting to byte-compile it
+	vlicense LICENSE
+	rm ${DESTDIR}/usr/lib/python${version%.*}/LICENSE.txt
+
+	# Remove major-only components that conflict with python3 packages
+	rm ${DESTDIR}/usr/bin/{pydoc3,python3,2to3,python3-config}
+	rm ${DESTDIR}/usr/lib/libpython3.so
+	rm ${DESTDIR}/usr/lib/pkgconfig/python3{,-embed}.pc
+	rm ${DESTDIR}/usr/share/man/man1/python3.1
+
+	# Remove files that belong to idle
+	rm ${DESTDIR}/usr/bin/idle3*
+	rm -r ${DESTDIR}/usr/lib/python${version%.*}/idlelib
+
+	# Remove test module and tests that fail to be byte-compiled.
+	rm -r ${DESTDIR}/usr/lib/python${version%.*}/test
+	rm -r ${DESTDIR}/usr/lib/python${version%.*}/lib2to3/tests
+
+	# Remove references to the install(1) wrapper.
+	sed -e "s,${XBPS_WRAPPERDIR},/usr/bin,g" -i \
+		${DESTDIR}/usr/lib/python${version%.*}/_sysconfigdata_*_*.py \
+		${DESTDIR}/usr/lib/python${version%.*}/config-${version%.*}*/Makefile
+
+	if [ "$CROSS_BUILD" ]; then
+		# Remove references to cross toolchain.
+		sed -i "s/$XBPS_CROSS_TRIPLET-//g" \
+			${DESTDIR}/usr/lib/python${version%.*}/_sysconfigdata_*_*.py \
+			${DESTDIR}/usr/lib/python${version%.*}/config-${version%.*}*/Makefile
+		sed -i -e "s,$XBPS_CROSS_BASE,,g" \
+			${DESTDIR}/usr/bin/python${version%.*}-config
+	fi
+
+	# https://peps.python.org/pep-0668/
+	vinstall ${FILESDIR}/EXTERNALLY-MANAGED 644 usr/lib/python${version%.*}
+}
+
+python3.11-devel_package() {
+	short_desc+=" - development files"
+	depends="${sourcepkg}-${version}_${revision}"
+	pkg_install() {
+		vmove usr/bin/python*-config
+		vmove usr/lib/pkgconfig
+		vmove usr/include
+		mv ${DESTDIR}/usr/lib/python${version%.*}/config-${version%.*}*/libpython${version%.*}*.a \
+			${PKGDESTDIR}/usr/lib
+		mkdir -p ${DESTDIR}/usr/include/python${version%.*}
+		mv ${PKGDESTDIR}/usr/include/python${version%.*}/pyconfig.h \
+			${DESTDIR}/usr/include/python${version%.*}
+	}
+}
diff --git a/srcpkgs/python3.11/update b/srcpkgs/python3.11/update
new file mode 100644
index 0000000000000..0e358debe1d47
--- /dev/null
+++ b/srcpkgs/python3.11/update
@@ -0,0 +1,3 @@
+pkgname=Python
+site="${homepage}/downloads/source/"
+pattern='Python-\K3\.11\.[0-9]+(?=\.tgz)'

From 9a8f8e4238013cbbe52e9ccc0844ece436ed73b3 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Wed, 11 Oct 2023 22:42:13 -0400
Subject: [PATCH 2/4] firefox: use python3.11 to build

---
 srcpkgs/firefox/template | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/firefox/template b/srcpkgs/firefox/template
index 1a499c52aa2d1..7cffc5dfdf1e6 100644
--- a/srcpkgs/firefox/template
+++ b/srcpkgs/firefox/template
@@ -15,8 +15,8 @@ checksum=d0f996116ae234dc7bd59e0d77ddefe268179d7500d16a9488309c826547c97c
 
 lib32disabled=yes
 
-hostmakedepends="autoconf213 unzip zip pkg-config perl python3 yasm rust cargo
- llvm clang lld nodejs cbindgen nasm which tar"
+hostmakedepends="autoconf213 unzip zip pkg-config perl python3.11 yasm rust
+ cargo llvm clang lld nodejs cbindgen nasm which tar"
 makedepends="nss-devel libjpeg-turbo-devel gtk+3-devel icu-devel
  pixman-devel libevent-devel libnotify-devel libvpx-devel libwebp-devel
  libXrender-devel libXcomposite-devel libSM-devel libXt-devel rust-std
@@ -63,6 +63,8 @@ post_patch() {
 }
 
 do_build() {
+	ln -s "/usr/bin/python3.11" "${XBPS_WRAPPERDIR}/python3"
+
 	if [ "$build_option_clang" ]; then
 		export CC=clang
 		export CXX=clang++

From 3e98037cef7c8a01e4024c1664fef587fa409791 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Wed, 11 Oct 2023 22:45:01 -0400
Subject: [PATCH 3/4] electron19: use python3.11 to build

---
 srcpkgs/electron19/template | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/electron19/template b/srcpkgs/electron19/template
index 3093248588438..ee888e1dceb79 100644
--- a/srcpkgs/electron19/template
+++ b/srcpkgs/electron19/template
@@ -12,7 +12,7 @@ hostmakedepends="$(vopt_if clang "clang lld") python pkgconf perl gperf bison ni
  pciutils-devel ffmpeg-devel libxml2-devel libglib-devel yarn openjdk libxslt-devel
  opus-devel libXcursor-devel libXcomposite-devel libXtst-devel libXrandr-devel libXScrnSaver-devel
  alsa-lib-devel re2-devel snappy-devel mit-krb5-devel $(vopt_if pulseaudio pulseaudio-devel)
- $(vopt_if sndio sndio-devel) jq"
+ $(vopt_if sndio sndio-devel) jq python3.11"
 makedepends="libpng-devel gtk+-devel gtk+3-devel nss-devel pciutils-devel
  libXi-devel libgcrypt-devel libgnome-keyring-devel cups-devel elfutils-devel
  libXcomposite-devel speech-dispatcher-devel libXrandr-devel mit-krb5-devel
@@ -190,6 +190,8 @@ post_patch() {
 }
 
 pre_configure() {
+	ln -s "/usr/bin/python3.11" "${XBPS_WRAPPERDIR}/python3"
+
 	cd "$wrksrc/$build_wrksrc"
 
 	# https://groups.google.com/a/chromium.org/d/topic/chromium-packagers/9JX1N2nf4PU/discussion
@@ -262,8 +264,8 @@ pre_configure() {
 
 
 	msg_normal "Replacing gn files\n"
-	python3 build/linux/unbundle/replace_gn_files.py --system-libraries \
-		$use_system
+	python3.11 build/linux/unbundle/replace_gn_files.py \
+		--system-libraries $use_system
 	third_party/libaddressinput/chromium/tools/update-strings.py
 }
 
@@ -399,6 +401,10 @@ do_build() {
 		export BUILD_AR="$AR_host"
 		export BUILD_NM="$NM_host"
 	fi
+
+	# Prevent ERR_OSSL_EVP_UNSUPPORTED
+	export NODE_OPTIONS=--openssl-legacy-provider
+
 	msg_normal "Ninja turtles GO!\n"
 	ninja ${makejobs} -C out/$_buildtype electron third_party/electron_node:headers
 	# finish rest of the build

From 9ae68efa00fe3abd9a0a5c13f31786c2af636d06 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Wed, 11 Oct 2023 22:45:20 -0400
Subject: [PATCH 4/4] electron24: use python3.11 to build

---
 srcpkgs/electron24/template | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/electron24/template b/srcpkgs/electron24/template
index 431ba6b0f8301..27c4f1aebd9e1 100644
--- a/srcpkgs/electron24/template
+++ b/srcpkgs/electron24/template
@@ -12,7 +12,7 @@ hostmakedepends="$(vopt_if clang "clang lld") python pkgconf perl gperf bison ni
  pciutils-devel ffmpeg-devel libxml2-devel libglib-devel yarn openjdk libxslt-devel
  opus-devel libXcursor-devel libXcomposite-devel libXtst-devel libXrandr-devel libXScrnSaver-devel
  alsa-lib-devel re2-devel snappy-devel mit-krb5-devel $(vopt_if pulseaudio pulseaudio-devel)
- $(vopt_if sndio sndio-devel) jq"
+ $(vopt_if sndio sndio-devel) jq python3.11"
 makedepends="libpng-devel gtk+-devel gtk+3-devel nss-devel pciutils-devel
  libXi-devel libgcrypt-devel libgnome-keyring-devel cups-devel elfutils-devel
  libXcomposite-devel speech-dispatcher-devel libXrandr-devel mit-krb5-devel
@@ -206,6 +206,8 @@ post_patch() {
 }
 
 pre_configure() {
+	ln -s "/usr/bin/python3.11" "${XBPS_WRAPPERDIR}/python3"
+
 	cd "$wrksrc/$build_wrksrc"
 
 	# https://groups.google.com/a/chromium.org/d/topic/chromium-packagers/9JX1N2nf4PU/discussion
@@ -275,8 +277,8 @@ pre_configure() {
 
 
 	msg_normal "Replacing gn files\n"
-	python3 build/linux/unbundle/replace_gn_files.py --system-libraries \
-		$use_system
+	python3.11 build/linux/unbundle/replace_gn_files.py \
+		--system-libraries $use_system
 	third_party/libaddressinput/chromium/tools/update-strings.py
 
 	# Satisfy some scripts that use git describe to figure out the electron version

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: New package: python3.11 3.11.6
  2023-10-12  3:02 [PR PATCH] New package: python3-legacy 3.11.6 ahesford
                   ` (9 preceding siblings ...)
  2023-10-13  1:50 ` [PR PATCH] [Closed]: " ahesford
@ 2023-10-13  1:50 ` ahesford
  10 siblings, 0 replies; 12+ messages in thread
From: ahesford @ 2023-10-13  1:50 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 183 bytes --]

New comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/46631#issuecomment-1760646175

Comment:
437f47a16485d34c9f71f0693a269466cae3baf3

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PR PATCH] [Closed]: New package: python3.11 3.11.6
  2023-10-12  3:02 [PR PATCH] New package: python3-legacy 3.11.6 ahesford
                   ` (8 preceding siblings ...)
  2023-10-12 13:05 ` [PR PATCH] [Updated] " ahesford
@ 2023-10-13  1:50 ` ahesford
  2023-10-13  1:50 ` ahesford
  10 siblings, 0 replies; 12+ messages in thread
From: ahesford @ 2023-10-13  1:50 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2969 bytes --]

There's a closed pull request on the void-packages repository

New package: python3.11 3.11.6
https://github.com/void-linux/void-packages/pull/46631

Description:
Python minor upgrades are all-or-nothing commitments to Void. Working through revbumps and runtime tests uncover a lot of incompatibilities, but runtime testing is limited to whatever testers happen to use. We are all familiar with the post-upgrade press to fix the tens of broken packages that shake out once the broader community gets the packages.

Even worse, large and sometimes important projects (`firefox`, `chromium` and `electron*`) use Python for their build processes and tend to slip past the upgrade testing procedure. These packages generally FTBFS and can require extensive patching of a litany of vendored Python packages. This is a painful process but, if we waited for upstream fixes for everything, we might lag behind several Python minor cycles. (Firefox *still* requires patching for Python 3.11.)

To make this upgrade easier in the future, I propose to provide the `python3-legacy` package, which will lag behind `python3` by at least one minor version. This package (and its `-devel` subpackage) provide us a few nice advantages:
1. It is sufficient to bootstrap a virtual environment. Users that have packages fundamentally incompatible with new Python can install `python3-legacy` and create an older venv that will provide some consistency.
2. It can live alongside the system `python3`, so users that have existing virtual environments which link against the prior Python libraries can be kept functional by installing `python3-legacy`. (Right now, any existing venvs will break on upgrade because the requisite shared library will be removed.)
3. Our `firefox`, `electron19` and `electron24` packages can use the legacy version for builds, so we avoid breaking these major packages without being forced to patch them. (I have started builds of `electron*` and watched them continue through ~7k files so far, and I've watched `firefox` for the first several minutes. I'll need to actually run through the complete builds to be sure.)

Note that `python3-legacy` is NOT intended to be an alternative to the system Python. It is a minimal installation ONLY and its sole purpose for end users is to create virtual environments. We should NEVER allow any package in the repository to provide files in the `site-packages` tree for this version or link against its `libpython`. (To enforce this, I am deliberately leaving `python3-legacy` out of `common/shlibs`.) Any future upgrade of `python3` must still ensure that *every* Python package at least installes in the new `$py3_sitelib`.

I've left `idle` out of this package but kept `tkinter` built in, although we can drop `tkinter` or add `idle` if others think there is merit in doing so.

#### Testing the changes
- I tested the changes in this PR: **IN PROCESS**

[ci skip]

cc: @void-linux/pkg-committers 

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2023-10-13  1:50 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-12  3:02 [PR PATCH] New package: python3-legacy 3.11.6 ahesford
2023-10-12  3:05 ` Vaelatern
2023-10-12  3:16 ` [PR PATCH] [Updated] " ahesford
2023-10-12  3:17 ` ahesford
2023-10-12  3:18 ` ahesford
2023-10-12  7:26 ` New package: python3.11 3.11.6 classabbyamp
2023-10-12 11:44 ` [PR PATCH] [Updated] " ahesford
2023-10-12 11:46 ` ahesford
2023-10-12 11:49 ` leahneukirchen
2023-10-12 13:05 ` [PR PATCH] [Updated] " ahesford
2023-10-13  1:50 ` [PR PATCH] [Closed]: " ahesford
2023-10-13  1:50 ` ahesford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).