Florian Festi wrote:
Hi!

I'll post the single changes made to the Depsolver to adjust it to the getProvides/Requires interface. All patches of course require the getProvides patch series.

Someone who exactly knows its purpose should have a look at the setAsDep code.

Florian
--- yum/depsolve.py-1	2007-06-14 14:22:42.000000000 +0200
+++ yum/depsolve.py	2007-06-14 14:23:59.000000000 +0200
@@ -917,20 +917,14 @@
 
     def _checkInstall(self, txmbr):
         reqs = txmbr.po.returnPrco('requires')
-        provs = txmbr.po.returnPrco('provides')
-
-        flags = {"GT": rpm.RPMSENSE_GREATER,
-                 "GE": rpm.RPMSENSE_EQUAL | rpm.RPMSENSE_GREATER,
-                 "LT": rpm.RPMSENSE_LESS,
-                 "LE": rpm.RPMSENSE_LESS | rpm.RPMSENSE_EQUAL,
-                 "EQ": rpm.RPMSENSE_EQUAL,
-                 None: 0 }
+        provs = set(txmbr.po.returnPrco('provides'))
 
         # if this is an update, we should check what the old
         # requires were to make things faster
         oldreqs = []
         for oldpo in txmbr.updates:
             oldreqs.extend(oldpo.returnPrco('requires'))
+        oldreqs = set(oldreqs)
 
         ret = []
         for req in reqs:
@@ -942,39 +936,24 @@
                 continue
             
             self.verbose_logger.log(logginglevels.DEBUG_2, "looking for %s as a requirement of %s", req, txmbr)
-            dep = self.deps.get(req, None)
-            if dep is None:
-                dep = self._provideToPkg(req)
-                if dep is None:
-                    reqtuple = (req[0], version_tuple_to_string(req[2]), flags[req[1]])
-                    self._dcobj.addRequires(txmbr.po, [reqtuple])
-                    ret.append( ((txmbr.name, txmbr.version, txmbr.release),
-                                 (req[0], version_tuple_to_string(req[2])), flags[req[1]], None,
-                                 rpm.RPMDEP_SENSE_REQUIRES) )
-                    continue
-
-            # Skip filebased requires on self, etc
-            if txmbr.name == dep.name:
+            provs = self.tsInfo.getProvides(*req) 
+            if not provs:
+                reqtuple = (req[0], version_tuple_to_string(req[2]), flags[req[1]])
+                self._dcobj.addRequires(txmbr.po, [reqtuple])
+                ret.append( ((txmbr.name, txmbr.version, txmbr.release),
+                             (req[0], version_tuple_to_string(req[2])), flags[req[1]], None,
+                             rpm.RPMDEP_SENSE_REQUIRES) )
                 continue
-            # FIXME: Yum doesn't need this, right?
-            #if (dep.name, txmbr.name) in whiteout.whitetup:
-            #   log.debug("ignoring %s>%s in whiteout" %(dep.name, txmbr.name))
-            #   continue
-            if self.isPackageInstalled(dep.name):
-                continue
-            if self.tsInfo.exists(dep.pkgtup):
-                pkgs = self.tsInfo.getMembers(pkgtup=dep.pkgtup)
-                member = self.bestPackagesFromList(pkgs)[0]
-
-                #Add relationship
-                found = False
-                for dependspo in txmbr.depends_on:
-                    if member.po == dependspo:
-                        found = True
-                        break
-                if not found:
+
+            #Add relationship
+            for po in provs:
+                if txmbr.name == po.name:
+                    continue
+                for member in self.tsInfo.getMembersWithState(
+                    pkgtup=po.pkgtup, output_states=TS_INSTALL_STATES):
                     member.setAsDep(txmbr.po)
 
+
         for conflict in txmbr.po.returnPrco('conflicts'):
             (r, f, v) = conflict
             txmbrs = self.tsInfo.matchNaevr(name=r)
_______________________________________________
Yum-devel mailing list
[email protected]
https://lists.dulug.duke.edu/mailman/listinfo/yum-devel

Reply via email to