[yum-cvs] yum-utils yumdownloader.py,1.9,1.10

Gijs Hollestelle gijs at linux.duke.edu
Sun May 14 14:08:30 UTC 2006


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

Modified Files:
	yumdownloader.py 
Log Message:
Fix bug #469:
Make yumdownloader download the correct source rpm if the provided package is
a subpackage of another package. For example yumdownloader --source mod_ssl 
now downloads the httpd src rpm.



Index: yumdownloader.py
===================================================================
RCS file: /home/groups/yum/cvs/yum-utils/yumdownloader.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- yumdownloader.py	7 May 2006 01:36:52 -0000	1.9
+++ yumdownloader.py	14 May 2006 14:08:27 -0000	1.10
@@ -22,6 +22,7 @@
 import yum.Errors
 import os
 import output
+import rpmUtils.arch
 from urlgrabber.progress import TextMeter
 from yum.logger import Logger
 from yum.packages import parsePackages
@@ -88,7 +89,7 @@
     my.doRepoSetup()
     archlist = None
     if opts.source:
-        archlist = ['src']
+        archlist = rpmUtils.arch.getArchList() + ['src']
 
     my.doSackSetup(archlist=archlist)
 
@@ -104,9 +105,30 @@
         if len(unmatched) > 0: # if we get back anything in unmatched, it fails
             my.errorlog(0, 'No Match for argument %s' % pkg)
             continue
+
         for newpkg in installable:
-            toActOn.append(newpkg)
-        
+            # This is to fix Bug 469
+            # If there are matches to the package argument given but there
+            # are no source packages, this can be caused because the
+            # source rpm this is built from has a different name
+            # for example: nscd is built from the glibc source rpm
+            # We find this name by parsing the sourcerpm filename
+            # (this is ugly but it appears to work)
+            # And finding a package with arch src and the same
+            # ver and rel as the binary package
+            # That should be the source package
+            # Note we do not use the epoch to search as the epoch for the
+            # source rpm might be different from the binary rpm (see
+            # for example mod_ssl)
+            if opts.source and newpkg.arch != 'src':
+                name = newpkg.returnSimple('sourcerpm').rsplit('-',2)[0]
+                src = my.pkgSack.searchNevra(name=name, arch = 'src',
+                  ver = newpkg.version,
+                  rel = newpkg.release
+                )
+                toActOn.extend(src)
+            else:
+                toActOn.append(newpkg)
 
         if toActOn:
             if opts.source:




More information about the Yum-cvs-commits mailing list