← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~wgrant/launchpad/avoid-dscsigningkey into lp:launchpad

 

William Grant has proposed merging lp:~wgrant/launchpad/avoid-dscsigningkey into lp:launchpad.

Commit message:
Avoid SourcePackageRelease.dscsigningkey when we just need signing_key_owner.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~wgrant/launchpad/avoid-dscsigningkey/+merge/301459

Avoid SourcePackageRelease.dscsigningkey when we just need signing_key_owner.

dscsigningkey can imply a call out to gpgservice nowadays.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/avoid-dscsigningkey into lp:launchpad.
=== modified file 'lib/lp/registry/browser/tests/test_distroseries.py'
--- lib/lp/registry/browser/tests/test_distroseries.py	2016-03-02 15:52:33 +0000
+++ lib/lp/registry/browser/tests/test_distroseries.py	2016-07-29 08:11:47 +0000
@@ -945,7 +945,6 @@
                     removeSecurityProxy(spr).signing_key_owner = key.owner
                     removeSecurityProxy(spr).signing_key_fingerprint = (
                         key.fingerprint)
-                    del get_property_cache(spr).dscsigningkey
 
         def flush_and_render():
             flush_database_caches()
@@ -1365,7 +1364,6 @@
             dsd.source_package_release.sourcepackagerelease)
         naked_spr.signing_key_fingerprint = key.fingerprint
         naked_spr.signing_key_owner = key.owner
-        del get_property_cache(naked_spr).dscsigningkey
         view = self.makeView(dsd.derived_series)
         root = html.fromstring(view())
         [creator_cell] = root.cssselect(
@@ -1373,7 +1371,7 @@
         matches = DocTestMatches(
             "... ago by %s (uploaded by %s)" % (
                 dsd.source_package_release.creator.displayname,
-                dsd.source_package_release.dscsigningkey.owner.displayname))
+                dsd.source_package_release.signing_key_owner.displayname))
         self.assertThat(creator_cell.text_content(), matches)
 
     def test_diff_row_links_to_parent_changelog(self):
@@ -2445,7 +2443,6 @@
             dsd.parent_source_package_release.sourcepackagerelease)
         naked_spr.signing_key_fingerprint = key.fingerprint
         naked_spr.signing_key_owner = key.owner
-        del get_property_cache(naked_spr).dscsigningkey
         with person_logged_in(self.simple_user):
             view = create_initialized_view(
                 dsd.derived_series, '+missingpackages',
@@ -2457,7 +2454,7 @@
         matches = DocTestMatches(
             "... ago by %s (uploaded by %s)" % (
                 parent_spr.creator.displayname,
-                parent_spr.dscsigningkey.owner.displayname))
+                parent_spr.signing_key_owner.displayname))
         self.assertThat(creator_cell.text_content(), matches)
 
 

=== modified file 'lib/lp/soyuz/configure.zcml'
--- lib/lp/soyuz/configure.zcml	2016-06-10 09:26:31 +0000
+++ lib/lp/soyuz/configure.zcml	2016-07-29 08:11:47 +0000
@@ -75,7 +75,6 @@
         class="lp.soyuz.model.sourcepackagerelease.SourcePackageRelease">
         <allow
             interface="lp.soyuz.interfaces.sourcepackagerelease.ISourcePackageRelease"/>
-        <allow attributes="signing_key_fingerprint signing_key_owner" />
         <!-- changelog needs to be updated when unembargoing -->
         <require
             permission="launchpad.Edit"

=== modified file 'lib/lp/soyuz/doc/publishing.txt'
--- lib/lp/soyuz/doc/publishing.txt	2016-03-02 15:52:33 +0000
+++ lib/lp/soyuz/doc/publishing.txt	2016-07-29 08:11:47 +0000
@@ -91,7 +91,6 @@
     >>> from lp.services.propertycache import get_property_cache
     >>> spph.sourcepackagerelease.signing_key_owner = None
     >>> spph.sourcepackagerelease.signing_key_fingerprint = None
-    >>> del get_property_cache(spph.sourcepackagerelease).dscsigningkey
     >>> print spph.package_signer
     None
 

=== modified file 'lib/lp/soyuz/interfaces/sourcepackagerelease.py'
--- lib/lp/soyuz/interfaces/sourcepackagerelease.py	2016-03-03 18:41:27 +0000
+++ lib/lp/soyuz/interfaces/sourcepackagerelease.py	2016-07-29 08:11:47 +0000
@@ -35,7 +35,8 @@
     version = Attribute("A version string")
     dateuploaded = Attribute("Date of Upload")
     urgency = Attribute("Source Package Urgency")
-    dscsigningkey = Attribute("DSC Signing Key")
+    signing_key_owner = Attribute("Signing key owner")
+    signing_key_fingerprint = Attribute("Signing key fingerprint")
     component = Attribute("Source Package Component")
     format = Attribute("The Source Package Format")
     changelog = Attribute("LibraryFileAlias containing debian/changelog.")

=== modified file 'lib/lp/soyuz/mail/binarypackagebuild.py'
--- lib/lp/soyuz/mail/binarypackagebuild.py	2015-08-23 22:53:55 +0000
+++ lib/lp/soyuz/mail/binarypackagebuild.py	2016-07-29 08:11:47 +0000
@@ -107,12 +107,12 @@
                         reason = BinaryPackageBuildRecipientReason.forCreator(
                             creator, recipient)
                         recipients[recipient] = reason
-            dsc_key = build.source_package_release.dscsigningkey
-            if dsc_key:
-                for recipient in get_recipients(dsc_key.owner):
+            signer = build.source_package_release.signing_key_owner
+            if signer:
+                for recipient in get_recipients(signer):
                     if recipient not in recipients:
                         reason = BinaryPackageBuildRecipientReason.forSigner(
-                            dsc_key.owner, recipient)
+                            signer, recipient)
                         recipients[recipient] = reason
 
         if not build.archive.is_ppa:

=== modified file 'lib/lp/soyuz/model/archive.py'
--- lib/lp/soyuz/model/archive.py	2016-07-14 16:06:01 +0000
+++ lib/lp/soyuz/model/archive.py	2016-07-29 08:11:47 +0000
@@ -701,14 +701,6 @@
             ids.discard(None)
             if ids:
                 list(getUtility(IPersonSet).getPrecachedPersonsFromIDs(ids))
-            keys = {
-                key.fingerprint: key for key in
-                getUtility(IGPGKeySet).getByFingerprints(
-                    set(map(attrgetter('signing_key_fingerprint'), releases))
-                    - set([None]))}
-            for spr in releases:
-                get_property_cache(spr).dscsigningkey = keys.get(
-                    spr.signing_key_fingerprint)
         return DecoratedResultSet(resultset, pre_iter_hook=eager_load)
 
     def getSourcesForDeletion(self, name=None, status=None, distroseries=None):

=== modified file 'lib/lp/soyuz/model/publishing.py'
--- lib/lp/soyuz/model/publishing.py	2016-06-14 12:40:30 +0000
+++ lib/lp/soyuz/model/publishing.py	2016-07-29 08:11:47 +0000
@@ -379,9 +379,7 @@
     @property
     def package_signer(self):
         """See `ISourcePackagePublishingHistory`."""
-        if self.sourcepackagerelease.dscsigningkey is not None:
-            return self.sourcepackagerelease.dscsigningkey.owner
-        return None
+        return self.sourcepackagerelease.signing_key_owner
 
     @cachedproperty
     def newer_distroseries_version(self):

=== modified file 'lib/lp/soyuz/model/sourcepackagerelease.py'
--- lib/lp/soyuz/model/sourcepackagerelease.py	2016-03-14 23:42:45 +0000
+++ lib/lp/soyuz/model/sourcepackagerelease.py	2016-07-29 08:11:47 +0000
@@ -173,15 +173,6 @@
             "UPDATE sourcepackagerelease SET copyright=%s WHERE id=%s",
             (content, self.id))
 
-    @cachedproperty
-    def dscsigningkey(self):
-        if self.signing_key_fingerprint is not None:
-            # Stripping proxy as some tests expect this former FK to
-            # hold an unsecured object. self is always proxied by things
-            # that hold it, so no issue here.
-            return removeSecurityProxy(getUtility(IGPGKeySet).getByFingerprint(
-                self.signing_key_fingerprint))
-
     @property
     def user_defined_fields(self):
         """See `IBinaryPackageRelease`."""

=== modified file 'lib/lp/soyuz/templates/sourcepackagepublishinghistory-listing-archive-detailed.pt'
--- lib/lp/soyuz/templates/sourcepackagepublishinghistory-listing-archive-detailed.pt	2011-12-08 22:41:00 +0000
+++ lib/lp/soyuz/templates/sourcepackagepublishinghistory-listing-archive-detailed.pt	2016-07-29 08:11:47 +0000
@@ -39,10 +39,10 @@
     </td>
     <td tal:condition="context/archive/owner/is_team"
         tal:define="spr context/sourcepackagerelease;
-                    signer spr/dscsigningkey/owner|nothing">
+                    signer spr/signing_key_owner|nothing">
       <tal:has_signer condition="signer">
-        <a tal:attributes="href spr/dscsigningkey/owner/fmt:url"
-           tal:content="spr/dscsigningkey/owner/name"></a>
+        <a tal:attributes="href spr/signing_key_owner/fmt:url"
+           tal:content="spr/signing_key_owner/name"></a>
       </tal:has_signer>
       <tal:no_signer condition="not: signer">
         no signer

=== modified file 'lib/lp/soyuz/tests/test_build_notify.py'
--- lib/lp/soyuz/tests/test_build_notify.py	2016-03-14 23:42:45 +0000
+++ lib/lp/soyuz/tests/test_build_notify.py	2016-07-29 08:11:47 +0000
@@ -438,7 +438,6 @@
         # Push past the security proxy
         removeSecurityProxy(spr).signing_key_owner = key.owner
         removeSecurityProxy(spr).signing_key_fingerprint = key.fingerprint
-        del get_property_cache(spr).dscsigningkey
         with dbuser(config.builddmaster.dbuser):
             build.notify()
         expected_reasons = [


Follow ups