[yum-cvs] yum/yum __init__.py,1.117,1.118 depsolve.py,1.63,1.64
Seth Vidal
skvidal at login.linux.duke.edu
Sun May 29 06:14:39 UTC 2005
Update of /home/groups/yum/cvs/yum/yum
In directory login:/tmp/cvs-serv3769/yum
Modified Files:
__init__.py depsolve.py
Log Message:
deplist function from Chip Turner: yum deplist pkgglob returns a list of
package deps and the packages that satisfy those deps
Index: __init__.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/__init__.py,v
retrieving revision 1.117
retrieving revision 1.118
diff -u -r1.117 -r1.118
--- __init__.py 8 May 2005 03:05:37 -0000 1.117
+++ __init__.py 29 May 2005 06:14:36 -0000 1.118
@@ -27,6 +27,7 @@
import sre_constants
import glob
+
import Errors
import rpmUtils
import rpmUtils.updates
@@ -34,6 +35,7 @@
import groups
import config
import repos
+import misc
import transactioninfo
from urlgrabber.grabber import URLGrabError
import depsolve
@@ -971,6 +973,46 @@
return restring
+ def findDeps(self, pkgs):
+ """Return the dependencies for a given package, as well
+ possible solutions for those dependencies.
+
+ Returns the deps as a dict of:
+ packageobject = [reqs] = [list of satisfying pkgs]"""
+
+ results = {}
+ self.doRepoSetup()
+ self.doRpmDBSetup()
+
+ avail = self.pkgSack.returnPackages()
+ exactmatch, matched, unmatched = parsePackages(avail, pkgs)
+
+ if len(unmatched) > 0:
+ self.errorlog(0, 'No Match for arguments: %s' % unmatched)
+
+ pkgs = misc.unique(exactmatch + matched)
+
+ for pkg in pkgs:
+ results[pkg] = {}
+ reqs = pkg.returnPrco('requires');
+ reqs.sort()
+ pkgresults = results[pkg] # shorthand so we don't have to do the
+ # double bracket thing
+
+ for req in reqs:
+ (r,f,v) = req
+ if r.startswith('rpmlib('):
+ continue
+
+ satisfiers = []
+
+ for po in self.whatProvides(r, f, v):
+ satisfiers.append(po)
+
+ pkgresults[req] = satisfiers
+
+ return results
+
def searchPackages(self, fields, criteria, callback=None):
"""Search specified fields for matches to criteria
optional callback specified to print out results
Index: depsolve.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/depsolve.py,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -r1.63 -r1.64
--- depsolve.py 24 May 2005 14:53:43 -0000 1.63
+++ depsolve.py 29 May 2005 06:14:36 -0000 1.64
@@ -17,6 +17,7 @@
import os
import os.path
import re
+import types
import rpmUtils.transaction
import rpmUtils.miscutils
@@ -74,12 +75,17 @@
if flags == 0:
flags = None
- (r_e, r_v, r_r) = rpmUtils.miscutils.stringToVersion(version)
+
+ if type(version) in (types.StringType, types.NoneType):
+ (r_e, r_v, r_r) = rpmUtils.miscutils.stringToVersion(version)
+ elif type(version) in (types.TupleType, types.ListType): # would this ever be a ListType?
+ (r_e, r_v, r_r) = version
+
defSack = ListPackageSack() # holder for items definitely providing this dep
for po in pkgs:
self.log(5, 'Potential match for %s from %s' % (name, po))
- if name[0] == '/' and version is None:
+ if name[0] == '/' and r_v is None:
# file dep add all matches to the defSack
defSack.addPackage(po)
continue
More information about the Yum-cvs-commits
mailing list