41 const Arch & arch_r )
const
90 if ( ! ( ret->empty() ||
_package->repoInfo().keepPackages() ) )
146 std::string package_str =
_package->name() +
"-" +
_package->edition().asString();
155 ZYPP_THROW(SkipRequestException(
"User requested skip of corrupted file"));
158 ZYPP_THROW(AbortRequestException(
"User requested to abort"));
181 return shared_ptr<void>(
static_cast<void*
>(0),
182 bind( mem_fun_ref(
static_cast<void (shared_ptr<Report>::*)()
>(&shared_ptr<Report>::reset) ),
202 policy.
progressCB( bind( &Base::progressPackageDownload,
this, _1 ) );
204 return _access.provideFile( _package->repoInfo(), loc, policy );
213 if ( ! ret->empty() )
215 MIL <<
"provided Package from cache " << _package <<
" at " << ret << endl;
221 RepoInfo info = _package->repoInfo();
228 MIL <<
"provide Package " << _package << endl;
232 report()->start( _package, url );
235 ret = doProvidePackage();
240 ERR <<
"Failed to provide Package " << _package << endl;
248 ERR <<
"Failed to provide Package " << _package << endl;
252 std::string package_str = _package->name() +
"-" + _package->edition().asString();
255 std::string detail_str(
str::form(
_(
"Failed to provide Package %s. Do you want to retry retrieval?"), package_str.c_str() ) );
264 ZYPP_THROW(SkipRequestException(
"User requested skip of corrupted file", excpt));
267 ZYPP_THROW(AbortRequestException(
"User requested to abort", excpt));
278 MIL <<
"provided Package " << _package <<
" at " << ret << endl;
298 virtual ManagedFile doProvidePackageFromCache()
const;
308 {
return report()->progressDeltaDownload( value ); }
311 {
return report()->progressDeltaApply( value ); }
314 {
return _policy.queryInstalled( _package->name(), ed_r, _package->arch() ); }
326 RepoInfo info = _package->repoInfo();
337 std::list<DeltaRpm> deltaRpms;
338 _deltas.deltaRpms( _package ).swap( deltaRpms );
342 for_( it, deltaRpms.begin(), deltaRpms.end())
344 DBG <<
"tryDelta " << *it << endl;
346 if ( ! ret->empty() )
353 return Base::doProvidePackage();
379 report()->finishDeltaDownload();
381 report()->startDeltaApply( delta );
384 report()->problemDeltaApply(
_(
"applydeltarpm check failed.") );
389 Pathname destination( _package->repoInfo().packagesPath() / _package->location().filename() );
394 report()->problemDeltaApply(
_(
"applydeltarpm failed.") );
397 report()->finishDeltaApply();
413 PluginPackageProvider(
const std::string & stem_r,
418 : Base( access_r, package_r, deltas_r, policy_r )
422 virtual ManagedFile doProvidePackageFromCache()
const
424 return Base::doProvidePackageFromCache();
429 return Base::doProvidePackage();
451 :
_pimpl(
Impl::factoryMake( access_r, package_r, deltas_r, policy_r ) )
458 {
return _pimpl->providePackage(); }
461 {
return _pimpl->providePackageFromCache(); }
464 {
return _pimpl->isCached(); }
Candidate delta and patches for a package.
RepoInfo info() const
Return any associated RepoInfo.
bool failOnChecksumError() const
Redirect ProvideFilePolicy failOnChecksumError to this if needed.
virtual ManagedFile doProvidePackageFromCache() const
Lookup the final rpm in cache.
const Repository & repository() const
PackageProvider implementation.
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
static ZConfig & instance()
Singleton ctor.
const BaseVersion & baseversion() const
ManagedFile providePackage() const
Provide the package.
bool isCached() const
Whether the package is cached.
ManagedFile tryDelta(const DeltaRpm &delta_r) const
urls_const_iterator baseUrlsBegin() const
iterator that points at begin of repository urls
callback::SendReport< repo::DownloadResolvableReport > Report
bool isCached() const
Whether the package is cached.
Policies and options for PackageProvider.
bool haveApplydeltarpm()
Test whether an execuatble applydeltarpm program is available.
What is known about a repository.
AutoDispose< const Pathname > ManagedFile
A Pathname plus associated cleanup code to be executed when path is no longer needed.
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Edition represents [epoch:]version[-release]
void progressDeltaApply(int value) const
Report & report() const
Access to the DownloadResolvableReport.
bool queryInstalled(const Edition &ed_r=Edition()) const
ManagedFile providePackageFromCache() const
Provide the package if it is cached.
QueryInstalledCB _queryInstalledCB
shared_ptr< Report > _report
#define ZYPP_RETHROW(EXCPT)
Drops a logline and rethrows, updating the CodeLocation.
RW_pointer< Impl > _pimpl
Implementation class.
PackageProvider(RepoMediaAccess &access, const Package::constPtr &package, const DeltaCandidates &deltas, const PackageProviderPolicy &policy_r=PackageProviderPolicy())
Ctor taking the Package to provide.
packagedelta::DeltaRpm DeltaRpm
shared_ptr< void > ScopedGuard
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
int unlink(const Pathname &path)
Like 'unlink'.
ManagedFile providePackageFromCache() const
Provide the package if it is cached.
const Edition & edition() const
bool progressPackageDownload(int value) const
Redirect ProvideFilePolicy package download progress to this.
RpmPackageProvider(RepoMediaAccess &access_r, const Package::constPtr &package_r, const DeltaCandidates &deltas_r, const PackageProviderPolicy &policy_r)
#define _(MSG)
Return translated text.
const OnMediaLocation & location() const
virtual ManagedFile doProvidePackage() const
Actually provide the final rpm.
void setDispose(const Dispose &dispose_r)
Set a new dispose function.
RepoMediaAccess & _access
ScopedGuard newReport() const
bool baseUrlsEmpty() const
whether repository urls are available
ProvideFilePolicy & failOnChecksumErrorCB(FailOnChecksumErrorCB failOnChecksumErrorCB_r)
Set callback.
std::string form(const char *format,...)
Printf style construction of std::string.
PackageProvider::Impl Base
const std::string & sequenceinfo() const
virtual ManagedFile doProvidePackageFromCache() const =0
Lookup the final rpm in cache.
Base class for Exception.
ProvideFilePolicy & progressCB(ProgressCB progressCB_r)
Set callback.
PackageProviderPolicy _policy
Provide a package from a Repo.
Impl(RepoMediaAccess &access_r, const Package::constPtr &package_r, const DeltaCandidates &deltas_r, const PackageProviderPolicy &policy_r)
Ctor taking the Package to provide.
ManagedFile providePackage() const
Provide the package.
Reference counted access to a _Tp object calling a custom Dispose function when the last AutoDispose ...
RPM PackageProvider implementation.
std::string asUserHistory() const
A single (multiline) string composed of asUserString and historyAsString.
bool quickcheck(const std::string &sequenceinfo_r)
Quick via check sequence info.
bool check(const std::string &sequenceinfo_r, bool quick_r)
Check via sequence info.
virtual ManagedFile doProvidePackage() const =0
Actually provide the final rpm.
bool queryInstalled(const std::string &name_r, const Edition &ed_r, const Arch &arch_r) const
Evaluate callback.
bool progressDeltaDownload(int value) const
Base for exceptions caused by explicit user request.
static bool schemeIsDownloading(const std::string &scheme_r)
http https ftp sftp tftp
Package::constPtr _package
bool provide(const Pathname &delta_r, const Pathname &new_r, const Progress &report_r)
Apply a binary delta to on-disk data to re-create a new rpm.
TraitsType::constPtrType constPtr
bool download_use_deltarpm_always() const
Whether to consider using a deltarpm even when rpm is local.
static const Edition noedition
Value representing noedition ("") This is in fact a valid Edition.
static Impl * factoryMake(RepoMediaAccess &access_r, const Package::constPtr &package_r, const DeltaCandidates &deltas_r, const PackageProviderPolicy &policy_r)
Factory method providing the appropriate implementation.