[yum-cvs] yum/yum yumRepo.py,1.32,1.33

Jeremy Katz katzj at linux.duke.edu
Sun Feb 4 18:23:20 UTC 2007


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

Modified Files:
	yumRepo.py 
Log Message:
further support for media installs.  determine the discid, don't do the
url bits for scheme == media (this may also work for yum 3.0.x to handle
the dvd being mounted for your core baseurl), and pass a few more bits

NOTE: the arguments for the media grabber function are not at all set in
stone right now and will change as pirut/anaconda actually use this.


Index: yumRepo.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/yumRepo.py,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- yumRepo.py	3 Feb 2007 22:04:11 -0000	1.32
+++ yumRepo.py	4 Feb 2007 18:23:18 -0000	1.33
@@ -17,6 +17,7 @@
 import time
 import types
 import urlparse
+urlparse.uses_fragment.append("media")
 
 import Errors
 from urlgrabber.grabber import URLGrabber
@@ -31,6 +32,7 @@
 from yum import misc
 
 import logging
+import logginglevels
 
 logger = logging.getLogger("yum.Repos")
 verbose_logger = logging.getLogger("yum.verbose.Repos")
@@ -291,7 +293,7 @@
     def check(self):
         """self-check the repo information  - if we don't have enough to move
            on then raise a repo error"""
-        if len(self.urls) < 1 and (not self.mediaid or not self.mediafunc):
+        if len(self.urls) < 1 and not self.mediaid:
             raise Errors.RepoError, \
              'Cannot find a valid baseurl for repo: %s' % self.id
 
@@ -446,15 +448,23 @@
 
                            self)
 
+        if url:
+            (scheme, netloc, path, query, fragid) = urlparse.urlsplit(url)
+
         if self.mediaid and self.mediafunc:
+            discnum = None
+            if url:
+                if scheme == "media" and fragid:
+                    discnum = int(fragid)
             try:
-                result = self.mediafunc(local = local, checkfunc = checkfunc, relative = relative, text = text, copy_local = copy_local)
-            except MediaError, e:
-                verbose_logger(logginglevels.DEBUG_2, "Error getting package from media; falling back to url %s" %(e,))
-            else:
+                # FIXME: we need to figure out what really matters to
+                # pass to the media grabber function here
+                result = self.mediafunc(local = local, checkfunc = checkfunc, relative = relative, text = text, copy_local = copy_local, url = url, mediaid = self.mediaid, name = self.name, discnum = discnum, range = (start, end))
                 return result
+            except Errors.MediaError, e:
+                verbose_logger.log(logginglevels.DEBUG_2, "Error getting package from media; falling back to url %s" %(e,))
         
-        if url is not None:
+        if url is not None and scheme != "media":
             ug = URLGrabber(keepalive = self.keepalive,
                             bandwidth = self.bandwidth,
                             retry = self.retries,




More information about the Yum-cvs-commits mailing list