Go to the documentation of this file.
71 const Arch & arch_r )
const
104 template <
class TPackage>
132 if ( ! ( ret->empty() ||
_package->repoInfo().keepPackages() ) )
175 policy.
progressCB( bind( &Base::progressPackageDownload,
this, _1 ) );
176 policy.
fileChecker( bind( &Base::rpmSigFileChecker,
this, _1 ) );
211 userData.
set(
"ResObject", roptr );
212 userData.
set(
"Package", roptr->asKind<
Package>() );
213 userData.
set(
"Localpath", file_r );
220 report()->pkgGpgCheck( userData );
231 WAR <<
"Unable to read package header from " << hr << endl;
235 std::string keyID = hr->signatureKeyID();
236 if ( keyID.length() > 0 ) {
237 if ( ! getZYpp()->keyRing()->provideAndImportKeyFromRepositoryWorkflow( keyID, info ) )
243 WAR <<
"packageSigCheck returned without setting providing missing key information" << endl;
251 if ( userData.
hasvalue(
"Action" ) )
255 else if ( userData.
haskey(
"Action" ) )
288 _target = getZYpp()->getTarget();
294 ret =
_target->rpmDb().checkPackageSignature( path_r, detail );
297 WAR <<
"Relax CHK_NOSIG: Config says unsigned packages are OK" << endl;
302 detail.push_back( RpmDb::CheckPackageDetail::value_type( ret,
"OOps. Target is not initialized!" ) );
304 userData.
set(
"CheckPackageResult", ret );
305 userData.
set(
"CheckPackageDetail", std::move(detail) );
317 WAR <<
_package->asUserString() <<
": " <<
"User requested to accept insecure file" << endl;
331 msg <<
_package->asUserString() <<
": " <<
_(
"Signature verification failed") <<
" " << ret;
332 if ( ! detail_r.empty() )
333 msg <<
"\n" << detail_r;
352 return shared_ptr<void>(
static_cast<void*
>(0),
353 bind( mem_fun_ref(
static_cast<void (shared_ptr<Report>::*)()
>(&shared_ptr<Report>::reset) ),
363 template <
class TPackage>
370 if ( ! ret->empty() )
372 MIL <<
"provided Package from cache " << _package <<
" at " << ret << endl;
373 report()->infoInCache( _package, ret );
378 RepoInfo info = _package->repoInfo();
399 MIL <<
"provided Package from toplevel cache " << _package <<
" at " << ret << endl;
412 MIL <<
"provide Package " << _package << endl;
417 if ( ! ret->empty() )
425 ret = doProvidePackage();
429 ERR <<
"Failed to provide Package " << _package << endl;
435 ERR <<
"Failed to provide Package " << _package << endl;
446 ZYPP_THROW(SkipRequestException(
"User requested skip of corrupted file"));
450 ZYPP_THROW(AbortRequestException(
"User requested to abort"));
457 ERR <<
"Failed to provide Package " << _package << endl;
460 const std::string & package_str = _package->asUserString();
468 ZYPP_THROW(SkipRequestException(
"User requested skip of corrupted file"));
472 ZYPP_THROW(AbortRequestException(
"User requested to abort"));
479 ERR <<
"Failed to provide Package " << _package << endl;
483 const std::string & package_str = _package->asUserString();
486 std::string detail_str(
str::form(
_(
"Failed to provide Package %s. Do you want to retry retrieval?"), package_str.c_str() ) );
495 ZYPP_THROW(SkipRequestException(
"User requested skip of file", excpt));
499 ZYPP_THROW(AbortRequestException(
"User requested to abort", excpt));
507 if ( ! ret->empty() )
513 MIL <<
"provided Package " << _package <<
" at " << ret << endl;
542 {
return report()->progressDeltaDownload( value ); }
545 {
return report()->progressDeltaApply( value ); }
562 std::list<DeltaRpm> deltaRpms;
567 for_( it, deltaRpms.begin(), deltaRpms.end())
569 DBG <<
"tryDelta " << *it << endl;
571 if ( ! ret->empty() )
604 report()->finishDeltaDownload();
606 report()->startDeltaApply( delta );
609 report()->problemDeltaApply(
_(
"applydeltarpm check failed.") );
620 report()->problemDeltaApply(
_(
"applydeltarpm failed.") );
624 report()->finishDeltaApply();
676 : _pimpl( factory::
make( access_r, pi_r, deltas_r, policy_r ) )
681 : _pimpl( factory::
make( access_r, pi_r, policy_r ) )
689 : _pimpl( factory::
make( access_r, package_r, deltas_r, policy_r ) )
const OnMediaLocation & location() const
virtual ManagedFile providePackageFromCache() const
Provide the package if it is cached.
Combining sat::Solvable and ResStatus.
RW_pointer< Impl > _pimpl
Implementation class.
int assert_dir(const Pathname &path, unsigned mode)
Like 'mkdir -p'.
const Pathname & path() const
Return current Pathname.
bool isKind(const ResKind &kind_r) const
bool isExist() const
Return whether valid stat info exists.
callback::SendReport< repo::DownloadResolvableReport > Report
void defaultReportSignatureError(RpmDb::CheckPackageResult ret, const std::string &detail_r=std::string()) const
Default signature verification error handling.
virtual ManagedFile providePackage() const =0
Provide the package.
repo::DownloadResolvableReport::Action _action
Base class for Exception.
CheckPackageResult
checkPackage result
bool progressDeltaDownload(int value) const
What is known about a repository.
RPM PackageProvider implementation (with deltarpm processing).
AutoDispose< const Pathname > ManagedFile
A Pathname plus associated cleanup code to be executed when path is no longer needed.
bool haveApplydeltarpm()
Test whether an execuatble applydeltarpm program is available.
virtual ~PackageProviderImpl()
ManagedFile providePackage() const
Provide the package.
Edition represents [epoch:]version[-release]
void progressDeltaApply(int value) const
ManagedFile tryDelta(const DeltaRpm &delta_r) const
bool baseUrlsEmpty() const
whether repository urls are available
RpmDb::CheckPackageResult packageSigCheck(const Pathname &path_r, bool isMandatory_r, UserData &userData) const
Actual rpm package signature check.
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
bool haskey(const std::string &key_r) const
Whether key_r is in data.
RepoMediaAccess & _access
const Tp & get(const std::string &key_r) const
Pass back a const Tp & reference to key_r value.
TraitsType::constPtrType constPtr
PackageProvider(RepoMediaAccess &access, const PoolItem &pi_r, const PackageProviderPolicy &policy_r=PackageProviderPolicy())
Ctor taking the package to provide.
TPackage::constPtr TPackagePtr
void rpmSigFileChecker(const Pathname &file_r) const
bool hasvalue(const std::string &key_r) const
Whether key_r is in data and value is not empty.
virtual ManagedFile providePackage() const
Provide the package.
int unlink(const Pathname &path)
Like 'unlink'.
ResTraits< TRes >::PtrType make(const sat::Solvable &solvable_r)
Directly create a certain kind of ResObject from sat::Solvable.
Typesafe passing of user data via callbacks.
bool queryInstalled(const std::string &name_r, const Edition &ed_r, const Arch &arch_r) const
Evaluate callback.
TraitsType::constPtrType constPtr
RpmSigCheckException(repo::DownloadResolvableReport::Action action_r, std::string msg_r="RpmSigCheckException")
Pathname packagesPath() const
Path where this repo packages are cached.
virtual ManagedFile providePackageFromCache() const =0
Provide the package if it is cached.
Wrapper class for ::stat/::lstat.
bool queryInstalled(const Edition &ed_r=Edition()) const
std::string asUserHistory() const
A single (multiline) string composed of asUserString and historyAsString.
std::list< packagedelta::DeltaRpm > deltaRpms(const Package::constPtr &package) const
const Edition & edition() const
Policy for provideFile and RepoMediaAccess.
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
shared_ptr< Report > _report
ProvideFilePolicy & progressCB(ProgressCB progressCB_r)
Set callback.
bool progressPackageDownload(int value) const
Redirect ProvideFilePolicy package download progress to this.
Policies and options for PackageProvider.
PackageProviderImpl(RepoMediaAccess &access_r, const TPackagePtr &package_r, const PackageProviderPolicy &policy_r)
Ctor taking the Package to provide.
const Repository & repository() const
const repo::DownloadResolvableReport::Action & action() const
Users final decision how to proceed.
Interface to the rpm program.
packagedelta::DeltaRpm DeltaRpm
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
PackageProviderImpl< TPackage > Base
PackageProvider::Impl * make(RepoMediaAccess &access_r, const PoolItem &pi_r, const DeltaCandidates &deltas_r, const PackageProviderPolicy &policy_r)
static ZConfig & instance()
Singleton ctor.
bool quickcheck(const std::string &sequenceinfo_r)
Quick via check sequence info.
void resolveSignatureErrorAction(repo::DownloadResolvableReport::Action action_r) const
React on signature verification error user action.
virtual ManagedFile doProvidePackage() const
Easy-to use interface to the ZYPP dependency resolver.
urls_const_iterator baseUrlsBegin() const
iterator that points at begin of repository urls
callback::UserData UserData
virtual bool isCached() const
Whether the package is cached.
RpmPackageProvider(RepoMediaAccess &access_r, const Package::constPtr &package_r, const DeltaCandidates &deltas_r, const PackageProviderPolicy &policy_r)
Report & report() const
Access to the DownloadResolvableReport.
Convenient building of std::string via std::ostringstream Basically a std::ostringstream autoconverti...
void reset()
Reset to default Ctor values.
shared_ptr< void > ScopedGuard
ManagedFile providePackageFromCache() const
Provide the package if it is cached.
void setDispose(const Dispose &dispose_r)
Set a new dispose function.
bool isCached() const
Whether the package is cached.
bool check(const std::string &sequenceinfo_r, bool quick_r)
Check via sequence info.
bool pkgGpgCheck() const
Whether the signature of rpm packages should be checked for this repo.
const char * c_str() const
Return current Pathname as C-string.
ScopedGuard newReport() const
QueryInstalledCB _queryInstalledCB
virtual bool isCached() const =0
Whether the package is cached.
PackageProvider implementation for Package and SrcPackage.
static const Edition noedition
Value representing noedition ("") This is in fact a valid Edition.
PackageProviderPolicy _policy
#define ZYPP_RETHROW(EXCPT)
Drops a logline and rethrows, updating the CodeLocation.
Reference counted access to a Tp object calling a custom Dispose function when the last AutoDispose h...
Pathname dirname() const
Return all but the last component od this path.
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.
Candidate delta and patches for a package.
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Pathname extend(const std::string &r) const
Append string r to the last component of the path.
bool pkgGpgCheckIsMandatory() const
Mandatory check (pkgGpgCheck is not off) must ask to confirm using unsigned packages.
const BaseVersion & baseversion() const
bool download_use_deltarpm_always() const
Whether to consider using a deltarpm even when rpm is local.
Detailed rpm signature check log messages A single multiline message if CHK_OK.
Exception thrown by PackageProviderImpl::rpmSigFileChecker.
std::string basename() const
Return the last component of this path.
RepoInfo info() const
Return any associated RepoInfo.
ManagedFile doProvidePackageFromCache() const
Lookup the final rpm in cache.
const std::string & sequenceinfo() const
int hardlinkCopy(const Pathname &oldpath, const Pathname &newpath)
Create newpath as hardlink or copy of oldpath.
std::string asUserString() const
virtual ManagedFile doProvidePackage() const
Actually provide the final rpm.
bool set(const std::string &key_r, AnyType val_r)
Set the value for key (nonconst version always returns true).
ProvideFilePolicy & fileChecker(FileChecker fileChecker_r)
Add a FileCecker passed down to the Fetcher.
Base for exceptions caused by explicit user request.
Pathname repoPackagesCachePath
PackageProvider implementation interface.
bool keepPackages() const
Whether packages downloaded from this repository will be kept in local cache.
Pathname path() const
Repository path.