[Yum-devel] [PATCH] Move some dependency checks to _has_needed_revdeps.

Casey Jao cjao at ugcs.caltech.edu
Mon May 7 20:42:04 UTC 2012


This patch is intended to address Bug 773440 regarding
clean_requirements_on_remove
(https://bugzilla.redhat.com/show_bug.cgi?id=773440).

Currently we only consider a reverse dependency of a pkg "needed"
if it was user-installed. The patch checks if the revdep is needed
by a pkg to be installed in the transaction. The corresponding
check in _remove_old_deps is now redundant since _has_needed_revdeps
considers a pkg as a revdep of itself.
---
 yum/__init__.py |   38 ++++++++++++++++++++++++++++----------
 1 file changed, 28 insertions(+), 10 deletions(-)

diff --git a/yum/__init__.py b/yum/__init__.py
index 7e67d20..3b4ddf5 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -6292,16 +6292,16 @@ class YumBase(depsolve.Depsolve):
                         continue
                         
                 # go through the stuff in the ts to be installed - make sure none of that needs the required pkg, either.
-                for (provn,provf,provevr) in required.provides:
-                    if self.tsInfo.getNewRequires(provn, provf, provevr).keys():
-                        still_needed = True
-                        okay_to_remove[required] = False
-                        break
-                for fn in required.filelist + required.dirlist:
-                    if self.tsInfo.getNewRequires(fn, None,(None,None,None)).keys():
-                        okay_to_remove[required] = False
-                        still_needed = True
-                        break
+               # for (provn,provf,provevr) in required.provides:
+               #     if self.tsInfo.getNewRequires(provn, provf, provevr).keys():
+               #         still_needed = True
+               #         okay_to_remove[required] = False
+               #     break
+               # for fn in required.filelist + required.dirlist:
+               #     if self.tsInfo.getNewRequires(fn, None,(None,None,None)).keys():
+               #         okay_to_remove[required] = False
+               #         still_needed = True
+               #         break
                             
                     #for tbi_pkg in self.tsInfo.getMembersWithState(output_states=TS_INSTALL_STATES):
                     #   for reqtuple in tbi_pkg.po.requires:
@@ -6354,7 +6354,25 @@ class YumBase(depsolve.Depsolve):
                     # Debugging output
                     self.verbose_logger.log(logginglevels.DEBUG_2, _("%s has revdep %s which was user-installed."), pkg, curpkg)
                     ok_to_remove[pkg] = False
+                    ok_to_remove[curpkg] = False
                     return True
+                # go through the stuff in the ts to be installed - make sure none of that needs the required pkg, either.
+                for (provn,provf,provevr) in curpkg.provides:
+                    if self.tsInfo.getNewRequires(provn, provf, provevr).keys():
+                        #still_needed = True
+                        okay_to_remove[pkg] = False
+                        okay_to_remove[curpkg] = False
+                        self.verbose_logger.log(logginglevels.DEBUG_2, _("%s is needed by a package to be installed."), curpkg)
+                        return True
+                        #break
+                for fn in curpkg.filelist + curpkg.dirlist:
+                    if self.tsInfo.getNewRequires(fn, None,(None,None,None)).keys():
+                        okay_to_remove[pkg] = False
+                        okay_to_remove[curpkg] = False
+                        #still_needed = True
+                        self.verbose_logger.log(logginglevels.DEBUG_2, _("%s is needed by a package to be installed."), curpkg)
+                        return True
+                        #break
                 visited[curpkg] = True
             all_leaves_visited = True
             leaves = curpkg.requiring_packages()
-- 
1.7.10.1



More information about the Yum-devel mailing list