70 const Arch & arch_r )
const
103 template <
class TPackage>
131 if ( ! ( ret->empty() ||
_package->repoInfo().keepPackages() ) )
174 policy.
progressCB( bind( &Base::progressPackageDownload,
this, _1 ) );
175 policy.
fileChecker( bind( &Base::rpmSigFileChecker,
this, _1 ) );
210 userData.
set(
"ResObject", roptr );
211 userData.
set(
"Package", roptr->asKind<
Package>() );
212 userData.
set(
"Localpath", file_r );
216 report()->pkgGpgCheck( userData );
220 if ( userData.
hasvalue(
"Action" ) )
224 else if ( userData.
haskey(
"Action" ) )
257 _target = getZYpp()->getTarget();
263 ret =
_target->rpmDb().checkPackageSignature( path_r, detail );
266 WAR <<
"Relax CHK_NOSIG: Config says unsigned packages are OK" << endl;
271 detail.push_back( RpmDb::CheckPackageDetail::value_type( ret,
"OOps. Target is not initialized!" ) );
273 userData.
set(
"CheckPackageResult", ret );
274 userData.
set(
"CheckPackageDetail", std::move(detail) );
286 WAR <<
_package->asUserString() <<
": " <<
"User requested to accept insecure file" << endl;
300 msg <<
_package->asUserString() <<
": " <<
_(
"Signature verification failed") <<
" " << ret;
301 if ( ! detail_r.empty() )
302 msg <<
"\n" << detail_r;
321 return shared_ptr<void>(
static_cast<void*
>(0),
322 bind( mem_fun_ref(
static_cast<void (shared_ptr<Report>::*)()
>(&shared_ptr<Report>::reset) ),
332 template <
class TPackage>
339 if ( ! ret->empty() )
341 MIL <<
"provided Package from cache " << _package <<
" at " << ret << endl;
342 report()->infoInCache( _package, ret );
347 RepoInfo info = _package->repoInfo();
368 MIL <<
"provided Package from toplevel cache " << _package <<
" at " << ret << endl;
381 MIL <<
"provide Package " << _package << endl;
386 if ( ! ret->empty() )
394 ret = doProvidePackage();
398 ERR <<
"Failed to provide Package " << _package << endl;
404 ERR <<
"Failed to provide Package " << _package << endl;
409 switch ( excpt.action() )
415 ZYPP_THROW(SkipRequestException(
"User requested skip of corrupted file"));
419 ZYPP_THROW(AbortRequestException(
"User requested to abort"));
426 ERR <<
"Failed to provide Package " << _package << endl;
429 const std::string & package_str = _package->asUserString();
437 ZYPP_THROW(SkipRequestException(
"User requested skip of corrupted file"));
441 ZYPP_THROW(AbortRequestException(
"User requested to abort"));
448 ERR <<
"Failed to provide Package " << _package << endl;
452 const std::string & package_str = _package->asUserString();
455 std::string detail_str(
str::form(
_(
"Failed to provide Package %s. Do you want to retry retrieval?"), package_str.c_str() ) );
464 ZYPP_THROW(SkipRequestException(
"User requested skip of file", excpt));
468 ZYPP_THROW(AbortRequestException(
"User requested to abort", excpt));
476 if ( ! ret->empty() )
482 MIL <<
"provided Package " << _package <<
" at " << ret << endl;
511 {
return report()->progressDeltaDownload( value ); }
514 {
return report()->progressDeltaApply( value ); }
531 std::list<DeltaRpm> deltaRpms;
536 for_( it, deltaRpms.begin(), deltaRpms.end())
538 DBG <<
"tryDelta " << *it << endl;
540 if ( ! ret->empty() )
573 report()->finishDeltaDownload();
575 report()->startDeltaApply( delta );
578 report()->problemDeltaApply(
_(
"applydeltarpm check failed.") );
589 report()->problemDeltaApply(
_(
"applydeltarpm failed.") );
593 report()->finishDeltaApply();
645 : _pimpl( factory::
make( access_r, pi_r, deltas_r, policy_r ) )
650 : _pimpl( factory::
make( access_r, pi_r, policy_r ) )
658 : _pimpl( factory::
make( access_r, package_r, deltas_r, policy_r ) )
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
#define ZYPP_RETHROW(EXCPT)
Drops a logline and rethrows, updating the CodeLocation.
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
PackageProvider implementation for Package and SrcPackage.
Reference counted access to a Tp object calling a custom Dispose function when the last AutoDispose h...
void reset()
Reset to default Ctor values.
void setDispose(const Dispose &dispose_r)
Set a new dispose function.
Edition represents [epoch:]version[-release]
static const Edition noedition
Value representing noedition ("") This is in fact a valid Edition.
Base class for Exception.
std::string asUserHistory() const
A single (multiline) string composed of asUserString and historyAsString.
TraitsType::constPtrType constPtr
Combining sat::Solvable and ResStatus.
Policy for provideFile and RepoMediaAccess.
ProvideFilePolicy & progressCB(ProgressCB progressCB_r)
Set callback.
ProvideFilePolicy & fileChecker(FileChecker fileChecker_r)
Add a FileCecker passed down to the Fetcher.
What is known about a repository.
bool baseUrlsEmpty() const
whether repository urls are available
bool keepPackages() const
Whether packages downloaded from this repository will be kept in local cache.
Pathname path() const
Repository path.
bool pkgGpgCheckIsMandatory() const
Mandatory check (pkgGpgCheck is not off) must ask to confirm using unsigned packages.
urls_const_iterator baseUrlsBegin() const
iterator that points at begin of repository urls
Pathname packagesPath() const
Path where this repo packages are cached.
bool pkgGpgCheck() const
Whether the signature of rpm packages should be checked for this repo.
RepoInfo info() const
Return any associated RepoInfo.
TraitsType::constPtrType constPtr
Base for exceptions caused by explicit user request.
static ZConfig & instance()
Singleton ctor.
bool download_use_deltarpm_always() const
Whether to consider using a deltarpm even when rpm is local.
Typesafe passing of user data via callbacks.
bool hasvalue(const std::string &key_r) const
Whether key_r is in data and value is not empty.
bool set(const std::string &key_r, AnyType val_r)
Set the value for key (nonconst version always returns true).
bool haskey(const std::string &key_r) const
Whether key_r is in data.
const Tp & get(const std::string &key_r) const
Pass back a const Tp & reference to key_r value.
Wrapper class for ::stat/::lstat.
const char * c_str() const
Return current Pathname as C-string.
bool isExist() const
Return whether valid stat info exists.
const Pathname & path() const
Return current Pathname.
Pathname extend(const std::string &r) const
Append string r to the last component of the path.
Pathname dirname() const
Return all but the last component od this path.
std::string basename() const
Return the last component of this path.
const Edition & edition() const
const std::string & sequenceinfo() const
const Repository & repository() const
const BaseVersion & baseversion() const
const OnMediaLocation & location() const
Candidate delta and patches for a package.
std::list< packagedelta::DeltaRpm > deltaRpms(const Package::constPtr &package) const
ManagedFile doProvidePackageFromCache() const
Lookup the final rpm in cache.
callback::UserData UserData
void rpmSigFileChecker(const Pathname &file_r) const
PackageProviderImpl(RepoMediaAccess &access_r, const TPackagePtr &package_r, const PackageProviderPolicy &policy_r)
Ctor taking the Package to provide.
virtual ManagedFile providePackageFromCache() const
Provide the package if it is cached.
PackageProviderPolicy _policy
shared_ptr< Report > _report
shared_ptr< void > ScopedGuard
virtual ManagedFile providePackage() const
Provide the package.
bool progressPackageDownload(int value) const
Redirect ProvideFilePolicy package download progress to this.
void defaultReportSignatureError(RpmDb::CheckPackageResult ret, const std::string &detail_r=std::string()) const
Default signature verification error handling.
callback::SendReport< repo::DownloadResolvableReport > Report
RepoMediaAccess & _access
RpmDb::CheckPackageResult packageSigCheck(const Pathname &path_r, bool isMandatory_r, UserData &userData) const
Actual rpm package signature check.
TPackage::constPtr TPackagePtr
virtual bool isCached() const
Whether the package is cached.
ScopedGuard newReport() const
Report & report() const
Access to the DownloadResolvableReport.
void resolveSignatureErrorAction(repo::DownloadResolvableReport::Action action_r) const
React on signature verification error user action.
PackageProviderImpl< TPackage > Base
virtual ~PackageProviderImpl()
virtual ManagedFile doProvidePackage() const
Actually provide the final rpm.
Policies and options for PackageProvider.
bool queryInstalled(const std::string &name_r, const Edition &ed_r, const Arch &arch_r) const
Evaluate callback.
QueryInstalledCB _queryInstalledCB
PackageProvider(RepoMediaAccess &access, const PoolItem &pi_r, const PackageProviderPolicy &policy_r=PackageProviderPolicy())
Ctor taking the package to provide.
RW_pointer< Impl > _pimpl
Implementation class.
ManagedFile providePackage() const
Provide the package.
bool isCached() const
Whether the package is cached.
ManagedFile providePackageFromCache() const
Provide the package if it is cached.
RPM PackageProvider implementation (with deltarpm processing).
virtual ManagedFile doProvidePackage() const
Actually provide the final rpm.
packagedelta::DeltaRpm DeltaRpm
RpmPackageProvider(RepoMediaAccess &access_r, const Package::constPtr &package_r, const DeltaCandidates &deltas_r, const PackageProviderPolicy &policy_r)
ManagedFile tryDelta(const DeltaRpm &delta_r) const
void progressDeltaApply(int value) const
bool progressDeltaDownload(int value) const
bool queryInstalled(const Edition &ed_r=Edition()) const
Exception thrown by PackageProviderImpl::rpmSigFileChecker.
repo::DownloadResolvableReport::Action _action
const repo::DownloadResolvableReport::Action & action() const
Users final decision how to proceed.
RpmSigCheckException(repo::DownloadResolvableReport::Action action_r, std::string msg_r="RpmSigCheckException")
Interface to the rpm program.
CheckPackageResult
checkPackage result
bool haveApplydeltarpm()
Test whether an execuatble applydeltarpm program is available.
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.
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.
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
int unlink(const Pathname &path)
Like 'unlink'.
int assert_dir(const Pathname &path, unsigned mode)
Like 'mkdir -p'.
int hardlinkCopy(const Pathname &oldpath, const Pathname &newpath)
Create newpath as hardlink or copy of oldpath.
PackageProvider::Impl * make(RepoMediaAccess &access_r, const PoolItem &pi_r, const DeltaCandidates &deltas_r, const PackageProviderPolicy &policy_r)
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
Easy-to use interface to the ZYPP dependency resolver.
AutoDispose< const Pathname > ManagedFile
A Pathname plus associated cleanup code to be executed when path is no longer needed.
ResTraits< TRes >::PtrType make(const sat::Solvable &solvable_r)
Directly create a certain kind of ResObject from sat::Solvable.
Pathname repoPackagesCachePath
PackageProvider implementation interface.
virtual bool isCached() const =0
Whether the package is cached.
virtual ManagedFile providePackageFromCache() const =0
Provide the package if it is cached.
virtual ManagedFile providePackage() const =0
Provide the package.
bool isKind(const ResKind &kind_r) const
std::string asUserString() const
Convenient building of std::string via std::ostringstream Basically a std::ostringstream autoconverti...
Detailed rpm signature check log messages A single multiline message if CHK_OK.