On Mon, May 7, 2012 at 10:42 PM, Casey Jao <c...@ugcs.caltech.edu> wrote:
> 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 > > _______________________________________________ > Yum-devel mailing list > Yum-devel@lists.baseurl.org > http://lists.baseurl.org/mailman/listinfo/yum-devel > All the commented out code look bad to me, especially the '#break', fine while testing, but bad in a final commit. If some code is left commented out, there should be some comment of why it is there in the code. Some unit test cases would be nice :) Tim
_______________________________________________ Yum-devel mailing list Yum-devel@lists.baseurl.org http://lists.baseurl.org/mailman/listinfo/yum-devel