[zypp-commit] r9317 - in /trunk/libzypp/zypp: Resolver.cc Resolver.h sat/SATResolver.cc sat/SATResolver.h solver/detail/Resolver.cc solver/detail/Resolver.h
Author: schubi2
Date: Mon Mar 31 15:39:26 2008
New Revision: 9317
URL: http://svn.opensuse.org/viewcvs/zypp?rev=9317&view=rev
Log:
added doUpdate( ) which Update to newest packages
Modified:
trunk/libzypp/zypp/Resolver.cc
trunk/libzypp/zypp/Resolver.h
trunk/libzypp/zypp/sat/SATResolver.cc
trunk/libzypp/zypp/sat/SATResolver.h
trunk/libzypp/zypp/solver/detail/Resolver.cc
trunk/libzypp/zypp/solver/detail/Resolver.h
Modified: trunk/libzypp/zypp/Resolver.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Resolver.cc?rev=9317&r1=9316&r2=9317&view=diff
==============================================================================
--- trunk/libzypp/zypp/Resolver.cc (original)
+++ trunk/libzypp/zypp/Resolver.cc Mon Mar 31 15:39:26 2008
@@ -71,6 +71,8 @@
{ _pimpl->applySolutions (solutions); }
void Resolver::doUpgrade( UpgradeStatistics & opt_stats_r )
{ _pimpl->doUpgrade(opt_stats_r); }
+ void Resolver::doUpdate()
+ { _pimpl->doUpdate(); }
void Resolver::setForceResolve( const bool force )
{ _pimpl->setForceResolve( force ); }
bool Resolver::forceResolve()
Modified: trunk/libzypp/zypp/Resolver.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Resolver.h?rev=9317&r1=9316&r2=9317&view=diff
==============================================================================
--- trunk/libzypp/zypp/Resolver.h (original)
+++ trunk/libzypp/zypp/Resolver.h Mon Mar 31 15:39:26 2008
@@ -83,7 +83,8 @@
* This will run a full upgrade on the pool, taking all upgrade
* dependencies (provide/obsolete for package renames, split-
* provides, etc.) into account and actually removing installed
- * packages if no upgrade exists.
+ * packages if no upgrade exists AND the package dependency is
+ * broken
*
* To be run with great caution. It basically brings your
* system 'back to start'.
@@ -93,6 +94,18 @@
void doUpgrade( UpgradeStatistics & opt_stats_r );
/**
+ * Update to newest package
+ *
+ * Install the newest version of your installed packages as
+ * far as possible. This means a newer package will NOT be
+ * installed if it generates dependency problems.
+ * So the user will not get an error message.
+ *
+ **/
+ void doUpdate( );
+
+
+ /**
* Return the list of problematic update items
* i.e. locked ones (due to foreign vendor)
**/
Modified: trunk/libzypp/zypp/sat/SATResolver.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/SATResolver.cc?rev=9317&r1=9316&r2=9317&view=diff
==============================================================================
--- trunk/libzypp/zypp/sat/SATResolver.cc (original)
+++ trunk/libzypp/zypp/sat/SATResolver.cc Mon Mar 31 15:39:26 2008
@@ -558,6 +558,89 @@
}
+bool SATResolver::doUpdate()
+{
+ MIL << "SATResolver::doUpdate()" << endl;
+
+ if (_solv) {
+ // remove old stuff
+ solver_free(_solv);
+ _solv = NULL;
+ queue_free( &(_jobQueue) );
+ }
+
+ queue_init( &_jobQueue );
+
+ _solv = solver_create( _SATPool, sat::Pool::instance().systemRepo().get() );
+ _solv->vendorCheckCb = &vendorCheck;
+
+ _solv->updatesystem = true;
+ _solv->dontinstallrecommended = true; // #FIXME dontinstallrecommended maybe set to false if it works correctly
+
+ sat::Pool::instance().prepare();
+
+ // Solve !
+ MIL << "Starting solving...." << endl;
+ solver_solve( _solv, &(_jobQueue) );
+ MIL << "....Solver end" << endl;
+
+ // copying solution back to zypp pool
+ //-----------------------------------------
+
+ /* solvables to be installed */
+ for (int i = 0; i < _solv->decisionq.count; i++)
+ {
+ Id p;
+ p = _solv->decisionq.elements[i];
+ if (p < 0 || !sat::Solvable(p))
+ continue;
+ if (sat::Solvable(p).repository().get() == _solv->installed)
+ continue;
+
+ PoolItem poolItem = _pool.find (sat::Solvable(p));
+ if (poolItem) {
+ SATSolutionToPool (poolItem, ResStatus::toBeInstalled, ResStatus::SOLVER);
+ } else {
+ ERR << "id " << p << " not found in ZYPP pool." << endl;
+ }
+ }
+
+ /* solvables to be erased */
+ for (int i = _solv->installed->start; i < _solv->installed->start + _solv->installed->nsolvables; i++)
+ {
+ if (_solv->decisionmap[i] > 0)
+ continue;
+
+ PoolItem poolItem = _pool.find (sat::Solvable(i));
+ if (poolItem) {
+ // Check if this is an update
+ CheckIfUpdate info;
+ invokeOnEach( _pool.byIdentBegin( poolItem ),
+ _pool.byIdentEnd( poolItem ),
+ resfilter::ByUninstalled(), // ByUninstalled
+ functor::functorRef
participants (1)
-
schubi2@svn.opensuse.org