diff -Nru launchpad-buildd-141/buildd-genconfig launchpad-buildd-142/buildd-genconfig --- launchpad-buildd-141/buildd-genconfig 2013-07-30 09:05:52.000000000 +0000 +++ launchpad-buildd-142/buildd-genconfig 2016-12-09 17:54:25.000000000 +0000 @@ -3,6 +3,8 @@ # Copyright 2009 Canonical Ltd. This software is licensed under the # GNU Affero General Public License version 3 (see the file LICENSE). +from __future__ import print_function + import os archtag = os.popen("dpkg --print-architecture").read().strip() @@ -50,5 +52,5 @@ template = template.replace(replacement_key, replacements[replacement_key]) -print template.strip() +print(template.strip()) diff -Nru launchpad-buildd-141/buildlivefs launchpad-buildd-142/buildlivefs --- launchpad-buildd-141/buildlivefs 2015-08-04 08:59:14.000000000 +0000 +++ launchpad-buildd-142/buildlivefs 2016-12-09 17:54:52.000000000 +0000 @@ -4,6 +4,8 @@ """A script that builds a live file system.""" +from __future__ import print_function + __metaclass__ = type from optparse import OptionParser @@ -48,8 +50,8 @@ """ args = set_personality(self.options.arch, args) if echo: - print "Running in chroot: %s" % ' '.join( - "'%s'" % arg for arg in args) + print("Running in chroot: %s" % + ' '.join("'%s'" % arg for arg in args)) sys.stdout.flush() subprocess.check_call([ "/usr/bin/sudo", "/usr/sbin/chroot", self.chroot_path] + args) diff -Nru launchpad-buildd-141/buildrecipe launchpad-buildd-142/buildrecipe --- launchpad-buildd-141/buildrecipe 2016-01-18 11:42:57.000000000 +0000 +++ launchpad-buildd-142/buildrecipe 2016-12-09 17:56:22.000000000 +0000 @@ -4,8 +4,9 @@ """A script that builds a package from a recipe and a chroot.""" -__metaclass__ = type +from __future__ import print_function +__metaclass__ = type from optparse import OptionParser import os @@ -38,7 +39,7 @@ :return: The process wait status. """ - print 'RUN %r' % args + print('RUN %r' % args) proc = Popen(args, env=env) pid, status, rusage = os.wait4(proc.pid, 0) print(rusage) @@ -112,18 +113,18 @@ assert lsb_release.returncode == 0 if self.git: - print 'Git version:' + print('Git version:') check_call(['git', '--version']) - print check_output( + print(check_output( ['dpkg-query', '-W', 'git-build-recipe']).rstrip( - '\n').replace('\t', ' ') + '\n').replace('\t', ' ')) else: - print 'Bazaar versions:' + print('Bazaar versions:') check_call(['bzr', 'version']) check_call(['bzr', 'plugins']) - print 'Building recipe:' - print recipe + print('Building recipe:') + print(recipe) sys.stdout.flush() env = { 'DEBEMAIL': self.author_email, @@ -174,24 +175,25 @@ control = self.getSourceControl() with open(os.path.join( self.apt_dir, "%s.dsc" % package), "w") as dummy_dsc: - print >>dummy_dsc, dedent("""\ + print(dedent("""\ Format: 1.0 Source: %(package)s Architecture: any Version: 99:0 - Maintainer: invalid@example.org""") % {"package": package} + Maintainer: invalid@example.org""") % {"package": package}, + file=dummy_dsc) for field in ( "Build-Depends", "Build-Depends-Indep", "Build-Conflicts", "Build-Conflicts-Indep", ): if field in control: - print >>dummy_dsc, "%s: %s" % (field, control[field]) - print >>dummy_dsc + print("%s: %s" % (field, control[field]), file=dummy_dsc) + print(file=dummy_dsc) def runAptFtparchive(self): conf_path = os.path.join(self.apt_dir, "ftparchive.conf") with open(conf_path, "w") as conf: - print >>conf, dedent("""\ + print(dedent("""\ Dir::ArchiveDir "%(apt_dir)s"; Default::Sources::Compress ". bzip2"; BinDirectory "%(apt_dir)s" { Sources "Sources"; }; @@ -201,7 +203,8 @@ Suite "invalid"; Codename "invalid"; Description "buildrecipe temporary archive"; - };""") % {"apt_dir": self.apt_dir} + };""") % {"apt_dir": self.apt_dir}, + file=conf) ftparchive_env = dict(os.environ) ftparchive_env.pop("APT_CONFIG", None) ret = call( @@ -228,7 +231,8 @@ tmp_list_path_relative = os.path.join( self.apt_dir_relative, "buildrecipe-archive.list") with open(tmp_list_path, "w") as tmp_list: - print >>tmp_list, "deb-src file://%s ./" % self.apt_dir_relative + print("deb-src file://%s ./" % self.apt_dir_relative, + file=tmp_list) ret = self.chroot([ 'apt-get', '-o', 'Dir::Etc::sourcelist=%s' % tmp_list_path_relative, @@ -279,8 +283,8 @@ :return: the status code. """ if echo: - print "Running in chroot: %s" % ' '.join( - "'%s'" % arg for arg in args) + print("Running in chroot: %s" % + ' '.join("'%s'" % arg for arg in args)) sys.stdout.flush() return call([ '/usr/bin/sudo', '/usr/sbin/chroot', self.chroot_path] + args) diff -Nru launchpad-buildd-141/buildsnap launchpad-buildd-142/buildsnap --- launchpad-buildd-141/buildsnap 2016-12-05 19:05:12.000000000 +0000 +++ launchpad-buildd-142/buildsnap 2017-02-10 11:39:04.000000000 +0000 @@ -126,7 +126,10 @@ def pull(self): """Run pull phase.""" print("Running pull phase...") - env = {"SNAPCRAFT_LOCAL_SOURCES": "1"} + env = { + "SNAPCRAFT_LOCAL_SOURCES": "1", + "SNAPCRAFT_SETUP_CORE": "1", + } if self.options.proxy_url: env["http_proxy"] = self.options.proxy_url env["https_proxy"] = self.options.proxy_url diff -Nru launchpad-buildd-141/debian/changelog launchpad-buildd-142/debian/changelog --- launchpad-buildd-141/debian/changelog 2016-12-05 19:05:52.000000000 +0000 +++ launchpad-buildd-142/debian/changelog 2017-02-10 14:53:44.000000000 +0000 @@ -1,3 +1,18 @@ +launchpad-buildd (142) trusty; urgency=medium + + * lpbuildd.binarypackage: Pass DEB_BUILD_OPTIONS=noautodbgsym if we have + not been told to build debug symbols (LP: #1623256). + * debian/upgrade-config, lpbuildd.slave: Drop compatibility with ancient + pre-lucid versions of python-apt. + * lpbuildd.pottery.intltool: Remove unused and Python-3-unfriendly + string/file conditional from ConfigFile.__init__. + * Use Python-3-compatible forms of "print" and "except". + * buildsnap: Set SNAPCRAFT_SETUP_CORE=1 during pull phase so that + snapcraft will fetch and unpack the core snap for classic confinement + when necessary (LP: #1650946). + + -- Colin Watson Fri, 10 Feb 2017 14:53:43 +0000 + launchpad-buildd (141) trusty; urgency=medium * buildsnap: Grant access to the proxy during the build phase as well as diff -Nru launchpad-buildd-141/debian/upgrade-config launchpad-buildd-142/debian/upgrade-config --- launchpad-buildd-141/debian/upgrade-config 2015-05-19 14:59:59.000000000 +0000 +++ launchpad-buildd-142/debian/upgrade-config 2016-12-09 18:04:44.000000000 +0000 @@ -5,6 +5,8 @@ """Upgrade a launchpad-buildd configuration file.""" +from __future__ import print_function + import os import re import sys @@ -14,17 +16,11 @@ apt_pkg.init() -# Compatibility with ancient python-apt, needed until the last hardy -# builders go away. -if hasattr(apt_pkg, "version_compare"): - version_compare = apt_pkg.version_compare # modern -else: - version_compare = apt_pkg.VersionCompare # ancient (old_version, conf_file) = sys.argv[1:] def upgrade_to_12(): - print "Upgrading %s to version 12" % conf_file + print("Upgrading %s to version 12" % conf_file) subprocess.call(["mv", conf_file, conf_file+"-prev12~"]) in_file = open(conf_file+"-prev12~", "r") out_file = open(conf_file, "w") @@ -38,7 +34,7 @@ out_file.close() def upgrade_to_34(): - print "Upgrading %s to version 34" % conf_file + print("Upgrading %s to version 34" % conf_file) subprocess.call(["mv", conf_file, conf_file+"-prev34~"]) in_file = open(conf_file+"-prev34~", "r") out_file = open(conf_file, "w") @@ -50,7 +46,7 @@ out_file.close() def upgrade_to_39(): - print "Upgrading %s to version 39" % conf_file + print("Upgrading %s to version 39" % conf_file) subprocess.call(["mv", conf_file, conf_file+"-prev39~"]) in_file = open(conf_file+"-prev39~", "r") out_file = open(conf_file, "w") @@ -64,7 +60,7 @@ out_file.close() def upgrade_to_57(): - print "Upgrading %s to version 57" % conf_file + print("Upgrading %s to version 57" % conf_file) subprocess.call(["mv", conf_file, conf_file+"-prev57~"]) in_file = open(conf_file+"-prev57~", "r") out_file = open(conf_file, "w") @@ -83,7 +79,7 @@ out_file.close() def upgrade_to_58(): - print "Upgrading %s to version 58" % conf_file + print("Upgrading %s to version 58" % conf_file) subprocess.call(["mv", conf_file, conf_file+"-prev58~"]) in_file = open(conf_file+"-prev58~", "r") out_file = open(conf_file, "w") @@ -94,7 +90,7 @@ '/slavebin/buildrecipe\n') def upgrade_to_59(): - print "Upgrading %s to version 59" % conf_file + print("Upgrading %s to version 59" % conf_file) subprocess.call(["mv", conf_file, conf_file+"-prev59~"]) in_file = open(conf_file+"-prev59~", "r") out_file = open(conf_file, "w") @@ -105,7 +101,7 @@ 'resultarchive = translation-templates.tar.gz\n') def upgrade_to_63(): - print "Upgrading %s to version 63" % conf_file + print("Upgrading %s to version 63" % conf_file) subprocess.call(["mv", conf_file, conf_file+"-prev63~"]) in_file = open(conf_file+"-prev63~", "r") out_file = open(conf_file, "w") @@ -114,7 +110,7 @@ out_file.write(line) def upgrade_to_110(): - print "Upgrading %s to version 110" % conf_file + print("Upgrading %s to version 110" % conf_file) subprocess.call(["mv", conf_file, conf_file+"-prev110~"]) in_file = open(conf_file+"-prev110~", "r") out_file = open(conf_file, "w") @@ -126,7 +122,7 @@ out_file.close() def upgrade_to_115(): - print "Upgrading %s to version 115" % conf_file + print("Upgrading %s to version 115" % conf_file) subprocess.call(["mv", conf_file, conf_file+"-prev115~"]) in_allmanagers = False in_file = open(conf_file+"-prev115~", "r") @@ -143,7 +139,7 @@ out_file.close() def upgrade_to_120(): - print "Upgrading %s to version 120" % conf_file + print("Upgrading %s to version 120" % conf_file) subprocess.call(["mv", conf_file, conf_file+"-prev120~"]) in_file = open(conf_file+"-prev120~", "r") out_file = open(conf_file, "w") @@ -155,7 +151,7 @@ out_file.close() def upgrade_to_126(): - print "Upgrading %s to version 126" % conf_file + print("Upgrading %s to version 126" % conf_file) subprocess.call(["mv", conf_file, conf_file+"-prev126~"]) in_file = open(conf_file+"-prev126~", "r") out_file = open(conf_file, "w") @@ -169,7 +165,7 @@ out_file.close() def upgrade_to_127(): - print "Upgrading %s to version 127" % conf_file + print("Upgrading %s to version 127" % conf_file) os.rename(conf_file, conf_file + "-prev127~") in_file = open(conf_file + "-prev127~", "r") @@ -203,27 +199,27 @@ if __name__ == "__main__": old_version = re.sub(r'[~-].*', '', old_version) - if version_compare(old_version, "12") < 0: + if apt_pkg.version_compare(old_version, "12") < 0: upgrade_to_12() - if version_compare(old_version, "34") < 0: + if apt_pkg.version_compare(old_version, "34") < 0: upgrade_to_34() - if version_compare(old_version, "39") < 0: + if apt_pkg.version_compare(old_version, "39") < 0: upgrade_to_39() - if version_compare(old_version, "57") < 0: + if apt_pkg.version_compare(old_version, "57") < 0: upgrade_to_57() - if version_compare(old_version, "58") < 0: + if apt_pkg.version_compare(old_version, "58") < 0: upgrade_to_58() - if version_compare(old_version, "59") < 0: + if apt_pkg.version_compare(old_version, "59") < 0: upgrade_to_59() - if version_compare(old_version, "63") < 0: + if apt_pkg.version_compare(old_version, "63") < 0: upgrade_to_63() - if version_compare(old_version, "110") < 0: + if apt_pkg.version_compare(old_version, "110") < 0: upgrade_to_110() - if version_compare(old_version, "115") < 0: + if apt_pkg.version_compare(old_version, "115") < 0: upgrade_to_115() - if version_compare(old_version, "120") < 0: + if apt_pkg.version_compare(old_version, "120") < 0: upgrade_to_120() - if version_compare(old_version, "126") < 0: + if apt_pkg.version_compare(old_version, "126") < 0: upgrade_to_126() - if version_compare(old_version, "127") < 0: + if apt_pkg.version_compare(old_version, "127") < 0: upgrade_to_127() diff -Nru launchpad-buildd-141/lpbuildd/binarypackage.py launchpad-buildd-142/lpbuildd/binarypackage.py --- launchpad-buildd-141/lpbuildd/binarypackage.py 2016-02-18 14:43:10.000000000 +0000 +++ launchpad-buildd-142/lpbuildd/binarypackage.py 2016-12-09 17:59:12.000000000 +0000 @@ -1,4 +1,4 @@ -# Copyright 2009, 2010 Canonical Ltd. This software is licensed under the +# Copyright 2009-2016 Canonical Ltd. This software is licensed under the # GNU Affero General Public License version 3 (see the file LICENSE). from __future__ import absolute_import @@ -145,7 +145,10 @@ if self.arch_indep: args.append("-A") args.append(self._dscfile) - self.runSubProcess(self._sbuildpath, args) + env = dict(os.environ) + if not self.build_debug_symbols: + env["DEB_BUILD_OPTIONS"] = "noautodbgsym" + self.runSubProcess(self._sbuildpath, args, env=env) def getAvailablePackages(self): """Return the available binary packages in the chroot. @@ -316,7 +319,7 @@ print("Returning build status: OK") try: self.gatherResults() - except Exception, e: + except Exception as e: self._slave.log("Failed to gather results: %s" % e) self._slave.buildFail() self.alreadyfailed = True diff -Nru launchpad-buildd-141/lpbuildd/check_implicit_pointer_functions.py launchpad-buildd-142/lpbuildd/check_implicit_pointer_functions.py --- launchpad-buildd-141/lpbuildd/check_implicit_pointer_functions.py 2015-05-19 14:59:59.000000000 +0000 +++ launchpad-buildd-142/lpbuildd/check_implicit_pointer_functions.py 2016-12-09 17:59:36.000000000 +0000 @@ -31,7 +31,9 @@ # are any implicitly declared functions whose return values are later # interpreted as pointers. Those are almost guaranteed to cause # crashes. -# + +from __future__ import print_function + import re import sys @@ -90,14 +92,14 @@ "%s:%d" % (last_implicit_func, last_implicit_filename, last_implicit_linenum) errlist += err+"\n" - print err + print(err) if not warn_only: rv = 2 if len(errlist): if in_line: - print errlist - print """ + print(errlist) + print(""" Our automated build log filter detected the problem(s) above that will likely cause your package to segfault on architectures where the size of @@ -111,7 +113,7 @@ More information can be found at: http://wiki.debian.org/ImplicitPointerConversions - """ + """) sys.exit(rv) if __name__ == '__main__': diff -Nru launchpad-buildd-141/lpbuildd/pottery/generate_translation_templates.py launchpad-buildd-142/lpbuildd/pottery/generate_translation_templates.py --- launchpad-buildd-141/lpbuildd/pottery/generate_translation_templates.py 2011-11-14 22:04:35.000000000 +0000 +++ launchpad-buildd-142/lpbuildd/pottery/generate_translation_templates.py 2016-12-09 17:59:04.000000000 +0000 @@ -2,6 +2,8 @@ # Copyright 2010 Canonical Ltd. This software is licensed under the # GNU Affero General Public License version 3 (see the file LICENSE). +from __future__ import print_function + __metaclass__ = type import os.path @@ -100,10 +102,10 @@ if __name__ == '__main__': if len(sys.argv) < 3: - print "Usage: %s branch resultname [workdir]" % sys.argv[0] - print " 'branch' is a branch URL or directory." - print " 'resultname' is the name of the result tarball." - print " 'workdir' is a directory, defaults to HOME." + print("Usage: %s branch resultname [workdir]" % sys.argv[0]) + print(" 'branch' is a branch URL or directory.") + print(" 'resultname' is the name of the result tarball.") + print(" 'workdir' is a directory, defaults to HOME.") sys.exit(1) if len(sys.argv) == 4: workdir = sys.argv[3] diff -Nru launchpad-buildd-141/lpbuildd/pottery/intltool.py launchpad-buildd-142/lpbuildd/pottery/intltool.py --- launchpad-buildd-141/lpbuildd/pottery/intltool.py 2016-01-08 01:18:16.000000000 +0000 +++ launchpad-buildd-142/lpbuildd/pottery/intltool.py 2016-12-09 18:02:57.000000000 +0000 @@ -49,13 +49,13 @@ :returns: False if the directory does not exist, if an error occurred when executing intltool-update or if files are missing from POTFILES.in. True if all went fine and all files in POTFILES.in - actually exist. + actually exist. """ current_path = os.getcwd() try: os.chdir(path) - except OSError, e: + except OSError as e: # Abort nicely if the directory does not exist. if e.errno == errno.ENOENT: return False @@ -65,7 +65,7 @@ for unlink_name in ['missing', 'notexist']: try: os.unlink(unlink_name) - except OSError, e: + except OSError as e: # It's ok if the files are missing. if e.errno != errno.ENOENT: raise @@ -235,11 +235,8 @@ """Represent a config file and return variables defined in it.""" def __init__(self, file_or_name): - if isinstance(file_or_name, basestring): - conf_file = file(file_or_name) - else: - conf_file = file_or_name - self.content = conf_file.read() + with open(file_or_name) as conf_file: + self.content = conf_file.read() def _stripQuotes(self, identifier): """Strip surrounding quotes from `identifier`, if present. diff -Nru launchpad-buildd-141/lpbuildd/slave.py launchpad-buildd-142/lpbuildd/slave.py --- launchpad-buildd-141/lpbuildd/slave.py 2016-02-05 15:47:41.000000000 +0000 +++ launchpad-buildd-142/lpbuildd/slave.py 2016-12-09 17:58:30.000000000 +0000 @@ -13,7 +13,6 @@ import os import re import urllib2 -import warnings import xmlrpclib import apt @@ -23,11 +22,6 @@ from twisted.python import log from twisted.web import xmlrpc -# XXX cjwatson 2013-10-07: Remove when all builders are on Ubuntu 10.04 LTS -# or newer. -warnings.filterwarnings( - "ignore", "apt API not stable yet", category=FutureWarning) - devnull = open("/dev/null", "r") @@ -369,7 +363,7 @@ # testing for regressions. For now, just suppress # the PyLint warnings. # pylint: disable-msg=W0703 - except Exception, info: + except Exception as info: extra_info = 'Error accessing Librarian: %s' % info self.log(extra_info) else: @@ -639,12 +633,7 @@ self._builders = {} cache = apt.Cache() try: - try: - self._version = cache["python-lpbuildd"].installed.version - except AttributeError: - # XXX cjwatson 2013-10-07: Remove when all builders are on - # Ubuntu 10.04 LTS or newer. - self._version = cache["python-lpbuildd"].installedVersion + self._version = cache["python-lpbuildd"].installed.version except KeyError: self._version = None log.msg("Initialized") diff -Nru launchpad-buildd-141/lpbuildd/tests/test_binarypackage.py launchpad-buildd-142/lpbuildd/tests/test_binarypackage.py --- launchpad-buildd-141/lpbuildd/tests/test_binarypackage.py 2015-10-06 11:21:52.000000000 +0000 +++ launchpad-buildd-142/lpbuildd/tests/test_binarypackage.py 2016-12-09 16:15:25.000000000 +0000 @@ -1,4 +1,4 @@ -# Copyright 2013 Canonical Ltd. This software is licensed under the +# Copyright 2013-2016 Canonical Ltd. This software is licensed under the # GNU Affero General Public License version 3 (see the file LICENSE). __metaclass__ = type @@ -11,10 +11,12 @@ from debian.deb822 import PkgRelation from testtools import TestCase from testtools.matchers import ( + Contains, ContainsDict, Equals, Is, MatchesListwise, + Not, ) from twisted.internet.task import Clock @@ -48,8 +50,8 @@ self.iterators = [] self.arch_indep = False - def runSubProcess(self, path, command, iterate=None): - self.commands.append([path]+command) + def runSubProcess(self, path, command, iterate=None, env=None): + self.commands.append(([path] + command, env)) if iterate is None: iterate = self.iterate self.iterators.append(iterate) @@ -111,12 +113,14 @@ self.buildid, 'i386', 'warty', '-c', 'chroot:autobuild', '--arch=i386', '--dist=warty', '--purge=never', '--nolog', 'foo_1.dsc', - ], True) + ], final=True) self.assertFalse(self.slave.wasCalled('chrootFail')) - def assertState(self, state, command, final): + def assertState(self, state, command, env_matcher=None, final=False): self.assertEqual(state, self.getState()) - self.assertEqual(command, self.buildmanager.commands[-1]) + self.assertEqual(command, self.buildmanager.commands[-1][0]) + if env_matcher is not None: + self.assertThat(self.buildmanager.commands[-1][1], env_matcher) if final: self.assertEqual( self.buildmanager.iterate, self.buildmanager.iterators[-1]) @@ -130,14 +134,14 @@ self.assertState( BinaryPackageBuildState.SBUILD, ['sharepath/slavebin/scan-for-processes', 'scan-for-processes', - self.buildid], False) + self.buildid], final=False) def assertUnmountsSanely(self): self.buildmanager.iterateReap(self.getState(), 0) self.assertState( BinaryPackageBuildState.UMOUNT, ['sharepath/slavebin/umount-chroot', 'umount-chroot', - self.buildid], True) + self.buildid], final=True) def test_iterate(self): # The build manager iterates a normal build from start to finish. @@ -161,6 +165,63 @@ self.assertUnmountsSanely() self.assertFalse(self.slave.wasCalled('buildFail')) + def test_with_debug_symbols(self): + # A build with debug symbols sets up /CurrentlyBuilding + # appropriately, and does not pass DEB_BUILD_OPTIONS. + self.buildmanager.initiate( + {'foo_1.dsc': ''}, 'chroot.tar.gz', + {'distribution': 'ubuntu', 'suite': 'warty', + 'ogrecomponent': 'main', 'archive_purpose': 'PRIMARY', + 'build_debug_symbols': True}) + os.makedirs(self.chrootdir) + self.buildmanager._state = BinaryPackageBuildState.UPDATE + self.buildmanager.iterate(0) + self.assertState( + BinaryPackageBuildState.SBUILD, + ['sharepath/slavebin/sbuild-package', 'sbuild-package', + self.buildid, 'i386', 'warty', '-c', 'chroot:autobuild', + '--arch=i386', '--dist=warty', '--purge=never', '--nolog', + 'foo_1.dsc'], + env_matcher=Not(Contains('DEB_BUILD_OPTIONS')), final=True) + self.assertFalse(self.slave.wasCalled('chrootFail')) + with open(os.path.join(self.chrootdir, 'CurrentlyBuilding')) as cb: + self.assertEqual(dedent("""\ + Package: foo + Component: main + Suite: warty + Purpose: PRIMARY + Build-Debug-Symbols: yes + """), cb.read()) + + def test_without_debug_symbols(self): + # A build with debug symbols sets up /CurrentlyBuilding + # appropriately, and passes DEB_BUILD_OPTIONS=noautodbgsym. + self.buildmanager.initiate( + {'foo_1.dsc': ''}, 'chroot.tar.gz', + {'distribution': 'ubuntu', 'suite': 'warty', + 'ogrecomponent': 'main', 'archive_purpose': 'PRIMARY', + 'build_debug_symbols': False}) + os.makedirs(self.chrootdir) + self.buildmanager._state = BinaryPackageBuildState.UPDATE + self.buildmanager.iterate(0) + self.assertState( + BinaryPackageBuildState.SBUILD, + ['sharepath/slavebin/sbuild-package', 'sbuild-package', + self.buildid, 'i386', 'warty', '-c', 'chroot:autobuild', + '--arch=i386', '--dist=warty', '--purge=never', '--nolog', + 'foo_1.dsc'], + env_matcher=ContainsDict( + {'DEB_BUILD_OPTIONS': Equals('noautodbgsym')}), + final=True) + self.assertFalse(self.slave.wasCalled('chrootFail')) + with open(os.path.join(self.chrootdir, 'CurrentlyBuilding')) as cb: + self.assertEqual(dedent("""\ + Package: foo + Component: main + Suite: warty + Purpose: PRIMARY + """), cb.read()) + def test_abort_sbuild(self): # Aborting sbuild kills processes in the chroot. self.startBuild() @@ -170,7 +231,7 @@ self.assertState( BinaryPackageBuildState.SBUILD, ['sharepath/slavebin/scan-for-processes', 'scan-for-processes', - self.buildid], False) + self.buildid], final=False) self.assertFalse(self.slave.wasCalled('buildFail')) # If reaping completes successfully, the build manager returns @@ -189,7 +250,7 @@ self.assertState( BinaryPackageBuildState.SBUILD, ['sharepath/slavebin/scan-for-processes', 'scan-for-processes', - self.buildid], False) + self.buildid], final=False) self.assertFalse(self.slave.wasCalled('builderFail')) reap_subprocess = self.buildmanager._subprocess @@ -213,7 +274,7 @@ self.assertState( BinaryPackageBuildState.UMOUNT, ['sharepath/slavebin/umount-chroot', 'umount-chroot', - self.buildid], True) + self.buildid], final=True) def test_abort_between_subprocesses(self): # If a build is aborted between subprocesses, the build manager @@ -227,13 +288,13 @@ self.assertState( BinaryPackageBuildState.INIT, ['sharepath/slavebin/scan-for-processes', 'scan-for-processes', - self.buildid], False) + self.buildid], final=False) self.buildmanager.iterate(0) self.assertState( BinaryPackageBuildState.CLEANUP, ['sharepath/slavebin/remove-build', 'remove-build', self.buildid], - True) + final=True) self.assertFalse(self.slave.wasCalled('builderFail')) def test_missing_changes(self): diff -Nru launchpad-buildd-141/sbuild-package launchpad-buildd-142/sbuild-package --- launchpad-buildd-141/sbuild-package 2016-03-03 16:27:33.000000000 +0000 +++ launchpad-buildd-142/sbuild-package 2016-12-09 16:15:25.000000000 +0000 @@ -67,7 +67,7 @@ echo "Initiating build $BUILDID with $NR_PROCESSORS jobs across $ACTUAL_NR_PROCESSORS processor cores." if [ $NR_PROCESSORS -gt 1 ]; then - export DEB_BUILD_OPTIONS=parallel=$NR_PROCESSORS + export DEB_BUILD_OPTIONS="${DEB_BUILD_OPTIONS:+$DEB_BUILD_OPTIONS }parallel=$NR_PROCESSORS" fi cd "$HOME/build-$BUILDID" diff -Nru launchpad-buildd-141/test_buildd_generatetranslationtemplates launchpad-buildd-142/test_buildd_generatetranslationtemplates --- launchpad-buildd-141/test_buildd_generatetranslationtemplates 2011-11-14 22:04:35.000000000 +0000 +++ launchpad-buildd-142/test_buildd_generatetranslationtemplates 2016-12-09 17:57:48.000000000 +0000 @@ -5,29 +5,31 @@ # Test script for manual use only. Exercises the # TranslationTemplatesBuildManager through XMLRPC. +from __future__ import print_function + import sys from xmlrpclib import ServerProxy if len(sys.argv) != 2: - print "Usage: %s " % sys.argv[0] - print "Where is the SHA1 of the chroot tarball to use." - print "The chroot tarball must be in the local Librarian." - print "See https://dev.launchpad.net/Soyuz/HowToUseSoyuzLocally" + print("Usage: %s " % sys.argv[0]) + print("Where is the SHA1 of the chroot tarball to use.") + print("The chroot tarball must be in the local Librarian.") + print("See https://dev.launchpad.net/Soyuz/HowToUseSoyuzLocally") sys.exit(1) chroot_sha1 = sys.argv[1] proxy = ServerProxy('http://localhost:8221/rpc') -print proxy.info() -print proxy.status() +print(proxy.info()) +print(proxy.status()) buildid = '1-2' build_type = 'translation-templates' filemap = {} args = {'branch_url': 'no-branch-here-sorry'} -print proxy.build(buildid, build_type, chroot_sha1, filemap, args) +print(proxy.build(buildid, build_type, chroot_sha1, filemap, args)) #status = proxy.status() #for filename, sha1 in status[3].iteritems(): -# print filename +# print(filename) #proxy.clean() diff -Nru launchpad-buildd-141/test_buildd_recipe launchpad-buildd-142/test_buildd_recipe --- launchpad-buildd-141/test_buildd_recipe 2011-11-14 22:04:35.000000000 +0000 +++ launchpad-buildd-142/test_buildd_recipe 2016-12-09 17:58:18.000000000 +0000 @@ -5,6 +5,11 @@ # This is a script to do end-to-end testing of the buildd with a bzr-builder # recipe, without involving the BuilderBehaviour. +from __future__ import print_function + +import sys +from xmlrpclib import ServerProxy + country_code = 'us' apt_cacher_ng_host = 'stumpy' distroseries_name = 'maverick' @@ -17,18 +22,15 @@ prefix += '%s:3142/' % apt_cacher_ng_host return '%s%s %s %s' % (prefix, host, distroseries_name, suites) -import sys -from xmlrpclib import ServerProxy - proxy = ServerProxy('http://localhost:8221/rpc') -print proxy.echo('Hello World') -print proxy.info() +print(proxy.echo('Hello World')) +print(proxy.info()) status = proxy.status() -print status +print(status) if status[0] != 'BuilderStatus.IDLE': - print "Aborting due to non-IDLE builder." + print("Aborting due to non-IDLE builder.") sys.exit(1) -print proxy.build( +print(proxy.build( '1-2', 'sourcepackagerecipe', '1ef177161c3cb073e66bf1550931c6fbaa0a94b0', {}, {'author_name': u'Steve\u1234', 'author_email': 'stevea@example.org', @@ -41,8 +43,8 @@ deb_line('%s.archive.ubuntu.com/ubuntu' % country_code, 'main universe'), deb_line('ppa.launchpad.net/launchpad/bzr-builder-dev/ubuntu', - 'main'),]}) + 'main'),]})) #status = proxy.status() #for filename, sha1 in status[3].iteritems(): -# print filename +# print(filename) #proxy.clean()