What does everyone think of having a pkg.commiter property? I realize
it's kind of a work around for the fact Fedora takes both the packager
and vendor fields, but it's useful so here is an initial implementation:

diff --git a/yum/packages.py b/yum/packages.py
index 0830258..7ae3cf3 100644
--- a/yum/packages.py
+++ b/yum/packages.py
@@ -461,6 +461,34 @@ class YumAvailablePackage(PackageObject, RpmBase):
     remote_path = property(_remote_path)
     remote_url = property(_remote_url)
 
+    def _committer(self):
+        "Returns the name of the last person to do a commit to the changelog."
+
+        if hasattr(self, '_committer_ret'):
+            return self._committer_ret
+
+        def _nf2ascii(x):
+            """ does .encode("ascii", "replace") but it never fails. """
+            ret = []
+            for val in x:
+                if ord(val) >= 128:
+                    val = '?'
+                ret.append(val)
+            return "".join(ret)
+
+        if not len(self.changelog): # Empty changelog is _possible_ I guess
+            self._committer_ret = self.packager
+            return self._committer_ret
+        
+        val = self.changelog[0][1]
+        # Chagnelog data is in multiple locale's, so we convert to ascii
+        # ignoring "bad" chars.
+        val = _nf2ascii(val)
+        # Hacky way to get rid of version numbers...
+        self._committer_ret = re.sub("""> .*""", '>', val)
+        return self._committer_ret
+
+    committer = property(_committer)
 
     def getDiscNum(self):
         if self.basepath is None:

-- 
James Antill <[EMAIL PROTECTED]>
Red Hat

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Yum-devel mailing list
[email protected]
https://lists.dulug.duke.edu/mailman/listinfo/yum-devel

Reply via email to