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
1=== modified file '.bzrignore'
2--- .bzrignore 2010-06-24 17:19:09 +0000
3+++ .bzrignore 2010-06-30 18:09:31 +0000
4@@ -69,3 +69,10 @@
5 apidocs
6 twistd.pid
7 lib/canonical/launchpad/apidoc
8+lib/canonical/launchpad-buildd_*.dsc
9+lib/canonical/launchpad-buildd_*.tar.gz
10+lib/canonical/launchpad-buildd_*_all.deb
11+lib/canonical/launchpad-buildd_*.changes
12+lib/canonical/launchpad-buildd_*_source.build
13+lib/canonical/launchpad-buildd_*_source.changes
14+lib/canonical/buildd/debian/*
15
16=== modified file 'lib/canonical/buildd/buildrecipe'
17--- lib/canonical/buildd/buildrecipe 2010-06-07 19:11:49 +0000
18+++ lib/canonical/buildd/buildrecipe 2010-06-30 18:09:31 +0000
19@@ -7,6 +7,7 @@
20 __metaclass__ = type
21
22
23+import os
24 import os.path
25 import pwd
26 from subprocess import call
27@@ -24,7 +25,7 @@
28 """Builds a package from a recipe."""
29
30 def __init__(self, build_id, author_name, author_email,
31- suite, distroseries_name):
32+ suite, distroseries_name, component, archive_purpose):
33 """Constructor.
34
35 :param build_id: The id of the build (a str).
36@@ -33,8 +34,10 @@
37 :param suite: The suite the package should be built for (a str).
38 """
39 self.build_id = build_id
40- self.author_name = author_name
41+ self.author_name = author_name.decode('utf-8')
42 self.author_email = author_email
43+ self.archive_purpose = archive_purpose
44+ self.component = component
45 self.distroseries_name = distroseries_name
46 self.suite = suite
47 self.base_branch = None
48@@ -66,9 +69,9 @@
49 self.tree_path_relative, 'manifest')
50 retcode = self.chroot([
51 'sudo', '-u', self.username, 'DEBEMAIL=%s' % self.author_email,
52- 'DEBFULLNAME=%s' % self.author_name, 'bzr', 'dailydeb',
53- '--no-build', recipe_path_relative, self.tree_path_relative,
54- '--manifest', manifest_path_relative,
55+ 'DEBFULLNAME=%s' % self.author_name.encode('utf-8'), 'bzr',
56+ 'dailydeb', '--no-build', recipe_path_relative,
57+ self.tree_path_relative, '--manifest', manifest_path_relative,
58 '--append-version', '~%s1' % self.distroseries_name])
59 if retcode != 0:
60 return retcode
61@@ -78,8 +81,27 @@
62 source)
63 return retcode
64
65+ def getPackageName(self):
66+ source_dir = os.path.join(
67+ self.chroot_path, self.source_dir_relative.lstrip('/'))
68+ changelog = os.path.join(source_dir, 'debian/changelog')
69+ return open(changelog, 'r').readline().split(' ')[0]
70+
71 def installBuildDeps(self):
72 """Install the build-depends of the source tree."""
73+ package = self.getPackageName()
74+ currently_building_path = os.path.join(
75+ self.chroot_path, 'CurrentlyBuilding')
76+ currently_building_contents = (
77+ 'Package: %s\n'
78+ 'Suite: %s\n'
79+ 'Component: %s\n'
80+ 'Purpose: %s\n'
81+ 'Build-Debug-Symbols: no\n' %
82+ (package, self.suite, self.component, self.archive_purpose))
83+ currently_building = open(currently_building_path, 'w')
84+ currently_building.write(currently_building_contents)
85+ currently_building.close()
86 return self.chroot(['sh', '-c', 'cd %s &&'
87 '/usr/lib/pbuilder/pbuilder-satisfydepends'
88 % self.source_dir_relative])
89
90=== modified file 'lib/canonical/buildd/sourcepackagerecipe.py'
91--- lib/canonical/buildd/sourcepackagerecipe.py 2010-06-07 19:11:49 +0000
92+++ lib/canonical/buildd/sourcepackagerecipe.py 2010-06-30 18:09:31 +0000
93@@ -82,20 +82,13 @@
94
95 def doRunBuild(self):
96 """Run the build process to build the source package."""
97- currently_building = get_build_path(
98- self._buildid, 'chroot-autobuild/CurrentlyBuilding')
99- splat_file(currently_building,
100- 'Suite: %s\n'
101- 'Component: %s\n'
102- 'Purpose: %s\n'
103- 'Build-Debug-Symbols: no\n' %
104- (self.suite, self.component, self.archive_purpose))
105 os.makedirs(get_chroot_path(self._buildid, 'work'))
106 recipe_path = get_chroot_path(self._buildid, 'work/recipe')
107 splat_file(recipe_path, self.recipe_text)
108 args = [
109- "buildrecipe.py", self._buildid, self.author_name,
110- self.author_email, self.suite, self.distroseries_name]
111+ "buildrecipe.py", self._buildid, self.author_name.encode('utf-8'),
112+ self.author_email, self.suite, self.distroseries_name,
113+ self.component, self.archive_purpose]
114 self.runSubProcess(self.build_recipe_path, args)
115
116 def iterate_BUILD_RECIPE(self, retcode):
117
118=== modified file 'lib/canonical/buildd/test_buildd_recipe'
119--- lib/canonical/buildd/test_buildd_recipe 2010-01-14 20:34:11 +0000
120+++ lib/canonical/buildd/test_buildd_recipe 2010-06-30 18:09:31 +0000
121@@ -5,25 +5,43 @@
122 # This is a script to do end-to-end testing of the buildd with a bzr-builder
123 # recipe, without involving the BuilderBehaviour.
124
125+country_code = 'us'
126+apt_cacher_ng_host = 'stumpy'
127+distroseries_name = 'lucid'
128+recipe_text = """# bzr-builder format 0.2 deb-version 0+{revno}
129+http://bazaar.launchpad.dev/~ppa-user/+junk/wakeonlan"""
130+
131+def deb_line(host, suites):
132+ prefix = 'deb http://'
133+ if apt_cacher_ng_host != None:
134+ prefix += '%s:3142/' % apt_cacher_ng_host
135+ return '%s%s %s %s' % (prefix, host, distroseries_name, suites)
136+
137+import sys
138 from xmlrpclib import ServerProxy
139+
140 proxy = ServerProxy('http://localhost:8221/rpc')
141 print proxy.echo('Hello World')
142 print proxy.info()
143-print proxy.status()
144-recipe_text = """# bzr-builder format 0.2 deb-version something
145-http://bazaar.launchpad.net/~james-w/bzr-builder/trunk/
146-merge packaging http://bazaar.launchpad.net/~james-w/bzr-builder/packaging"""
147+status = proxy.status()
148+print status
149+if status[0] != 'BuilderStatus.IDLE':
150+ print "Aborting due to non-IDLE builder."
151+ sys.exit(1)
152 print proxy.build(
153- '1-2', 'sourcepackagerecipe', 'f2afc3c0507dffba181638d70ae55ac675679460',
154- {}, {'author_name': 'Steve',
155+ '1-2', 'sourcepackagerecipe', '1ef177161c3cb073e66bf1550931c6fbaa0a94b0',
156+ {}, {'author_name': u'Steve\u1234',
157 'author_email': 'stevea@example.org',
158- 'package_name': 'bzr-builder',
159- 'suite': 'lucid',
160+ 'suite': distroseries_name,
161+ 'distroseries_name': distroseries_name,
162 'ogrecomponent': 'universe',
163 'archive_purpose': 'puppies',
164 'recipe_text': recipe_text,
165 'archives': [
166- 'deb http://nz.archive.ubuntu.com/ubuntu lucid main universe']})
167+ deb_line('%s.archive.ubuntu.com/ubuntu' % country_code,
168+ 'main universe'),
169+ deb_line('ppa.launchpad.net/launchpad/bzr-builder-dev/ubuntu',
170+ 'main'),]})
171 #status = proxy.status()
172 #for filename, sha1 in status[3].iteritems():
173 # print filename