← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~wgrant/launchpad/bug-783855-1 into lp:launchpad

 

William Grant has proposed merging lp:~wgrant/launchpad/bug-783855-1 into lp:launchpad with lp:~wgrant/launchpad/bug-783855-0 as a prerequisite.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~wgrant/launchpad/bug-783855-1/+merge/61709

The second part of my signature refactoring series, this branch cleans up a couple of things in SignableTagFile.

fingerprint and signer_address weren't used by anyone, so have been removed. signer is implied by signingkey, so is now a property. filecontents is an odd implementation detail of parse_tagfile_lines not preserved by its impending rewrite, so its users now check raw_contents, an abstraction.
-- 
https://code.launchpad.net/~wgrant/launchpad/bug-783855-1/+merge/61709
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/bug-783855-1 into lp:launchpad.
=== modified file 'lib/lp/archiveuploader/changesfile.py'
--- lib/lp/archiveuploader/changesfile.py	2011-05-20 08:29:18 +0000
+++ lib/lp/archiveuploader/changesfile.py	2011-05-20 08:29:19 +0000
@@ -355,11 +355,6 @@
         return self._dict['Architecture']
 
     @property
-    def filecontents(self):
-        """Return files section contents."""
-        return self._dict['filecontents']
-
-    @property
     def simulated_changelog(self):
         """Build and return a changelog entry for this changesfile.
 

=== modified file 'lib/lp/archiveuploader/dscfile.py'
--- lib/lp/archiveuploader/dscfile.py	2011-05-20 08:29:18 +0000
+++ lib/lp/archiveuploader/dscfile.py	2011-05-20 08:29:19 +0000
@@ -113,7 +113,16 @@
 
     fingerprint = None
     signingkey = None
-    signer = None
+
+    @property
+    def signer(self):
+        if self.signingkey is not None:
+            return self.signingkey.owner
+
+    @property
+    def raw_content(self):
+        """Return files section contents."""
+        return self._dict['filecontents']
 
     def processSignature(self):
         """Verify the signature on the filename.
@@ -148,11 +157,7 @@
             raise UploadError("File %s is signed with a deactivated key %s"
                               % (self.filename, key.keyid))
 
-        self.fingerprint = sig.fingerprint
         self.signingkey = key
-        self.signer = key.owner
-        self.signer_address = self.parseAddress("%s <%s>" % (
-            self.signer.displayname, self.signer.preferredemail.email))
 
     def parseAddress(self, addr, fieldname="Maintainer"):
         """Parse an address, using the policy to decide if we should add a
@@ -613,6 +618,7 @@
 
         # We have no way of knowing what encoding the original copyright
         # file is in, unfortunately, and there is no standard, so guess.
+        encoded_raw_content = guess_encoding(self.raw_content)
         encoded = Deb822Dict()
         for key, value in pending.items():
             if value is not None:
@@ -650,7 +656,7 @@
             creator=self.changes.changed_by['person'],
             urgency=self.changes.converted_urgency,
             homepage=encoded.get('homepage'),
-            dsc=encoded['filecontents'],
+            dsc=encoded_raw_content,
             dscsigningkey=self.signingkey,
             dsc_maintainer_rfc822=encoded['Maintainer'],
             dsc_format=encoded['Format'],

=== modified file 'lib/lp/archiveuploader/nascentupload.py'
--- lib/lp/archiveuploader/nascentupload.py	2011-03-03 00:43:44 +0000
+++ lib/lp/archiveuploader/nascentupload.py	2011-05-20 08:29:19 +0000
@@ -928,12 +928,12 @@
                 IDistributionSet)['ubuntu'].currentseries
             return distroseries.createQueueEntry(
                 PackagePublishingPocket.RELEASE, self.changes.filename,
-                self.changes.filecontents, distroseries.main_archive,
+                self.changes.raw_content, distroseries.main_archive,
                 self.changes.signingkey)
         else:
             return distroseries.createQueueEntry(
                 self.policy.pocket, self.changes.filename,
-                self.changes.filecontents, self.policy.archive,
+                self.changes.raw_content, self.policy.archive,
                 self.changes.signingkey)
 
     #

=== modified file 'lib/lp/archiveuploader/tests/nascentuploadfile.txt'
--- lib/lp/archiveuploader/tests/nascentuploadfile.txt	2010-12-22 01:08:48 +0000
+++ lib/lp/archiveuploader/tests/nascentuploadfile.txt	2011-05-20 08:29:19 +0000
@@ -352,11 +352,6 @@
     >>> ed_binary_changes.signingkey.displayname
     u'1024D/5D147547'
 
-The IGPGKey fingerprint used to sign this ChangesFile:
-
-    >>> print ed_binary_changes.fingerprint
-    FD311613D941C6DE55737D310E3498675D147547
-
 
 == DSCFile ==
 
@@ -414,11 +409,6 @@
     >>> ed_source_dsc.signingkey.displayname
     u'1024D/6C64A8C5'
 
-The IGPGKey fingerprint used to sign this DSC:
-
-    >>> print ed_source_dsc.fingerprint
-    340CA3BB270E2716C9EE0B768E7EB7086C64A8C5
-
 A DSCFile provides a verification API similiar to what we have in
 ChangesFile itself: