Bug 1449629 - Install Python 3.5 in Debian 7 base image; r?glandium draft
authorGregory Szorc <gps@mozilla.com>
Mon, 02 Apr 2018 19:27:12 -0700
changeset 776430 1fce08651eabb661d8fddaa78089af73509154f7
parent 776429 c00cd59263cd5eb91dc7041ec6a7e9937e8591fc
child 776431 0e12d3a93b67b08ade239434e73bb224bcc41c9e
push id104879
push userbmo:gps@mozilla.com
push dateTue, 03 Apr 2018 02:27:40 +0000
reviewersglandium
bugs1449629
milestone61.0a1
Bug 1449629 - Install Python 3.5 in Debian 7 base image; r?glandium Debian 7 ships Python 3.2 by default. That's too old for our upcoming build requirement of Python 3.5. This commit adds a Python 3.5 package for wheezy that backports the Python 3.5 from a much later Debian version. The patch was inspired by the existing patch for Python 2.7. However, it needed additional work. The changes and reasons should all be documented in the changelog file as part of the package diff we apply. I'm a bit disappointed we had to disable PGO. But it was reliably segfaulting during the build. I didn't feel like going down that rabbit hole. MozReview-Commit-ID: ABpHW1KYFQP
build/debian-packages/python3.5-wheezy.diff
taskcluster/ci/docker-image/kind.yml
taskcluster/ci/packages/kind.yml
new file mode 100644
--- /dev/null
+++ b/build/debian-packages/python3.5-wheezy.diff
@@ -0,0 +1,192 @@
+diff --git a/debian/changelog b/debian/changelog
+index e19964f..0bc60c2 100644
+--- a/debian/changelog
++++ b/debian/changelog
+@@ -1,3 +1,21 @@
++python3.5 (3.5.3-1.deb7moz1) wheezy; urgency=medium
++
++  * Mozilla backport for wheezy.
++  * debian/control.in:
++    - Remove libmpdec-dev dependency; wheezy doesn't have it; Python
++      vendors it.
++    - Remove libexpat1-dev dependency; it prevents co-installing some
++      i386 -dev packages.
++  * debian/rules:
++    - Adapt ar, ranlib, and objcopy paths to work on wheezy.
++    - Remove --with-system-libmpdec because wheezy doesn't have it.
++    - Disable PGO builds because they segfault.
++    - Remove -Og from debug builds because GCC 4.7 doesn't like it.
++  * debian/control.in, debian/rules: Don't generate the -doc package
++    and HTML documentation.
++
++ -- Gregory Szorc <gps@mozilla.com>  Thu, 29 Mar 2018 20:00:00 -0700
++
+ python3.5 (3.5.3-1) unstable; urgency=medium
+ 
+   * Python 3.5.3 release.
+diff --git a/debian/control.in b/debian/control.in
+index 7d36556..ec1af78 100644
+--- a/debian/control.in
++++ b/debian/control.in
+@@ -9,7 +9,6 @@ Build-Depends: debhelper (>= 9), @bd_dpkgdev@
+   zlib1g-dev, libbz2-dev, liblzma-dev,
+   libgdbm-dev, libdb-dev,
+   tk-dev, blt-dev (>= 2.4z), libssl-dev,
+-  libexpat1-dev, libmpdec-dev (>= 2.4),
+   libbluetooth-dev [!hurd-i386 !kfreebsd-i386 !kfreebsd-amd64],
+   locales [!armel !avr32 !hppa !ia64 !mipsel],
+   libsqlite3-dev, libffi-dev (>= 3.0.5) [!or1k !avr32],
+@@ -27,7 +26,7 @@ Architecture: any
+ Multi-Arch: allowed
+ Priority: @PRIO@
+ Depends: @PVER@-minimal (= ${binary:Version}), lib@PVER@-stdlib (= ${binary:Version}), mime-support, ${shlibs:Depends}, ${misc:Depends}
+-Suggests: @PVER@-venv, @PVER@-doc, binutils
++Suggests: @PVER@-venv, binutils
+ Description: Interactive high-level object-oriented language (version @VER@)
+  Python is a high-level, interactive, object-oriented language. Its @VER@ version
+  includes an extensive class library with lots of goodies for
+@@ -115,7 +114,7 @@ Description: Examples for the Python language (v@VER@)
+ Package: @PVER@-dev
+ Architecture: any
+ Multi-Arch: allowed
+-Depends: @PVER@ (= ${binary:Version}), lib@PVER@-dev (= ${binary:Version}), lib@PVER@ (= ${binary:Version}), libexpat1-dev, ${shlibs:Depends}, ${misc:Depends}
++Depends: @PVER@ (= ${binary:Version}), lib@PVER@-dev (= ${binary:Version}), lib@PVER@ (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
+ Recommends: libc6-dev | libc-dev
+ Description: Header files and a static library for Python (v@VER@)
+  Header files, a static library and development tools for building
+@@ -129,7 +128,7 @@ Section: libdevel
+ Architecture: any
+ Multi-Arch: same
+ Pre-Depends: ${misc:Pre-Depends}
+-Depends: lib@PVER@-stdlib (= ${binary:Version}), lib@PVER@ (= ${binary:Version}), libexpat1-dev, ${shlibs:Depends}, ${misc:Depends}
++Depends: lib@PVER@-stdlib (= ${binary:Version}), lib@PVER@ (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
+ Recommends: libc6-dev | libc-dev
+ Description: Header files and a static library for Python (v@VER@)
+  Header files, a static library and development tools for building
+@@ -161,28 +160,6 @@ Description: IDE for Python (v@VER@) using Tkinter
+  IDLE is an Integrated Development Environment for Python (v@VER@).
+  IDLE is written using Tkinter and therefore quite platform-independent.
+ 
+-Package: @PVER@-doc
+-Section: doc
+-Architecture: all
+-Multi-Arch: foreign
+-Depends: libjs-jquery, libjs-underscore, ${misc:Depends}
+-Suggests: @PVER@
+-Description: Documentation for the high-level object-oriented language Python (v@VER@)
+- These is the official set of documentation for the interactive high-level
+- object-oriented language Python (v@VER@). All documents are provided
+- in HTML format. The package consists of ten documents:
+- .
+-   * What's New in Python@VER@
+-   * Tutorial
+-   * Python Library Reference
+-   * Macintosh Module Reference
+-   * Python Language Reference
+-   * Extending and Embedding Python
+-   * Python/C API Reference
+-   * Installing Python Modules
+-   * Documenting Python
+-   * Distributing Python Modules
+-
+ Package: @PVER@-dbg
+ Section: debug
+ Architecture: any
+diff --git a/debian/rules b/debian/rules
+index 05895da..294d432 100755
+--- a/debian/rules
++++ b/debian/rules
+@@ -136,14 +136,14 @@ endif
+ CC=$(DEB_HOST_GNU_TYPE)-gcc
+ CXX=$(DEB_HOST_GNU_TYPE)-g++
+ 
+-AR=$(DEB_HOST_GNU_TYPE)-ar
+-RANLIB=$(DEB_HOST_GNU_TYPE)-ranlib
++AR=$(DEB_HOST_GNU_TYPE)-gcc-ar-4.7
++RANLIB=$(DEB_HOST_GNU_TYPE)-gcc-ranlib-4.7
+ 
+ DPKG_CPPFLAGS:= $(shell dpkg-buildflags --get CPPFLAGS)
+ DPKG_CFLAGS  := $(shell dpkg-buildflags --get CFLAGS)
+ DPKG_LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS)
+ OPT_CFLAGS   := $(filter-out -O%,$(DPKG_CFLAGS)) # default is -O3
+-DEBUG_CFLAGS := $(patsubst -O%,-Og,$(DPKG_CFLAGS))
++DEBUG_CFLAGS := $(DPKG_CFLAGS)
+ 
+ # on alpha, use -O2 only, use -mieee
+ ifeq ($(DEB_HOST_ARCH),alpha)
+@@ -155,14 +155,6 @@ ifeq ($(DEB_HOST_ARCH),m68k)
+     EXTRA_OPT_FLAGS += -O2
+ endif
+ 
+-ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
+-  ifeq ($(DEB_HOST_ARCH_OS),linux)
+-    ifneq (,$(findstring $(DEB_HOST_ARCH), amd64 armel armhf i386 powerpc ppc64 ppc64el s390x))
+-      with_pgo := yes
+-    endif
+-  endif
+-endif
+-
+ ifneq (,$(findstring $(DEB_HOST_ARCH), amd64 armel armhf i386 powerpc ppc64 ppc64el s390x))
+   with_lto := yes
+ endif
+@@ -187,8 +179,6 @@ ifeq ($(with_lto),yes)
+       LTO_CFLAGS += -ffat-lto-objects
+     endif
+     EXTRA_OPT_CFLAGS += $(LTO_CFLAGS)
+-    AR=$(DEB_HOST_GNU_TYPE)-gcc-ar
+-    RANLIB=$(DEB_HOST_GNU_TYPE)-gcc-ranlib
+ endif
+ 
+ make_build_target = $(if $(with_pgo),profile-opt)
+@@ -322,7 +312,6 @@ common_configure_args = \
+ 		--with-computed-gotos \
+ 		--without-ensurepip \
+ 		--with-system-expat \
+-		--with-system-libmpdec \
+ 
+ ifneq (,$(filter $(DEB_HOST_ARCH), avr32 or1k))
+   common_configure_args += --without-ffi
+@@ -659,7 +648,6 @@ minimal-test:
+ 
+ stamps/stamp-doc-html:
+ 	dh_testdir
+-	$(MAKE) -C Doc html
+ 	@mkdir -p stamps
+ 	touch stamps/stamp-doc-html
+ 
+@@ -1299,26 +1287,6 @@ binary-indep: build-indep install stamps/stamp-control
+ 	dh_testdir -i
+ 	dh_testroot -i
+ 
+-	: # $(p_doc) package
+-	dh_installdirs -p$(p_doc) \
+-		usr/share/doc/$(p_base) \
+-		usr/share/doc/$(p_doc)
+-	dh_installdocs -p$(p_doc)
+-	cp -a Doc/build/html $(d_doc)/usr/share/doc/$(p_base)/
+-	rm -f $(d_doc)/usr/share/doc/$(p_base)/html/_static/jquery.js
+-	dh_link -p$(p_doc) \
+-		/usr/share/doc/$(p_base)/html /usr/share/doc/$(p_doc)/html \
+-		/usr/share/javascript/jquery/jquery.js /usr/share/doc/$(p_base)/html/_static/jquery.js \
+-		/usr/share/javascript/underscore/underscore.js /usr/share/doc/$(p_base)/html/_static/underscore.js
+-
+-	: # devhelp docs
+-	cd $(buildd_static) && ./python ../debian/pyhtml2devhelp.py \
+-		../$(d_doc)/usr/share/doc/$(p_base)/html index.html $(VER) \
+-		> ../$(d_doc)/usr/share/doc/$(p_base)/html/$(PVER).devhelp
+-	gzip -9nv $(d_doc)/usr/share/doc/$(p_base)/html/$(PVER).devhelp
+-	dh_link -p$(p_doc) \
+-		/usr/share/doc/$(p_base)/html /usr/share/devhelp/books/$(PVER)
+-
+ 	for i in $(p_ltst); do \
+ 	  rm -rf debian/$$i/usr/share/doc/$$i; \
+ 	  ln -s $(p_base) debian/$$i/usr/share/doc/$$i; \
+@@ -1377,7 +1345,7 @@ ifneq ($(with_gdbm),yes)
+ endif
+ 
+ 	find $(d_ldbg) $(d_ldev) -name '*.a' ! -type l \
+-		| xargs -n 1 $(DEB_HOST_GNU_TYPE)-objcopy -p --remove-section=.gnu.lto_.*
++		| xargs -n 1 objcopy -p --remove-section=.gnu.lto_.*
+ 	dh_strip -a -N$(p_dbg) -N$(p_ldbg) -Xdebug -Xdbg --dbg-package=$(p_dbg)
+ 	mkdir -p $(d_dbg)/usr/share/gdb/auto-load/usr/bin
+ 	cp Tools/gdb/libpython.py $(d_dbg)/usr/share/gdb/auto-load/usr/bin/$(PVER)m-gdb.py
--- a/taskcluster/ci/docker-image/kind.yml
+++ b/taskcluster/ci/docker-image/kind.yml
@@ -29,16 +29,17 @@ jobs:
       BASE_TAG: '20171210'
       SNAPSHOT: '20171210T214726Z'
     packages:
       - deb7-gdb
       - deb7-git
       - deb7-make
       - deb7-mercurial
       - deb7-python
+      - deb7-python3.5
       - deb7-xz-utils
   toolchain-build:
     symbol: I(toolchain)
     parent: debian7-base
     packages:
       - deb7-cmake
       - deb7-ninja
   debian7-amd64-build:
--- a/taskcluster/ci/packages/kind.yml
+++ b/taskcluster/ci/packages/kind.yml
@@ -30,16 +30,28 @@ jobs:
     run:
       using: debian-package
       dsc:
         url: http://snapshot.debian.org/archive/debian/20160813T164221Z/pool/main/p/python2.7/python2.7_2.7.9-2+deb8u1.dsc
         sha256: 274c293e7156edf59cb9f0a9d8cedcd94fa801df35adf39b8a9f3d776a250ead
       patch: python-wheezy.diff
       pre-build-command: debian/rules control-file
 
+  deb7-python3.5:
+    description: "Python 3.5 backport for Debian wheezy"
+    treeherder:
+      symbol: Deb7(python3.5)
+    run:
+      using: debian-package
+      dsc:
+        url: http://snapshot.debian.org/archive/debian/20170119T211826Z/pool/main/p/python3.5/python3.5_3.5.3-1.dsc
+        sha256: 5259cbb15bb93f7bdfbe9ce03a972ea47f81c86057d5939ef9ce578414b2f1de
+      patch: python3.5-wheezy.diff
+      pre-build-command: debian/rules control-file
+
   deb7-cmake:
     description: "Cmake backport for Debian wheezy"
     treeherder:
       symbol: Deb7(cmake)
     run:
       using: debian-package
       dsc:
         url: http://snapshot.debian.org/archive/debian/20161204T034107Z/pool/main/c/cmake/cmake_3.7.1-1.dsc