← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~xnox/launchpad:core20 into launchpad:master

 

Dimitri John Ledkov has proposed merging ~xnox/launchpad:core20 into launchpad:master.

Commit message:
Add core16 & core20 UI support

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1849687 in Launchpad itself: "please allow pulling core20 base, when asked"
  https://bugs.launchpad.net/launchpad/+bug/1849687

For more details, see:
https://code.launchpad.net/~xnox/launchpad/+git/launchpad/+merge/375089

Add core16 & core20 UI support
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~xnox/launchpad:core20 into launchpad:master.
diff --git a/lib/lp/snappy/browser/tests/test_snap.py b/lib/lp/snappy/browser/tests/test_snap.py
index bffd4d1..68a2f9f 100644
--- a/lib/lp/snappy/browser/tests/test_snap.py
+++ b/lib/lp/snappy/browser/tests/test_snap.py
@@ -429,8 +429,12 @@ class TestSnapAddView(BaseTestSnapView):
         browser.getControl(
             name="field.auto_build_channels.core").value = "stable"
         browser.getControl(
+            name="field.auto_build_channels.core16").value = "candidate"
+        browser.getControl(
             name="field.auto_build_channels.core18").value = "beta"
         browser.getControl(
+            name="field.auto_build_channels.core20").value = "edge/feature"
+        browser.getControl(
             name="field.auto_build_channels.snapcraft").value = "edge"
         browser.getControl("Create snap package").click()
 
@@ -447,7 +451,8 @@ class TestSnapAddView(BaseTestSnapView):
             MatchesTagText(content, "auto_build_pocket"))
         self.assertThat(
             "Source snap channels for automatic builds:\nEdit snap package\n"
-            "core\nstable\ncore18\nbeta\nsnapcraft\nedge\n",
+            "core\nstable\ncore16\ncandidate\ncore18\nbeta\n"
+            "core20\nedge/feature\nsnapcraft\nedge\n",
             MatchesTagText(content, "auto_build_channels"))
 
     @responses.activate
@@ -1673,7 +1678,9 @@ class TestSnapRequestBuildsView(BaseTestSnapView):
             when building the snap package.
             Source snap channels:
             core
+            core16
             core18
+            core20
             snapcraft
             The channels to use for build tools when building the snap
             package.
diff --git a/lib/lp/snappy/browser/widgets/snapbuildchannels.py b/lib/lp/snappy/browser/widgets/snapbuildchannels.py
index 368f9ab..7e13ef2 100644
--- a/lib/lp/snappy/browser/widgets/snapbuildchannels.py
+++ b/lib/lp/snappy/browser/widgets/snapbuildchannels.py
@@ -36,7 +36,7 @@ class SnapBuildChannelsWidget(BrowserWidget, InputWidget):
 
     template = ViewPageTemplateFile("templates/snapbuildchannels.pt")
     hint = False
-    snap_names = ["core", "core18", "snapcraft"]
+    snap_names = ["core", "core16", "core18", "core20", "snapcraft"]
     _widgets_set_up = False
 
     def __init__(self, context, request):
diff --git a/lib/lp/snappy/browser/widgets/templates/snapbuildchannels.pt b/lib/lp/snappy/browser/widgets/templates/snapbuildchannels.pt
index 48b5d41..63b64bd 100644
--- a/lib/lp/snappy/browser/widgets/templates/snapbuildchannels.pt
+++ b/lib/lp/snappy/browser/widgets/templates/snapbuildchannels.pt
@@ -8,10 +8,18 @@
     <td><div tal:content="structure view/core_widget" /></td>
   </tr>
   <tr>
+    <td>core16</td>
+    <td><div tal:content="structure view/core16_widget" /></td>
+  </tr>
+  <tr>
     <td>core18</td>
     <td><div tal:content="structure view/core18_widget" /></td>
   </tr>
   <tr>
+    <td>core20</td>
+    <td><div tal:content="structure view/core20_widget" /></td>
+  </tr>
+  <tr>
     <td>snapcraft</td>
     <td><div tal:content="structure view/snapcraft_widget" /></td>
   </tr>
diff --git a/lib/lp/snappy/browser/widgets/tests/test_snapbuildchannelswidget.py b/lib/lp/snappy/browser/widgets/tests/test_snapbuildchannelswidget.py
index 3cac446..7e8a47a 100644
--- a/lib/lp/snappy/browser/widgets/tests/test_snapbuildchannelswidget.py
+++ b/lib/lp/snappy/browser/widgets/tests/test_snapbuildchannelswidget.py
@@ -89,7 +89,9 @@ class TestSnapBuildChannelsWidget(TestCaseWithFactory):
         self.widget.setUpSubWidgets()
         self.assertTrue(self.widget._widgets_set_up)
         self.assertIsNotNone(getattr(self.widget, "core_widget", None))
+        self.assertIsNotNone(getattr(self.widget, "core16_widget", None))
         self.assertIsNotNone(getattr(self.widget, "core18_widget", None))
+        self.assertIsNotNone(getattr(self.widget, "core20_widget", None))
         self.assertIsNotNone(getattr(self.widget, "snapcraft_widget", None))
 
     def test_setUpSubWidgets_second_call(self):
@@ -98,34 +100,46 @@ class TestSnapBuildChannelsWidget(TestCaseWithFactory):
         self.widget._widgets_set_up = True
         self.widget.setUpSubWidgets()
         self.assertIsNone(getattr(self.widget, "core_widget", None))
+        self.assertIsNone(getattr(self.widget, "core16_widget", None))
         self.assertIsNone(getattr(self.widget, "core18_widget", None))
+        self.assertIsNone(getattr(self.widget, "core20_widget", None))
         self.assertIsNone(getattr(self.widget, "snapcraft_widget", None))
 
     def test_setRenderedValue_None(self):
         self.widget.setRenderedValue(None)
         self.assertIsNone(self.widget.core_widget._getCurrentValue())
+        self.assertIsNone(self.widget.core16_widget._getCurrentValue())
         self.assertIsNone(self.widget.core18_widget._getCurrentValue())
+        self.assertIsNone(self.widget.core20_widget._getCurrentValue())
         self.assertIsNone(self.widget.snapcraft_widget._getCurrentValue())
 
     def test_setRenderedValue_empty(self):
         self.widget.setRenderedValue({})
         self.assertIsNone(self.widget.core_widget._getCurrentValue())
+        self.assertIsNone(self.widget.core16_widget._getCurrentValue())
         self.assertIsNone(self.widget.core18_widget._getCurrentValue())
+        self.assertIsNone(self.widget.core20_widget._getCurrentValue())
         self.assertIsNone(self.widget.snapcraft_widget._getCurrentValue())
 
     def test_setRenderedValue_one_channel(self):
         self.widget.setRenderedValue({"snapcraft": "stable"})
         self.assertIsNone(self.widget.core_widget._getCurrentValue())
+        self.assertIsNone(self.widget.core16_widget._getCurrentValue())
         self.assertIsNone(self.widget.core18_widget._getCurrentValue())
+        self.assertIsNone(self.widget.core20_widget._getCurrentValue())
         self.assertEqual(
             "stable", self.widget.snapcraft_widget._getCurrentValue())
 
     def test_setRenderedValue_all_channels(self):
         self.widget.setRenderedValue(
-            {"core": "candidate", "core18": "beta", "snapcraft": "stable"})
+            {"core": "candidate", "core18": "beta", "core20": "edge",
+             "core16": "edge/feature", "snapcraft": "stable"})
         self.assertEqual(
             "candidate", self.widget.core_widget._getCurrentValue())
+        self.assertEqual(
+            "edge/feature", self.widget.core16_widget._getCurrentValue())
         self.assertEqual("beta", self.widget.core18_widget._getCurrentValue())
+        self.assertEqual("edge", self.widget.core20_widget._getCurrentValue())
         self.assertEqual(
             "stable", self.widget.snapcraft_widget._getCurrentValue())
 
@@ -146,7 +160,9 @@ class TestSnapBuildChannelsWidget(TestCaseWithFactory):
         # there is no "false" counterpart to this test.)
         form = {
             "field.auto_build_channels.core": "",
+            "field.auto_build_channels.core16": "candidate",
             "field.auto_build_channels.core18": "beta",
+            "field.auto_build_channels.core20": "edge",
             "field.auto_build_channels.snapcraft": "stable",
             }
         self.widget.request = LaunchpadTestRequest(form=form)
@@ -155,25 +171,32 @@ class TestSnapBuildChannelsWidget(TestCaseWithFactory):
     def test_getInputValue(self):
         form = {
             "field.auto_build_channels.core": "",
+            "field.auto_build_channels.core16": "candidate",
             "field.auto_build_channels.core18": "beta",
+            "field.auto_build_channels.core20": "edge",
             "field.auto_build_channels.snapcraft": "stable",
             }
         self.widget.request = LaunchpadTestRequest(form=form)
         self.assertEqual(
-            {"core18": "beta", "snapcraft": "stable"},
+            {"core16": "candidate", "core18": "beta", "core20": "edge",
+             "snapcraft": "stable"},
             self.widget.getInputValue())
 
     def test_call(self):
         # The __call__ method sets up the widgets.
         markup = self.widget()
         self.assertIsNotNone(self.widget.core_widget)
+        self.assertIsNotNone(self.widget.core16_widget)
         self.assertIsNotNone(self.widget.core18_widget)
+        self.assertIsNotNone(self.widget.core20_widget)
         self.assertIsNotNone(self.widget.snapcraft_widget)
         soup = BeautifulSoup(markup)
         fields = soup.findAll(["input"], {"id": re.compile(".*")})
         expected_ids = [
             "field.auto_build_channels.core",
+            "field.auto_build_channels.core16",
             "field.auto_build_channels.core18",
+            "field.auto_build_channels.core20",
             "field.auto_build_channels.snapcraft",
             ]
         ids = [field["id"] for field in fields]
diff --git a/lib/lp/snappy/interfaces/snap.py b/lib/lp/snappy/interfaces/snap.py
index 70626c9..cdbc01c 100644
--- a/lib/lp/snappy/interfaces/snap.py
+++ b/lib/lp/snappy/interfaces/snap.py
@@ -394,8 +394,8 @@ class ISnapView(Interface):
             title=_("Source snap channels to use for this build."),
             description=_(
                 "A dictionary mapping snap names to channels to use for this "
-                "build.  Currently only 'core', 'core18', and 'snapcraft' "
-                "keys are supported."),
+                "build.  Currently only 'core', 'core16', 'core18', 'core20' "
+                "and 'snapcraft' keys are supported."),
             key_type=TextLine(), required=False))
     # Really ISnapBuild, patched in lp.snappy.interfaces.webservice.
     @export_factory_operation(Interface, [])
@@ -423,8 +423,8 @@ class ISnapView(Interface):
             title=_("Source snap channels to use for this build."),
             description=_(
                 "A dictionary mapping snap names to channels to use for this "
-                "build.  Currently only 'core', 'core18', and 'snapcraft' "
-                "keys are supported."),
+                "build.  Currently only 'core', 'core16', 'core18', 'core20' "
+                "and 'snapcraft' keys are supported."),
             key_type=TextLine(), required=False))
     @export_factory_operation(ISnapBuildRequest, [])
     @operation_for_version("devel")
@@ -755,8 +755,8 @@ class ISnapEditableAttributes(IHasOwner):
         key_type=TextLine(), required=False, readonly=False,
         description=_(
             "A dictionary mapping snap names to channels to use when building "
-            "this snap package.  Currently only 'core', 'core18', and "
-            "'snapcraft' keys are supported.")))
+            "this snap package.  Currently only 'core', 'core16', 'core18', "
+            "'core20' and 'snapcraft' keys are supported.")))
 
     is_stale = Bool(
         title=_("Snap package is stale and is due to be rebuilt."),
diff --git a/lib/lp/snappy/interfaces/snapbuild.py b/lib/lp/snappy/interfaces/snapbuild.py
index fdd9c86..a1ce3eb 100644
--- a/lib/lp/snappy/interfaces/snapbuild.py
+++ b/lib/lp/snappy/interfaces/snapbuild.py
@@ -169,8 +169,8 @@ class ISnapBuildView(IPackageBuild):
         title=_("Source snap channels to use for this build."),
         description=_(
             "A dictionary mapping snap names to channels to use for this "
-            "build.  Currently only 'core', 'core18', and 'snapcraft' keys "
-            "are supported."),
+            "build.  Currently only 'core', 'core16', 'core18', 'core20' "
+            "and 'snapcraft' keys are supported."),
         key_type=TextLine()))
 
     virtualized = Bool(
diff --git a/lib/lp/snappy/interfaces/snapjob.py b/lib/lp/snappy/interfaces/snapjob.py
index 276362a..a7c6d09 100644
--- a/lib/lp/snappy/interfaces/snapjob.py
+++ b/lib/lp/snappy/interfaces/snapjob.py
@@ -75,8 +75,8 @@ class ISnapRequestBuildsJob(IRunnableJob):
         title=_("Source snap channels to use for these builds."),
         description=_(
             "A dictionary mapping snap names to channels to use for these "
-            "builds.  Currently only 'core', 'core18', and 'snapcraft' keys "
-            "are supported."),
+            "builds.  Currently only 'core', 'core16', 'core18', 'core20' "
+            "and 'snapcraft' keys are supported."),
         key_type=TextLine(), required=False, readonly=True)
 
     architectures = Set(