Merge ~cjwatson/launchpad-buildd:py3-on-bionic into launchpad-buildd:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: d36cd0b6772302554b88ae1ea3bc8155a69a4e66
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad-buildd:py3-on-bionic
Merge into: launchpad-buildd:master
Diff against target: 191 lines (+46/-15)
14 files modified
bin/buildrecipe (+1/-1)
bin/check-implicit-pointer-functions (+1/-1)
bin/in-target (+1/-1)
bin/test_buildd_generatetranslationtemplates (+1/-1)
bin/test_buildd_recipe (+1/-1)
buildd-genconfig (+1/-1)
debian/changelog (+1/-0)
debian/check-python3-twisted (+9/-0)
debian/control (+3/-3)
debian/launchpad-buildd.init (+1/-1)
debian/rules (+23/-2)
debian/upgrade-config (+1/-1)
lpbuildd/check_implicit_pointer_functions.py (+1/-1)
setup.py (+1/-1)
Reviewer Review Type Date Requested Status
Ioana Lasc (community) Approve
Review via email: mp+383615@code.launchpad.net

Commit message

Run on Python 3 when built for >= bionic

To post a comment you must log in.
Revision history for this message
Ioana Lasc (ilasc) wrote :

looks good

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/bin/buildrecipe b/bin/buildrecipe
2index d20820a..f3034e7 100755
3--- a/bin/buildrecipe
4+++ b/bin/buildrecipe
5@@ -1,4 +1,4 @@
6-#!/usr/bin/python -u
7+#!/usr/bin/python3 -u
8 # Copyright 2010-2019 Canonical Ltd. This software is licensed under the
9 # GNU Affero General Public License version 3 (see the file LICENSE).
10
11diff --git a/bin/check-implicit-pointer-functions b/bin/check-implicit-pointer-functions
12index 6e20f3f..7ff5389 100755
13--- a/bin/check-implicit-pointer-functions
14+++ b/bin/check-implicit-pointer-functions
15@@ -1,4 +1,4 @@
16-#! /usr/bin/python -u
17+#! /usr/bin/python3 -u
18 #
19 # Copyright 2020 Canonical Ltd. This software is licensed under the
20 # GNU Affero General Public License version 3 (see the file LICENSE).
21diff --git a/bin/in-target b/bin/in-target
22index 73db48a..da0303d 100755
23--- a/bin/in-target
24+++ b/bin/in-target
25@@ -1,4 +1,4 @@
26-#! /usr/bin/python -u
27+#! /usr/bin/python3 -u
28 #
29 # Copyright 2017 Canonical Ltd. This software is licensed under the
30 # GNU Affero General Public License version 3 (see the file LICENSE).
31diff --git a/bin/test_buildd_generatetranslationtemplates b/bin/test_buildd_generatetranslationtemplates
32index 5bfaae0..85ddc2e 100755
33--- a/bin/test_buildd_generatetranslationtemplates
34+++ b/bin/test_buildd_generatetranslationtemplates
35@@ -1,4 +1,4 @@
36-#!/usr/bin/env python
37+#!/usr/bin/python3
38 # Copyright 2010 Canonical Ltd. This software is licensed under the
39 # GNU Affero General Public License version 3 (see the file LICENSE).
40 #
41diff --git a/bin/test_buildd_recipe b/bin/test_buildd_recipe
42index aa4c2bb..849b28b 100755
43--- a/bin/test_buildd_recipe
44+++ b/bin/test_buildd_recipe
45@@ -1,4 +1,4 @@
46-#!/usr/bin/env python
47+#!/usr/bin/python3
48 # Copyright 2010 Canonical Ltd. This software is licensed under the
49 # GNU Affero General Public License version 3 (see the file LICENSE).
50 #
51diff --git a/buildd-genconfig b/buildd-genconfig
52index c1f61ec..467dee4 100755
53--- a/buildd-genconfig
54+++ b/buildd-genconfig
55@@ -1,4 +1,4 @@
56-#!/usr/bin/python
57+#!/usr/bin/python3
58 #
59 # Copyright 2009 Canonical Ltd. This software is licensed under the
60 # GNU Affero General Public License version 3 (see the file LICENSE).
61diff --git a/debian/changelog b/debian/changelog
62index 006223d..91b8886 100644
63--- a/debian/changelog
64+++ b/debian/changelog
65@@ -24,6 +24,7 @@ launchpad-buildd (190) UNRELEASED; urgency=medium
66 * Add a proper wrapper for check-implicit-pointer-functions.
67 * Add a python3-lpbuildd binary package.
68 * Fix LXD.run to not default to universal_newlines=True.
69+ * Run on Python 3 when built for >= bionic.
70
71 -- Colin Watson <cjwatson@ubuntu.com> Tue, 28 Apr 2020 10:19:27 +0100
72
73diff --git a/debian/check-python3-twisted b/debian/check-python3-twisted
74new file mode 100755
75index 0000000..21331e8
76--- /dev/null
77+++ b/debian/check-python3-twisted
78@@ -0,0 +1,9 @@
79+#! /usr/bin/python3
80+
81+import sys
82+
83+import twisted
84+
85+
86+ok = (twisted.version.major, twisted.version.minor) >= (16, 4)
87+sys.exit(0 if ok else 1)
88diff --git a/debian/control b/debian/control
89index eb4ceef..7f19082 100644
90--- a/debian/control
91+++ b/debian/control
92@@ -66,9 +66,9 @@ Depends: adduser,
93 lxd,
94 ntpdate,
95 pristine-tar,
96- python,
97- python-apt,
98- python-lpbuildd (=${source:Version}),
99+ ${lpbuildd-python-prefix},
100+ ${lpbuildd-python-prefix}-apt,
101+ ${lpbuildd-python-prefix}-lpbuildd (= ${source:Version}),
102 sbuild,
103 schroot,
104 sudo,
105diff --git a/debian/launchpad-buildd.init b/debian/launchpad-buildd.init
106index 13ab745..4952893 100755
107--- a/debian/launchpad-buildd.init
108+++ b/debian/launchpad-buildd.init
109@@ -79,7 +79,7 @@ d_start() {
110 # Useful for certain kinds of image builds.
111 modprobe nbd || true
112
113- su - buildd -c "BUILDD_SLAVE_CONFIG=$CONFROOT/$CONF twistd --no_save --pidfile $PIDFILE --python $TACFILE --logfile $LOGFILE --umask 022"
114+ su - buildd -c "BUILDD_SLAVE_CONFIG=$CONFROOT/$CONF twistd3 --no_save --pidfile $PIDFILE --python $TACFILE --logfile $LOGFILE --umask 022"
115 }
116
117 #
118diff --git a/debian/rules b/debian/rules
119index 07aee67..2746afa 100755
120--- a/debian/rules
121+++ b/debian/rules
122@@ -7,16 +7,37 @@
123
124 export PYBUILD_NAME := lpbuildd
125
126-export LIBDIR := $(shell python -c 'import distutils.sysconfig; print(distutils.sysconfig.get_python_lib())')
127+ifeq (ok,$(shell debian/check-python3-twisted && echo ok))
128+ export LPBUILDD_PYTHON_PREFIX := python3
129+ export LIBDIR := $(shell python3 -c 'import distutils.sysconfig; print(distutils.sysconfig.get_python_lib())')
130+else
131+ export LPBUILDD_PYTHON_PREFIX := python
132+ export LIBDIR := $(shell python2 -c 'import distutils.sysconfig; print(distutils.sysconfig.get_python_lib())')
133+endif
134
135 %:
136 dh $@ --with=python2,python3 --buildsystem=pybuild
137
138 override_dh_auto_build:
139 dh_auto_build
140- python buildd-genconfig --template=template-buildd-slave.conf \
141+ python3 buildd-genconfig --template=template-buildd-slave.conf \
142 --arch=i386 --port=8221 --name=default --host=buildd.buildd \
143 > buildd-slave-example.conf
144
145+ifeq ($(LPBUILDD_PYTHON_PREFIX),python)
146+override_dh_install:
147+ dh_install
148+ find debian/launchpad-buildd -type f | xargs grep -l '#!.*python3' | \
149+ xargs -r sed -i 's/\(#!.*\)python3/\1python2/'
150+
151+override_dh_installinit:
152+ dh_installinit
153+ sed -i 's/twistd3/twistd/' \
154+ debian/launchpad-buildd/etc/init.d/launchpad-buildd
155+endif
156+
157+override_dh_gencontrol:
158+ dh_gencontrol -- -Vlpbuildd-python-prefix=$(LPBUILDD_PYTHON_PREFIX)
159+
160 override_dh_builddeb:
161 dh_builddeb -- -Zgzip
162diff --git a/debian/upgrade-config b/debian/upgrade-config
163index 6f1ac77..3c7b9d4 100755
164--- a/debian/upgrade-config
165+++ b/debian/upgrade-config
166@@ -1,4 +1,4 @@
167-#!/usr/bin/python
168+#!/usr/bin/python3
169 #
170 # Copyright 2009-2020 Canonical Ltd. This software is licensed under the
171 # GNU Affero General Public License version 3 (see the file LICENSE).
172diff --git a/lpbuildd/check_implicit_pointer_functions.py b/lpbuildd/check_implicit_pointer_functions.py
173index 26372ae..9b8b191 100755
174--- a/lpbuildd/check_implicit_pointer_functions.py
175+++ b/lpbuildd/check_implicit_pointer_functions.py
176@@ -1,4 +1,4 @@
177-#!/usr/bin/env python
178+#!/usr/bin/python3
179
180 #
181 # Copyright (c) 2004 Hewlett-Packard Development Company, L.P.
182diff --git a/setup.py b/setup.py
183index 82ae655..32e4498 100755
184--- a/setup.py
185+++ b/setup.py
186@@ -1,4 +1,4 @@
187-#!/usr/bin/env python
188+#!/usr/bin/python3
189
190 # Copyright 2015-2019 Canonical Ltd. All rights reserved.
191 #

Subscribers

People subscribed via source and target branches