ref: refs/heads/master
commit b5408f5b4b5abf89ffbeb4322ee2b01044bc2047
Author: Michael Andres
Date: Tue Feb 3 17:09:48 2009 +0100
Send any output from rpm install/delete scripts via callback,
so applications are able to display it. (bnc #369450)
---
zypp/target/TargetCallbackReceiver.cc | 14 +++++++++++-
zypp/target/TargetCallbackReceiver.h | 31 +++++++++++++++++-----------
zypp/target/TargetImpl.cc | 5 ++-
zypp/target/rpm/RpmCallbacks.h | 36 ++++++++++++++++----------------
zypp/target/rpm/RpmDb.cc | 8 +++++++
5 files changed, 60 insertions(+), 34 deletions(-)
diff --git a/zypp/target/TargetCallbackReceiver.cc b/zypp/target/TargetCallbackReceiver.cc
index 463fd9d..0d02f92 100644
--- a/zypp/target/TargetCallbackReceiver.cc
+++ b/zypp/target/TargetCallbackReceiver.cc
@@ -81,10 +81,15 @@ namespace zypp
return rpm::RpmInstallReport::problem( excpt_r );
}
+ void RpmInstallPackageReceiver::finishInfo( const std::string & info_r )
+ {
+ _finishInfo = info_r;
+ }
+
/** Finish operation in case of success */
void RpmInstallPackageReceiver::finish()
{
- _report->finish( _resolvable, rpm::InstallResolvableReport::NO_ERROR, std::string(), _level );
+ _report->finish( _resolvable, rpm::InstallResolvableReport::NO_ERROR, _finishInfo, _level );
}
/** Finish operation in case of success */
@@ -161,11 +166,16 @@ namespace zypp
return rpm::RpmRemoveReport::problem( excpt_r );
}
+ void RpmRemovePackageReceiver::finishInfo( const std::string & info_r )
+ {
+ _finishInfo = info_r;
+ }
+
/** Finish operation in case of success */
void RpmRemovePackageReceiver::finish()
{
_report->progress( 100, _resolvable );
- _report->finish( _resolvable, rpm::RemoveResolvableReport::NO_ERROR, std::string() );
+ _report->finish( _resolvable, rpm::RemoveResolvableReport::NO_ERROR, _finishInfo );
}
/** Finish operation in case of success */
diff --git a/zypp/target/TargetCallbackReceiver.h b/zypp/target/TargetCallbackReceiver.h
index 04ca7ba..8b435bc 100644
--- a/zypp/target/TargetCallbackReceiver.h
+++ b/zypp/target/TargetCallbackReceiver.h
@@ -22,28 +22,29 @@ namespace zypp
namespace target
{ /////////////////////////////////////////////////////////////////
- class RpmInstallPackageReceiver
+ class RpmInstallPackageReceiver
: public callback::ReceiveReportrpm::RpmInstallReport
{
callback::SendReport rpm::InstallResolvableReport _report;
Resolvable::constPtr _resolvable;
target::rpm::InstallResolvableReport::RpmLevel _level;
bool _abort;
+ std::string _finishInfo;
public:
RpmInstallPackageReceiver (Resolvable::constPtr res);
virtual ~RpmInstallPackageReceiver ();
-
+
virtual void reportbegin();
-
+
virtual void reportend();
/** Start the operation */
virtual void start( const Pathname & name );
-
+
void tryLevel( target::rpm::InstallResolvableReport::RpmLevel level_r );
-
+
bool aborted() const { return _abort; }
/**
@@ -55,33 +56,36 @@ namespace zypp
/** inform user about a problem */
virtual rpm::RpmInstallReport::Action problem( Exception & excpt_r );
+ /** Additional rpm output to be reported in \ref finish in case of success. */
+ virtual void finishInfo( const std::string & info_r );
+
/** Finish operation in case of success */
virtual void finish();
/** Finish operatin in case of fail, report fail exception */
virtual void finish( Exception & excpt_r );
};
-
- class RpmRemovePackageReceiver
+
+ class RpmRemovePackageReceiver
: public callback::ReceiveReportrpm::RpmRemoveReport
{
callback::SendReport rpm::RemoveResolvableReport _report;
Resolvable::constPtr _resolvable;
bool _abort;
-
+ std::string _finishInfo;
public:
RpmRemovePackageReceiver (Resolvable::constPtr res);
virtual ~RpmRemovePackageReceiver ();
-
+
virtual void reportbegin();
-
+
virtual void reportend();
/** Start the operation */
virtual void start( const std::string & name );
-
+
/**
* Inform about progress
* Return true on abort
@@ -96,13 +100,16 @@ namespace zypp
/** inform user about a problem */
virtual rpm::RpmRemoveReport::Action problem( Exception & excpt_r );
+ /** Additional rpm output to be reported in \ref finish in case of success. */
+ virtual void finishInfo( const std::string & info_r );
+
/** Finish operation in case of success */
virtual void finish();
/** Finish operatin in case of fail, report fail exception */
virtual void finish( Exception & excpt_r );
};
-
+
/////////////////////////////////////////////////////////////////
} // namespace target
///////////////////////////////////////////////////////////////////
diff --git a/zypp/target/TargetImpl.cc b/zypp/target/TargetImpl.cc
index d5af084..92ff04e 100644
--- a/zypp/target/TargetImpl.cc
+++ b/zypp/target/TargetImpl.cc
@@ -831,7 +831,7 @@ namespace zypp
progress.connect(); // disconnected on destruction.
bool success = false;
- rpm::RpmInstFlags flags;
+ rpm::RpmInstFlags flags( policy_r.rpmInstFlags() & rpm::RPMINST_JUSTDB );
// Why force and nodeps?
//
// Because zypp builds the transaction and the resolver asserts that
@@ -899,7 +899,8 @@ namespace zypp
progress.connect(); // disconnected on destruction.
bool success = false;
- rpm::RpmInstFlags flags( rpm::RPMINST_NODEPS );
+ rpm::RpmInstFlags flags( policy_r.rpmInstFlags() & rpm::RPMINST_JUSTDB );
+ flags |= rpm::RPMINST_NODEPS;
if (policy_r.dryRun()) flags |= rpm::RPMINST_TEST;
try
{
diff --git a/zypp/target/rpm/RpmCallbacks.h b/zypp/target/rpm/RpmCallbacks.h
index f65ae68..6fd0071 100644
--- a/zypp/target/rpm/RpmCallbacks.h
+++ b/zypp/target/rpm/RpmCallbacks.h
@@ -41,27 +41,27 @@ struct RpmRemoveReport : public callback::ReportBase
/** Start the operation */
virtual void start( const std::string & name )
- { }
+ {}
/**
* Inform about progress
* Return true on abort
*/
virtual bool progress( unsigned percent )
- {
- return false;
- }
+ { return false; }
virtual Action problem( Exception & excpt_r )
- {
- return ABORT;
- }
+ { return ABORT; }
+
+ /** Additional rpm output to be reported in \ref finish in case of success. */
+ virtual void finishInfo( const std::string & info_r )
+ {}
/** Finish operation in case of success */
virtual void finish()
- { }
+ {}
/** Finish operation in case of fail, report fail exception */
virtual void finish( Exception & excpt_r )
- { }
+ {}
};
///////////////////////////////////////////////////////////////////
@@ -78,28 +78,28 @@ struct RpmInstallReport : public callback::ReportBase
/** Start the operation */
virtual void start( const Pathname & name )
- { }
+ {}
/**
* Inform about progress
* Return false on abort
*/
virtual bool progress( unsigned percent )
- {
- return true;
- }
+ { return true; }
+
+ /** Additional rpm output to be reported in \ref finish in case of success. */
+ virtual void finishInfo( const std::string & info_r )
+ {}
/** Finish operation in case of success */
virtual void finish()
- { }
+ {}
virtual Action problem( Exception & excpt_r )
- {
- return ABORT;
- }
+ { return ABORT; }
/** Finish operation in case of fail, report fail exception */
virtual void finish( Exception & excpt_r )
- { }
+ {}
};
} // namespace rpm
diff --git a/zypp/target/rpm/RpmDb.cc b/zypp/target/rpm/RpmDb.cc
index 4af210a..a207cf5 100644
--- a/zypp/target/rpm/RpmDb.cc
+++ b/zypp/target/rpm/RpmDb.cc
@@ -2092,6 +2092,10 @@ void RpmDb::doInstallPackage( const Pathname & filename, RpmInstFlags flags, cal
ostringstream sstr;
sstr << "Additional rpm output:" << endl << rpmmsg << endl;
historylog.comment(sstr.str());
+
+ // report additional rpm output in finish
+ // TranslatorExplanation Text is followed by a ':' and the actual output.
+ report->finishInfo(str::form( "%s:\n%s\n", _("Additional rpm output"), rpmmsg.c_str() ));
}
}
@@ -2228,6 +2232,10 @@ void RpmDb::doRemovePackage( const string & name_r, RpmInstFlags flags, callback
ostringstream sstr;
sstr << "Additional rpm output:" << endl << rpmmsg << endl;
historylog.comment(sstr.str());
+
+ // report additional rpm output in finish
+ // TranslatorExplanation Text is followed by a ':' and the actual output.
+ report->finishInfo(str::form( "%s:\n%s\n", _("Additional rpm output"), rpmmsg.c_str() ));
}
}
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org