← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~rvb/launchpad/bug-869221-expose-nominatedarchindep into lp:launchpad

 

Raphaël Victor Badin has proposed merging lp:~rvb/launchpad/bug-869221-expose-nominatedarchindep into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #869221 in Launchpad itself: "Initializing a distroseries that doesn't use the parent's archindep arch will fail"
  https://bugs.launchpad.net/launchpad/+bug/869221

For more details, see:
https://code.launchpad.net/~rvb/launchpad/bug-869221-expose-nominatedarchindep/+merge/78797

This branch simply exposes IDistroseries.nominatedarchindep on the api.  This is (good to have in general and) in preparation for the ui part of fixing #869221.

= Tests =

./bin/test -vvc test_distroseries_webservice test_nominatedarchindep

= QA =

Fetch a distroseries via the api and make sure that it has the attribute nominatedarchindep.
-- 
https://code.launchpad.net/~rvb/launchpad/bug-869221-expose-nominatedarchindep/+merge/78797
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~rvb/launchpad/bug-869221-expose-nominatedarchindep into lp:launchpad.
=== modified file 'lib/canonical/launchpad/interfaces/_schema_circular_imports.py'
--- lib/canonical/launchpad/interfaces/_schema_circular_imports.py	2011-09-27 20:07:25 +0000
+++ lib/canonical/launchpad/interfaces/_schema_circular_imports.py	2011-10-10 07:06:26 +0000
@@ -31,11 +31,6 @@
     patch_reference_property,
     )
 from canonical.launchpad.interfaces.emailaddress import IEmailAddress
-from lp.services.messages.interfaces.message import (
-    IIndexedMessage,
-    IMessage,
-    IUserToUserEmail,
-    )
 from canonical.launchpad.interfaces.temporaryblobstorage import (
     ITemporaryBlobStorage,
     ITemporaryStorageManager,
@@ -173,6 +168,11 @@
 from lp.registry.interfaces.teammembership import ITeamMembership
 from lp.registry.interfaces.wikiname import IWikiName
 from lp.services.comments.interfaces.conversation import IComment
+from lp.services.messages.interfaces.message import (
+    IIndexedMessage,
+    IMessage,
+    IUserToUserEmail,
+    )
 from lp.services.worlddata.interfaces.country import (
     ICountry,
     ICountrySet,
@@ -506,6 +506,8 @@
 patch_collection_return_type(
     IDistroSeries, 'getPackageUploads', IPackageUpload)
 patch_reference_property(IDistroSeries, 'previous_series', IDistroSeries)
+patch_reference_property(
+    IDistroSeries, 'nominatedarchindep', IDistroArchSeries)
 patch_collection_return_type(
     IDistroSeries, 'getDerivedSeries', IDistroSeries)
 patch_collection_return_type(

=== modified file 'lib/lp/registry/browser/tests/test_distroseries_webservice.py'
--- lib/lp/registry/browser/tests/test_distroseries_webservice.py	2011-07-05 10:47:28 +0000
+++ lib/lp/registry/browser/tests/test_distroseries_webservice.py	2011-10-10 07:06:26 +0000
@@ -5,6 +5,8 @@
 
 from datetime import timedelta
 
+from zope.security.proxy import removeSecurityProxy
+
 from canonical.testing import AppServerLayer
 from lp.registry.enum import (
     DistroSeriesDifferenceStatus,
@@ -57,3 +59,11 @@
         search_results = ds_ws.getDifferenceComments(
             since=yesterday, source_package_name=package_name)
         self.assertContentEqual([self._wsFor(comment)], search_results)
+
+    def test_nominatedarchindep(self):
+        # nominatedarchindep is exposed on IDistroseries.
+        distroseries = self.factory.makeDistroSeries()
+        arch = self.factory.makeDistroArchSeries(distroseries=distroseries)
+        removeSecurityProxy(distroseries).nominatedarchindep = arch
+        ds_ws = self._wsFor(distroseries)
+        self.assertEqual(self._wsFor(arch), ds_ws.nominatedarchindep)

=== modified file 'lib/lp/registry/interfaces/distroseries.py'
--- lib/lp/registry/interfaces/distroseries.py	2011-09-10 00:16:56 +0000
+++ lib/lp/registry/interfaces/distroseries.py	2011-10-10 07:06:26 +0000
@@ -284,9 +284,14 @@
 
     architecturecount = Attribute("The number of architectures in this "
         "series.")
-    nominatedarchindep = Attribute(
-        "DistroArchSeries designed to build architecture-independent "
-        "packages whithin this distroseries context.")
+    nominatedarchindep = exported(
+        Reference(
+            Interface,  # IDistroArchSeries.
+            title=_("DistroArchSeries designed to build "
+                    "architecture-independent packages whithin this "
+                    "distroseries context."),
+            default=None,
+            required=False))
     messagecount = Attribute("The total number of translatable items in "
         "this series.")
     distroserieslanguages = Attribute("The set of dr-languages in this "

=== modified file 'lib/lp/soyuz/scripts/initialize_distroseries.py'
--- lib/lp/soyuz/scripts/initialize_distroseries.py	2011-10-07 09:30:44 +0000
+++ lib/lp/soyuz/scripts/initialize_distroseries.py	2011-10-10 07:06:26 +0000
@@ -171,7 +171,7 @@
         if len(potential_nominated_arches) == 0:
             raise InitializationError(
                 "The distroseries has no architectures selected to "
-                 "build architecture independent binaries.")
+                "build architecture independent binaries.")
 
     def _checkPublisherConfig(self):
         """A series cannot be initialized if it has no publisher config