libzypp  16.17.4
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>
15 #include "zypp/repo/PackageDelta.h"
16 #include "zypp/base/Logger.h"
17 #include "zypp/base/Gettext.h"
19 #include "zypp/base/NonCopyable.h"
22 #include "zypp/repo/PackageDelta.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"
32 #include "zypp/target/rpm/RpmDb.h"
33 #include "zypp/FileChecker.h"
34 
35 using std::endl;
36 
38 namespace zypp
39 {
41  namespace repo
42  {
44  // class PackageProviderPolicy
46 
47  bool PackageProviderPolicy::queryInstalled( const std::string & name_r,
48  const Edition & ed_r,
49  const Arch & arch_r ) const
50  {
51  if ( _queryInstalledCB )
52  return _queryInstalledCB( name_r, ed_r, arch_r );
53  return false;
54  }
55 
61  {
62  Impl() {}
63  virtual ~Impl() {}
64 
69  virtual ManagedFile providePackage() const = 0;
70 
72  virtual ManagedFile providePackageFromCache() const = 0;
73 
75  virtual bool isCached() const = 0;
76  };
77 
82  template <class TPackage>
84  {
85  typedef typename TPackage::constPtr TPackagePtr; // Package or SrcPackage
87  public:
89  PackageProviderImpl( RepoMediaAccess & access_r, const TPackagePtr & package_r,
90  const PackageProviderPolicy & policy_r )
91  : _policy( policy_r )
92  , _package( package_r )
93  , _access( access_r )
94  , _retry(false)
95  {}
96 
97  virtual ~PackageProviderImpl() {}
98 
99  public:
104  virtual ManagedFile providePackage() const;
105 
108  {
109  ManagedFile ret( doProvidePackageFromCache() );
110  if ( ! ( ret->empty() || _package->repoInfo().keepPackages() ) )
112  return ret;
113  }
114 
116  virtual bool isCached() const
117  { return ! doProvidePackageFromCache()->empty(); }
118 
119  protected:
122 
131  { return ManagedFile( _package->cachedLocation() ); }
132 
148  {
149  ManagedFile ret;
150  OnMediaLocation loc = _package->location();
151 
152  ProvideFilePolicy policy;
153  policy.progressCB( bind( &Base::progressPackageDownload, this, _1 ) );
154  return _access.provideFile( _package->repoInfo(), loc, policy );
155  }
156 
157  protected:
159  Report & report() const
160  { return *_report; }
161 
163  bool progressPackageDownload( int value ) const
164  { return report()->progress( value, _package ); }
165 
167 
168  RpmDb::CheckPackageResult packageSigCheck( const Pathname & path_r, bool isMandatory_r, UserData & userData ) const
169  {
170  if ( !_target )
171  _target = getZYpp()->getTarget();
172 
173  RpmDb::CheckPackageResult ret = RpmDb::CHK_ERROR;
175  if ( _target )
176  {
177  ret = _target->rpmDb().checkPackageSignature( path_r, detail );
178  if ( ret == RpmDb::CHK_NOSIG && !isMandatory_r )
179  {
180  WAR << "Relax CHK_NOSIG: Config says unsigned packages are OK" << endl;
181  ret = RpmDb::CHK_OK;
182  }
183  }
184  else
185  detail.push_back( RpmDb::CheckPackageDetail::value_type( ret, "OOps. Target is not initialized!" ) );
186 
187  userData.set( "CheckPackageResult", ret );
188  userData.set( "CheckPackageDetail", std::move(detail) );
189  return ret;
190  }
191 
196  {
197  switch ( action_r )
198  {
200  _retry = true;
201  break;
203  WAR << _package->asUserString() << ": " << "User requested to accept insecure file" << endl;
204  break;
205  default:
207  ZYPP_THROW(AbortRequestException("User requested to abort"));
208  break;
209  }
210  }
211 
213  void defaultReportSignatureError( RpmDb::CheckPackageResult ret, const std::string & detail_r = std::string() ) const
214  {
215  str::Str msg;
216  msg << _package->asUserString() << ": " << _("Signature verification failed") << " " << ret;
217  if ( ! detail_r.empty() )
218  msg << "\n" << detail_r;
219  resolveSignatureErrorAction( report()->problem( _package, repo::DownloadResolvableReport::INVALID, msg.str() ) );
220  }
221 
222  protected:
224  TPackagePtr _package;
226 
227  private:
228  typedef shared_ptr<void> ScopedGuard;
229 
230  ScopedGuard newReport() const
231  {
232  _report.reset( new Report );
233  // Use a custom deleter calling _report.reset() when guard goes out of
234  // scope (cast required as reset is overloaded). We want report to end
235  // when leaving providePackage and not wait for *this going out of scope.
236  return shared_ptr<void>( static_cast<void*>(0),
237  bind( mem_fun_ref( static_cast<void (shared_ptr<Report>::*)()>(&shared_ptr<Report>::reset) ),
238  ref(_report) ) );
239  }
240 
241  mutable bool _retry;
242  mutable shared_ptr<Report> _report;
244  };
246 
247  template <class TPackage>
249  {
250  ScopedGuard guardReport( newReport() );
251 
252  // check for cache hit:
253  ManagedFile ret( providePackageFromCache() );
254  if ( ! ret->empty() )
255  {
256  MIL << "provided Package from cache " << _package << " at " << ret << endl;
257  report()->infoInCache( _package, ret );
258  return ret; // <-- cache hit
259  }
260 
261  // HERE: cache misss, check toplevel cache or do download:
262  RepoInfo info = _package->repoInfo();
263 
264  // Check toplevel cache
265  {
266  RepoManagerOptions topCache;
267  if ( info.packagesPath().dirname() != topCache.repoPackagesCachePath ) // not using toplevel cache
268  {
269  const OnMediaLocation & loc( _package->location() );
270  if ( ! loc.checksum().empty() ) // no cache hit without checksum
271  {
272  PathInfo pi( topCache.repoPackagesCachePath / info.packagesPath().basename() / info.path() / loc.filename() );
273  if ( pi.isExist() && loc.checksum() == CheckSum( loc.checksum().type(), std::ifstream( pi.c_str() ) ) )
274  {
275  report()->start( _package, pi.path().asFileUrl() );
276  const Pathname & dest( info.packagesPath() / info.path() / loc.filename() );
277  if ( filesystem::assert_dir( dest.dirname() ) == 0 && filesystem::hardlinkCopy( pi.path(), dest ) == 0 )
278  {
279  ret = ManagedFile( dest );
280  if ( ! info.keepPackages() )
282 
283  MIL << "provided Package from toplevel cache " << _package << " at " << ret << endl;
284  report()->finish( _package, repo::DownloadResolvableReport::NO_ERROR, std::string() );
285  return ret; // <-- toplevel cache hit
286  }
287  }
288  }
289  }
290  }
291 
292  // FIXME we only support the first url for now.
293  if ( info.baseUrlsEmpty() )
294  ZYPP_THROW(Exception("No url in repository."));
295 
296  MIL << "provide Package " << _package << endl;
297  Url url = * info.baseUrlsBegin();
298  try {
299  do {
300  _retry = false;
301  if ( ! ret->empty() )
302  {
304  ret.reset();
305  }
306  report()->start( _package, url );
307  try
308  {
309  ret = doProvidePackage();
310 
311  if ( info.pkgGpgCheck() )
312  {
313  UserData userData( "pkgGpgCheck" );
314  ResObject::constPtr roptr( _package ); // gcc6 needs it more explcit. Has problem deducing
315  userData.set( "ResObject", roptr ); // a type for '_package->asKind<ResObject>()'...
316  /*legacy:*/userData.set( "Package", roptr->asKind<Package>() );
317  userData.set( "Localpath", ret.value() );
318 #if ( 1 )
319  bool pkgGpgCheckIsMandatory = info.pkgGpgCheckIsMandatory();
320  if ( str::startsWith( VERSION, "16.15." ) )
321  {
322  // BSC#1038984: For a short period of time, libzypp-16.15.x
323  // will silently accept unsigned packages IFF a repositories gpgcheck
324  // configuration is explicitly turned OFF like this:
325  // gpgcheck = 0
326  // repo_gpgcheck = 0
327  // pkg_gpgcheck = 1
328  // This will allow some already released products to adapt to the behavioral
329  // changes introduced by fixing BSC#1038984, while systems with a default
330  // configuration (gpgcheck = 1) already benefit from the fix.
331  // With libzypp-16.16.x the above configuration will reject unsigned packages
332  // as it should.
333  if ( pkgGpgCheckIsMandatory && !info.gpgCheck() && !info.repoGpgCheck() )
334  pkgGpgCheckIsMandatory = false;
335  }
336  RpmDb::CheckPackageResult res = packageSigCheck( ret, pkgGpgCheckIsMandatory, userData );
337 #else
338  RpmDb::CheckPackageResult res = packageSigCheck( ret, info.pkgGpgCheckIsMandatory(), userData );
339 #endif
340  // publish the checkresult, even if it is OK. Apps may want to report something...
341  report()->pkgGpgCheck( userData );
342 
343  if ( res != RpmDb::CHK_OK )
344  {
345  if ( userData.hasvalue( "Action" ) ) // pkgGpgCheck report provided an user error action
346  {
347  resolveSignatureErrorAction( userData.get( "Action", repo::DownloadResolvableReport::ABORT ) );
348  }
349  else if ( userData.haskey( "Action" ) ) // pkgGpgCheck requests the default problem report (wo. details)
350  {
351  defaultReportSignatureError( res );
352  }
353  else // no advice from user => usedefaults
354  {
355  switch ( res )
356  {
357  case RpmDb::CHK_OK: // Signature is OK
358  break;
359 
360  case RpmDb::CHK_NOKEY: // Public key is unavailable
361  case RpmDb::CHK_NOTFOUND: // Signature is unknown type
362  case RpmDb::CHK_FAIL: // Signature does not verify
363  case RpmDb::CHK_NOTTRUSTED: // Signature is OK, but key is not trusted
364  case RpmDb::CHK_ERROR: // File does not exist or can't be opened
365  case RpmDb::CHK_NOSIG: // File is unsigned
366  default:
367  // report problem (w. details), throw if to abort, else retry/ignore
368  defaultReportSignatureError( res, str::Str() << userData.get<RpmDb::CheckPackageDetail>( "CheckPackageDetail" ) );
369  break;
370  }
371  }
372  }
373  }
374  }
375  catch ( const UserRequestException & excpt )
376  {
377  ERR << "Failed to provide Package " << _package << endl;
378  if ( ! _retry )
379  ZYPP_RETHROW( excpt );
380  }
381  catch ( const FileCheckException & excpt )
382  {
383  ERR << "Failed to provide Package " << _package << endl;
384  if ( ! _retry )
385  {
386  const std::string & package_str = _package->asUserString();
387  // TranslatorExplanation %s = package being checked for integrity
388  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() ) ) )
389  {
391  _retry = true;
392  break;
394  ZYPP_THROW(SkipRequestException("User requested skip of corrupted file"));
395  break;
397  ZYPP_THROW(AbortRequestException("User requested to abort"));
398  break;
399  default:
400  break;
401  }
402  }
403  }
404  catch ( const Exception & excpt )
405  {
406  ERR << "Failed to provide Package " << _package << endl;
407  if ( ! _retry )
408  {
409  // Aything else gets reported
410  const std::string & package_str = _package->asUserString();
411 
412  // TranslatorExplanation %s = name of the package being processed.
413  std::string detail_str( str::form(_("Failed to provide Package %s. Do you want to retry retrieval?"), package_str.c_str() ) );
414  detail_str += str::form( "\n\n%s", excpt.asUserHistory().c_str() );
415 
416  switch ( report()->problem( _package, repo::DownloadResolvableReport::IO, detail_str.c_str() ) )
417  {
419  _retry = true;
420  break;
422  ZYPP_THROW(SkipRequestException("User requested skip of file", excpt));
423  break;
425  ZYPP_THROW(AbortRequestException("User requested to abort", excpt));
426  break;
427  default:
428  ZYPP_RETHROW( excpt );
429  break;
430  }
431  }
432  }
433  } while ( _retry );
434  } catch(...){
435  // bsc#1045735: Be sure no invalid files stay in the cache!
436  // TODO: It would be better to provide a filechecker passed to the
437  // fetcher that performs the pkgGpgCheck. This way a bad file would be
438  // discarded before it's moved to the cache.
439  // For now make sure the file gets deleted (even if keeppackages=1).
440  if ( ! ret->empty() )
442  throw;
443  }
444 
445  report()->finish( _package, repo::DownloadResolvableReport::NO_ERROR, std::string() );
446  MIL << "provided Package " << _package << " at " << ret << endl;
447  return ret;
448  }
449 
450 
455  class RpmPackageProvider : public PackageProviderImpl<Package>
456  {
457  public:
459  const Package::constPtr & package_r,
460  const DeltaCandidates & deltas_r,
461  const PackageProviderPolicy & policy_r )
462  : PackageProviderImpl<Package>( access_r, package_r, policy_r )
463  , _deltas( deltas_r )
464  {}
465 
466  protected:
467  virtual ManagedFile doProvidePackage() const;
468 
469  private:
471 
472  ManagedFile tryDelta( const DeltaRpm & delta_r ) const;
473 
474  bool progressDeltaDownload( int value ) const
475  { return report()->progressDeltaDownload( value ); }
476 
477  void progressDeltaApply( int value ) const
478  { return report()->progressDeltaApply( value ); }
479 
480  bool queryInstalled( const Edition & ed_r = Edition() ) const
481  { return _policy.queryInstalled( _package->name(), ed_r, _package->arch() ); }
482 
483  private:
485  };
487 
489  {
490  Url url;
491  RepoInfo info = _package->repoInfo();
492  // FIXME we only support the first url for now.
493  if ( info.baseUrlsEmpty() )
494  ZYPP_THROW(Exception("No url in repository."));
495  else
496  url = * info.baseUrlsBegin();
497 
498  // check whether to process patch/delta rpms
499  if ( ZConfig::instance().download_use_deltarpm()
501  {
502  std::list<DeltaRpm> deltaRpms;
503  _deltas.deltaRpms( _package ).swap( deltaRpms );
504 
505  if ( ! deltaRpms.empty() && queryInstalled() && applydeltarpm::haveApplydeltarpm() )
506  {
507  for_( it, deltaRpms.begin(), deltaRpms.end())
508  {
509  DBG << "tryDelta " << *it << endl;
510  ManagedFile ret( tryDelta( *it ) );
511  if ( ! ret->empty() )
512  return ret;
513  }
514  }
515  }
516 
517  // no patch/delta -> provide full package
518  return Base::doProvidePackage();
519  }
520 
521  ManagedFile RpmPackageProvider::tryDelta( const DeltaRpm & delta_r ) const
522  {
523  if ( delta_r.baseversion().edition() != Edition::noedition
524  && ! queryInstalled( delta_r.baseversion().edition() ) )
525  return ManagedFile();
526 
527  if ( ! applydeltarpm::quickcheck( delta_r.baseversion().sequenceinfo() ) )
528  return ManagedFile();
529 
530  report()->startDeltaDownload( delta_r.location().filename(),
531  delta_r.location().downloadSize() );
532  ManagedFile delta;
533  try
534  {
535  ProvideFilePolicy policy;
536  policy.progressCB( bind( &RpmPackageProvider::progressDeltaDownload, this, _1 ) );
537  delta = _access.provideFile( delta_r.repository().info(), delta_r.location(), policy );
538  }
539  catch ( const Exception & excpt )
540  {
541  report()->problemDeltaDownload( excpt.asUserHistory() );
542  return ManagedFile();
543  }
544  report()->finishDeltaDownload();
545 
546  report()->startDeltaApply( delta );
547  if ( ! applydeltarpm::check( delta_r.baseversion().sequenceinfo() ) )
548  {
549  report()->problemDeltaApply( _("applydeltarpm check failed.") );
550  return ManagedFile();
551  }
552 
553  // build the package and put it into the cache
554  Pathname destination( _package->repoInfo().packagesPath() / _package->repoInfo().path() / _package->location().filename() );
555 
556  if ( ! applydeltarpm::provide( delta, destination,
557  bind( &RpmPackageProvider::progressDeltaApply, this, _1 ) ) )
558  {
559  report()->problemDeltaApply( _("applydeltarpm failed.") );
560  return ManagedFile();
561  }
562  report()->finishDeltaApply();
563 
564  return ManagedFile( destination, filesystem::unlink );
565  }
566 
568  // class PackageProvider
570  namespace factory
571  {
572  inline PackageProvider::Impl * make( RepoMediaAccess & access_r, const PoolItem & pi_r,
573  const DeltaCandidates & deltas_r,
574  const PackageProviderPolicy & policy_r )
575  {
576  if ( pi_r.isKind<Package>() )
577  return new RpmPackageProvider( access_r, pi_r->asKind<Package>(), deltas_r, policy_r );
578  else if ( pi_r.isKind<SrcPackage>() )
579  return new PackageProviderImpl<SrcPackage>( access_r, pi_r->asKind<SrcPackage>(), policy_r );
580  else
581  ZYPP_THROW( Exception( str::Str() << "Don't know how to cache non-package " << pi_r.asUserString() ) );
582  }
583 
584  inline PackageProvider::Impl * make( RepoMediaAccess & access_r, const PoolItem & pi_r,
585  const PackageProviderPolicy & policy_r )
586  {
587  if ( pi_r.isKind<Package>() )
588  return new PackageProviderImpl<Package>( access_r, pi_r->asKind<Package>(), policy_r );
589  else if ( pi_r.isKind<SrcPackage>() )
590  return new PackageProviderImpl<SrcPackage>( access_r, pi_r->asKind<SrcPackage>(), policy_r );
591  else
592  ZYPP_THROW( Exception( str::Str() << "Don't know how to cache non-package " << pi_r.asUserString() ) );
593  }
594 
595  inline PackageProvider::Impl * make( RepoMediaAccess & access_r, const Package::constPtr & package_r,
596  const DeltaCandidates & deltas_r,
597  const PackageProviderPolicy & policy_r )
598  { return new RpmPackageProvider( access_r, package_r, deltas_r, policy_r ); }
599 
600  } // namespace factory
602 
604  const DeltaCandidates & deltas_r, const PackageProviderPolicy & policy_r )
605 
606  : _pimpl( factory::make( access_r, pi_r, deltas_r, policy_r ) )
607  {}
608 
610  const PackageProviderPolicy & policy_r )
611  : _pimpl( factory::make( access_r, pi_r, policy_r ) )
612  {}
613 
614  /* legacy */
616  const Package::constPtr & package_r,
617  const DeltaCandidates & deltas_r,
618  const PackageProviderPolicy & policy_r )
619  : _pimpl( factory::make( access_r, package_r, deltas_r, policy_r ) )
620  {}
621 
623  {}
624 
626  { return _pimpl->providePackage(); }
627 
629  { return _pimpl->providePackageFromCache(); }
630 
632  { return _pimpl->isCached(); }
633 
634  } // namespace repo
636 } // namespace zypp
PackageProvider implementation interface.
virtual bool isCached() const
Whether the package is cached.
Candidate delta and patches for a package.
virtual ManagedFile providePackageFromCache() const
Provide the package if it is cached.
int assert_dir(const Pathname &path, unsigned mode)
Like &#39;mkdir -p&#39;.
Definition: PathInfo.cc:320
RepoInfo info() const
Return any associated RepoInfo.
Definition: Repository.cc:273
Interface to gettext.
Interface to the rpm program.
Definition: RpmDb.h:47
#define MIL
Definition: Logger.h:64
const Repository & repository() const
Definition: PackageDelta.h:70
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
Definition: Exception.h:350
Describes a path on a certain media amongs as the information required to download it...
bool hasvalue(const std::string &key_r) const
Whether key_r is in data and value is not empty.
Definition: UserData.h:101
static ZConfig & instance()
Singleton ctor.
Definition: Resolver.cc:125
const BaseVersion & baseversion() const
Definition: PackageDelta.h:69
bool isCached() const
Whether the package is cached.
callback::SendReport< repo::DownloadResolvableReport > Report
Architecture.
Definition: Arch.h:36
ManagedFile tryDelta(const DeltaRpm &delta_r) const
void reset()
Reset to default Ctor values.
Definition: AutoDispose.h:145
urls_const_iterator baseUrlsBegin() const
iterator that points at begin of repository urls
Definition: RepoInfo.cc:593
Policies and options for PackageProvider.
bool haveApplydeltarpm()
Test whether an execuatble applydeltarpm program is available.
bool pkgGpgCheck() const
Whether the signature of rpm packages should be checked for this repo.
Definition: RepoInfo.cc:393
What is known about a repository.
Definition: RepoInfo.h:71
AutoDispose< const Pathname > ManagedFile
A Pathname plus associated cleanup code to be executed when path is no longer needed.
Definition: ManagedFile.h:27
Url url
Definition: MediaCurl.cc:196
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition: Easy.h:27
Edition represents [epoch:]version[-release]
Definition: Edition.h:60
bool progressPackageDownload(int value) const
Redirect ProvideFilePolicy package download progress to this.
void progressDeltaApply(int value) const
TraitsType::constPtrType constPtr
Definition: ResObject.h:44
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
Definition: String.cc:36
bool isKind(const ResKind &kind_r) const
Definition: SolvableType.h:64
Pathname packagesPath() const
Path where this repo packages are cached.
Definition: RepoInfo.cc:542
virtual ManagedFile providePackage() const =0
Provide the package.
Report & report() const
Access to the DownloadResolvableReport.
#define ERR
Definition: Logger.h:66
bool queryInstalled(const Edition &ed_r=Edition()) const
virtual ManagedFile providePackage() const
Provide the package.
PackageProvider implementation for Package and SrcPackage.
bool repoGpgCheck() const
Whether the signature of repo metadata should be checked for this repo.
Definition: RepoInfo.cc:378
Repo manager settings.
Definition: RepoManager.h:53
Policy for provideFile.
std::string str() const
Definition: String.h:221
bool pkgGpgCheckIsMandatory() const
Mandatory check (pkgGpgCheck is not off) must ask to confirm using unsigned packages.
Definition: RepoInfo.cc:396
virtual bool isCached() const =0
Whether the package is cached.
PackageProvider(RepoMediaAccess &access, const PoolItem &pi_r, const PackageProviderPolicy &policy_r=PackageProviderPolicy())
Ctor taking the package to provide.
#define ZYPP_RETHROW(EXCPT)
Drops a logline and rethrows, updating the CodeLocation.
Definition: Exception.h:358
RW_pointer< Impl > _pimpl
Implementation class.
const Tp & get(const std::string &key_r) const
Pass back a const Tp & reference to key_r value.
Definition: UserData.h:175
packagedelta::DeltaRpm DeltaRpm
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
Definition: NonCopyable.h:26
bool keepPackages() const
Whether packages downloaded from this repository will be kept in local cache.
Definition: RepoInfo.cc:536
Convenient building of std::string via std::ostringstream Basically a std::ostringstream autoconverti...
Definition: String.h:210
RpmDb::CheckPackageResult packageSigCheck(const Pathname &path_r, bool isMandatory_r, UserData &userData) const
int unlink(const Pathname &path)
Like &#39;unlink&#39;.
Definition: PathInfo.cc:653
ManagedFile providePackageFromCache() const
Provide the package if it is cached.
bool set(const std::string &key_r, AnyType val_r)
Set the value for key (nonconst version always returns true).
Definition: UserData.h:118
PackageProviderImpl(RepoMediaAccess &access_r, const TPackagePtr &package_r, const PackageProviderPolicy &policy_r)
Ctor taking the Package to provide.
Package interface.
Definition: Package.h:32
ManagedFile doProvidePackageFromCache() const
Lookup the final rpm in cache.
PackageProviderImpl< TPackage > Base
#define WAR
Definition: Logger.h:65
Detailed rpm signature check log messages A single multiline message if CHK_OK.
Definition: RpmDb.h:444
bool gpgCheck() const
Whether default signature checking should be performed.
Definition: RepoInfo.cc:368
bool startsWith(const C_Str &str_r, const C_Str &prefix_r)
alias for hasPrefix
Definition: String.h:1086
virtual ManagedFile providePackageFromCache() const =0
Provide the package if it is cached.
ResTraits< TRes >::PtrType make(const sat::Solvable &solvable_r)
Directly create a certain kind of ResObject from sat::Solvable.
Definition: ResObject.h:119
int hardlinkCopy(const Pathname &oldpath, const Pathname &newpath)
Create newpath as hardlink or copy of oldpath.
Definition: PathInfo.cc:836
RpmPackageProvider(RepoMediaAccess &access_r, const Package::constPtr &package_r, const DeltaCandidates &deltas_r, const PackageProviderPolicy &policy_r)
#define _(MSG)
Definition: Gettext.h:29
reference value() const
Reference to the Tp object.
Definition: AutoDispose.h:133
void defaultReportSignatureError(RpmDb::CheckPackageResult ret, const std::string &detail_r=std::string()) const
Default signature verification error handling.
const OnMediaLocation & location() const
Definition: PackageDelta.h:68
virtual ManagedFile doProvidePackage() const
Actually provide the final rpm.
Provides files from different repos.
virtual ManagedFile doProvidePackage() const
Actually provide the final rpm.
bool baseUrlsEmpty() const
whether repository urls are available
Definition: RepoInfo.cc:602
void setDispose(const Dispose &dispose_r)
Set a new dispose function.
Definition: AutoDispose.h:158
SrcPackage interface.
Definition: SrcPackage.h:29
const std::string & sequenceinfo() const
Definition: PackageDelta.h:46
Base class for Exception.
Definition: Exception.h:143
ProvideFilePolicy & progressCB(ProgressCB progressCB_r)
Set callback.
void resolveSignatureErrorAction(repo::DownloadResolvableReport::Action action_r) const
React on signature verification error user action.
callback::SendReport< DownloadProgressReport > * report
Definition: MediaCurl.cc:199
const Pathname & filename() const
The path to the resource relatve to the url and path.
ManagedFile providePackage() const
Provide the package.
Typesafe passing of user data via callbacks.
Definition: UserData.h:38
Reference counted access to a Tp object calling a custom Dispose function when the last AutoDispose h...
Definition: AutoDispose.h:92
shared_ptr< MediaSetAccess > _access
RPM PackageProvider implementation (with deltarpm processing).
Pathname repoPackagesCachePath
Definition: RepoManager.h:82
std::string asUserHistory() const
A single (multiline) string composed of asUserString and historyAsString.
Definition: Exception.cc:91
CheckPackageResult
checkPackage result
Definition: RpmDb.h:429
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.
bool queryInstalled(const std::string &name_r, const Edition &ed_r, const Arch &arch_r) const
Evaluate callback.
bool haskey(const std::string &key_r) const
Whether key_r is in data.
Definition: UserData.h:97
Combining sat::Solvable and ResStatus.
Definition: PoolItem.h:50
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
Definition: Url.cc:474
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:1
const ByteCount & downloadSize() const
The size of the resource on the server.
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.
Url manipulation class.
Definition: Url.h:87
std::string asUserString() const
Definition: SolvableType.h:88
Pathname path() const
Repository path.
Definition: RepoInfo.cc:581
TraitsType::constPtrType constPtr
Definition: Package.h:38
bool download_use_deltarpm_always() const
Whether to consider using a deltarpm even when rpm is local.
Definition: ZConfig.cc:980
#define DBG
Definition: Logger.h:63
static const Edition noedition
Value representing noedition ("") This is in fact a valid Edition.
Definition: Edition.h:73