mlandres@svn.opensuse.org wrote:
Author: mlandres Date: Mon Jun 2 18:00:31 2008 New Revision: 10319
URL: http://svn.opensuse.org/viewcvs/zypp?rev=10319&view=rev Log: Allow to skip/abort failed package removal
Modified: branches/SuSE-Linux-11_0-Branch/libzypp/devel/devel.ma/NewPool.cc branches/SuSE-Linux-11_0-Branch/libzypp/package/libzypp.changes branches/SuSE-Linux-11_0-Branch/libzypp/zypp/target/rpm/RpmDb.cc
Modified: branches/SuSE-Linux-11_0-Branch/libzypp/devel/devel.ma/NewPool.cc URL: http://svn.opensuse.org/viewcvs/zypp/branches/SuSE-Linux-11_0-Branch/libzypp/devel/devel.ma/NewPool.cc?rev=10319&r1=10318&r2=10319&view=diff ============================================================================== --- branches/SuSE-Linux-11_0-Branch/libzypp/devel/devel.ma/NewPool.cc (original) +++ branches/SuSE-Linux-11_0-Branch/libzypp/devel/devel.ma/NewPool.cc Mon Jun 2 18:00:31 2008 @@ -561,20 +561,16 @@
SEC << zypp::getZYpp()->diskUsage() << endl;
- for_( it, pool.begin(), pool.end() ) + for_( it, pool.byKindBegin<SrcPackage>(), pool.byKindEnd<SrcPackage>() ) { - //MIL << *it << endl; - //DBG << (*it)->diskusage() << endl; + MIL << *it << endl; }
- PoolItem pu ( getPi<Package>("amarok") ); - PoolItem pi ( getPi<Package>("amarok",Edition("1.4.7-37")) ); - - pi.status().setTransact( true, ResStatus::USER ); - SEC << zypp::getZYpp()->diskUsage() << endl; + for_( it, pool.byIdentBegin( ResKind::srcpackage, "zypper" ), pool.byIdentEnd( ResKind::srcpackage, "zypper" ) ) + { + WAR << *it << endl; + }
- pu.status().setTransact( true, ResStatus::USER ); - SEC << zypp::getZYpp()->diskUsage() << endl;
///////////////////////////////////////////////////////////////////
Modified: branches/SuSE-Linux-11_0-Branch/libzypp/package/libzypp.changes URL: http://svn.opensuse.org/viewcvs/zypp/branches/SuSE-Linux-11_0-Branch/libzypp/package/libzypp.changes?rev=10319&r1=10318&r2=10319&view=diff ============================================================================== --- branches/SuSE-Linux-11_0-Branch/libzypp/package/libzypp.changes (original) +++ branches/SuSE-Linux-11_0-Branch/libzypp/package/libzypp.changes Mon Jun 2 18:00:31 2008 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Mon Jun 2 17:57:22 CEST 2008 - ma@suse.de + +- Allow to skip/abort failed package removal. (bnc #226041) +- revision 10319 + +------------------------------------------------------------------- Mon Jun 2 17:37:02 CEST 2008 - dmacvicar@suse.de
- import newer keys if a trusted key is updated
Modified: branches/SuSE-Linux-11_0-Branch/libzypp/zypp/target/rpm/RpmDb.cc URL: http://svn.opensuse.org/viewcvs/zypp/branches/SuSE-Linux-11_0-Branch/libzypp/zypp/target/rpm/RpmDb.cc?rev=10319&r1=10318&r2=10319&view=diff ============================================================================== --- branches/SuSE-Linux-11_0-Branch/libzypp/zypp/target/rpm/RpmDb.cc (original) +++ branches/SuSE-Linux-11_0-Branch/libzypp/zypp/target/rpm/RpmDb.cc Mon Jun 2 18:00:31 2008 @@ -2110,17 +2110,28 @@
report->start( name_r );
- try - { - doRemovePackage(name_r, flags, report); - } - catch (RpmException & excpt_r) - { - report->problem(excpt_r); //! partial fix to bug #388810, \todo allow to abort/retry failed rpm removal - report->finish(excpt_r); - ZYPP_RETHROW(excpt_r); - } - report->finish(); + do + try + { + doRemovePackage(name_r, flags, report); + report->finish(); + break; + } + catch (RpmException & excpt_r) + { + RpmRemoveReport::Action user = report->problem( excpt_r ); + + if ( user == RpmRemoveReport::ABORT ) + { + report->finish( excpt_r ); + ZYPP_RETHROW(excpt_r); + } + else if ( user == RpmRemoveReport::IGNORE ) + { + break; + } + } + while (true); }
I think this doesn't work as expected, because this rethrowed exception is catched by this code in TargetImpl.cc:700 try { rpm().removePackage( p, flags ); } catch (Exception & excpt_r) { WAR << "removal of " << p << " failed"; success = false; ZYPP_CAUGHT( excpt_r ); } and for loop continue, so without setted abort variable and break this continue with removing or installing packages. I now work on it in trunk (more fixes like abort during progress and more) so I can backport some safe part to 11.0. Pepa -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org For additional commands, e-mail: zypp-devel+help@opensuse.org