[yum-cvs] yum-utils repoquery.py,1.6,1.7 yumdownloader.py,1.4,1.5

Panu Matilainen pmatilai at login.linux.duke.edu
Wed Jun 1 06:24:56 UTC 2005


Update of /home/groups/yum/cvs/yum-utils
In directory login:/tmp/cvs-serv20311

Modified Files:
	repoquery.py yumdownloader.py 
Log Message:
yumdownloader:
- add --source option
- add /usr/share/yum-cli to module search path so it actually works

reqoquery:
- remove leftover debug junk


Index: repoquery.py
===================================================================
RCS file: /home/groups/yum/cvs/yum-utils/repoquery.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- repoquery.py	1 Jun 2005 06:08:02 -0000	1.6
+++ repoquery.py	1 Jun 2005 06:24:54 -0000	1.7
@@ -291,7 +291,6 @@
         return pkgs.values()
 
     def location(self, name):
-        print "XXXXX", name
         loc = []
         for pkg in self.returnNewestByName(name):
             repo = self.repos.getRepo(pkg['repoid'])

Index: yumdownloader.py
===================================================================
RCS file: /home/groups/yum/cvs/yum-utils/yumdownloader.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- yumdownloader.py	19 Apr 2005 14:27:07 -0000	1.4
+++ yumdownloader.py	1 Jun 2005 06:24:54 -0000	1.5
@@ -14,9 +14,12 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
+import sys
+
+sys.path.insert(0, '/usr/share/yum-cli')
+
 import yum
 import yum.Errors
-import sys
 import os
 import output
 from urlgrabber.progress import TextMeter
@@ -25,7 +28,7 @@
 from optparse import OptionParser
 from urlparse import urljoin
 
-def initYum():
+def initYum(source=False):
     my = yum.YumBase()
     my.doConfigSetup()
     my.conf.setConfigOption('uid', os.geteuid())
@@ -36,8 +39,13 @@
     file_object =sys.stdout)
     my.repos.callback = output.CacheProgressCallback(my.log,
     my.errorlog, my.filelog)
+
     my.doRepoSetup()
-    my.doSackSetup()
+    archlist = None
+    if source:
+        archlist = ['src']
+
+    my.doSackSetup(archlist=archlist)
     return my
 
 def parseArgs():
@@ -49,6 +57,8 @@
       help='just list the urls it would download instead of downloading')
     parser.add_option("--resolve", default=False, dest="resolve", action="store_true",
       help='resolve dependencies and download required packages')
+    parser.add_option("--source", default=False, dest="source", action="store_true",
+      help='operate on source packages')
     (opts, args) = parser.parse_args()
     if len(args) < 1: 
         parser.print_help()
@@ -57,7 +67,7 @@
 
 def main():
     (opts, args) = parseArgs()
-    my = initYum()
+    my = initYum(opts.source)
     avail = my.pkgSack.returnPackages()
     toDownload = {}
 
@@ -71,7 +81,11 @@
         for newpkg in installable:
             toDownload.setdefault(newpkg.name,[]).append(newpkg.pkgtup)
 
-    toDownload = returnBestPackages(toDownload)
+    if opts.source:
+        toDownload = returnBestPackages(toDownload, 'src')
+    else:
+        toDownload = returnBestPackages(toDownload)
+        
     # If the user supplies to --resolve flag, resolve dependencies for
     # all packages
     # note this might require root access because the headers need to be




More information about the Yum-cvs-commits mailing list