}
Receiver * getReceiver() const
- { return _receiver == &_noReceiver ? NULL : _receiver; }
+ { return _receiver == &_noReceiver ? 0 : _receiver; }
void setReceiver( Receiver & rec_r )
{ _receiver = &rec_r; }
UpgradeStatistics.h \
ZYpp.h \
TranslatedText.h \
- ZYppFactory.h
+ ZYppFactory.h \
+ ZYppCallbacks.h
## ##################################################
};
enum Error {
+ NO_ERROR,
NOT_FOUND, // the requested Url was not found
IO, // IO error
INVALID // the downloaded file is invalid
};
enum Error {
+ NO_ERROR,
NOT_FOUND, // the requested Url was not found
IO, // IO error
INVALID // the downloaded file is invalid
};
enum Error {
+ NO_ERROR,
NOT_FOUND, // the requested Url was not found
IO, // IO error
INVALID // th source is invalid
};
enum Error {
+ NO_ERROR,
NOT_FOUND, // the requested Url was not found
IO, // IO error
INVALID // th source is invalid
};
enum Error {
+ NO_ERROR,
NOT_FOUND, // the medie not found at all
IO, // error accessing the media
INVALID, // media is broken
};
enum Error {
+ NO_ERROR,
NOT_FOUND, // the requested Url was not found
IO, // IO error
INVALID // th resolvable is invalid
};
virtual void start(
- Resolvable::Ptr resolvable
+ Resolvable::constPtr resolvable
) {}
- virtual bool progress(int value, Resolvable::Ptr resolvable)
+ virtual bool progress(int value, Resolvable::constPtr resolvable)
{ return false; }
virtual Action problem(
- Resolvable::Ptr resolvable
+ Resolvable::constPtr resolvable
, Error error
, TranslatedText description
) { return ABORT; }
virtual void finish(
- Resolvable::Ptr resolvable
+ Resolvable::constPtr resolvable
, Error error
, TranslatedText reason
) {}
};
enum Error {
+ NO_ERROR,
NOT_FOUND, // the requested Url was not found
IO, // IO error
INVALID // th resolvable is invalid
};
enum Error {
+ NO_ERROR,
NOT_FOUND, // the requested Url was not found
IO, // IO error
INVALID // th resolvable is invalid
};
enum Error {
+ NO_ERROR,
NOT_FOUND, // the requested Url was not found
IO, // IO error
INVALID // th resolvable is invalid
targetincludedir = $(pkgincludedir)/target
targetinclude_HEADERS = \
- TargetImpl.h
+ TargetImpl.h \
+ TargetCallbackReceiver.h
## ##################################################
## ##################################################
lib@PACKAGE@_target_la_SOURCES = \
- TargetImpl.cc
+ TargetImpl.cc \
+ TargetCallbackReceiver.cc
lib@PACKAGE@_target_la_LDFLAGS = @LIBZYPP_VERSION_INFO@
#include "zypp/base/Logger.h"
#include "zypp/target/TargetImpl.h"
+#include "zypp/target/TargetCallbackReceiver.h"
#include "zypp/solver/detail/Types.h"
#include "zypp/solver/detail/InstallOrder.h"
Package::constPtr p = dynamic_pointer_cast<const Package>(it->resolvable());
if (it->status().isToBeInstalled())
{
+#warning Exception handling
+ // create a progress report proxy
+ RpmInstallPackageReceiver progress(it->resolvable());
+
+ progress.connect();
+
rpm().installPackage(p->getPlainRpm(),
p->installOnly() ? rpm::RpmDb::RPMINST_NOUPGRADE : 0);
+
+ progress.disconnect();
+
}
else
{
//
void RpmDb::installPackage( const Pathname & filename, unsigned flags )
{
- RpmInstallReport report;
+ callback::SendReport<RpmInstallReport> report;
+
+ report->start(filename);
+
try {
doInstallPackage(filename, flags, report);
}
catch (RpmException & excpt_r)
{
- report.end(excpt_r);
+ report->end(/*excpt_r*/);
ZYPP_RETHROW(excpt_r);
}
- report.end();
+ report->end();
}
-void RpmDb::doInstallPackage( const Pathname & filename, unsigned flags, RpmInstallReport & report )
+void RpmDb::doInstallPackage( const Pathname & filename, unsigned flags, callback::SendReport<RpmInstallReport> & report )
{
FAILIFNOTINITIALIZED;
Logfile progresslog;
MIL << "RpmDb::installPackage(" << filename << "," << flags << ")" << endl;
+
// backup
if ( _packagebackups ) {
// FIXME report->progress( pd.init( -2, 100 ) ); // allow 1% for backup creation.
ERR << "backup of " << filename.asString() << " failed" << endl;
}
// FIXME status handling
- report.progress( 0 ); // allow 1% for backup creation.
+ report->progress( 0 ); // allow 1% for backup creation.
} else {
- report.progress( 100 );
+ report->progress( 100 );
}
// run rpm
{
int percent;
sscanf (line.c_str () + 2, "%d", &percent);
- report.progress( percent );
+ report->progress( percent );
}
else
rpmmsg += line+'\n';
protected:
void doRemovePackage( const std::string & name_r, unsigned flags, RpmRemoveReport & report );
- void doInstallPackage( const Pathname & filename, unsigned flags, RpmInstallReport & report );
+ void doInstallPackage( const Pathname & filename, unsigned flags, callback::SendReport<RpmInstallReport> & report );
const std::list<Package::Ptr> & doGetPackages(ScanDbReport & report);
void doRebuildDatabase(RebuildDbReport & report);