libzypp 17.31.23
PackageProvider.cc
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12#include <iostream>
13#include <fstream>
14#include <sstream>
16#include <zypp/base/Logger.h>
17#include <zypp/base/Gettext.h>
18#include <zypp-core/base/UserRequestException>
19#include <zypp/base/NonCopyable.h>
23
24#include <zypp/TmpPath.h>
25#include <zypp/ZConfig.h>
26#include <zypp/RepoInfo.h>
27#include <zypp/RepoManager.h>
28#include <zypp/SrcPackage.h>
29
30#include <zypp/ZYppFactory.h>
31#include <zypp/Target.h>
33#include <zypp/FileChecker.h>
35
36using std::endl;
37
39namespace zypp
40{
42 namespace repo
43 {
49 {
50 public:
51 RpmSigCheckException( repo::DownloadResolvableReport::Action action_r, std::string msg_r = "RpmSigCheckException" )
52 : FileCheckException( std::move(msg_r) )
53 , _action( std::move(action_r) )
54 {}
55
58 { return _action; }
59
60 private:
62 };
63
64
66 // class PackageProviderPolicy
68
69 bool PackageProviderPolicy::queryInstalled( const std::string & name_r,
70 const Edition & ed_r,
71 const Arch & arch_r ) const
72 {
74 return _queryInstalledCB( name_r, ed_r, arch_r );
75 return false;
76 }
77
83 {
84 Impl() {}
85 virtual ~Impl() {}
86
91 virtual ManagedFile providePackage() const = 0;
92
95
97 virtual bool isCached() const = 0;
98 };
99
104 template <class TPackage>
106 {
107 typedef typename TPackage::constPtr TPackagePtr; // Package or SrcPackage
109 public:
111 PackageProviderImpl( RepoMediaAccess & access_r, const TPackagePtr & package_r,
112 const PackageProviderPolicy & policy_r )
113 : _policy( policy_r )
114 , _package( package_r )
115 , _access( access_r )
116 , _retry(false)
117 {}
118
120
121 public:
127
130 {
132 if ( ! ( ret->empty() || _package->repoInfo().keepPackages() ) )
134 return ret;
135 }
136
138 virtual bool isCached() const
139 { return ! doProvidePackageFromCache()->empty(); }
140
141 protected:
144
153 { return ManagedFile( _package->cachedLocation() ); }
154
170 {
171 ManagedFile ret;
172 OnMediaLocation loc = _package->location();
173
174 ProvideFilePolicy policy;
175 policy.progressCB( bind( &Base::progressPackageDownload, this, _1 ) );
176 policy.fileChecker( bind( &Base::rpmSigFileChecker, this, _1 ) );
177 return _access.provideFile( _package->repoInfo(), loc, policy );
178 }
179
180 protected:
182 Report & report() const
183 { return *_report; }
184
186 bool progressPackageDownload( int value ) const
187 { return report()->progress( value, _package ); }
188
189
204 void rpmSigFileChecker( const Pathname & file_r ) const
205 {
206 RepoInfo info = _package->repoInfo();
207 if ( info.pkgGpgCheck() )
208 {
209 UserData userData( "pkgGpgCheck" );
210 ResObject::constPtr roptr( _package ); // gcc6 needs it more explcit. Has problem deducing
211 userData.set( "ResObject", roptr ); // a type for '_package->asKind<ResObject>()'...
212 /*legacy:*/userData.set( "Package", roptr->asKind<Package>() );
213 userData.set( "Localpath", file_r );
214
216 while ( res == RpmDb::CHK_NOKEY ) {
217 res = packageSigCheck( file_r, info.pkgGpgCheckIsMandatory(), userData );
218
219 // publish the checkresult, even if it is OK. Apps may want to report something...
220 report()->pkgGpgCheck( userData );
221
222 if ( res == RpmDb::CHK_NOKEY ) {
223 // if the check fails because we don't know the key
224 // we try to resolv it with gpgkey urls from the
225 // repository, if available
226
228 if ( !hr ) {
229 // we did not find any information about the key in the header
230 // this should never happen
231 WAR << "Unable to read package header from " << hr << endl;
232 break;
233 }
234
235 std::string keyID = hr->signatureKeyID();
236 if ( keyID.length() > 0 ) {
237 if ( ! getZYpp()->keyRing()->provideAndImportKeyFromRepositoryWorkflow( keyID, info ) )
238 break;
239
240 } else {
241 // we did not find any information about the key in the header
242 // this should never happen
243 WAR << "packageSigCheck returned without setting providing missing key information" << endl;
244 break;
245 }
246 }
247 }
248
249 if ( res != RpmDb::CHK_OK )
250 {
251 if ( userData.hasvalue( "Action" ) ) // pkgGpgCheck report provided an user error action
252 {
254 }
255 else if ( userData.haskey( "Action" ) ) // pkgGpgCheck requests the default problem report (wo. details)
256 {
258 }
259 else // no advice from user => usedefaults
260 {
261 switch ( res )
262 {
263 case RpmDb::CHK_OK: // Signature is OK
264 break;
265
266 case RpmDb::CHK_NOKEY: // Public key is unavailable
267 case RpmDb::CHK_NOTFOUND: // Signature is unknown type
268 case RpmDb::CHK_FAIL: // Signature does not verify
269 case RpmDb::CHK_NOTTRUSTED: // Signature is OK, but key is not trusted
270 case RpmDb::CHK_ERROR: // File does not exist or can't be opened
271 case RpmDb::CHK_NOSIG: // File is unsigned
272 default:
273 // report problem (w. details), throw if to abort, else retry/ignore
274 defaultReportSignatureError( res, str::Str() << userData.get<RpmDb::CheckPackageDetail>( "CheckPackageDetail" ) );
275 break;
276 }
277 }
278 }
279 }
280 }
281
283
285 RpmDb::CheckPackageResult packageSigCheck( const Pathname & path_r, bool isMandatory_r, UserData & userData ) const
286 {
287 if ( !_target )
288 _target = getZYpp()->getTarget();
289
292 if ( _target )
293 {
294 ret = _target->rpmDb().checkPackageSignature( path_r, detail );
295 if ( ret == RpmDb::CHK_NOSIG && !isMandatory_r )
296 {
297 WAR << "Relax CHK_NOSIG: Config says unsigned packages are OK" << endl;
298 ret = RpmDb::CHK_OK;
299 }
300 }
301 else
302 detail.push_back( RpmDb::CheckPackageDetail::value_type( ret, "OOps. Target is not initialized!" ) );
303
304 userData.set( "CheckPackageResult", ret );
305 userData.set( "CheckPackageDetail", std::move(detail) );
306 return ret;
307 }
308
313 {
314 switch ( action_r )
315 {
317 WAR << _package->asUserString() << ": " << "User requested to accept insecure file" << endl;
318 break;
319 default:
322 ZYPP_THROW(RpmSigCheckException(action_r,"Signature verification failed"));
323 break;
324 }
325 }
326
328 void defaultReportSignatureError( RpmDb::CheckPackageResult ret, const std::string & detail_r = std::string() ) const
329 {
330 str::Str msg;
331 msg << _package->asUserString() << ": " << _("Signature verification failed") << " " << ret;
332 if ( ! detail_r.empty() )
333 msg << "\n" << detail_r;
335 }
337
338 protected:
342
343 private:
344 typedef shared_ptr<void> ScopedGuard;
345
347 {
348 _report.reset( new Report );
349 // Use a custom deleter calling _report.reset() when guard goes out of
350 // scope (cast required as reset is overloaded). We want report to end
351 // when leaving providePackage and not wait for *this going out of scope.
352 return shared_ptr<void>( static_cast<void*>(0),
353 std::bind( std::mem_fn(static_cast<void (shared_ptr<Report>::*)()>(&shared_ptr<Report>::reset)),
354 std::ref(_report) ) );
355 }
356
357 mutable bool _retry;
358 mutable shared_ptr<Report> _report;
360 };
362
363 template <class TPackage>
365 {
366 ScopedGuard guardReport( newReport() );
367
368 // check for cache hit:
369 ManagedFile ret( providePackageFromCache() );
370 if ( ! ret->empty() )
371 {
372 MIL << "provided Package from cache " << _package << " at " << ret << endl;
373 report()->infoInCache( _package, ret );
374 return ret; // <-- cache hit
375 }
376
377 // HERE: cache misss, check toplevel cache or do download:
378 RepoInfo info = _package->repoInfo();
379
380 // Check toplevel cache
381 {
382 RepoManagerOptions topCache;
383 if ( info.packagesPath().dirname() != topCache.repoPackagesCachePath ) // not using toplevel cache
384 {
385 const OnMediaLocation & loc( _package->location() );
386 if ( ! loc.checksum().empty() ) // no cache hit without checksum
387 {
388 PathInfo pi( topCache.repoPackagesCachePath / info.packagesPath().basename() / info.path() / loc.filename() );
389 if ( pi.isExist() && loc.checksum() == CheckSum( loc.checksum().type(), std::ifstream( pi.c_str() ) ) )
390 {
391 report()->start( _package, pi.path().asFileUrl() );
392 const Pathname & dest( info.packagesPath() / info.path() / loc.filename() );
393 if ( filesystem::assert_dir( dest.dirname() ) == 0 && filesystem::hardlinkCopy( pi.path(), dest ) == 0 )
394 {
395 ret = ManagedFile( dest );
396 if ( ! info.keepPackages() )
398
399 MIL << "provided Package from toplevel cache " << _package << " at " << ret << endl;
400 report()->finish( _package, repo::DownloadResolvableReport::NO_ERROR, std::string() );
401 return ret; // <-- toplevel cache hit
402 }
403 }
404 }
405 }
406 }
407
408 // FIXME we only support the first url for now.
409 if ( info.baseUrlsEmpty() )
410 ZYPP_THROW(Exception("No url in repository."));
411
412 MIL << "provide Package " << _package << endl;
413 Url url = * info.baseUrlsBegin();
414 try {
415 do {
416 _retry = false;
417 if ( ! ret->empty() )
418 {
420 ret.reset();
421 }
422 report()->start( _package, url );
423 try
424 {
425 ret = doProvidePackage();
426 }
427 catch ( const UserRequestException & excpt )
428 {
429 ERR << "Failed to provide Package " << _package << endl;
430 if ( ! _retry )
431 ZYPP_RETHROW( excpt );
432 }
433 catch ( const RpmSigCheckException & excpt )
434 {
435 ERR << "Failed to provide Package " << _package << endl;
436 if ( ! _retry )
437 {
438 // Signature verification error was already reported by the
439 // rpmSigFileChecker. Just handle the users action decision:
440 switch ( excpt.action() )
441 {
443 _retry = true;
444 break;
446 ZYPP_THROW(SkipRequestException("User requested skip of corrupted file"));
447 break;
448 default:
450 ZYPP_THROW(AbortRequestException("User requested to abort"));
451 break;
452 }
453 }
454 }
455 catch ( const FileCheckException & excpt )
456 {
457 ERR << "Failed to provide Package " << _package << endl;
458 if ( ! _retry )
459 {
460 const std::string & package_str = _package->asUserString();
461 // TranslatorExplanation %s = package being checked for integrity
462 switch ( report()->problem( _package, repo::DownloadResolvableReport::INVALID, str::form(_("Package %s seems to be corrupted during transfer. Do you want to retry retrieval?"), package_str.c_str() ) ) )
463 {
465 _retry = true;
466 break;
468 ZYPP_THROW(SkipRequestException("User requested skip of corrupted file"));
469 break;
470 default:
472 ZYPP_THROW(AbortRequestException("User requested to abort"));
473 break;
474 }
475 }
476 }
477 catch ( const Exception & excpt )
478 {
479 ERR << "Failed to provide Package " << _package << endl;
480 if ( ! _retry )
481 {
482 // Aything else gets reported
483 const std::string & package_str = _package->asUserString();
484
485 // TranslatorExplanation %s = name of the package being processed.
486 std::string detail_str( str::form(_("Failed to provide Package %s. Do you want to retry retrieval?"), package_str.c_str() ) );
487 detail_str += str::form( "\n\n%s", excpt.asUserHistory().c_str() );
488
489 switch ( report()->problem( _package, repo::DownloadResolvableReport::IO, detail_str.c_str() ) )
490 {
492 _retry = true;
493 break;
495 ZYPP_THROW(SkipRequestException("User requested skip of file", excpt));
496 break;
497 default:
499 ZYPP_THROW(AbortRequestException("User requested to abort", excpt));
500 break;
501 }
502 }
503 }
504 } while ( _retry );
505 } catch(...){
506 // bsc#1045735: Be sure no invalid files stay in the cache!
507 if ( ! ret->empty() )
509 throw;
510 }
511
512 report()->finish( _package, repo::DownloadResolvableReport::NO_ERROR, std::string() );
513 MIL << "provided Package " << _package << " at " << ret << endl;
514 return ret;
515 }
516
517
523 {
524 public:
526 const Package::constPtr & package_r,
527 const DeltaCandidates & deltas_r,
528 const PackageProviderPolicy & policy_r )
529 : PackageProviderImpl<Package>( access_r, package_r, policy_r )
530 , _deltas( deltas_r )
531 {}
532
533 protected:
534 virtual ManagedFile doProvidePackage() const;
535
536 private:
538
539 ManagedFile tryDelta( const DeltaRpm & delta_r ) const;
540
541 bool progressDeltaDownload( int value ) const
542 { return report()->progressDeltaDownload( value ); }
543
544 void progressDeltaApply( int value ) const
545 { return report()->progressDeltaApply( value ); }
546
547 bool queryInstalled( const Edition & ed_r = Edition() ) const
548 { return _policy.queryInstalled( _package->name(), ed_r, _package->arch() ); }
549
550 private:
552 };
554
556 {
557 // check whether to process patch/delta rpms
558 // FIXME we only check the first url for now.
559 if ( ZConfig::instance().download_use_deltarpm()
560 && ( _package->repoInfo().url().schemeIsDownloading() || ZConfig::instance().download_use_deltarpm_always() ) )
561 {
562 std::list<DeltaRpm> deltaRpms;
563 _deltas.deltaRpms( _package ).swap( deltaRpms );
564
565 if ( ! deltaRpms.empty() && queryInstalled() && applydeltarpm::haveApplydeltarpm() )
566 {
567 for_( it, deltaRpms.begin(), deltaRpms.end())
568 {
569 DBG << "tryDelta " << *it << endl;
570 ManagedFile ret( tryDelta( *it ) );
571 if ( ! ret->empty() )
572 return ret;
573 }
574 }
575 }
576
577 // no patch/delta -> provide full package
578 return Base::doProvidePackage();
579 }
580
582 {
583 if ( delta_r.baseversion().edition() != Edition::noedition
584 && ! queryInstalled( delta_r.baseversion().edition() ) )
585 return ManagedFile();
586
588 return ManagedFile();
589
590 report()->startDeltaDownload( delta_r.location().filename(),
591 delta_r.location().downloadSize() );
592 ManagedFile delta;
593 try
594 {
595 ProvideFilePolicy policy;
596 policy.progressCB( bind( &RpmPackageProvider::progressDeltaDownload, this, _1 ) );
597 delta = _access.provideFile( delta_r.repository().info(), delta_r.location(), policy );
598 }
599 catch ( const Exception & excpt )
600 {
601 report()->problemDeltaDownload( excpt.asUserHistory() );
602 return ManagedFile();
603 }
604 report()->finishDeltaDownload();
605
606 report()->startDeltaApply( delta );
607 if ( ! applydeltarpm::check( delta_r.baseversion().sequenceinfo() ) )
608 {
609 report()->problemDeltaApply( _("applydeltarpm check failed.") );
610 return ManagedFile();
611 }
612
613 // Build the package
614 Pathname cachedest( _package->repoInfo().packagesPath() / _package->repoInfo().path() / _package->location().filename() );
615 Pathname builddest( cachedest.extend( ".drpm" ) );
616
617 if ( ! applydeltarpm::provide( delta, builddest,
618 bind( &RpmPackageProvider::progressDeltaApply, this, _1 ) ) )
619 {
620 report()->problemDeltaApply( _("applydeltarpm failed.") );
621 return ManagedFile();
622 }
623 ManagedFile builddestCleanup( builddest, filesystem::unlink );
624 report()->finishDeltaApply();
625
626 // Check and move it into the cache
627 // Here the rpm itself is ready. If the packages sigcheck fails, it
628 // makes no sense to return a ManagedFile() and fallback to download the
629 // full rpm. It won't be different. So let the exceptions escape...
630 rpmSigFileChecker( builddest );
631 if ( filesystem::hardlinkCopy( builddest, cachedest ) != 0 )
632 ZYPP_THROW( Exception( str::Str() << "Can't hardlink/copy " << builddest << " to " << cachedest ) );
633
634 return ManagedFile( cachedest, filesystem::unlink );
635 }
636
638 // class PackageProvider
640 namespace factory
641 {
642 inline PackageProvider::Impl * make( RepoMediaAccess & access_r, const PoolItem & pi_r,
643 const DeltaCandidates & deltas_r,
644 const PackageProviderPolicy & policy_r )
645 {
646 if ( pi_r.isKind<Package>() )
647 return new RpmPackageProvider( access_r, pi_r->asKind<Package>(), deltas_r, policy_r );
648 else if ( pi_r.isKind<SrcPackage>() )
649 return new PackageProviderImpl<SrcPackage>( access_r, pi_r->asKind<SrcPackage>(), policy_r );
650 else
651 ZYPP_THROW( Exception( str::Str() << "Don't know how to cache non-package " << pi_r.asUserString() ) );
652 }
653
654 inline PackageProvider::Impl * make( RepoMediaAccess & access_r, const PoolItem & pi_r,
655 const PackageProviderPolicy & policy_r )
656 {
657 if ( pi_r.isKind<Package>() )
658 return new PackageProviderImpl<Package>( access_r, pi_r->asKind<Package>(), policy_r );
659 else if ( pi_r.isKind<SrcPackage>() )
660 return new PackageProviderImpl<SrcPackage>( access_r, pi_r->asKind<SrcPackage>(), policy_r );
661 else
662 ZYPP_THROW( Exception( str::Str() << "Don't know how to cache non-package " << pi_r.asUserString() ) );
663 }
664
665 inline PackageProvider::Impl * make( RepoMediaAccess & access_r, const Package::constPtr & package_r,
666 const DeltaCandidates & deltas_r,
667 const PackageProviderPolicy & policy_r )
668 { return new RpmPackageProvider( access_r, package_r, deltas_r, policy_r ); }
669
670 } // namespace factory
672
674 const DeltaCandidates & deltas_r, const PackageProviderPolicy & policy_r )
675
676 : _pimpl( factory::make( access_r, pi_r, deltas_r, policy_r ) )
677 {}
678
680 const PackageProviderPolicy & policy_r )
681 : _pimpl( factory::make( access_r, pi_r, policy_r ) )
682 {}
683
684 /* legacy */
686 const Package::constPtr & package_r,
687 const DeltaCandidates & deltas_r,
688 const PackageProviderPolicy & policy_r )
689 : _pimpl( factory::make( access_r, package_r, deltas_r, policy_r ) )
690 {}
691
693 {}
694
696 { return _pimpl->providePackage(); }
697
699 { return _pimpl->providePackageFromCache(); }
700
702 { return _pimpl->isCached(); }
703
704 } // namespace repo
706} // namespace zypp
Architecture.
Definition: Arch.h:37
void reset()
Reset to default Ctor values.
Definition: AutoDispose.h:159
void setDispose(const Dispose &dispose_r)
Set a new dispose function.
Definition: AutoDispose.h:176
bool empty() const
Definition: CheckSum.cc:173
std::string type() const
Definition: CheckSum.cc:167
Edition represents [epoch:]version[-release]
Definition: Edition.h:61
static const Edition noedition
Value representing noedition ("") This is in fact a valid Edition.
Definition: Edition.h:73
Base class for Exception.
Definition: Exception.h:146
std::string asUserHistory() const
A single (multiline) string composed of asUserString and historyAsString.
Definition: Exception.cc:91
Describes a resource file located on a medium.
const ByteCount & downloadSize() const
The size of the resource on the server.
const Pathname & filename() const
The path to the resource on the medium.
const CheckSum & checksum() const
The checksum of the resource on the server.
Package interface.
Definition: Package.h:33
TraitsType::constPtrType constPtr
Definition: Package.h:38
Combining sat::Solvable and ResStatus.
Definition: PoolItem.h:51
Policy for provideFile and RepoMediaAccess.
ProvideFilePolicy & fileChecker(FileChecker fileChecker_r)
Add a FileCecker passed down to the Fetcher.
ProvideFilePolicy & progressCB(ProgressCB progressCB_r)
Set callback.
What is known about a repository.
Definition: RepoInfo.h:72
bool baseUrlsEmpty() const
whether repository urls are available
Definition: RepoInfo.cc:743
bool keepPackages() const
Whether packages downloaded from this repository will be kept in local cache.
Definition: RepoInfo.cc:677
Pathname path() const
Repository path.
Definition: RepoInfo.cc:722
bool pkgGpgCheckIsMandatory() const
Mandatory check (pkgGpgCheck is not off) must ask to confirm using unsigned packages.
Definition: RepoInfo.cc:432
urls_const_iterator baseUrlsBegin() const
iterator that points at begin of repository urls
Definition: RepoInfo.cc:734
Pathname packagesPath() const
Path where this repo packages are cached.
Definition: RepoInfo.cc:683
bool pkgGpgCheck() const
Whether the signature of rpm packages should be checked for this repo.
Definition: RepoInfo.cc:429
RepoInfo info() const
Return any associated RepoInfo.
Definition: Repository.cc:273
TraitsType::constPtrType constPtr
Definition: ResObject.h:43
SrcPackage interface.
Definition: SrcPackage.h:30
Url manipulation class.
Definition: Url.h:92
Base for exceptions caused by explicit user request.
static ZConfig & instance()
Singleton ctor.
Definition: ZConfig.cc:922
bool download_use_deltarpm_always() const
Whether to consider using a deltarpm even when rpm is local.
Definition: ZConfig.cc:1176
Typesafe passing of user data via callbacks.
Definition: UserData.h:39
const Tp & get(const std::string &key_r) const
Pass back a const Tp & reference to key_r value.
Definition: UserData.h:175
bool hasvalue(const std::string &key_r) const
Whether key_r is in data and value is not empty.
Definition: UserData.h:101
bool set(const std::string &key_r, AnyType val_r)
Set the value for key (nonconst version always returns true).
Definition: UserData.h:118
bool haskey(const std::string &key_r) const
Whether key_r is in data.
Definition: UserData.h:97
Wrapper class for stat/lstat.
Definition: PathInfo.h:221
const Pathname & path() const
Return current Pathname.
Definition: PathInfo.h:246
bool isExist() const
Return whether valid stat info exists.
Definition: PathInfo.h:281
const char * c_str() const
Return current Pathname as C-string.
Definition: PathInfo.h:250
Pathname extend(const std::string &r) const
Append string r to the last component of the path.
Definition: Pathname.h:173
Pathname dirname() const
Return all but the last component od this path.
Definition: Pathname.h:124
std::string basename() const
Return the last component of this path.
Definition: Pathname.h:128
bool empty() const
Test for an empty path.
Definition: Pathname.h:114
const std::string & sequenceinfo() const
Definition: PackageDelta.h:46
const OnMediaLocation & location() const
Definition: PackageDelta.h:68
const Repository & repository() const
Definition: PackageDelta.h:70
const BaseVersion & baseversion() const
Definition: PackageDelta.h:69
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.
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.
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
RpmDb::CheckPackageResult packageSigCheck(const Pathname &path_r, bool isMandatory_r, UserData &userData) const
Actual rpm package signature check.
virtual bool isCached() const
Whether the package is cached.
void resolveSignatureErrorAction(repo::DownloadResolvableReport::Action action_r) const
React on signature verification error user action.
Report & report() const
Access to the DownloadResolvableReport.
PackageProviderImpl< TPackage > Base
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.
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.
Provides files from different repos.
ManagedFile provideFile(RepoInfo repo_r, const OnMediaLocation &loc_r, const ProvideFilePolicy &policy_r)
Provide a file from a Repository.
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
RpmSigCheckException(repo::DownloadResolvableReport::Action action_r, std::string msg_r="RpmSigCheckException")
const repo::DownloadResolvableReport::Action & action() const
Users final decision how to proceed.
Interface to the rpm program.
Definition: RpmDb.h:50
CheckPackageResult
checkPackage result
Definition: RpmDb.h:354
static RpmHeader::constPtr readPackage(const Pathname &path, VERIFICATION verification=VERIFY)
Get an accessible packages data from disk.
Definition: RpmHeader.cc:212
intrusive_ptr< const RpmHeader > constPtr
Definition: RpmHeader.h:65
Definition: Arch.h:361
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.
Definition: Applydeltarpm.h:48
bool check(const std::string &sequenceinfo_r, bool quick_r)
Check via sequence info.
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
Definition: NonCopyable.h:26
int unlink(const Pathname &path)
Like 'unlink'.
Definition: PathInfo.cc:700
int assert_dir(const Pathname &path, unsigned mode)
Like 'mkdir -p'.
Definition: PathInfo.cc:319
int hardlinkCopy(const Pathname &oldpath, const Pathname &newpath)
Create newpath as hardlink or copy of oldpath.
Definition: PathInfo.cc:883
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.
Definition: String.cc:36
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:2
AutoDispose< const Pathname > ManagedFile
A Pathname plus associated cleanup code to be executed when path is no longer needed.
Definition: ManagedFile.h:27
ResTraits< TRes >::PtrType make(const sat::Solvable &solvable_r)
Directly create a certain kind of ResObject from sat::Solvable.
Definition: ResObject.h:118
Repo manager settings.
Definition: RepoManager.h:54
Pathname repoPackagesCachePath
Definition: RepoManager.h:82
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
Definition: SolvableType.h:64
std::string asUserString() const
Definition: SolvableType.h:95
Convenient building of std::string via std::ostringstream Basically a std::ostringstream autoconverti...
Definition: String.h:212
std::string str() const
Definition: String.h:222
Detailed rpm signature check log messages A single multiline message if CHK_OK.
Definition: RpmDb.h:369
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition: Easy.h:28
#define ZYPP_RETHROW(EXCPT)
Drops a logline and rethrows, updating the CodeLocation.
Definition: Exception.h:440
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
Definition: Exception.h:428
#define _(MSG)
Definition: Gettext.h:37
#define DBG
Definition: Logger.h:95
#define MIL
Definition: Logger.h:96
#define ERR
Definition: Logger.h:98
#define WAR
Definition: Logger.h:97