[yum-cvs] yum/yum __init__.py, 1.278, 1.279 packages.py, 1.86, 1.87 yumRepo.py, 1.35, 1.36

Jeremy Katz katzj at linux.duke.edu
Mon Feb 12 22:14:22 UTC 2007


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

Modified Files:
	__init__.py packages.py yumRepo.py 
Log Message:
* switch back to using AnacondaDepsolver by default

media fixes:
* remove the media placeholder at this point
* sort downloading based on discid to avoid ping pong-ing between discs
* handle getting the discnum from the package
* default disc to 1, not None


Index: __init__.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/__init__.py,v
retrieving revision 1.278
retrieving revision 1.279
diff -u -r1.278 -r1.279
--- __init__.py	6 Feb 2007 06:10:32 -0000	1.278
+++ __init__.py	12 Feb 2007 22:14:20 -0000	1.279
@@ -54,14 +54,14 @@
 
 __version__ = '3.1.1'
 
-class YumBase(depsolve.Depsolve):
+class YumBase(depsolve.AnacondaDepsolver):
     """This is a primary structure and base class. It houses the objects and
        methods needed to perform most things in yum. It is almost an abstract
        class in that you will need to add your own class above it for most
        real use."""
     
     def __init__(self):
-        depsolve.Depsolve.__init__(self)
+        depsolve.AnacondaDepsolver.__init__(self)
         self.tsInfo = None
         self.rpmdb = None
         self.up = None
@@ -78,14 +78,6 @@
 
         self.mediagrabber = None
 
-    def _mediaPlaceholder(self, *args, **kwargs):
-        # FIXME: this should be removed once the media bits are fully
-        # working, but this way we can do a little bit more easy testing
-        print "calling media placeholder"
-        print "args:",  args
-        print "kwargs:", kwargs
-        import pdb; pdb.set_trace()
-
     def _transactionDataFactory(self):
         """Factory method returning TransactionData object"""
         return transactioninfo.TransactionData()
@@ -650,6 +642,21 @@
             
            
     def downloadPkgs(self, pkglist, callback=None):
+        def mediasort(a, b):
+            # FIXME: we should probably also use the mediaid; else we
+            # could conceivably ping-pong between different disc1's
+            a = a.getDiscNum()
+            b = b.getDiscNum()
+            if a is None:
+                return -1
+            if b is None:
+                return 1
+            if a < b:
+                return -1
+            elif a > b:
+                return 1
+            return 0
+        
         """download list of package objects handed to you, output based on
            callback, raise yum.Errors.YumBaseError on problems"""
 
@@ -689,6 +696,7 @@
                 return errors
                 
 
+        remote_pkgs.sort(mediasort)
         i = 0
         for po in remote_pkgs:
             i += 1

Index: packages.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/packages.py,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -r1.86 -r1.87
--- packages.py	3 Feb 2007 15:37:38 -0000	1.86
+++ packages.py	12 Feb 2007 22:14:20 -0000	1.87
@@ -23,12 +23,14 @@
 import fnmatch
 import stat
 import warnings
-from urlparse import urljoin
 from rpmUtils import RpmUtilsError
 import rpmUtils.arch
 import rpmUtils.miscutils
 import Errors
 
+import urlparse
+urlparse.uses_fragment.append("media")
+
 
 def comparePoEVR(po1, po2):
     (e1, v1, r1) = (po1.epoch, po1.version, po1.release)
@@ -421,14 +423,19 @@
         you should use self.repo.getPackage."""
         base = self.basepath
         if base:
-            return urljoin(base, self.remote_path)
-        return urljoin(self.repo.urls[0], self.remote_path)
+            return urlparse.urljoin(base, self.remote_path)
+        return urlparse.urljoin(self.repo.urls[0], self.remote_path)
     
     size = property(_size)
     remote_path = property(_remote_path)
     remote_url = property(_remote_url)
-    
-    
+
+
+    def getDiscNum(self):
+        (scheme, netloc, path, query, fragid) = urlparse.urlsplit(self.basepath)
+        if scheme == "media":
+            return int(fragid)
+        return None
     
     def returnLocalHeader(self):
         """returns an rpm header object from the package object's local
@@ -525,7 +532,7 @@
 
             self.basepath = url
             self.relativepath = pkgdict.location['href']
-        
+
         if hasattr(pkgdict, 'hdrange'):
             self.hdrstart = pkgdict.hdrange['start']
             self.hdrend = pkgdict.hdrange['end']
@@ -593,7 +600,7 @@
         self.rel = self.release
         self.summary = self.hdr['summary']
         self.description = self.hdr['description']
-        self.pkgid = self.hdr[rpm.RPMTAG_SHA1HEADER]
+        self.pkgid = self.hdr[rpm.RPMTAG_SHA1HEADER] or self.hdr[rpm.RPMTAG_SIGMD5]
         self.packagesize = self.hdr['size']
         self.__mode_cache = {}
         self.__prcoPopulated = False

Index: yumRepo.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/yumRepo.py,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- yumRepo.py	7 Feb 2007 06:48:36 -0000	1.35
+++ yumRepo.py	12 Feb 2007 22:14:20 -0000	1.36
@@ -467,7 +467,7 @@
             (scheme, netloc, path, query, fragid) = urlparse.urlsplit(url)
 
         if self.mediaid and self.mediafunc:
-            discnum = None
+            discnum = 1
             if url:
                 if scheme == "media" and fragid:
                     discnum = int(fragid)




More information about the Yum-cvs-commits mailing list