Bug 1449629 - Install Python 3.5 in Debian 7 base image; r?glandium draft
authorGregory Szorc <gps@mozilla.com>
Thu, 29 Mar 2018 20:28:29 -0700
changeset 775119 b3a85356fc1f8fe4086e00bc5d269060be36f1a8
parent 775051 dcd10220d55aea46db212314c46d25a96a7be243
child 775120 0980630d01a7182f9687e1c097c7c9fd114130b0
push id104617
push userbmo:gps@mozilla.com
push dateFri, 30 Mar 2018 04:14:53 +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,186 @@
+--- a/debian/changelog
++++ b/debian/changelog
+@@ -1,3 +1,21 @@
++python3.5 (3.5.4-4.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.4-4) unstable; urgency=medium
+ 
+   * Add package breaks for extensions referencing symbols for the removed
+--- a/debian/control.in
++++ b/debian/control.in
+@@ -9,7 +9,6 @@
+   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 @@
+ 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
+@@ -116,7 +115,7 @@
+ 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
+@@ -130,7 +129,7 @@
+ 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
+@@ -162,28 +161,6 @@
+  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
+--- a/debian/rules
++++ b/debian/rules
+@@ -135,14 +135,14 @@
+ 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)
+@@ -158,14 +158,6 @@
+     DEBUG_CFLAGS += -fexceptions
+ 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
+@@ -190,8 +182,6 @@
+       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)
+@@ -325,7 +315,6 @@
+ 		--with-computed-gotos \
+ 		--without-ensurepip \
+ 		--with-system-expat \
+-		--with-system-libmpdec \
+ 
+ ifneq (,$(filter $(DEB_HOST_ARCH), avr32 or1k))
+   common_configure_args += --without-ffi
+@@ -657,7 +646,6 @@
+ 
+ stamps/stamp-doc-html:
+ 	dh_testdir
+-	BLURB_ENV='PYTHONPATH=$(CURDIR)/debian/blurb' $(MAKE) -C Doc html
+ 	@mkdir -p stamps
+ 	touch stamps/stamp-doc-html
+ 
+@@ -1304,26 +1292,6 @@
+ 	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; \
+@@ -1382,7 +1350,7 @@
+ 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/20180301T094050Z/pool/main/p/python3.5/python3.5_3.5.4-4.dsc
+        sha256: 0861056b92ba4ad189fd4be9b8b81101286466bd7002c07f7ab4427dbbd7b899
+      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