[yum-cvs] yum/repomd mdUtils.py,1.1,1.2

Jeremy Katz katzj at login.linux.duke.edu
Fri Sep 16 22:02:33 UTC 2005


Update of /home/groups/yum/cvs/yum/repomd
In directory login:/tmp/cvs-serv24554/repomd

Modified Files:
	mdUtils.py 
Log Message:
add utility function to find the newest package in a list since I've seen
this code a few times...


Index: mdUtils.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/repomd/mdUtils.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- mdUtils.py	17 Feb 2004 05:22:35 -0000	1.1
+++ mdUtils.py	16 Sep 2005 22:02:31 -0000	1.2
@@ -41,6 +41,14 @@
     #print '%s, %s, %s vs %s, %s, %s = %s' % (e1, v1, r1, e2, v2, r2, rc)
     return rc
 
+def newestInList(pkgs):
+    # return the newest in the list of packages
+    new = pkgs.pop()
+    for pkg in pkgs:
+        if compareEVR(pkg.returnEVR(), new.returnEVR()) > 0:
+            new = pkg
+    return new
+
 ###########
 # Title: Remove duplicates from a sequence
 # Submitter: Tim Peters 




More information about the Yum-cvs-commits mailing list