launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #00846
[Merge] lp:~abentley/launchpad/allow-0.3 into lp:launchpad/devel
Aaron Bentley has proposed merging lp:~abentley/launchpad/allow-0.3 into lp:launchpad/devel.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
= Summary =
Fix bug #479705 by supporting recipe format 0.3
== Proposed fix ==
Make format 0.3 the default everywhere
== Pre-implementation notes ==
None
== Implementation details ==
None
== Tests ==
bin/test test_sourcepackagerecipe
== Demo and Q/A ==
Create a recipe in 0.3 format using a nest-part instruction. Build it.
= Launchpad lint =
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/code/model/sourcepackagerecipedata.py
lib/lp/code/model/tests/test_sourcepackagerecipe.py
lib/canonical/buildd/buildrecipe
lib/canonical/buildd/debian/control
lib/lp/code/browser/tests/test_sourcepackagerecipe.py
lib/lp/code/interfaces/sourcepackagerecipe.py
lib/lp/code/model/tests/test_recipebuilder.py
./lib/lp/code/model/sourcepackagerecipedata.py
168: E202 whitespace before ')'
./lib/lp/code/model/tests/test_sourcepackagerecipe.py
285: E231 missing whitespace after ','
309: E231 missing whitespace after ','
317: E231 missing whitespace after ','
324: E231 missing whitespace after ','
332: E231 missing whitespace after ','
370: E231 missing whitespace after ','
430: E231 missing whitespace after ','
510: E301 expected 1 blank line, found 0
731: Line exceeds 78 characters.
./lib/canonical/buildd/debian/control
11: Line exceeds 78 characters.
./lib/lp/code/browser/tests/test_sourcepackagerecipe.py
275: E231 missing whitespace after ','
./lib/lp/code/interfaces/sourcepackagerecipe.py
77: E231 missing whitespace after ','
154: E202 whitespace before ')'
154: E231 missing whitespace after ','
./lib/lp/code/model/tests/test_recipebuilder.py
169: E501 line too long (82 characters)
176: E501 line too long (80 characters)
203: E501 line too long (80 characters)
245: E301 expected 1 blank line, found 2
82: Line exceeds 78 characters.
169: Line exceeds 78 characters.
176: Line exceeds 78 characters.
203: Line exceeds 78 characters.
--
https://code.launchpad.net/~abentley/launchpad/allow-0.3/+merge/34477
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~abentley/launchpad/allow-0.3 into lp:launchpad/devel.
=== modified file 'lib/canonical/buildd/buildrecipe'
--- lib/canonical/buildd/buildrecipe 2010-08-20 17:23:15 +0000
+++ lib/canonical/buildd/buildrecipe 2010-09-02 20:06:30 +0000
@@ -55,8 +55,8 @@
"""
# XXX: AaronBentley 2010-07-07 bug=602463: pbuilder uses aptitude but
# does not depend on it.
- return self.chroot(['apt-get', 'install', '-y', 'pbuilder',
- 'bzr-builder', 'sudo', 'aptitude'])
+ return self.chroot([
+ 'apt-get', 'install', '-y', 'pbuilder', 'aptitude'])
def buildTree(self):
"""Build the recipe into a source tree.
@@ -65,37 +65,35 @@
:return: a retcode from `bzr dailydeb`.
"""
assert not os.path.exists(self.tree_path)
- recipe_path_relative = os.path.join(self.work_dir_relative, 'recipe')
- self.tree_path_relative = os.path.join(self.work_dir_relative, 'tree')
- manifest_path_relative = os.path.join(
- self.tree_path_relative, 'manifest')
- recipe_path = os.path.join(self.chroot_path, recipe_path_relative[1:])
+ recipe_path = os.path.join(self.work_dir, 'recipe')
+ manifest_path = os.path.join(self.tree_path, 'manifest')
recipe_file = open(recipe_path, 'rb')
try:
recipe = recipe_file.read()
finally:
recipe_file.close()
- # As of bzr 2.2, a defined identity is needed. In this case, we're using
- # buildd@<hostname>.
+ # As of bzr 2.2, a defined identity is needed. In this case, we're
+ # using buildd@<hostname>.
hostname = socket.gethostname()
bzr_email = 'buildd@%s' % hostname
print 'Building recipe:'
print recipe
- retcode = self.chroot([
- 'sudo', '-i', '-u', self.username, 'DEBEMAIL=%s' % self.author_email,
- 'DEBFULLNAME=%s' % self.author_name.encode('utf-8'),
- 'BZR_EMAIL=%s' % bzr_email, 'bzr',
- 'dailydeb', '--no-build', recipe_path_relative,
- self.tree_path_relative, '--manifest', manifest_path_relative,
- '--append-version', '~%s1' % self.distroseries_name],
- echo=True)
+ sys.stdout.flush()
+ env = {
+ 'DEBEMAIL': self.author_email,
+ 'DEBFULLNAME': self.author_name.encode('utf-8'),
+ 'BZR_EMAIL': bzr_email}
+ retcode = call([
+ 'bzr', 'dailydeb', '--safe', '--no-build', recipe_path,
+ self.tree_path, '--manifest', manifest_path,
+ '--append-version', '~%s1' % self.distroseries_name], env=env)
if retcode != 0:
return retcode
(source,) = [name for name in os.listdir(self.tree_path)
if name != 'manifest']
- self.source_dir_relative = os.path.join(self.tree_path_relative,
- source)
+ self.source_dir_relative = os.path.join(
+ self.work_dir_relative, 'tree', source)
return retcode
def getPackageName(self):
@@ -163,10 +161,10 @@
if __name__ == '__main__':
builder = RecipeBuilder(*sys.argv[1:])
+ if builder.buildTree() != 0:
+ sys.exit(RETCODE_FAILURE_BUILD_TREE)
if builder.install() != 0:
sys.exit(RETCODE_FAILURE_INSTALL)
- if builder.buildTree() != 0:
- sys.exit(RETCODE_FAILURE_BUILD_TREE)
if builder.installBuildDeps() != 0:
sys.exit(RETCODE_FAILURE_INSTALL_BUILD_DEPS)
if builder.buildSourcePackage() != 0:
=== modified file 'lib/canonical/buildd/debian/control'
--- lib/canonical/buildd/debian/control 2010-07-22 16:15:58 +0000
+++ lib/canonical/buildd/debian/control 2010-09-02 20:06:30 +0000
@@ -8,7 +8,7 @@
Package: launchpad-buildd
Section: misc
Architecture: all
-Depends: python-twisted-core, python-twisted-web, debootstrap, dpkg-dev, linux32, file, bzip2, sudo, ntpdate, adduser, apt-transport-https, lsb-release, apache2, ${misc:Depends}
+Depends: python-twisted-core, python-twisted-web, debootstrap, dpkg-dev, linux32, file, bzip2, sudo, ntpdate, adduser, apt-transport-https, lsb-release, apache2, bzr-builder (>=0.5), ${misc:Depends}
Description: Launchpad buildd slave
This is the launchpad buildd slave package. It contains everything needed to
get a launchpad buildd going apart from the database manipulation required to
=== modified file 'lib/lp/code/browser/tests/test_sourcepackagerecipe.py'
--- lib/lp/code/browser/tests/test_sourcepackagerecipe.py 2010-09-01 03:25:36 +0000
+++ lib/lp/code/browser/tests/test_sourcepackagerecipe.py 2010-09-02 20:06:30 +0000
@@ -146,7 +146,7 @@
.*
Recipe contents
- # bzr-builder format 0.2 deb-version 0\+\{revno\}
+ # bzr-builder format 0.3 deb-version 0\+\{revno\}
lp://dev/~chef/ratatouille/veggies"""
main_text = extract_text(find_main_content(browser.contents))
self.assertTextMatchesExpressionIgnoreWhitespace(
@@ -267,7 +267,7 @@
browser = self.createRecipe(
dedent('''
- # bzr-builder format 0.2 deb-version 0+{revno}
+ # bzr-builder format 0.3 deb-version 0+{revno}
%(branch)s
merge %(package_branch)s
''' % {
@@ -403,7 +403,7 @@
.*
Recipe contents
- # bzr-builder format 0.2 deb-version 0\+\{revno\}
+ # bzr-builder format 0.3 deb-version 0\+\{revno\}
lp://dev/~chef/ratatouille/meat"""
main_text = extract_text(find_main_content(browser.contents))
self.assertTextMatchesExpressionIgnoreWhitespace(
@@ -513,7 +513,7 @@
.*
Recipe contents
- # bzr-builder format 0.2 deb-version 0\+\{revno\}
+ # bzr-builder format 0.3 deb-version 0\+\{revno\}
lp://dev/~chef/ratatouille/meat"""
main_text = extract_text(find_main_content(browser.contents))
self.assertTextMatchesExpressionIgnoreWhitespace(
@@ -567,7 +567,7 @@
Request build\(s\)
Recipe contents
- # bzr-builder format 0.2 deb-version 0\+\{revno\}
+ # bzr-builder format 0.3 deb-version 0\+\{revno\}
lp://dev/~chef/chocolate/cake""", self.getMainText(recipe))
def test_index_no_builds(self):
=== modified file 'lib/lp/code/interfaces/sourcepackagerecipe.py'
--- lib/lp/code/interfaces/sourcepackagerecipe.py 2010-08-20 20:31:18 +0000
+++ lib/lp/code/interfaces/sourcepackagerecipe.py 2010-09-02 20:06:30 +0000
@@ -59,7 +59,7 @@
MINIMAL_RECIPE_TEXT = dedent(u'''\
- # bzr-builder format 0.2 deb-version 0+{revno}
+ # bzr-builder format 0.3 deb-version 0+{revno}
%s
''')
=== modified file 'lib/lp/code/model/sourcepackagerecipedata.py'
--- lib/lp/code/model/sourcepackagerecipedata.py 2010-08-20 20:31:18 +0000
+++ lib/lp/code/model/sourcepackagerecipedata.py 2010-09-02 20:06:30 +0000
@@ -253,8 +253,8 @@
def setRecipe(self, builder_recipe):
"""Convert the BaseRecipeBranch `builder_recipe` to the db form."""
- if builder_recipe.format > 0.2:
- raise TooNewRecipeFormat(builder_recipe.format, 0.2)
+ if builder_recipe.format > 0.3:
+ raise TooNewRecipeFormat(builder_recipe.format, 0.3)
branch_map = self._scanInstructions(builder_recipe)
# If this object hasn't been added to a store yet, there can't be any
# instructions linking to us yet.
=== modified file 'lib/lp/code/model/tests/test_recipebuilder.py'
--- lib/lp/code/model/tests/test_recipebuilder.py 2010-08-27 15:03:18 +0000
+++ lib/lp/code/model/tests/test_recipebuilder.py 2010-09-02 20:06:30 +0000
@@ -155,7 +155,7 @@
'author_name': u'Joe User',
'archive_purpose': 'PPA',
'ogrecomponent': 'universe',
- 'recipe_text': '# bzr-builder format 0.2 deb-version 0+{revno}\n'
+ 'recipe_text': '# bzr-builder format 0.3 deb-version 0+{revno}\n'
'lp://dev/~joe/someapp/pkg\n',
'archives': expected_archives,
'distroseries_name': job.build.distroseries.name,
@@ -222,7 +222,7 @@
'author_name': u'Joe User',
'archive_purpose': 'PPA',
'ogrecomponent': 'universe',
- 'recipe_text': '# bzr-builder format 0.2 deb-version 0+{revno}\n'
+ 'recipe_text': '# bzr-builder format 0.3 deb-version 0+{revno}\n'
'lp://dev/~joe/someapp/pkg\n',
'archives': expected_archives,
'distroseries_name': job.build.distroseries.name,
=== modified file 'lib/lp/code/model/tests/test_sourcepackagerecipe.py'
--- lib/lp/code/model/tests/test_sourcepackagerecipe.py 2010-09-01 03:25:36 +0000
+++ lib/lp/code/model/tests/test_sourcepackagerecipe.py 2010-09-02 20:06:30 +0000
@@ -239,7 +239,7 @@
def test_rejects_run_command(self):
recipe_text = '''\
- # bzr-builder format 0.2 deb-version 0.1-{revno}
+ # bzr-builder format 0.3 deb-version 0.1-{revno}
%(base)s
run touch test
''' % dict(base=self.factory.makeAnyBranch().bzr_identity)
@@ -255,7 +255,7 @@
sp_recipe = self.makeSourcePackageRecipeFromBuilderRecipe(
builder_recipe1)
recipe_text = '''\
- # bzr-builder format 0.2 deb-version 0.1-{revno}
+ # bzr-builder format 0.3 deb-version 0.1-{revno}
%(base)s
run touch test
''' % dict(base=self.factory.makeAnyBranch().bzr_identity)
@@ -267,9 +267,15 @@
builder_recipe2)
self.assertEquals([branch1], list(sp_recipe.getReferencedBranches()))
+ def test_accept_format_0_3(self):
+ """Recipe format 0.3 is accepted."""
+ builder_recipe = self.factory.makeRecipe()
+ builder_recipe.format = 0.3
+ self.makeSourcePackageRecipeFromBuilderRecipe(builder_recipe)
+
def test_reject_newer_formats(self):
builder_recipe = self.factory.makeRecipe()
- builder_recipe.format = 0.3
+ builder_recipe.format = 0.4
self.assertRaises(
TooNewRecipeFormat,
self.makeSourcePackageRecipeFromBuilderRecipe, builder_recipe)
@@ -568,7 +574,7 @@
def test_builds_simplest_recipe(self):
recipe_text = '''\
- # bzr-builder format 0.2 deb-version 0.1-{revno}
+ # bzr-builder format 0.3 deb-version 0.1-{revno}
%(base)s
''' % self.branch_identities
base_branch = self.get_recipe(recipe_text)
@@ -578,7 +584,7 @@
def test_builds_recipe_with_merge(self):
recipe_text = '''\
- # bzr-builder format 0.2 deb-version 0.1-{revno}
+ # bzr-builder format 0.3 deb-version 0.1-{revno}
%(base)s
merge bar %(merged)s
''' % self.branch_identities
@@ -593,7 +599,7 @@
def test_builds_recipe_with_nest(self):
recipe_text = '''\
- # bzr-builder format 0.2 deb-version 0.1-{revno}
+ # bzr-builder format 0.3 deb-version 0.1-{revno}
%(base)s
nest bar %(nested)s baz
''' % self.branch_identities
@@ -608,7 +614,7 @@
def test_builds_recipe_with_nest_then_merge(self):
recipe_text = '''\
- # bzr-builder format 0.2 deb-version 0.1-{revno}
+ # bzr-builder format 0.3 deb-version 0.1-{revno}
%(base)s
nest bar %(nested)s baz
merge zam %(merged)s
@@ -628,7 +634,7 @@
def test_builds_recipe_with_merge_then_nest(self):
recipe_text = '''\
- # bzr-builder format 0.2 deb-version 0.1-{revno}
+ # bzr-builder format 0.3 deb-version 0.1-{revno}
%(base)s
merge zam %(merged)s
nest bar %(nested)s baz
@@ -648,7 +654,7 @@
def test_builds_a_merge_in_to_a_nest(self):
recipe_text = '''\
- # bzr-builder format 0.2 deb-version 0.1-{revno}
+ # bzr-builder format 0.3 deb-version 0.1-{revno}
%(base)s
nest bar %(nested)s baz
merge zam %(merged)s
@@ -671,7 +677,7 @@
nested2 = self.factory.makeAnyBranch()
self.branch_identities['nested2'] = nested2.bzr_identity
recipe_text = '''\
- # bzr-builder format 0.2 deb-version 0.1-{revno}
+ # bzr-builder format 0.3 deb-version 0.1-{revno}
%(base)s
nest bar %(nested)s baz
nest zam %(nested2)s zoo
@@ -691,7 +697,7 @@
def tests_builds_recipe_with_revspecs(self):
recipe_text = '''\
- # bzr-builder format 0.2 deb-version 0.1-{revno}
+ # bzr-builder format 0.3 deb-version 0.1-{revno}
%(base)s revid:a
nest bar %(nested)s baz tag:b
merge zam %(merged)s 2