diff --git a/python-interpreter-builder/Dockerfile.in b/python-interpreter-builder/Dockerfile.in index 9323f750..4ce3bd02 100644 --- a/python-interpreter-builder/Dockerfile.in +++ b/python-interpreter-builder/Dockerfile.in @@ -44,6 +44,7 @@ ENV LANG C.UTF-8 # Add build scripts ADD scripts /scripts +ADD patches /patches # Build the Python interpreters RUN /scripts/build-python-3.5.sh diff --git a/python-interpreter-builder/patches/3.5/double-build.diff b/python-interpreter-builder/patches/3.5/double-build.diff new file mode 100644 index 00000000..cb52c64b --- /dev/null +++ b/python-interpreter-builder/patches/3.5/double-build.diff @@ -0,0 +1,96 @@ +# Source is https://github.com/python/cpython/pull/1478 + +Index: Python-3.5.3/Makefile.pre.in +=================================================================== +--- Python-3.5.3.orig/Makefile.pre.in ++++ Python-3.5.3/Makefile.pre.in +@@ -982,7 +982,7 @@ TESTTIMEOUT= 3600 + + # Run a basic set of regression tests. + # This excludes some tests that are particularly resource-intensive. +-test: all platform ++test: @DEF_MAKE_RULE@ platform + $(TESTRUNNER) $(TESTOPTS) + + # Run the full test suite twice - once without .pyc files, and once with. +@@ -992,7 +992,7 @@ test: all platform + # the bytecode read from a .pyc file had the bug, sometimes the directly + # generated bytecode. This is sometimes a very shy bug needing a lot of + # sample data. +-testall: all platform ++testall: @DEF_MAKE_RULE@ platform + -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f + $(TESTPYTHON) -E $(srcdir)/Lib/compileall.py + -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f +@@ -1001,7 +1001,7 @@ testall: all platform + + # Run the test suite for both architectures in a Universal build on OSX. + # Must be run on an Intel box. +-testuniversal: all platform ++testuniversal: @DEF_MAKE_RULE@ platform + if [ `arch` != 'i386' ];then \ + echo "This can only be used on OSX/i386" ;\ + exit 1 ;\ +@@ -1024,7 +1024,7 @@ QUICKTESTOPTS= $(TESTOPTS) -x test_subpr + test_multiprocessing_forkserver \ + test_mailbox test_socket test_poll \ + test_select test_zipfile test_concurrent_futures +-quicktest: all platform ++quicktest: @DEF_MAKE_RULE@ platform + $(TESTRUNNER) $(QUICKTESTOPTS) + + +@@ -1376,7 +1376,7 @@ LIBPL= @LIBPL@ + # pkgconfig directory + LIBPC= $(LIBDIR)/pkgconfig + +-libainstall: all python-config ++libainstall: @DEF_MAKE_RULE@ python-config + @for i in $(LIBDIR) $(LIBPL) $(LIBPC); \ + do \ + if test ! -d $(DESTDIR)$$i; then \ +@@ -1635,7 +1635,7 @@ distclean: clobber + -exec rm -f {} ';' + + # Check for smelly exported symbols (not starting with Py/_Py) +-smelly: all ++smelly: @DEF_MAKE_RULE@ + nm -p $(LIBRARY) | \ + sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \ + +@@ -1673,7 +1673,7 @@ funny: + -o -print + + # Perform some verification checks on any modified files. +-patchcheck: all ++patchcheck: @DEF_MAKE_RULE@ + $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/patchcheck.py + + # Dependencies +Index: Python-3.5.3/Misc/ACKS +=================================================================== +--- Python-3.5.3.orig/Misc/ACKS ++++ Python-3.5.3/Misc/ACKS +@@ -1092,6 +1092,7 @@ Jason Orendorff + Douglas Orr + William Orr + Michele Orrù ++Tomáš Orsava + Oleg Oshmyan + Denis S. Otkidach + Peter Otten +Index: Python-3.5.3/Misc/NEWS +=================================================================== +--- Python-3.5.3.orig/Misc/NEWS ++++ Python-3.5.3/Misc/NEWS +@@ -634,6 +634,10 @@ Windows + Build + ----- + ++- bpo-29243: Prevent unnecessary rebuilding of Python during ``make test``, ++ ``make install`` and some other make targets when configured with ++ ``--enable-optimizations``. ++ + - Issue #29080: Removes hard dependency on hg.exe from PCBuild/build.bat + + - Issue #23903: Added missed names to PC/python3.def. diff --git a/python-interpreter-builder/patches/3.5/series b/python-interpreter-builder/patches/3.5/series new file mode 100644 index 00000000..f6c2876b --- /dev/null +++ b/python-interpreter-builder/patches/3.5/series @@ -0,0 +1 @@ +double-build.diff diff --git a/python-interpreter-builder/patches/3.6/double-build.diff b/python-interpreter-builder/patches/3.6/double-build.diff new file mode 100644 index 00000000..a89a20f6 --- /dev/null +++ b/python-interpreter-builder/patches/3.6/double-build.diff @@ -0,0 +1,96 @@ +# Source is https://github.com/python/cpython/pull/1478 + +Index: Python-3.6.1/Makefile.pre.in +=================================================================== +--- Python-3.6.1.orig/Makefile.pre.in ++++ Python-3.6.1/Makefile.pre.in +@@ -1000,7 +1000,7 @@ TESTTIMEOUT= 1200 + + # Run a basic set of regression tests. + # This excludes some tests that are particularly resource-intensive. +-test: all platform ++test: @DEF_MAKE_RULE@ platform + $(TESTRUNNER) $(TESTOPTS) + + # Run the full test suite twice - once without .pyc files, and once with. +@@ -1010,7 +1010,7 @@ test: all platform + # the bytecode read from a .pyc file had the bug, sometimes the directly + # generated bytecode. This is sometimes a very shy bug needing a lot of + # sample data. +-testall: all platform ++testall: @DEF_MAKE_RULE@ platform + -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f + $(TESTPYTHON) -E $(srcdir)/Lib/compileall.py + -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f +@@ -1019,7 +1019,7 @@ testall: all platform + + # Run the test suite for both architectures in a Universal build on OSX. + # Must be run on an Intel box. +-testuniversal: all platform ++testuniversal: @DEF_MAKE_RULE@ platform + if [ `arch` != 'i386' ];then \ + echo "This can only be used on OSX/i386" ;\ + exit 1 ;\ +@@ -1042,7 +1042,7 @@ QUICKTESTOPTS= $(TESTOPTS) -x test_subpr + test_multiprocessing_forkserver \ + test_mailbox test_socket test_poll \ + test_select test_zipfile test_concurrent_futures +-quicktest: all platform ++quicktest: @DEF_MAKE_RULE@ platform + $(TESTRUNNER) $(QUICKTESTOPTS) + + +@@ -1379,7 +1379,7 @@ LIBPL= @LIBPL@ + # pkgconfig directory + LIBPC= $(LIBDIR)/pkgconfig + +-libainstall: all python-config ++libainstall: @DEF_MAKE_RULE@ python-config + @for i in $(LIBDIR) $(LIBPL) $(LIBPC); \ + do \ + if test ! -d $(DESTDIR)$$i; then \ +@@ -1639,7 +1639,7 @@ distclean: clobber + -exec rm -f {} ';' + + # Check for smelly exported symbols (not starting with Py/_Py) +-smelly: all ++smelly: @DEF_MAKE_RULE@ + nm -p $(LIBRARY) | \ + sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \ + +@@ -1676,7 +1676,7 @@ funny: + -o -print + + # Perform some verification checks on any modified files. +-patchcheck: all ++patchcheck: @DEF_MAKE_RULE@ + $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/patchcheck.py + + # Dependencies +Index: Python-3.6.1/Misc/ACKS +=================================================================== +--- Python-3.6.1.orig/Misc/ACKS ++++ Python-3.6.1/Misc/ACKS +@@ -1111,6 +1111,7 @@ Jason Orendorff + Douglas Orr + William Orr + Michele Orrù ++Tomáš Orsava + Oleg Oshmyan + Denis S. Otkidach + Peter Otten +Index: Python-3.6.1/Misc/NEWS +=================================================================== +--- Python-3.6.1.orig/Misc/NEWS ++++ Python-3.6.1/Misc/NEWS +@@ -306,6 +306,10 @@ Tests + Build + ----- + ++- bpo-29243: Prevent unnecessary rebuilding of Python during ``make test``, ++ ``make install`` and some other make targets when configured with ++ ``--enable-optimizations``. ++ + - bpo-27593: sys.version and the platform module python_build(), + python_branch(), and python_revision() functions now use + git information rather than hg when building from a repo. diff --git a/python-interpreter-builder/patches/3.6/series b/python-interpreter-builder/patches/3.6/series new file mode 100644 index 00000000..f6c2876b --- /dev/null +++ b/python-interpreter-builder/patches/3.6/series @@ -0,0 +1 @@ +double-build.diff diff --git a/python-interpreter-builder/scripts/build-python-3.5.sh b/python-interpreter-builder/scripts/build-python-3.5.sh index a80473d8..8f536144 100755 --- a/python-interpreter-builder/scripts/build-python-3.5.sh +++ b/python-interpreter-builder/scripts/build-python-3.5.sh @@ -13,8 +13,9 @@ d8890b84d773cd7059e597dbefa510340de8336ec9b9e9032bf030f19291565a Python-3.5.3.t EOF tar xzf Python-3.5.3.tgz -# Build +# Apply patches cd Python-3.5.3 +QUILT_PATCHES=/patches/3.5 quilt push -a # Explanation of flags: # @@ -115,10 +116,6 @@ cd build-static LDFLAGS="-Wl,-z,relro" \ RANLIB="x86_64-linux-gnu-gcc-ranlib" \ -# Due to https://bugs.python.org/issue29243, "make altinstall" -# rebuilds everything from scratch, twice. This is a workaround. -sed -i 's/^all:.*$/all: build_all/' Makefile - make profile-opt make altinstall diff --git a/python-interpreter-builder/scripts/build-python-3.6.sh b/python-interpreter-builder/scripts/build-python-3.6.sh index cb4fa360..05a4e00e 100755 --- a/python-interpreter-builder/scripts/build-python-3.6.sh +++ b/python-interpreter-builder/scripts/build-python-3.6.sh @@ -13,8 +13,9 @@ aa50b0143df7c89ce91be020fe41382613a817354b33acdc6641b44f8ced3828 Python-3.6.1.t EOF tar xzf Python-3.6.1.tgz -# Build +# Apply patches cd Python-3.6.1 +QUILT_PATCHES=/patches/3.6 quilt push -a # Explanation of flags: # @@ -115,10 +116,6 @@ cd build-static LDFLAGS="-Wl,-z,relro" \ RANLIB="x86_64-linux-gnu-gcc-ranlib" \ -# Due to https://bugs.python.org/issue29243, "make altinstall" -# rebuilds everything from scratch, twice. This is a workaround. -sed -i 's/^all:.*$/all: build_all/' Makefile - make profile-opt make altinstall