Merge lp:~abentley/launchpad/fix-stuck into lp:launchpad

Proposed by Aaron Bentley
Status: Merged
Approved by: Edwin Grubbs
Approved revision: no longer in the source branch.
Merged at revision: 11082
Proposed branch: lp:~abentley/launchpad/fix-stuck
Merge into: lp:launchpad
Diff against target: 173 lines (+64/-24)
4 files modified
.bzrignore (+7/-0)
lib/canonical/buildd/buildrecipe (+27/-5)
lib/canonical/buildd/sourcepackagerecipe.py (+3/-10)
lib/canonical/buildd/test_buildd_recipe (+27/-9)
To merge this branch: bzr merge lp:~abentley/launchpad/fix-stuck
Reviewer Review Type Date Requested Status
Edwin Grubbs (community) Approve
Review via email: mp+28924@code.launchpad.net

Commit message

Fix bug #598258 by encoding author name.

Description of the change

= Summary =
Fix bug #598258: recipe build hangs (~deejay1/+recipe/daily).

== Proposed fix ==
Encode the author's name as utf-8.

== Pre-implementation notes ==
None

== Implementation details ==
In order to test this locally, I had to fix the test script test_buildd_recipe.
As well as fixing it, I added support for apt_cacher_ng, to avoid excessive
downloads. I changed it to abort early when it can't proceeed. I updated the
chroot md5sum to the current lucid chroot.

It turns out that, for reasons unknown, pbuilder objects to the Package: line
being missing from the /CurrentlyBuilding file when testing locally. (But not,
it appears, when running on production builders.) So I had to change
CurrentlyBuilding to be created by the buildrecipe script, after the recipe has
been executed, using the package name in debian/changelog (which is
authoritative).

I also added the build results to .bzrignore.

== Tests ==
test_buildd_recipe

== Demo and Q/A ==
Change your display name to include non-ascii characters. Create a recipe and
request a build. It should work completely.

= Launchpad lint =

Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.

Linting changed files:
  .bzrignore
  lib/canonical/buildd/sourcepackagerecipe.py
  lib/canonical/buildd/buildrecipe
  lib/canonical/buildd/test_buildd_recipe

To post a comment you must log in.
Revision history for this message
Edwin Grubbs (edwin-grubbs) wrote :

Hi Aaron,

This looks good.

merge-approved

-Edwin

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file '.bzrignore'
--- .bzrignore 2010-06-24 17:19:09 +0000
+++ .bzrignore 2010-06-30 18:09:31 +0000
@@ -69,3 +69,10 @@
69apidocs69apidocs
70twistd.pid70twistd.pid
71lib/canonical/launchpad/apidoc71lib/canonical/launchpad/apidoc
72lib/canonical/launchpad-buildd_*.dsc
73lib/canonical/launchpad-buildd_*.tar.gz
74lib/canonical/launchpad-buildd_*_all.deb
75lib/canonical/launchpad-buildd_*.changes
76lib/canonical/launchpad-buildd_*_source.build
77lib/canonical/launchpad-buildd_*_source.changes
78lib/canonical/buildd/debian/*
7279
=== modified file 'lib/canonical/buildd/buildrecipe'
--- lib/canonical/buildd/buildrecipe 2010-06-07 19:11:49 +0000
+++ lib/canonical/buildd/buildrecipe 2010-06-30 18:09:31 +0000
@@ -7,6 +7,7 @@
7__metaclass__ = type7__metaclass__ = type
88
99
10import os
10import os.path11import os.path
11import pwd12import pwd
12from subprocess import call13from subprocess import call
@@ -24,7 +25,7 @@
24 """Builds a package from a recipe."""25 """Builds a package from a recipe."""
2526
26 def __init__(self, build_id, author_name, author_email,27 def __init__(self, build_id, author_name, author_email,
27 suite, distroseries_name):28 suite, distroseries_name, component, archive_purpose):
28 """Constructor.29 """Constructor.
2930
30 :param build_id: The id of the build (a str).31 :param build_id: The id of the build (a str).
@@ -33,8 +34,10 @@
33 :param suite: The suite the package should be built for (a str).34 :param suite: The suite the package should be built for (a str).
34 """35 """
35 self.build_id = build_id36 self.build_id = build_id
36 self.author_name = author_name37 self.author_name = author_name.decode('utf-8')
37 self.author_email = author_email38 self.author_email = author_email
39 self.archive_purpose = archive_purpose
40 self.component = component
38 self.distroseries_name = distroseries_name41 self.distroseries_name = distroseries_name
39 self.suite = suite42 self.suite = suite
40 self.base_branch = None43 self.base_branch = None
@@ -66,9 +69,9 @@
66 self.tree_path_relative, 'manifest')69 self.tree_path_relative, 'manifest')
67 retcode = self.chroot([70 retcode = self.chroot([
68 'sudo', '-u', self.username, 'DEBEMAIL=%s' % self.author_email,71 'sudo', '-u', self.username, 'DEBEMAIL=%s' % self.author_email,
69 'DEBFULLNAME=%s' % self.author_name, 'bzr', 'dailydeb',72 'DEBFULLNAME=%s' % self.author_name.encode('utf-8'), 'bzr',
70 '--no-build', recipe_path_relative, self.tree_path_relative,73 'dailydeb', '--no-build', recipe_path_relative,
71 '--manifest', manifest_path_relative,74 self.tree_path_relative, '--manifest', manifest_path_relative,
72 '--append-version', '~%s1' % self.distroseries_name])75 '--append-version', '~%s1' % self.distroseries_name])
73 if retcode != 0:76 if retcode != 0:
74 return retcode77 return retcode
@@ -78,8 +81,27 @@
78 source)81 source)
79 return retcode82 return retcode
8083
84 def getPackageName(self):
85 source_dir = os.path.join(
86 self.chroot_path, self.source_dir_relative.lstrip('/'))
87 changelog = os.path.join(source_dir, 'debian/changelog')
88 return open(changelog, 'r').readline().split(' ')[0]
89
81 def installBuildDeps(self):90 def installBuildDeps(self):
82 """Install the build-depends of the source tree."""91 """Install the build-depends of the source tree."""
92 package = self.getPackageName()
93 currently_building_path = os.path.join(
94 self.chroot_path, 'CurrentlyBuilding')
95 currently_building_contents = (
96 'Package: %s\n'
97 'Suite: %s\n'
98 'Component: %s\n'
99 'Purpose: %s\n'
100 'Build-Debug-Symbols: no\n' %
101 (package, self.suite, self.component, self.archive_purpose))
102 currently_building = open(currently_building_path, 'w')
103 currently_building.write(currently_building_contents)
104 currently_building.close()
83 return self.chroot(['sh', '-c', 'cd %s &&'105 return self.chroot(['sh', '-c', 'cd %s &&'
84 '/usr/lib/pbuilder/pbuilder-satisfydepends'106 '/usr/lib/pbuilder/pbuilder-satisfydepends'
85 % self.source_dir_relative])107 % self.source_dir_relative])
86108
=== modified file 'lib/canonical/buildd/sourcepackagerecipe.py'
--- lib/canonical/buildd/sourcepackagerecipe.py 2010-06-07 19:11:49 +0000
+++ lib/canonical/buildd/sourcepackagerecipe.py 2010-06-30 18:09:31 +0000
@@ -82,20 +82,13 @@
8282
83 def doRunBuild(self):83 def doRunBuild(self):
84 """Run the build process to build the source package."""84 """Run the build process to build the source package."""
85 currently_building = get_build_path(
86 self._buildid, 'chroot-autobuild/CurrentlyBuilding')
87 splat_file(currently_building,
88 'Suite: %s\n'
89 'Component: %s\n'
90 'Purpose: %s\n'
91 'Build-Debug-Symbols: no\n' %
92 (self.suite, self.component, self.archive_purpose))
93 os.makedirs(get_chroot_path(self._buildid, 'work'))85 os.makedirs(get_chroot_path(self._buildid, 'work'))
94 recipe_path = get_chroot_path(self._buildid, 'work/recipe')86 recipe_path = get_chroot_path(self._buildid, 'work/recipe')
95 splat_file(recipe_path, self.recipe_text)87 splat_file(recipe_path, self.recipe_text)
96 args = [88 args = [
97 "buildrecipe.py", self._buildid, self.author_name,89 "buildrecipe.py", self._buildid, self.author_name.encode('utf-8'),
98 self.author_email, self.suite, self.distroseries_name]90 self.author_email, self.suite, self.distroseries_name,
91 self.component, self.archive_purpose]
99 self.runSubProcess(self.build_recipe_path, args)92 self.runSubProcess(self.build_recipe_path, args)
10093
101 def iterate_BUILD_RECIPE(self, retcode):94 def iterate_BUILD_RECIPE(self, retcode):
10295
=== modified file 'lib/canonical/buildd/test_buildd_recipe'
--- lib/canonical/buildd/test_buildd_recipe 2010-01-14 20:34:11 +0000
+++ lib/canonical/buildd/test_buildd_recipe 2010-06-30 18:09:31 +0000
@@ -5,25 +5,43 @@
5# This is a script to do end-to-end testing of the buildd with a bzr-builder5# This is a script to do end-to-end testing of the buildd with a bzr-builder
6# recipe, without involving the BuilderBehaviour.6# recipe, without involving the BuilderBehaviour.
77
8country_code = 'us'
9apt_cacher_ng_host = 'stumpy'
10distroseries_name = 'lucid'
11recipe_text = """# bzr-builder format 0.2 deb-version 0+{revno}
12http://bazaar.launchpad.dev/~ppa-user/+junk/wakeonlan"""
13
14def deb_line(host, suites):
15 prefix = 'deb http://'
16 if apt_cacher_ng_host != None:
17 prefix += '%s:3142/' % apt_cacher_ng_host
18 return '%s%s %s %s' % (prefix, host, distroseries_name, suites)
19
20import sys
8from xmlrpclib import ServerProxy21from xmlrpclib import ServerProxy
22
9proxy = ServerProxy('http://localhost:8221/rpc')23proxy = ServerProxy('http://localhost:8221/rpc')
10print proxy.echo('Hello World')24print proxy.echo('Hello World')
11print proxy.info()25print proxy.info()
12print proxy.status()26status = proxy.status()
13recipe_text = """# bzr-builder format 0.2 deb-version something27print status
14http://bazaar.launchpad.net/~james-w/bzr-builder/trunk/28if status[0] != 'BuilderStatus.IDLE':
15merge packaging http://bazaar.launchpad.net/~james-w/bzr-builder/packaging"""29 print "Aborting due to non-IDLE builder."
30 sys.exit(1)
16print proxy.build(31print proxy.build(
17 '1-2', 'sourcepackagerecipe', 'f2afc3c0507dffba181638d70ae55ac675679460',32 '1-2', 'sourcepackagerecipe', '1ef177161c3cb073e66bf1550931c6fbaa0a94b0',
18 {}, {'author_name': 'Steve',33 {}, {'author_name': u'Steve\u1234',
19 'author_email': 'stevea@example.org',34 'author_email': 'stevea@example.org',
20 'package_name': 'bzr-builder',35 'suite': distroseries_name,
21 'suite': 'lucid',36 'distroseries_name': distroseries_name,
22 'ogrecomponent': 'universe',37 'ogrecomponent': 'universe',
23 'archive_purpose': 'puppies',38 'archive_purpose': 'puppies',
24 'recipe_text': recipe_text,39 'recipe_text': recipe_text,
25 'archives': [40 'archives': [
26 'deb http://nz.archive.ubuntu.com/ubuntu lucid main universe']})41 deb_line('%s.archive.ubuntu.com/ubuntu' % country_code,
42 'main universe'),
43 deb_line('ppa.launchpad.net/launchpad/bzr-builder-dev/ubuntu',
44 'main'),]})
27#status = proxy.status()45#status = proxy.status()
28#for filename, sha1 in status[3].iteritems():46#for filename, sha1 in status[3].iteritems():
29# print filename47# print filename