python3: Fix race condition when doing parallel builds
authorJeffery To <jeffery.to@gmail.com>
Sat, 20 May 2023 11:07:22 +0000 (19:07 +0800)
committerRosen Penev <rosenp@gmail.com>
Wed, 24 May 2023 03:04:33 +0000 (06:04 +0300)
When doing parallel builds, host Python can install the python3 symlink
before the Python standard library is installed completely.

When this occurs, it is possible for other packages to detect the
python3 symlink and try to use host Python before it is fully installed.

This adds a patch to make commoninstall (where the standard library is
installed) a prerequisite of bininstall (where the python3 symlink is
installed), so that commoninstall is fully completed before bininstall
begins.

Patch has been submitted upstream:
https://github.com/python/cpython/pull/104693

Fixes: https://github.com/openwrt/packages/issues/19241
Signed-off-by: Jeffery To <jeffery.to@gmail.com>
lang/python/python3/patches/027-install-python3-symlink-after-stdlib.patch [new file with mode: 0644]

diff --git a/lang/python/python3/patches/027-install-python3-symlink-after-stdlib.patch b/lang/python/python3/patches/027-install-python3-symlink-after-stdlib.patch
new file mode 100644 (file)
index 0000000..efd193a
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -1361,7 +1361,7 @@ altbininstall: $(BUILDPYTHON) @FRAMEWORK
+                       $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE); \
+       fi
+-bininstall: altbininstall
++bininstall: commoninstall altbininstall
+       if test ! -d $(DESTDIR)$(LIBPC); then \
+               echo "Creating directory $(LIBPC)"; \
+               $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(LIBPC); \