Author: schubi2 Date: Fri Feb 22 09:56:35 2008 New Revision: 8865 URL: http://svn.opensuse.org/viewcvs/zypp?rev=8865&view=rev Log: Unmaintained packages which does not fit to the updated system (broken dependencies) will be deleted. Modified: trunk/libzypp/zypp/ProblemSolution.h trunk/libzypp/zypp/solver/detail/Resolver.cc trunk/libzypp/zypp/solver/detail/Resolver.h trunk/libzypp/zypp/solver/detail/ResolverUpgrade.cc Modified: trunk/libzypp/zypp/ProblemSolution.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ProblemSolution.h?rev=8865&r1=8864&r2=8865&view=diff ============================================================================== --- trunk/libzypp/zypp/ProblemSolution.h (original) +++ trunk/libzypp/zypp/ProblemSolution.h Fri Feb 22 09:56:35 2008 @@ -106,6 +106,8 @@ **/ void addAction( solver::detail::SolutionAction_constPtr action ); + solver::detail::CSolutionActionList actions() {return _actions;} + }; Modified: trunk/libzypp/zypp/solver/detail/Resolver.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/solver/detail/Resolver.cc?rev=8865&r1=8864&r2=8865&view=diff ============================================================================== --- trunk/libzypp/zypp/solver/detail/Resolver.cc (original) +++ trunk/libzypp/zypp/solver/detail/Resolver.cc Fri Feb 22 09:56:35 2008 @@ -36,6 +36,8 @@ #include "zypp/sat/Solvable.h" #include "zypp/sat/SATResolver.h" +#define MAXSOLVERRUNS 5 + ///////////////////////////////////////////////////////////////////////// namespace zypp { /////////////////////////////////////////////////////////////////////// @@ -295,6 +297,82 @@ /////////////////////////////////////////////////////////////////// +// +// +// METHOD NAME : Resolver::checkUnmaintainedItems +// METHOD TYPE : +// +// DESCRIPTION : Unmaintained packages which does not fit to +// the updated system (broken dependencies) will be +// deleted. +// +void Resolver::checkUnmaintainedItems () { + int solverRuns = 1; + MIL << "Checking unmaintained items....." << endl; + + while (!resolvePool() && solverRuns++ < MAXSOLVERRUNS) { + ResolverProblemList problemList = problems(); + ProblemSolutionList solutionList; + PoolItemList problemItemList; + + for (ResolverProblemList::iterator iter = problemList.begin(); iter != problemList.end(); ++iter) { + ResolverProblem problem = **iter; + DBG << "Problem:" << endl; + DBG << problem.description() << endl; + DBG << problem.details() << endl; + + ProblemSolutionList solutions = problem.solutions(); + for (ProblemSolutionList::const_iterator iterSolution = solutions.begin(); + iterSolution != solutions.end(); ++iter) { + ProblemSolution_Ptr solution = *iterSolution; + DBG << " Solution:" << endl; + DBG << " " << solution->description() << endl; + DBG << " " << solution->details() << endl; + solver::detail::CSolutionActionList actionList = solution->actions(); + bool fitUnmaintained = false; + PoolItemList deletedItems; + for (CSolutionActionList::const_iterator iterActions = actionList.begin(); + iterActions != actionList.end(); ++iterActions) { + TransactionSolutionAction_constPtr transactionAction = dynamic_pointer_cast<const TransactionSolutionAction>(*iterActions); + if (transactionAction && + transactionAction->action() == REMOVE + && _unmaintained_items.find(transactionAction->item()) != _unmaintained_items.end()) { + // The solution contains unmaintained items ONLY which will be deleted. So take this solution + fitUnmaintained = true; + deletedItems.push_back (transactionAction->item()); + } else { + fitUnmaintained = false; + } + } + if (fitUnmaintained) { + MIL << "Problem:" << endl; + MIL << problem.description() << endl; + MIL << problem.details() << endl; + MIL << "Will be solved by removing unmaintained package(s)............" << endl; + MIL << " Solution:" << endl; + MIL << " " << solution->description() << endl; + MIL << " " << solution->details() << endl; + solutionList.push_back (solution); + problemItemList.insert (problemItemList.end(), deletedItems.begin(), deletedItems.end() ); + break; // not regarding the other solutions + } + } + } + + if (!solutionList.empty()) { + applySolutions (solutionList); + // list of problematic items after doUpgrade() which is show to the user + _problem_items.insert (_problem_items.end(), problemItemList.begin(), problemItemList.end()); + _problem_items.unique(); + } else { + // break cause there is no other solution available by the next run + solverRuns = MAXSOLVERRUNS; + } + } +} + + +/////////////////////////////////////////////////////////////////// };// namespace detail ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// Modified: trunk/libzypp/zypp/solver/detail/Resolver.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/solver/detail/Resolver.h?rev=8865&r1=8864&r2=8865&view=diff ============================================================================== --- trunk/libzypp/zypp/solver/detail/Resolver.h (original) +++ trunk/libzypp/zypp/solver/detail/Resolver.h Fri Feb 22 09:56:35 2008 @@ -72,7 +72,7 @@ PoolItemList _problem_items; // list of not supported packages - PoolItemList _unmaintained_items; + PoolItemSet _unmaintained_items; CapabilitySet _extra_requires; CapabilitySet _extra_conflicts; @@ -105,6 +105,9 @@ bool doesObsoleteCapability (PoolItem candidate, const Capability & cap); bool doesObsoleteItem (PoolItem candidate, PoolItem installed); + // Unmaintained packages which does not fit to the updated system + // (broken dependencies) will be deleted. + void checkUnmaintainedItems (); public: Modified: trunk/libzypp/zypp/solver/detail/ResolverUpgrade.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/solver/detail/ResolverUpgrade.cc?rev=8865&r1=8864&r2=8865&view=diff ============================================================================== --- trunk/libzypp/zypp/solver/detail/ResolverUpgrade.cc (original) +++ trunk/libzypp/zypp/solver/detail/ResolverUpgrade.cc Fri Feb 22 09:56:35 2008 @@ -55,9 +55,12 @@ #include "zypp/solver/detail/Helper.h" #include "zypp/solver/detail/Resolver.h" #include "zypp/solver/detail/Testcase.h" +#include "zypp/ResolverProblem.h" +#include "zypp/ProblemSolution.h" #include "zypp/Target.h" #include "zypp/sat/SATResolver.h" + ///////////////////////////////////////////////////////////////////////// namespace zypp { /////////////////////////////////////////////////////////////////////// @@ -215,8 +218,6 @@ TodoMap addProvided; TodoMap addMultiProvided; - sat::Pool::instance().prepare(); - Target_Ptr target; try { target = getZYpp()->target(); @@ -420,6 +421,7 @@ // Remember new package for 2nd pass. Capability installedCap( installed->name(), Rel::EQ, installed->edition(), installed->kind()); + // find ALL providers sat::WhatProvides possibleProviders(installedCap); @@ -513,7 +515,7 @@ /////////////////////////////////////////////////////////////////// if ( can_be_dropped ) { - _unmaintained_items.push_back( installed ); + _unmaintained_items.insert( installed ); } } // pass 1 end @@ -627,8 +629,14 @@ // Setting Resolver to upgrade mode _upgradeMode = true; + + // Unmaintained packages which does not fit to the updated system + // (broken dependencies) will be deleted. + checkUnmaintainedItems (); + } + /////////////////////////////////////////////////////////////////// };// namespace detail ///////////////////////////////////////////////////////////////////// -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org