[yum-cvs] yum/yum pgpmsg.py,1.4,1.5

Seth Vidal skvidal at linux.duke.edu
Thu Mar 2 21:20:35 UTC 2006


Update of /home/groups/yum/cvs/yum/yum
In directory login1.linux.duke.edu:/tmp/cvs-serv13137

Modified Files:
	pgpmsg.py 
Log Message:

reverse the sort order of the displayed user id from gpg keys.
This is more likely to get us the most recent and hopefully most correct
user id.


Index: pgpmsg.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/pgpmsg.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- pgpmsg.py	21 Mar 2005 11:49:42 -0000	1.4
+++ pgpmsg.py	2 Mar 2006 21:20:33 -0000	1.5
@@ -774,7 +774,7 @@
         self.version = None
         self.public_key = None
         self.revocation = None
-        self.user_id = None
+        #self.user_id = None
         self.user_ids = []
         self.rvkd_user_ids = []
 
@@ -789,6 +789,14 @@
                 sio.write("   " + str(sig))
         return sio.getvalue()
     
+    def get_user_id(self):
+        # take the LAST one in the list, not first
+        # they appear to be ordered FIFO from the key and that means if you
+        # added a key later then it won't show the one you expect
+        return self.user_ids[-1][0].id
+        
+    user_id = property(get_user_id)
+    
     def expiration(self) :
         if self.version == 3 :
             if self.public_key.validity == 0 :
@@ -974,11 +982,11 @@
                     raise ValueError('pgp packet %d is not user id or subkey, is %s' % (pkt_idx, map_to_str(ctb_pkt_to_str, pkts[pkt_idx].pkt_typ)))
 
         # did we get all the things we needed?
-        if not self.user_id :
-            # just take the first valid user id we encountered then
-            if len(self.user_ids) == 0 :
-                raise ValueError('no user id packet was present in the cert')
-            self.user_id = self.user_ids[0][0].id
+        #if not self.user_id :
+        # just take the first valid user id we encountered then
+        if len(self.user_ids) == 0 :
+            raise ValueError('no user id packet was present in the cert')
+
 
 
 def get_ctb(msg, idx) :




More information about the Yum-cvs-commits mailing list