From 4f1a1dc1954f622555f6836aa31895fd0d0991e5 Mon Sep 17 00:00:00 2001 From: Stanislav Visnovsky Date: Mon, 6 Feb 2006 19:13:28 +0000 Subject: [PATCH] provide also the level of RPM pushing in callbacks --- zypp/ZYppCallbacks.h | 13 +++++++++++-- zypp/target/TargetCallbackReceiver.cc | 11 +++++++++-- zypp/target/TargetCallbackReceiver.h | 3 +++ zypp/target/TargetImpl.cc | 4 ++++ 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/zypp/ZYppCallbacks.h b/zypp/ZYppCallbacks.h index 6530d3dcf..e11862cc5 100644 --- a/zypp/ZYppCallbacks.h +++ b/zypp/ZYppCallbacks.h @@ -233,6 +233,13 @@ namespace zypp INVALID // th resolvable is invalid }; + // the level of RPM pushing + enum RpmLevel { + RPM, + RPM_NODEPS, + RPM_NODEPS_FORCE + }; + virtual void start( Resolvable::constPtr resolvable ) {} @@ -243,13 +250,15 @@ namespace zypp virtual Action problem( Resolvable::constPtr resolvable , Error error - , std::string description + , std::string description + , RpmLevel level ) { return ABORT; } virtual void finish( Resolvable::constPtr resolvable , Error error , std::string reason + , RpmLevel level ) {} }; @@ -279,7 +288,7 @@ namespace zypp virtual Action problem( Resolvable::Ptr resolvable , Error error - , std::string description + , std::string description ) { return ABORT; } virtual void finish( diff --git a/zypp/target/TargetCallbackReceiver.cc b/zypp/target/TargetCallbackReceiver.cc index f0f14481b..128bc6a45 100644 --- a/zypp/target/TargetCallbackReceiver.cc +++ b/zypp/target/TargetCallbackReceiver.cc @@ -24,6 +24,7 @@ namespace zypp RpmInstallPackageReceiver::RpmInstallPackageReceiver (Resolvable::constPtr res) : callback::ReceiveReport () , _resolvable (res) + , _level( target::rpm::InstallResolvableReport::RPM ) { } @@ -61,6 +62,7 @@ namespace zypp _report->problem( _resolvable , rpm::InstallResolvableReport::INVALID , excpt_r.msg() + , _level ); switch (user) { @@ -78,13 +80,18 @@ namespace zypp /** Finish operation in case of success */ void RpmInstallPackageReceiver::finish() { - _report->finish( _resolvable, rpm::InstallResolvableReport::NO_ERROR, std::string() ); + _report->finish( _resolvable, rpm::InstallResolvableReport::NO_ERROR, std::string(), _level ); } /** Finish operation in case of success */ void RpmInstallPackageReceiver::finish( Exception & excpt_r ) { - _report->finish( _resolvable, rpm::InstallResolvableReport::INVALID, std::string() ); + _report->finish( _resolvable, rpm::InstallResolvableReport::INVALID, std::string(), _level ); + } + + void RpmInstallPackageReceiver::tryLevel( target::rpm::InstallResolvableReport::RpmLevel level_r ) + { + _level = level_r; } ///////////////////////////////////////////////////////////////// diff --git a/zypp/target/TargetCallbackReceiver.h b/zypp/target/TargetCallbackReceiver.h index 36545c9da..aa07a14d5 100644 --- a/zypp/target/TargetCallbackReceiver.h +++ b/zypp/target/TargetCallbackReceiver.h @@ -27,6 +27,7 @@ namespace zypp { callback::SendReport _report; Resolvable::constPtr _resolvable; + target::rpm::InstallResolvableReport::RpmLevel _level; public: @@ -39,6 +40,8 @@ namespace zypp /** Start the operation */ virtual void start( const Pathname & name ); + + void tryLevel( target::rpm::InstallResolvableReport::RpmLevel level_r ); /** * Inform about progress diff --git a/zypp/target/TargetImpl.cc b/zypp/target/TargetImpl.cc index 51e5f1648..0d51c3b1d 100644 --- a/zypp/target/TargetImpl.cc +++ b/zypp/target/TargetImpl.cc @@ -148,6 +148,8 @@ namespace zypp progress.connect(); try { + progress.tryLevel( target::rpm::InstallResolvableReport::RPM ); + rpm().installPackage(p->getPlainRpm(), p->installOnly() ? rpm::RpmDb::RPMINST_NOUPGRADE : 0); } @@ -156,6 +158,7 @@ namespace zypp WAR << "Install failed, retrying with --nodeps" << endl; try { + progress.tryLevel( target::rpm::InstallResolvableReport::RPM_NODEPS ); rpm().installPackage(p->getPlainRpm(), p->installOnly() ? rpm::RpmDb::RPMINST_NOUPGRADE : rpm::RpmDb::RPMINST_NODEPS); } @@ -164,6 +167,7 @@ namespace zypp WAR << "Install failed again, retrying with --force --nodeps" << endl; try { + progress.tryLevel( target::rpm::InstallResolvableReport::RPM_NODEPS_FORCE ); rpm().installPackage(p->getPlainRpm(), p->installOnly() ? rpm::RpmDb::RPMINST_NOUPGRADE : (rpm::RpmDb::RPMINST_NODEPS|rpm::RpmDb::RPMINST_FORCE)); } -- 2.34.1