Author: mlandres Date: Thu Sep 20 15:35:21 2007 New Revision: 7317 URL: http://svn.opensuse.org/viewcvs/zypp?rev=7317&view=rev Log: - Avoid calling rpm repeatedly in case of an error. This is fault-prone, esp. if the error occurred executing the packages post-install script. Modified: trunk/libzypp/VERSION.cmake trunk/libzypp/devel/devel.ma/Parse.cc trunk/libzypp/package/libzypp.changes trunk/libzypp/zypp/ZYppCallbacks.h trunk/libzypp/zypp/target/TargetImpl.cc Modified: trunk/libzypp/VERSION.cmake URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/VERSION.cmake?rev=7317&r1=7316&r2=7317&view=diff ============================================================================== --- trunk/libzypp/VERSION.cmake (original) +++ trunk/libzypp/VERSION.cmake Thu Sep 20 15:35:21 2007 @@ -47,4 +47,4 @@ SET(LIBZYPP_MAJOR "3") SET(LIBZYPP_MINOR "24") SET(LIBZYPP_COMPATMINOR "24") -SET(LIBZYPP_PATCH "4") +SET(LIBZYPP_PATCH "5") Modified: trunk/libzypp/devel/devel.ma/Parse.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.ma/Parse.cc?rev=7317&r1=7316&r2=7317&view=diff ============================================================================== --- trunk/libzypp/devel/devel.ma/Parse.cc (original) +++ trunk/libzypp/devel/devel.ma/Parse.cc Thu Sep 20 15:35:21 2007 @@ -308,6 +308,11 @@ return true; } +bool install() +{ + SEC << getZYpp()->commit( ZYppCommitPolicy() ) << endl; +} + /////////////////////////////////////////////////////////////////// struct ConvertDbReceive : public callback::ReceiveReporttarget::ScriptResolvableReport @@ -553,32 +558,22 @@ USR << "pool: " << pool << endl; SEC << pool.knownRepositoriesSize() << endl; - if ( 0 ) + if ( 1 ) { { - zypp::base::LogControl::TmpLineWriter shutUp; - //getZYpp()->initTarget( sysRoot ); - getZYpp()->initTarget( "/" ); + zypp::base::LogControl::TmpLineWriter shutUp; + getZYpp()->initTarget( sysRoot ); + //getZYpp()->initTarget( "/" ); } MIL << "Added target: " << pool << endl; } //std::for_each( pool.begin(), pool.end(), Xprint() ); - - repo::DeltaCandidates deltas( repo::makeDeltaCandidates( pool.knownRepositoriesBegin(), - pool.knownRepositoriesEnd() ) ); - - DBG << "patch: " << deltas.patchRpms(0).size() << " " << deltas.patchRpms(0) << endl; - DBG << "delta: " << deltas.deltaRpms(0).size() << " " << deltas.deltaRpms(0) << endl; - - PoolItem pi( getPi<Package>( "kernel-default", Edition("2.6.22.5-12") ) ); - USR << pi << endl; - USR << repoProvidePackage( pi ) << endl; - - pi = getPi<Package>( "update-test-affects-package-manager", Edition("99-99") ); + PoolItem pi = getPi<Package>( "update-test-affects-package-manager", Edition("99-99") ); USR << pi << endl; - USR << repoProvidePackage( pi ) << endl; + pi.status().setTransact( true, ResStatus::USER ); + //install(); /////////////////////////////////////////////////////////////////// INT << "===[END]============================================" << endl << endl; Modified: trunk/libzypp/package/libzypp.changes URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/package/libzypp.changes?rev=7317&r1=7316&r2=7317&view=diff ============================================================================== --- trunk/libzypp/package/libzypp.changes (original) +++ trunk/libzypp/package/libzypp.changes Thu Sep 20 15:35:21 2007 @@ -1,4 +1,12 @@ ------------------------------------------------------------------- +Thu Sep 20 15:19:53 CEST 2007 - ma@suse.de + +- Avoid calling rpm repeatedly in case of an error. This is fault-prone, + esp. if the error occurred executing the packages post-install script. +- version 3.24.5 +- revision 7317 + +------------------------------------------------------------------- Thu Sep 20 11:00:04 CEST 2007 - ma@suse.de - If a package is deselected by user, apply this soft lock to all Modified: trunk/libzypp/zypp/ZYppCallbacks.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ZYppCallbacks.h?rev=7317&r1=7316&r2=7317&view=diff ============================================================================== --- trunk/libzypp/zypp/ZYppCallbacks.h (original) +++ trunk/libzypp/zypp/ZYppCallbacks.h Thu Sep 20 15:35:21 2007 @@ -24,12 +24,12 @@ /////////////////////////////////////////////////////////////////// namespace zypp { ///////////////////////////////////////////////////////////////// - + struct ProgressReport : public callback::ReportBase { virtual void start( const ProgressData &/*task*/ ) {} - + virtual bool progress( const ProgressData &/*task*/ ) { return true; } @@ -46,7 +46,7 @@ struct ProgressReportAdaptor { - + ProgressReportAdaptor( const ProgressData::ReceiverFnc &fnc, callback::SendReport<ProgressReport> &report ) : _fnc(fnc) @@ -54,7 +54,7 @@ , _first(true) { } - + bool operator()( const ProgressData &progress ) { if ( _first ) @@ -62,27 +62,27 @@ _report->start(progress); _first = false; } - + _report->progress(progress); bool value = true; if ( _fnc ) value = _fnc(progress); - - + + if ( progress.finalReport() ) { _report->finish(progress); } return value; } - + ProgressData::ReceiverFnc _fnc; callback::SendReport<ProgressReport> &_report; bool _first; }; - + //////////////////////////////////////////////////////////////////////////// - + namespace repo { // progress for downloading a resolvable @@ -343,7 +343,7 @@ { /** * Prompt for authentication data. - * + * * \param url URL which required the authentication * \param msg prompt text * \param auth_data input/output object for handling authentication @@ -425,6 +425,7 @@ }; // the level of RPM pushing + /** \deprecated We fortunately no longer do 3 attempts. */ enum RpmLevel { RPM, RPM_NODEPS, Modified: trunk/libzypp/zypp/target/TargetImpl.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/target/TargetImpl.cc?rev=7317&r1=7316&r2=7317&view=diff ============================================================================== --- trunk/libzypp/zypp/target/TargetImpl.cc (original) +++ trunk/libzypp/zypp/target/TargetImpl.cc Thu Sep 20 15:35:21 2007 @@ -519,78 +519,50 @@ progress.connect(); bool success = true; unsigned flags = 0; + // Why force and nodeps? + // + // Because zypp builds the transaction and the resolver asserts that + // everything is fine. + // We use rpm just to unpack and register the package in the database. + // We do this step by step, so rpm is not aware of the bigger context. + // So we turn off rpms internal checks, because we do it inside zypp. + flags |= rpm::RpmDb::RPMINST_NODEPS; + flags |= rpm::RpmDb::RPMINST_FORCE; + // if (p->installOnly()) flags |= rpm::RpmDb::RPMINST_NOUPGRADE; if (policy_r.dryRun()) flags |= rpm::RpmDb::RPMINST_TEST; if (policy_r.rpmNoSignature()) flags |= rpm::RpmDb::RPMINST_NOSIGNATURE; try { - progress.tryLevel( target::rpm::InstallResolvableReport::RPM ); + progress.tryLevel( target::rpm::InstallResolvableReport::RPM_NODEPS_FORCE ); rpm().installPackage( localfile, flags ); if ( progress.aborted() ) { WAR << "commit aborted by the user" << endl; progress.disconnect(); + success = false; abort = true; break; } - } catch (Exception & excpt_r) { ZYPP_CAUGHT(excpt_r); - WAR << "Install failed, retrying with --nodeps" << endl; - if (policy_r.dryRun()) + if ( policy_r.dryRun() ) { WAR << "dry run failed" << endl; progress.disconnect(); break; } - - try - { - progress.tryLevel( target::rpm::InstallResolvableReport::RPM_NODEPS ); - flags |= rpm::RpmDb::RPMINST_NODEPS; - rpm().installPackage( localfile, flags ); - - if ( progress.aborted() ) - { - WAR << "commit aborted by the user" << endl; - abort = true; - progress.disconnect(); - break; - } - } - catch (Exception & excpt_r) - { - ZYPP_CAUGHT(excpt_r); - WAR << "Install failed again, retrying with --force --nodeps" << endl; - - try - { - progress.tryLevel( target::rpm::InstallResolvableReport::RPM_NODEPS_FORCE ); - flags |= rpm::RpmDb::RPMINST_FORCE; - rpm().installPackage( localfile, flags ); - } - catch (Exception & excpt_r) - { - remaining.push_back( *it ); - success = false; - ZYPP_CAUGHT(excpt_r); - } - - if ( progress.aborted() ) - { - WAR << "commit aborted by the user" << endl; - abort = true; - progress.disconnect(); - break; - } - } + // else + WAR << "Install failed" << endl; + remaining.push_back( *it ); + success = false; } - if (success - && !policy_r.dryRun()) + + if ( success && !policy_r.dryRun() ) { it->status().resetTransact( ResStatus::USER ); } -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org