[yum-cvs] yum-utils yumdownloader.py,1.23,1.24

Tim Lauridsen timlau at linux.duke.edu
Tue Jun 26 09:23:12 UTC 2007


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

Modified Files:
	yumdownloader.py 
Log Message:
solved issue where '--source' was not working if souce repo was enabled in the .repo files (rhbz #244543).
made yumdownloader a little more verbose.

Index: yumdownloader.py
===================================================================
RCS file: /home/groups/yum/cvs/yum-utils/yumdownloader.py,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- yumdownloader.py	18 Jun 2007 09:46:58 -0000	1.23
+++ yumdownloader.py	26 Jun 2007 09:23:10 -0000	1.24
@@ -63,7 +63,7 @@
             self.conf.cache = 0
 
         # Setup yum (Ts, RPM db, Repo & Sack)
-        self.doUtilYumSetup()
+        self.doUtilYumSetup(opts)
         # Setup source repos
         if opts.source:
             self.setupSourceRepos()
@@ -118,6 +118,9 @@
                       ver = newpkg.version,
                       rel = newpkg.release
                     )
+                    if src == []:
+                        self.logger.error('No source RPM found for %s' % str(newpkg))
+                        
                     toActOn.extend(src)
                 else:
                     toActOn.append(newpkg)
@@ -145,6 +148,8 @@
             for pkg in self.tsInfo.getMembers():
                 if not pkg in toDownload:
                     toDownload.append(pkg)
+        if len(toDownload) == 0:
+            self.logger.error('Nothing to download')
             
         for pkg in toDownload:
             n,a,e,v,r = pkg.pkgtup
@@ -175,7 +180,25 @@
                                    size=os.stat(path).st_size)
                     shutil.copy2(path, local)
                     progress.end(progress.size)
-        
+   
+    # sligly modified from the one in YumUtilBase    
+    def doUtilYumSetup(self,opts):
+        """do a default setup for all the normal/necessary yum components,
+           really just a shorthand for testing"""
+        # FIXME - we need another way to do this, I think.
+        try:
+            self._getTs()
+            self._getRpmDB()
+            self._getRepos()
+            # if '--source' is used the add src to the archlist
+            if opts.source:
+                archlist = rpmUtils.arch.getArchList() + ['src']    
+            else:
+                archlist = rpmUtils.arch.getArchList()
+            self._getSacks(archlist=archlist)
+        except yum.Errors.YumBaseError, msg:
+            self.logger.critical(str(msg))
+            sys.exit(1)
 
 
     def addCmdOptions(self,parser):




More information about the Yum-cvs-commits mailing list