Skip to content

Commit 0ef2f0b

Browse files
author
Doug Greiman
committed
Apply patch to fix double-build issue.
Source is python/cpython#1478, backported to 3.5 and 3.6.
1 parent a8d033a commit 0ef2f0b

7 files changed

Lines changed: 199 additions & 10 deletions

File tree

‎python-interpreter-builder/Dockerfile.in‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ ENV LANG C.UTF-8
4444

4545
# Add build scripts
4646
ADD scripts /scripts
47+
ADD patches /patches
4748

4849
# Build the Python interpreters
4950
RUN /scripts/build-python-3.5.sh
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Source is https://github.com/python/cpython/pull/1478
2+
3+
Index: Python-3.5.3/Makefile.pre.in
4+
===================================================================
5+
--- Python-3.5.3.orig/Makefile.pre.in
6+
+++ Python-3.5.3/Makefile.pre.in
7+
@@ -982,7 +982,7 @@ TESTTIMEOUT= 3600
8+
9+
# Run a basic set of regression tests.
10+
# This excludes some tests that are particularly resource-intensive.
11+
-test: all platform
12+
+test: @DEF_MAKE_RULE@ platform
13+
$(TESTRUNNER) $(TESTOPTS)
14+
15+
# Run the full test suite twice - once without .pyc files, and once with.
16+
@@ -992,7 +992,7 @@ test: all platform
17+
# the bytecode read from a .pyc file had the bug, sometimes the directly
18+
# generated bytecode. This is sometimes a very shy bug needing a lot of
19+
# sample data.
20+
-testall: all platform
21+
+testall: @DEF_MAKE_RULE@ platform
22+
-find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
23+
$(TESTPYTHON) -E $(srcdir)/Lib/compileall.py
24+
-find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
25+
@@ -1001,7 +1001,7 @@ testall: all platform
26+
27+
# Run the test suite for both architectures in a Universal build on OSX.
28+
# Must be run on an Intel box.
29+
-testuniversal: all platform
30+
+testuniversal: @DEF_MAKE_RULE@ platform
31+
if [ `arch` != 'i386' ];then \
32+
echo "This can only be used on OSX/i386" ;\
33+
exit 1 ;\
34+
@@ -1024,7 +1024,7 @@ QUICKTESTOPTS= $(TESTOPTS) -x test_subpr
35+
test_multiprocessing_forkserver \
36+
test_mailbox test_socket test_poll \
37+
test_select test_zipfile test_concurrent_futures
38+
-quicktest: all platform
39+
+quicktest: @DEF_MAKE_RULE@ platform
40+
$(TESTRUNNER) $(QUICKTESTOPTS)
41+
42+
43+
@@ -1376,7 +1376,7 @@ LIBPL= @LIBPL@
44+
# pkgconfig directory
45+
LIBPC= $(LIBDIR)/pkgconfig
46+
47+
-libainstall: all python-config
48+
+libainstall: @DEF_MAKE_RULE@ python-config
49+
@for i in $(LIBDIR) $(LIBPL) $(LIBPC); \
50+
do \
51+
if test ! -d $(DESTDIR)$$i; then \
52+
@@ -1635,7 +1635,7 @@ distclean: clobber
53+
-exec rm -f {} ';'
54+
55+
# Check for smelly exported symbols (not starting with Py/_Py)
56+
-smelly: all
57+
+smelly: @DEF_MAKE_RULE@
58+
nm -p $(LIBRARY) | \
59+
sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
60+
61+
@@ -1673,7 +1673,7 @@ funny:
62+
-o -print
63+
64+
# Perform some verification checks on any modified files.
65+
-patchcheck: all
66+
+patchcheck: @DEF_MAKE_RULE@
67+
$(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/patchcheck.py
68+
69+
# Dependencies
70+
Index: Python-3.5.3/Misc/ACKS
71+
===================================================================
72+
--- Python-3.5.3.orig/Misc/ACKS
73+
+++ Python-3.5.3/Misc/ACKS
74+
@@ -1092,6 +1092,7 @@ Jason Orendorff
75+
Douglas Orr
76+
William Orr
77+
Michele Orrù
78+
+Tomáš Orsava
79+
Oleg Oshmyan
80+
Denis S. Otkidach
81+
Peter Otten
82+
Index: Python-3.5.3/Misc/NEWS
83+
===================================================================
84+
--- Python-3.5.3.orig/Misc/NEWS
85+
+++ Python-3.5.3/Misc/NEWS
86+
@@ -634,6 +634,10 @@ Windows
87+
Build
88+
-----
89+
90+
+- bpo-29243: Prevent unnecessary rebuilding of Python during ``make test``,
91+
+ ``make install`` and some other make targets when configured with
92+
+ ``--enable-optimizations``.
93+
+
94+
- Issue #29080: Removes hard dependency on hg.exe from PCBuild/build.bat
95+
96+
- Issue #23903: Added missed names to PC/python3.def.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
double-build.diff
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Source is https://github.com/python/cpython/pull/1478
2+
3+
Index: Python-3.6.1/Makefile.pre.in
4+
===================================================================
5+
--- Python-3.6.1.orig/Makefile.pre.in
6+
+++ Python-3.6.1/Makefile.pre.in
7+
@@ -1000,7 +1000,7 @@ TESTTIMEOUT= 1200
8+
9+
# Run a basic set of regression tests.
10+
# This excludes some tests that are particularly resource-intensive.
11+
-test: all platform
12+
+test: @DEF_MAKE_RULE@ platform
13+
$(TESTRUNNER) $(TESTOPTS)
14+
15+
# Run the full test suite twice - once without .pyc files, and once with.
16+
@@ -1010,7 +1010,7 @@ test: all platform
17+
# the bytecode read from a .pyc file had the bug, sometimes the directly
18+
# generated bytecode. This is sometimes a very shy bug needing a lot of
19+
# sample data.
20+
-testall: all platform
21+
+testall: @DEF_MAKE_RULE@ platform
22+
-find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
23+
$(TESTPYTHON) -E $(srcdir)/Lib/compileall.py
24+
-find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
25+
@@ -1019,7 +1019,7 @@ testall: all platform
26+
27+
# Run the test suite for both architectures in a Universal build on OSX.
28+
# Must be run on an Intel box.
29+
-testuniversal: all platform
30+
+testuniversal: @DEF_MAKE_RULE@ platform
31+
if [ `arch` != 'i386' ];then \
32+
echo "This can only be used on OSX/i386" ;\
33+
exit 1 ;\
34+
@@ -1042,7 +1042,7 @@ QUICKTESTOPTS= $(TESTOPTS) -x test_subpr
35+
test_multiprocessing_forkserver \
36+
test_mailbox test_socket test_poll \
37+
test_select test_zipfile test_concurrent_futures
38+
-quicktest: all platform
39+
+quicktest: @DEF_MAKE_RULE@ platform
40+
$(TESTRUNNER) $(QUICKTESTOPTS)
41+
42+
43+
@@ -1379,7 +1379,7 @@ LIBPL= @LIBPL@
44+
# pkgconfig directory
45+
LIBPC= $(LIBDIR)/pkgconfig
46+
47+
-libainstall: all python-config
48+
+libainstall: @DEF_MAKE_RULE@ python-config
49+
@for i in $(LIBDIR) $(LIBPL) $(LIBPC); \
50+
do \
51+
if test ! -d $(DESTDIR)$$i; then \
52+
@@ -1639,7 +1639,7 @@ distclean: clobber
53+
-exec rm -f {} ';'
54+
55+
# Check for smelly exported symbols (not starting with Py/_Py)
56+
-smelly: all
57+
+smelly: @DEF_MAKE_RULE@
58+
nm -p $(LIBRARY) | \
59+
sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \
60+
61+
@@ -1676,7 +1676,7 @@ funny:
62+
-o -print
63+
64+
# Perform some verification checks on any modified files.
65+
-patchcheck: all
66+
+patchcheck: @DEF_MAKE_RULE@
67+
$(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/patchcheck.py
68+
69+
# Dependencies
70+
Index: Python-3.6.1/Misc/ACKS
71+
===================================================================
72+
--- Python-3.6.1.orig/Misc/ACKS
73+
+++ Python-3.6.1/Misc/ACKS
74+
@@ -1111,6 +1111,7 @@ Jason Orendorff
75+
Douglas Orr
76+
William Orr
77+
Michele Orrù
78+
+Tomáš Orsava
79+
Oleg Oshmyan
80+
Denis S. Otkidach
81+
Peter Otten
82+
Index: Python-3.6.1/Misc/NEWS
83+
===================================================================
84+
--- Python-3.6.1.orig/Misc/NEWS
85+
+++ Python-3.6.1/Misc/NEWS
86+
@@ -306,6 +306,10 @@ Tests
87+
Build
88+
-----
89+
90+
+- bpo-29243: Prevent unnecessary rebuilding of Python during ``make test``,
91+
+ ``make install`` and some other make targets when configured with
92+
+ ``--enable-optimizations``.
93+
+
94+
- bpo-27593: sys.version and the platform module python_build(),
95+
python_branch(), and python_revision() functions now use
96+
git information rather than hg when building from a repo.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
double-build.diff

‎python-interpreter-builder/scripts/build-python-3.5.sh‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ d8890b84d773cd7059e597dbefa510340de8336ec9b9e9032bf030f19291565a Python-3.5.3.t
1313
EOF
1414
tar xzf Python-3.5.3.tgz
1515

16-
# Build
16+
# Apply patches
1717
cd Python-3.5.3
18+
QUILT_PATCHES=/patches/3.5 quilt push -a
1819

1920
# Explanation of flags:
2021
#
@@ -115,10 +116,6 @@ cd build-static
115116
LDFLAGS="-Wl,-z,relro" \
116117
RANLIB="x86_64-linux-gnu-gcc-ranlib" \
117118

118-
# Due to https://bugs.python.org/issue29243, "make altinstall"
119-
# rebuilds everything from scratch, twice. This is a workaround.
120-
sed -i 's/^all:.*$/all: build_all/' Makefile
121-
122119
make profile-opt
123120
make altinstall
124121

‎python-interpreter-builder/scripts/build-python-3.6.sh‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ aa50b0143df7c89ce91be020fe41382613a817354b33acdc6641b44f8ced3828 Python-3.6.1.t
1313
EOF
1414
tar xzf Python-3.6.1.tgz
1515

16-
# Build
16+
# Apply patches
1717
cd Python-3.6.1
18+
QUILT_PATCHES=/patches/3.6 quilt push -a
1819

1920
# Explanation of flags:
2021
#
@@ -115,10 +116,6 @@ cd build-static
115116
LDFLAGS="-Wl,-z,relro" \
116117
RANLIB="x86_64-linux-gnu-gcc-ranlib" \
117118

118-
# Due to https://bugs.python.org/issue29243, "make altinstall"
119-
# rebuilds everything from scratch, twice. This is a workaround.
120-
sed -i 's/^all:.*$/all: build_all/' Makefile
121-
122119
make profile-opt
123120
make altinstall
124121

0 commit comments

Comments
 (0)