ref: refs/heads/master
commit 10b0c5e11662444f0d5d50b8d41cd91199e785ef
Author: Michael Andres
Date: Tue Mar 3 16:51:05 2009 +0100
Reintroduce ResStatus UninstalledDueToObsolete.
---
zypp/ResStatus.cc | 6 ++-
zypp/ResStatus.h | 14 +++++-
zypp/pool/GetResolvablesToInsDel.cc | 6 ++-
zypp/solver/detail/Resolver.h | 23 ++++-----
zypp/solver/detail/ResolverUpgrade.cc | 6 --
zypp/solver/detail/SATResolver.cc | 87 +++++++++++++++------------------
zypp/solver/detail/SATResolver.h | 38 +++++++--------
7 files changed, 90 insertions(+), 90 deletions(-)
diff --git a/zypp/ResStatus.cc b/zypp/ResStatus.cc
index d59b6e0..5d93707 100644
--- a/zypp/ResStatus.cc
+++ b/zypp/ResStatus.cc
@@ -23,6 +23,7 @@ namespace zypp
const ResStatus ResStatus::toBeInstalled (UNINSTALLED, UNDETERMINED, TRANSACT);
const ResStatus ResStatus::toBeUninstalled (INSTALLED, UNDETERMINED, TRANSACT);
const ResStatus ResStatus::toBeUninstalledDueToUpgrade (INSTALLED, UNDETERMINED, TRANSACT, EXPLICIT_INSTALL, DUE_TO_UPGRADE);
+ const ResStatus ResStatus::toBeUninstalledDueToObsolete(INSTALLED, UNDETERMINED, TRANSACT, EXPLICIT_INSTALL, DUE_TO_OBSOLETE);
///////////////////////////////////////////////////////////////////
//
@@ -86,8 +87,9 @@ namespace zypp
else if (obj.isByApplHigh()) str << "h";
else if (obj.isByUser()) str << "u";
- str << (obj.isToBeUninstalledDueToUpgrade() ? "U" :
- ( obj.isToBeInstalledSoft() ? "S" : "_" ) );
+ str << (obj.isToBeUninstalledDueToObsolete() ? "O" :
+ ( obj.isToBeUninstalledDueToUpgrade() ? "U" :
+ ( obj.isToBeInstalledSoft() ? "S" : "_" ) ) );
str << (obj.isSeen() ? "@" : "" );
diff --git a/zypp/ResStatus.h b/zypp/ResStatus.h
index 6cb25f7..aa2a3d6 100644
--- a/zypp/ResStatus.h
+++ b/zypp/ResStatus.h
@@ -127,7 +127,8 @@ namespace zypp
{
EXPLICIT_REMOVE = bit::RangeValue::value,
SOFT_REMOVE = bit::RangeValue::value,
- DUE_TO_UPGRADE = bit::RangeValue::value
+ DUE_TO_OBSOLETE = bit::RangeValue::value,
+ DUE_TO_UPGRADE = bit::RangeValue::value
};
enum SolverStateValue
{
@@ -301,6 +302,9 @@ namespace zypp
}
}
+ bool isToBeUninstalledDueToObsolete () const
+ { return isToBeUninstalled() && fieldValueIs<TransactDetailField>( DUE_TO_OBSOLETE ); }
+
bool isToBeUninstalledDueToUpgrade() const
{ return isToBeUninstalled() && fieldValueIs<TransactDetailField>( DUE_TO_UPGRADE ); }
@@ -545,6 +549,13 @@ namespace zypp
//------------------------------------------------------------------------
// *** These are only for the Resolver ***
+ bool setToBeUninstalledDueToObsolete ( )
+ {
+ if (!setToBeUninstalled (SOLVER)) return false;
+ fieldValueAssign<TransactDetailField>(DUE_TO_OBSOLETE);
+ return true;
+ }
+
bool setToBeUninstalledDueToUpgrade ( TransactByValue causer )
{
if (!setToBeUninstalled (causer)) return false;
@@ -650,6 +661,7 @@ namespace zypp
static const ResStatus toBeInstalled;
static const ResStatus toBeUninstalled;
static const ResStatus toBeUninstalledDueToUpgrade;
+ static const ResStatus toBeUninstalledDueToObsolete;
//@}
private:
diff --git a/zypp/pool/GetResolvablesToInsDel.cc b/zypp/pool/GetResolvablesToInsDel.cc
index 63eb576..2389382 100644
--- a/zypp/pool/GetResolvablesToInsDel.cc
+++ b/zypp/pool/GetResolvablesToInsDel.cc
@@ -87,7 +87,11 @@ namespace zypp
}
else if (it->status().isToBeUninstalled())
{
- if( it->status().isToBeUninstalledDueToUpgrade() )
+ if ( it->status().isToBeUninstalledDueToObsolete() )
+ {
+ DBG << "Ignore auto_delete (should be obsoleted): " << *it << endl;
+ }
+ else if ( it->status().isToBeUninstalledDueToUpgrade() )
{
DBG << "Ignore auto_delete (should be upgraded): " << *it << endl;
}
diff --git a/zypp/solver/detail/Resolver.h b/zypp/solver/detail/Resolver.h
index 3cda52b..8f01dda 100644
--- a/zypp/solver/detail/Resolver.h
+++ b/zypp/solver/detail/Resolver.h
@@ -82,7 +82,7 @@ namespace zypp
};
typedef std::multimap ItemCapKindMap;
typedef std::list<ItemCapKind> ItemCapKindList;
-
+
///////////////////////////////////////////////////////////////////
//
@@ -98,7 +98,7 @@ class Resolver : public base::ReferenceCounted, private base::NonCopyable {
CapabilitySet _extra_requires;
CapabilitySet _extra_conflicts;
-
+
// Regard dependencies of the item weak onl
PoolItemList _addWeak;
@@ -106,7 +106,7 @@ class Resolver : public base::ReferenceCounted, private base::NonCopyable {
// have unfulfilled requirements.
// This behaviour is favourited by ZMD
bool _upgradeMode; // Resolver has been called with doUpgrade
- bool _updateMode; // Resolver has been called with doUpdate
+ bool _updateMode; // Resolver has been called with doUpdate
bool _verifying; // The system will be checked
TriBool _onlyRequires; // do install required resolvables only
// no recommended resolvables, language
@@ -124,10 +124,9 @@ class Resolver : public base::ReferenceCounted, private base::NonCopyable {
ItemCapKindMap _installs;
ItemCapKindMap _satifiedByInstalled;
ItemCapKindMap _installedSatisfied;
-
+
// helpers
- bool doesObsoleteItem (PoolItem candidate, PoolItem installed);
- void collectResolverInfo (void);
+ void collectResolverInfo (void);
// Unmaintained packages which does not fit to the updated system
// (broken dependencies) will be deleted.
@@ -158,7 +157,7 @@ class Resolver : public base::ReferenceCounted, private base::NonCopyable {
void removeExtraConflict (const Capability & capability);
void removeQueueItem (const SolverQueueItem_Ptr item);
- void addQueueItem (const SolverQueueItem_Ptr item);
+ void addQueueItem (const SolverQueueItem_Ptr item);
const CapabilitySet extraRequires () { return _extra_requires; }
const CapabilitySet extraConflicts () { return _extra_conflicts; }
@@ -170,7 +169,7 @@ class Resolver : public base::ReferenceCounted, private base::NonCopyable {
void setIgnorealreadyrecommended (const bool ignorealreadyrecommended)
{ _ignorealreadyrecommended = ignorealreadyrecommended; }
- bool ignorealreadyrecommended() { return _ignorealreadyrecommended; }
+ bool ignorealreadyrecommended() { return _ignorealreadyrecommended; }
void setOnlyRequires (const TriBool state)
{ _onlyRequires = state; }
@@ -178,14 +177,14 @@ class Resolver : public base::ReferenceCounted, private base::NonCopyable {
bool verifySystem ();
bool resolvePool();
- bool resolveQueue(solver::detail::SolverQueueItemList & queue);
+ bool resolveQueue(solver::detail::SolverQueueItemList & queue);
void doUpdate();
bool doUpgrade( zypp::UpgradeStatistics & opt_stats_r );
PoolItemList problematicUpdateItems( void ) const;
bool isUpgradeMode(){ return _upgradeMode;}; // Resolver has been called with doUpgrade
- bool isUpdateMode(){ return _updateMode;}; // Resolver has been called with doUpdate
+ bool isUpdateMode(){ return _updateMode;}; // Resolver has been called with doUpdate
bool isVerifyingMode(){ return _verifying;}; // The system will be checked
ResolverProblemList problems () const;
@@ -204,9 +203,9 @@ class Resolver : public base::ReferenceCounted, private base::NonCopyable {
// installation
const ItemCapKindList isInstalledBy (const PoolItem item);
const ItemCapKindList installs (const PoolItem item);
- const ItemCapKindList satifiedByInstalled (const PoolItem item);
+ const ItemCapKindList satifiedByInstalled (const PoolItem item);
const ItemCapKindList installedSatisfied (const PoolItem item);
-
+
};
///////////////////////////////////////////////////////////////////
diff --git a/zypp/solver/detail/ResolverUpgrade.cc b/zypp/solver/detail/ResolverUpgrade.cc
index 28c3579..e0b9ffc 100644
--- a/zypp/solver/detail/ResolverUpgrade.cc
+++ b/zypp/solver/detail/ResolverUpgrade.cc
@@ -50,12 +50,6 @@ namespace zypp
using namespace std;
using namespace zypp;
-bool
-Resolver::doesObsoleteItem (PoolItem candidate, PoolItem installed)
-{
- return _satResolver->doesObsoleteItem (candidate, installed);
-}
-
//-----------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////
diff --git a/zypp/solver/detail/SATResolver.cc b/zypp/solver/detail/SATResolver.cc
index 809842f..bbb39a0 100644
--- a/zypp/solver/detail/SATResolver.cc
+++ b/zypp/solver/detail/SATResolver.cc
@@ -33,6 +33,7 @@
#include "zypp/ZConfig.h"
#include "zypp/sat/Pool.h"
#include "zypp/sat/WhatProvides.h"
+#include "zypp/sat/WhatObsoletes.h"
#include "zypp/solver/detail/SATResolver.h"
#include "zypp/solver/detail/ProblemSolutionCombi.h"
#include "zypp/solver/detail/ProblemSolutionIgnore.h"
@@ -172,7 +173,7 @@ SATResolver::resetItemTransaction (PoolItem item)
{
bool found = false;
for (PoolItemList::const_iterator iter = _items_to_remove.begin();
- iter != _items_to_remove.end(); iter++) {
+ iter != _items_to_remove.end(); ++iter) {
if (*iter == item) {
_items_to_remove.remove(*iter);
found = true;
@@ -181,7 +182,7 @@ SATResolver::resetItemTransaction (PoolItem item)
}
if (!found) {
for (PoolItemList::const_iterator iter = _items_to_install.begin();
- iter != _items_to_install.end(); iter++) {
+ iter != _items_to_install.end(); ++iter) {
if (*iter == item) {
_items_to_install.remove(*iter);
found = true;
@@ -191,7 +192,7 @@ SATResolver::resetItemTransaction (PoolItem item)
}
if (!found) {
for (PoolItemList::const_iterator iter = _items_to_keep.begin();
- iter != _items_to_keep.end(); iter++) {
+ iter != _items_to_keep.end(); ++iter) {
if (*iter == item) {
_items_to_keep.remove(*iter);
found = true;
@@ -201,7 +202,7 @@ SATResolver::resetItemTransaction (PoolItem item)
}
if (!found) {
for (PoolItemList::const_iterator iter = _items_to_lock.begin();
- iter != _items_to_lock.end(); iter++) {
+ iter != _items_to_lock.end(); ++iter) {
if (*iter == item) {
_items_to_lock.remove(*iter);
found = true;
@@ -294,32 +295,6 @@ SATSolutionToPool (PoolItem item, const ResStatus & status, const ResStatus::Tra
return;
}
-
-//----------------------------------------------------------------------------
-// helper functions for distupgrade
-//----------------------------------------------------------------------------
-
-bool SATResolver::doesObsoleteItem (PoolItem candidate, PoolItem installed) {
- Solvable *sCandidate = _SATPool->solvables + candidate.satSolvable().id();
- ::_Repo *installedRepo = sat::Pool::instance().systemRepo().get();
-
- Id p, pp, obsolete, *obsoleteIt;
-
- if ((!installedRepo || sCandidate->repo != installedRepo) && sCandidate->obsoletes) {
- obsoleteIt = sCandidate->repo->idarraydata + sCandidate->obsoletes;
- while ((obsolete = *obsoleteIt++) != 0)
- {
- for (pp = pool_whatprovides(_SATPool, obsolete); (p = _SATPool->whatprovidesdata[pp++]) != 0; ) {
- if (p > 0 && installed.satSolvable().id() == (sat::detail::SolvableIdType)p) {
- MIL << candidate << " obsoletes " << installed << endl;
- return true;
- }
- }
- }
- }
- return false;
-}
-
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
// resolvePool
@@ -480,27 +455,43 @@ SATResolver::solving(const CapabilitySet & requires_caps,
/* solvables to be erased */
Repository systemRepo( sat::Pool::instance().findSystemRepo() ); // don't create if it does not exist
- for_( it, systemRepo.solvablesBegin(), systemRepo.solvablesEnd() )
+ if ( systemRepo && ! systemRepo.solvablesEmpty() )
{
- if (_solv->decisionmap[it->id()] > 0)
- continue;
-
- PoolItem poolItem( *it );
- // Check if this is an update
- CheckIfUpdate info;
- invokeOnEach( _pool.byIdentBegin( poolItem ),
- _pool.byIdentEnd( poolItem ),
- resfilter::ByUninstalled(), // ByUninstalled
- functor::functorRef (info) );
-
- if (info.is_updated) {
- SATSolutionToPool (poolItem, ResStatus::toBeUninstalledDueToUpgrade , ResStatus::SOLVER);
- } else {
- SATSolutionToPool (poolItem, ResStatus::toBeUninstalled, ResStatus::SOLVER);
+ bool mustCheckObsoletes = false;
+ for_( it, systemRepo.solvablesBegin(), systemRepo.solvablesEnd() )
+ {
+ if (_solv->decisionmap[it->id()] > 0)
+ continue;
+
+ PoolItem poolItem( *it );
+ // Check if this is an update
+ CheckIfUpdate info;
+ invokeOnEach( _pool.byIdentBegin( poolItem ),
+ _pool.byIdentEnd( poolItem ),
+ resfilter::ByUninstalled(), // ByUninstalled
+ functor::functorRef (info) );
+
+ if (info.is_updated) {
+ SATSolutionToPool( poolItem, ResStatus::toBeUninstalledDueToUpgrade, ResStatus::SOLVER );
+ } else {
+ SATSolutionToPool( poolItem, ResStatus::toBeUninstalled, ResStatus::SOLVER );
+ if ( ! mustCheckObsoletes )
+ mustCheckObsoletes = true; // lazy check for UninstalledDueToObsolete
+ }
+ _result_items_to_remove.push_back (poolItem);
+ }
+ if ( mustCheckObsoletes )
+ {
+ sat::WhatObsoletes obsoleted( _result_items_to_install.begin(), _result_items_to_install.end() );
+ for_( it, obsoleted.poolItemBegin(), obsoleted.poolItemEnd() )
+ {
+ ResStatus & status( it->status() );
+ // WhatObsoletes contains installed items only!
+ if ( status.transacts() && ! status.isToBeUninstalledDueToUpgrade() )
+ status.setToBeUninstalledDueToObsolete();
+ }
}
- _result_items_to_remove.push_back (poolItem);
}
-
/* solvables which are recommended */
for (int i = 0; i < _solv->recommendations.count; i++)
{
diff --git a/zypp/solver/detail/SATResolver.h b/zypp/solver/detail/SATResolver.h
index 2afaa03..655c6c4 100644
--- a/zypp/solver/detail/SATResolver.h
+++ b/zypp/solver/detail/SATResolver.h
@@ -78,25 +78,25 @@ class SATResolver : public base::ReferenceCounted, private base::NonCopyable {
PoolItemList _result_items_to_install;
PoolItemList _result_items_to_remove;
- bool _fixsystem; // repair errors in rpm dependency graph
- bool _allowdowngrade; // allow to downgrade installed solvable
- bool _allowarchchange; // allow to change architecture of installed solvables
- bool _allowvendorchange; // allow to change vendor of installed solvables
+ bool _fixsystem; // repair errors in rpm dependency graph
+ bool _allowdowngrade; // allow to downgrade installed solvable
+ bool _allowarchchange; // allow to change architecture of installed solvables
+ bool _allowvendorchange; // allow to change vendor of installed solvables
bool _allowuninstall; // allow removal of installed solvables
bool _updatesystem; // update
- bool _allowvirtualconflicts; // false: conflicts on package name, true: conflicts on package provides
- bool _noupdateprovide; // true: update packages needs not to provide old package
- bool _dosplitprovides; // true: consider legacy split provides
+ bool _allowvirtualconflicts; // false: conflicts on package name, true: conflicts on package provides
+ bool _noupdateprovide; // true: update packages needs not to provide old package
+ bool _dosplitprovides; // true: consider legacy split provides
bool _onlyRequires; // true: consider required packages only
bool _ignorealreadyrecommended; // true: ignore recommended packages that were already recommended by the installed packages
- bool _distupgrade;
+ bool _distupgrade;
bool _distupgrade_removeunsupported;
-
+
// ---------------------------------- methods
std::string SATprobleminfoString (Id problem, std::string &detail, Id &ignoreId);
void resetItemTransaction (PoolItem item);
- // Create a SAT solver and reset solver selection in the pool (Collecting
+ // Create a SAT solver and reset solver selection in the pool (Collecting
void solverInit(const PoolItemList & weakItems);
// common solver run with the _jobQueue; Save results back to pool
bool solving(const CapabilitySet & requires_caps = CapabilitySet(),
@@ -113,10 +113,10 @@ class SATResolver : public base::ReferenceCounted, private base::NonCopyable {
// e.g. The release package has a buddy to the concerning product item.
// This user want's the message "Product foo conflicts with product bar" and
// NOT "package release-foo conflicts with package release-bar"
- // So these functions return the concerning buddy (e.g. product item)
+ // So these functions return the concerning buddy (e.g. product item)
sat::Solvable mapSolvable (const Id &id);
PoolItem mapItem (const PoolItem &item);
-
+
public:
SATResolver (const ResPool & pool, Pool *SATPool);
@@ -175,33 +175,31 @@ class SATResolver : public base::ReferenceCounted, private base::NonCopyable {
bool allowvendorchange () const {return _allowvendorchange;}
void setAllowvendorchange ( const bool allowvendorchange) { _allowvendorchange = allowvendorchange;}
-
+
bool allowuninstall () const {return _allowuninstall;}
void setAllowuninstall ( const bool allowuninstall) { _allowuninstall = allowuninstall;}
bool updatesystem () const {return _updatesystem;}
void setUpdatesystem ( const bool updatesystem) { _updatesystem = updatesystem;}
-
+
bool allowvirtualconflicts () const {return _allowvirtualconflicts;}
void setAllowvirtualconflicts ( const bool allowvirtualconflicts) { _allowvirtualconflicts = allowvirtualconflicts;}
-
+
bool noupdateprovide () const {return _noupdateprovide;}
void setNoupdateprovide ( const bool noupdateprovide) { _noupdateprovide = noupdateprovide;}
bool dosplitprovides () const {return _dosplitprovides;}
void setDosplitprovides ( const bool dosplitprovides) { _dosplitprovides = dosplitprovides;}
-
+
bool onlyRequires () const {return _onlyRequires;}
void setOnlyRequires ( const bool onlyRequires) { _onlyRequires = onlyRequires;}
- bool doesObsoleteItem (PoolItem candidate, PoolItem installed);
-
- PoolItemList problematicUpdateItems( void ) const { return _problem_items; }
+ PoolItemList problematicUpdateItems( void ) const { return _problem_items; }
PoolItemList resultItemsToInstall () { return _result_items_to_install; }
PoolItemList resultItemsToRemove () { return _result_items_to_remove; }
PoolItemList problematicUpdateItems() { return _problem_items; }
-
+
};
///////////////////////////////////////////////////////////////////
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org