From: Klaus Kaempf Date: Wed, 8 Feb 2006 13:25:52 +0000 (+0000) Subject: complete commit() X-Git-Tag: 6.6.0~5139 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9c6cc7f20a1f92e5267582ff1e559f34705ba6b9;p=platform%2Fupstream%2Flibzypp.git complete commit() --- diff --git a/zypp/target/TargetImpl.cc b/zypp/target/TargetImpl.cc index cace53abe..c512957c6 100644 --- a/zypp/target/TargetImpl.cc +++ b/zypp/target/TargetImpl.cc @@ -125,11 +125,12 @@ namespace zypp commit (to_uninstall); if (medianr == 0) { // commit all - commit( to_install ); - commit( to_srcinstall ); + remaining_r = commit( to_install ); + srcremaining_r = commit( to_srcinstall ); } else { PoolItemList current_install; + PoolItemList current_srcinstall; for (PoolItemList::iterator it = to_install.begin(); it != to_install.end(); ++it) { Resolvable::constPtr res( it->resolvable() ); @@ -144,7 +145,10 @@ namespace zypp current_install.push_back( *it ); } } - for (PoolItemList::iterator it = to_install.begin(); it != to_install.end(); ++it) { + PoolItemList bad = commit (current_install); + remaining_r.insert(remaining_r.end(), bad.begin(), bad.end()); + + for (PoolItemList::iterator it = to_srcinstall.begin(); it != to_srcinstall.end(); ++it) { Resolvable::constPtr res( it->resolvable() ); Package::constPtr pkg( asKind(res) ); if (pkg @@ -154,18 +158,22 @@ namespace zypp srcremaining_r.push_back( *it ); } else { - current_install.push_back( *it ); + current_srcinstall.push_back( *it ); } } - commit (current_install); + bad = commit (current_srcinstall); + srcremaining_r.insert(remaining_r.end(), bad.begin(), bad.end()); } return; } - void TargetImpl::commit(const PoolItemList & items_r) + PoolItemList + TargetImpl::commit( const PoolItemList & items_r) { + PoolItemList remaining; + MIL << "TargetImpl::commit()" << endl; for (PoolItemList::const_iterator it = items_r.begin(); it != items_r.end(); it++) @@ -182,6 +190,7 @@ namespace zypp RpmInstallPackageReceiver progress(it->resolvable()); progress.connect(); + bool success = true; try { progress.tryLevel( target::rpm::InstallResolvableReport::RPM ); @@ -208,12 +217,15 @@ namespace zypp p->installOnly() ? rpm::RpmDb::RPMINST_NOUPGRADE : (rpm::RpmDb::RPMINST_NODEPS|rpm::RpmDb::RPMINST_FORCE)); } catch (Exception & excpt_r) { - progress.disconnect(); - ZYPP_RETHROW(excpt_r); + remaining.push_back( *it ); + success = false; + ZYPP_CAUGHT(excpt_r); } } } - + if (success) { + it->status().setStatus( ResStatus::installed ); + } progress.disconnect(); } @@ -232,14 +244,15 @@ namespace zypp rpm().removePackage(p, rpm::RpmDb::RPMINST_NODEPS); } progress.disconnect(); + it->status().setStatus( ResStatus::uninstalled ); } - it->status().setStatus( ResStatus::uninstalled ); - MIL << "Successful remove, " << *it << " is now uninstalled " << endl; } #warning FIXME other resolvables } + return remaining; + } rpm::RpmDb & TargetImpl::rpm() diff --git a/zypp/target/TargetImpl.h b/zypp/target/TargetImpl.h index 187d8613c..119fea2c8 100644 --- a/zypp/target/TargetImpl.h +++ b/zypp/target/TargetImpl.h @@ -74,8 +74,9 @@ namespace zypp media > 0 means limit commits to this media */ void commit( ResPool pool_r, unsigned int medianr, PoolItemList & errors_r, PoolItemList & remaining_r, PoolItemList & srcremaining_r ); - /** Commit ordered changes */ - void commit( const PoolItemList & items_r ); + /** Commit ordered changes + return uncommitted ones (due to error) */ + PoolItemList commit( const PoolItemList & items_r ); /** Overload to realize stream output. */ virtual std::ostream & dumpOn( std::ostream & str ) const