← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~jelmer/launchpad/recipe-format-0.4 into lp:launchpad

 

Jelmer Vernooij has proposed merging lp:~jelmer/launchpad/recipe-format-0.4 into lp:launchpad with lp:~jelmer/launchpad/optional-deb-version as a prerequisite.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #891928 in Launchpad itself: "Unrecognized 0.4 version of recipe"
  https://bugs.launchpad.net/launchpad/+bug/891928

For more details, see:
https://code.launchpad.net/~jelmer/launchpad/recipe-format-0.4/+merge/85334

Add support for version 0.4 of the recipe format. 

This format makes the "deb-version" field optional.  

It depends on a database change (lp:~jelmer/launchpad/optional-deb-version, which is waiting for merging into db-devel).
-- 
https://code.launchpad.net/~jelmer/launchpad/recipe-format-0.4/+merge/85334
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jelmer/launchpad/recipe-format-0.4 into lp:launchpad.
=== modified file 'lib/lp/code/model/sourcepackagerecipedata.py'
--- lib/lp/code/model/sourcepackagerecipedata.py	2011-11-15 11:04:59 +0000
+++ lib/lp/code/model/sourcepackagerecipedata.py	2011-12-12 13:55:21 +0000
@@ -141,7 +141,7 @@
         return branch
 
 
-MAX_RECIPE_FORMAT = 0.3
+MAX_RECIPE_FORMAT = 0.4
 
 
 class SourcePackageRecipeData(Storm):
@@ -160,7 +160,7 @@
     base_branch = Reference(base_branch_id, 'Branch.id')
 
     recipe_format = Unicode(allow_none=False)
-    deb_version_template = Unicode(allow_none=False)
+    deb_version_template = Unicode(allow_none=True)
     revspec = Unicode(allow_none=True)
 
     instructions = ReferenceSet(
@@ -306,7 +306,10 @@
         self._recordInstructions(
             builder_recipe, parent_insn=None, branch_map=branch_map)
         self.base_branch = base_branch
-        self.deb_version_template = unicode(builder_recipe.deb_version)
+        if builder_recipe.deb_version is None:
+            self.deb_version_template = None
+        else:
+            self.deb_version_template = unicode(builder_recipe.deb_version)
         self.recipe_format = unicode(builder_recipe.format)
 
     def __init__(self, recipe, sourcepackage_recipe=None,

=== modified file 'lib/lp/code/model/tests/test_sourcepackagerecipe.py'
--- lib/lp/code/model/tests/test_sourcepackagerecipe.py	2011-11-15 16:25:02 +0000
+++ lib/lp/code/model/tests/test_sourcepackagerecipe.py	2011-12-12 13:55:21 +0000
@@ -921,6 +921,21 @@
         self.check_recipe_branch(
             child_branch, "zam", self.merged_branch.bzr_identity, revspec="2")
 
+    def test_builds_recipe_without_debversion(self):
+        recipe_text = '''\
+        # bzr-builder format 0.4
+        %(base)s
+        nest bar %(nested)s baz
+        ''' % self.branch_identities
+        base_branch = self.get_recipe(recipe_text)
+        self.check_base_recipe_branch(
+            base_branch, self.base_branch.bzr_identity, num_child_branches=1,
+            deb_version=None)
+        child_branch, location = base_branch.child_branches[0].as_tuple()
+        self.assertEqual("baz", location)
+        self.check_recipe_branch(
+            child_branch, "bar", self.nested_branch.bzr_identity)
+
 
 class RecipeDateLastModified(TestCaseWithFactory):
     """Exercises the situations where date_last_modified is updated."""