libzypp  17.38.17
repodownloaderwf.cc
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
9 #include "repodownloaderwf.h"
10 #include <fstream>
11 #include <utility>
12 
13 #include <zypp-common/PublicKey.h>
15 #include <zypp-media/ng/ProvideSpec>
16 
17 #include <zypp/KeyRing.h>
18 #include <zypp/ZConfig.h>
20 
21 #include <zypp/ng/Context>
22 #include <zypp/ng/media/Provide>
23 #include <zypp/ng/repo/Downloader>
27 #include <zypp/ng/reporthelper.h>
28 
32 
37 
38 #undef ZYPP_BASE_LOGGER_LOGGROUP
39 #define ZYPP_BASE_LOGGER_LOGGROUP "zypp::repomanager"
40 
41 
42 namespace zyppng {
43  namespace {
44 
45  using namespace zyppng::operators;
46 
47  struct DownloadMasterIndexLogic
48  {
49  public:
50  using MediaHandle = typename Provide::MediaHandle;
51  using ProvideRes = typename Provide::Res;
52 
53  DownloadMasterIndexLogic( repo::DownloadContextRef &&ctxRef, MediaHandle &&mediaHandle, zypp::filesystem::Pathname &&masterIndex_r )
54  : _dlContext( std::move(ctxRef) )
55  , _media(std::move( mediaHandle ))
56  , _masterIndex(std::move( masterIndex_r ))
57  { }
58 
59  public:
60  MaybeAwaitable<expected<repo::DownloadContextRef>> execute( ) {
61  BLOCKTRACE("DownloadMasterIndexLogic");
62  zypp::RepoInfo ri = _dlContext->repoInfo();
63  // always download them, even if repoGpgCheck is disabled
64  _sigpath = _masterIndex.extend( ".asc" );
65  _keypath = _masterIndex.extend( ".key" );
66  _destdir = _dlContext->destDir();
67 
68  static const std::string rinfoSigcheckTag { "repo_sigcheck_plugin" };
69  if ( ri.hasExtraValue( rinfoSigcheckTag ) ) {
70  zypp::Pathname rmRoot { _dlContext->zyppContext()->config().repoManagerRoot() };
71  zypp::Pathname plugindir { _dlContext->zyppContext()->config().pluginsPath() };
72  _sigcheckPlugins = zypp::SigcheckPlugins( ri.extraValue( rinfoSigcheckTag ), plugindir );
73  if ( _sigcheckPlugins ) {
74  try {
75  _sigcheckPlugins.launch( rmRoot );
76  } catch ( ... ) {
77  return expected<repo::DownloadContextRef>::error( std::current_exception() );
78  }
79  }
80  }
81 
82  auto providerRef = _dlContext->zyppContext()->provider();
83  return provider()->provide( _media, _masterIndex, ProvideFileSpec().setDownloadSize( zypp::ByteCount( 20, zypp::ByteCount::MB ) ).setMirrorsAllowed( false ) )
84  | and_then( [this]( ProvideRes && masterres ) {
85  // update the gpg keys provided by the repo
86  return RepoInfoWorkflow::fetchGpgKeys( _dlContext->zyppContext(), _dlContext->repoInfo() )
87  | and_then( [this](){
88  // fetch signature and maybe key file
89  return provider()->provide( _media, _sigpath, ProvideFileSpec().setOptional( true ).setDownloadSize( zypp::ByteCount( 20, zypp::ByteCount::MB ) ).setMirrorsAllowed( false ) )
90 
92 
93  | [this]( expected<zypp::ManagedFile> sigFile ) {
94  zypp::Pathname sigpathLocal { _destdir/_sigpath };
95  if ( !sigFile.is_valid () || !zypp::PathInfo(sigpathLocal).isExist() ) {
96  return makeReadyTask(expected<void>::success()); // no sigfile, valid result
97  }
98  _dlContext->files().push_back( std::move(*sigFile) );
99 
100  // check if we got the key, if not we fall back to downloading the .key file
101  auto expKeyId = mtry( &KeyRing::readSignatureKeyId, _dlContext->zyppContext()->keyRing(), sigpathLocal );
102  if ( expKeyId && !_dlContext->zyppContext()->keyRing()->isKeyKnown(*expKeyId) ) {
103 
104  bool needsMirrorToFetchKey = _dlContext->repoInfo().baseUrlsEmpty() && _dlContext->repoInfo().mirrorListUrl().isValid() ;
105  if ( needsMirrorToFetchKey ) {
106  // when dealing with mirrors we notify the user to use gpgKeyUrl instead of
107  // fetching the gpg key from any mirror
108  JobReportHelper( _dlContext->zyppContext() ).warning(_("Downloading signature key via mirrors, consider explicitly setting gpgKeyUrl via the repository configuration instead."));
109  }
110 
111  // we did not get the key via gpgUrl downloads, lets fallback
112  return provider()->provide( _media, _keypath, ProvideFileSpec().setOptional( true ).setDownloadSize( zypp::ByteCount( 20, zypp::ByteCount::MB ) ).setMirrorsAllowed(needsMirrorToFetchKey) )
113  | and_then( Provide::copyResultToDest ( provider(), _destdir / _keypath ) )
114  | and_then( [this]( zypp::ManagedFile keyFile ) {
115 
116  _dlContext->files().push_back( std::move(keyFile));
117  return expected<void>::success();
118  });
119  }
120 
121  // we should not reach this line, but if we do we continue and fail later if its required
122  return makeReadyTask(expected<void>::success());
123  };
124  })
125  | [masterres=std::move(masterres)]( expected<void> ) {
126  return make_expected_success( std::move(masterres) );
127  };
128 
129  } )
130 
131  // copy everything into a directory
133  | and_then( [this]( zypp::ManagedFile &&masterIndex ) {
134  _masterIndexFile = std::move(masterIndex);
135  return expected<void>::success();
136  } )
137 
138  // execute plugin verification if there is one
139  | and_then( std::bind( &DownloadMasterIndexLogic::pluginVerification, this ) )
140 
141  // signature check plugins
142  | and_then( std::bind( &DownloadMasterIndexLogic::executeSigcheckPlugins, this ) )
143 
144  // signature checking
145  | and_then( std::bind( &DownloadMasterIndexLogic::signatureCheck, this ) )
146 
147  // final tasks
148  | and_then([this]() {
149  // Accepted!
150  _dlContext->repoInfo().setMetadataPath( _destdir );
151  _dlContext->repoInfo().setValidRepoSignature( _repoSigValidated );
152 
153  // release the media handle
154  _media = MediaHandle();
155  auto &allFiles = _dlContext->files();
156 
157  // make sure the masterIndex is in front
158  allFiles.insert( allFiles.begin(), std::move(_masterIndexFile) );
159  return make_expected_success( std::move(_dlContext) );
160  });
161  }
162 
163 
164  private:
165  ProvideRef provider () {
166  return _dlContext->zyppContext()->provider();
167  }
168 
169  MaybeAwaitable<expected<void>> executeSigcheckPlugins()
170  {
171  // If no plugins, wrap the result in a task that is already finished.
172  if ( !_sigcheckPlugins ) {
173  return makeReadyTask( expected<void>::success() );
174  }
175  BLOCKTRACE("executeSigcheckPlugins");
176 
177  MaybeAwaitable<expected<void>> chain = makeReadyTask( expected<void>::success() );
178 
179  for ( auto & plugin : _sigcheckPlugins.plugins() ) {
180  auto * pluginPtr = &plugin; // Get the stable address
181  for ( const auto & ext : { plugin.sigExtension(), plugin.keyExtension() } ) {
182  if ( ext.empty() )
183  continue;
184  zypp::Pathname extpath { _masterIndex.extend( ext ) };
185  zypp::Pathname extdest { _destdir / extpath };
186 
187  // Chain the next download to the previous one
188  chain = std::move(chain) | and_then([this, extpath, extdest, pluginPtr]() {
189  return provider()->provide( _media, extpath, ProvideFileSpec().setOptional( false ).setMirrorsAllowed( false ) )
190  | and_then( Provide::copyResultToDest( provider(), extdest ) )
191  | and_then( [this]( zypp::ManagedFile downloaded_r ) {
192  _dlContext->files().push_back( std::move(downloaded_r) );
193  return expected<void>::success();
194  });
195  });
196  }
197 
198  // now verify
199  chain = std::move(chain) | and_then([this, pluginPtr]() {
200  const zypp::Pathname masterIndexLocal { _destdir / _masterIndex };
201  zypp::Pathname sig;
202  if ( not pluginPtr->sigExtension().empty() ) {
203  sig = _destdir / _masterIndex.extend( pluginPtr->sigExtension() );
204  }
205  zypp::Pathname key;
206  if ( not pluginPtr->keyExtension().empty() ) {
207  key = _destdir / _masterIndex.extend( pluginPtr->keyExtension() );
208  }
209  try {
210  pluginPtr->sigcheck( masterIndexLocal, sig, key );
211  } catch ( ... ) {
212  return expected<void>::error( std::current_exception() );
213  }
214  return expected<void>::success();
215  });
216  }
217  return chain;
218  }
219 
220  // Traditional gpg sigcheck
221  MaybeAwaitable<expected<void>> signatureCheck () {
222  BLOCKTRACE("signatureCheck");
223 
224  if ( _dlContext->repoInfo().repoGpgCheck() ) {
225 
226  // The local files are in destdir_r, if they were present on the server
227  zypp::Pathname masterIndexLocal { _destdir/_masterIndex };
228  zypp::Pathname sigpathLocal { _destdir/_sigpath };
229  zypp::Pathname keypathLocal { _destdir/_keypath };
230  bool isSigned = zypp::PathInfo(sigpathLocal).isExist();
231 
232  if ( isSigned || _dlContext->repoInfo().repoGpgCheckIsMandatory() ) {
233 
234  auto verifyCtx = zypp::keyring::VerifyFileContext( masterIndexLocal );
235 
236  // only add the signature if it exists
237  if ( isSigned )
238  verifyCtx.signature( sigpathLocal );
239 
240  // only add the key if it exists
241  if ( zypp::PathInfo(keypathLocal).isExist() ) {
242  try {
243  _dlContext->zyppContext()->keyRing()->importKey( zypp::PublicKey(keypathLocal), false );
244  } catch (...) {
245  return makeReadyTask( expected<void>::error( ZYPP_FWD_CURRENT_EXCPT() ) );
246  }
247  }
248 
249  // set the checker context even if the key is not known
250  // (unsigned repo, key file missing; bnc #495977)
251  verifyCtx.keyContext( _dlContext->repoInfo() );
252 
253  return getExtraKeysInRepomd()
254  | and_then([this, vCtx = std::move(verifyCtx) ]() mutable {
255  for ( const auto &keyData : _buddyKeys ) {
256  DBG << "Keyhint remember buddy " << keyData << std::endl;
257  vCtx.addBuddyKey( keyData.id() );
258  }
259 
260  return SignatureFileCheckWorkflow::verifySignature( _dlContext->zyppContext(), std::move(vCtx))
261  | and_then([ this ]( zypp::keyring::VerifyFileContext verRes ){
262  // remember the validation status
263  _repoSigValidated = verRes.fileValidated();
264  return expected<void>::success();
265  });
266  });
267 
268  } else {
269  WAR << "Accept unsigned repository because repoGpgCheck is not mandatory for " << _dlContext->repoInfo().alias() << std::endl;
270  }
271  } else {
272  WAR << "Signature checking disabled in config of repository " << _dlContext->repoInfo().alias() << std::endl;
273  }
274  return makeReadyTask(expected<void>::success());
275  }
276 
277  // execute the repo verification if there is one
278  expected<void> pluginVerification () {
279  zypp::Pathname masterIndexLocal { _destdir/_masterIndex };
280  // The local files are in destdir_r, if they were present on the server
281  zypp::Pathname sigpathLocal { _destdir/_sigpath };
282  zypp::Pathname keypathLocal { _destdir/_keypath };
283 
284  if ( _dlContext->pluginRepoverification() && _dlContext->pluginRepoverification()->isNeeded() ) {
285  try {
286 
287  if ( zypp::PathInfo(sigpathLocal).isExist() && !zypp::PathInfo(keypathLocal).isExist() ) {
288  auto kr = _dlContext->zyppContext()->keyRing();
289  // if we have a signature but no keyfile, we need to export it from the keyring
290  auto expKeyId = mtry( &KeyRing::readSignatureKeyId, kr.get(), sigpathLocal );
291  if ( !expKeyId ) {
292  MIL << "Failed to read signature from file: " << sigpathLocal << std::endl;
293  } else {
294  std::ofstream os( keypathLocal.c_str() );
295  if ( kr->isKeyKnown(*expKeyId) ) {
296  kr->dumpPublicKey(
297  *expKeyId,
298  kr->isKeyTrusted(*expKeyId),
299  os
300  );
301  }
302  }
303  }
304 
305  _dlContext->pluginRepoverification()->getChecker( sigpathLocal, keypathLocal, _dlContext->repoInfo() )( masterIndexLocal );
306  } catch ( ... ) {
307  return expected<void>::error( std::current_exception () );
308  }
309  }
310  return expected<void>::success();
311  }
312 
317  MaybeAwaitable<expected<void>> getExtraKeysInRepomd () {
318  BLOCKTRACE("getExtraKeysInRepomd");
319  const zypp::Pathname masterIndexLocal { _destdir / _masterIndex };
320 
321  if ( _masterIndex.basename() != "repomd.xml" ) {
322  return makeReadyTask( expected<void>::success() );
323  }
324 
325  std::vector<std::pair<std::string,std::string>> keyhints { zypp::parser::yum::RepomdFileReader(masterIndexLocal).keyhints() };
326  if ( keyhints.empty() )
327  return makeReadyTask( expected<void>::success() );
328  DBG << "Check keyhints: " << keyhints.size() << std::endl;
329 
330  auto keyRing { _dlContext->zyppContext()->keyRing() };
331  return std::move( keyhints )
332  | transform( [this, keyRing]( std::pair<std::string, std::string> val ) {
333 
334  const auto& [ file, keyid ] = val;
335  if ( not zypp::PublicKey::isSafeKeyId( keyid ) ) {
336  const std::string str { zypp::str::Str() << "Keyhint is too short to safely identify a gpg key. Skip auto import:" << keyid << " (" << file << ")" };
337  WAR << str << std::endl;
338  return makeReadyTask(expected<zypp::PublicKeyData>::error( std::make_exception_ptr( zypp::Exception(str)) ));
339  }
340 
341  auto keyData = keyRing->trustedPublicKeyData( keyid );
342  if ( keyData ) {
343  DBG << "Keyhint is already trusted: " << keyid << " (" << file << ")" << std::endl;
344  return makeReadyTask ( expected<zypp::PublicKeyData>::success(keyData) ); // already a trusted key
345  }
346 
347  DBG << "Keyhint search key " << keyid << " (" << file << ")" << std::endl;
348 
349  keyData = keyRing->publicKeyData( keyid );
350  if ( keyData )
351  return makeReadyTask( expected<zypp::PublicKeyData>::success(keyData) );
352 
353  // TODO: Enhance the key caching in general...
354  const zypp::ZConfig & conf = _dlContext->zyppContext()->config();
355  zypp::Pathname cacheFile = conf.repoManagerRoot() / conf.pubkeyCachePath() / file;
356 
357  return zypp::PublicKey::noThrow(cacheFile)
358  | [ keyid = keyid ]( auto &&key ){
359  if ( key.fileProvidesKey( keyid ) )
360  return make_expected_success( std::forward<decltype(key)>(key) );
361  else
362  return expected<zypp::PublicKey>::error( std::make_exception_ptr (zypp::Exception("File does not provide key")));
363  }
364  | or_else ([ this, file = file, keyid = keyid, cacheFile ] ( auto ) mutable -> MaybeAwaitable<expected<zypp::PublicKey>> {
365  auto providerRef = _dlContext->zyppContext()->provider();
366  return providerRef->provide( _media, file, ProvideFileSpec().setOptional(true).setMirrorsAllowed(false) )
367  | and_then( Provide::copyResultToDest( providerRef, _destdir / file ) )
368  | and_then( [this, providerRef, file, keyid , cacheFile = std::move(cacheFile)]( zypp::ManagedFile &&res ) {
369 
370  // remember we downloaded the file
371  _dlContext->files().push_back ( std::move(res) );
372 
373  auto key = zypp::PublicKey::noThrow( _dlContext->files().back() );
374  if ( not key.fileProvidesKey( keyid ) ) {
375  const std::string str = (zypp::str::Str() << "Keyhint " << file << " does not contain a key with id " << keyid << ". Skipping it.");
376  WAR << str << std::endl;
377  return makeReadyTask(expected<zypp::PublicKey>::error( std::make_exception_ptr( zypp::Exception(str)) ));
378  }
379 
380  // Try to cache it...
381  zypp::filesystem::assert_dir( cacheFile.dirname() );
382  return providerRef->copyFile( key.path(), cacheFile )
383  | [ key ]( expected<zypp::ManagedFile> res ) mutable {
384  if ( res ) {
385  // do not delete from cache
386  res->resetDispose ();
387  }
388  return expected<zypp::PublicKey>::success( std::move(key) );
389  };
390  });
391  })
392  | and_then( [ keyRing, keyid = keyid ]( zypp::PublicKey key ){
393  keyRing->importKey( key, false ); // store in general keyring (not trusted!)
394  return expected<zypp::PublicKeyData>::success(keyRing->publicKeyData( keyid )); // fetch back from keyring in case it was a hidden key
395  });
396  })
397  | [this] ( std::vector<expected<zypp::PublicKeyData>> &&keyHints ) mutable {
398  std::for_each( keyHints.begin(), keyHints.end(), [this]( expected<zypp::PublicKeyData> &keyData ){
399  if ( keyData && *keyData ) {
400  _buddyKeys.push_back ( std::move(keyData.get()) );
401  }
402  });
403 
404  MIL << "Check keyhints done. Buddy keys: " << _buddyKeys.size() << std::endl;
405  return expected<void>::success();
406  };
407  }
408 
409  repo::DownloadContextRef _dlContext;
410  MediaHandle _media;
412 
417  zypp::TriBool _repoSigValidated = zypp::indeterminate;
418 
419  std::vector<zypp::PublicKeyData> _buddyKeys;
420 
422  };
423 
424  }
425 
426  MaybeAwaitable<expected<repo::DownloadContextRef> > RepoDownloaderWorkflow::downloadMasterIndex(repo::DownloadContextRef dl, ProvideMediaHandle mediaHandle, zypp::Pathname masterIndex_r)
427  {
428  DownloadMasterIndexLogic impl( std::move(dl), std::move(mediaHandle), std::move(masterIndex_r) );
429  zypp_co_return zypp_co_await( impl.execute() );
430  }
431 
432  MaybeAwaitable<expected<repo::DownloadContextRef>> RepoDownloaderWorkflow::downloadMasterIndex ( repo::DownloadContextRef dl, LazyMediaHandle<Provide> mediaHandle, zypp::filesystem::Pathname masterIndex_r )
433  {
434  using namespace zyppng::operators;
435  return dl->zyppContext()->provider()->attachMediaIfNeeded( mediaHandle )
436  | and_then([ dl, mi = std::move(masterIndex_r) ]( ProvideMediaHandle handle ) mutable {
437  return downloadMasterIndex( std::move(dl), std::move(handle), std::move(mi) );
438  });
439  }
440 
441 
442  namespace {
443  auto statusImpl ( repo::DownloadContextRef dlCtx, ProvideMediaHandle &&mediaHandle ) {
444  const auto finalizeStatus = [ dlCtx ]( zypp::RepoStatus status ){
445  return expected<zypp::RepoStatus>::success( zypp::RepoStatus( dlCtx->repoInfo()) && status );
446  };
447 
448  switch( dlCtx->repoInfo().type().toEnum()) {
450  return RpmmdWorkflows::repoStatus( dlCtx, std::forward<ProvideMediaHandle>(mediaHandle) ) | and_then( std::move(finalizeStatus) );
452  return SuseTagsWorkflows::repoStatus( dlCtx, std::forward<ProvideMediaHandle>(mediaHandle) ) | and_then( std::move(finalizeStatus) );
454  return PlaindirWorkflows::repoStatus ( dlCtx, std::forward<ProvideMediaHandle>(mediaHandle) ) | and_then( std::move(finalizeStatus) );
456  break;
457  }
458 
459  return makeReadyTask<expected<zypp::RepoStatus>>( expected<zypp::RepoStatus>::error( ZYPP_EXCPT_PTR (zypp::repo::RepoUnknownTypeException(dlCtx->repoInfo()))) );
460  }
461  }
462 
463  MaybeAwaitable<expected<zypp::RepoStatus> > RepoDownloaderWorkflow::repoStatus(repo::DownloadContextRef dl, ProvideMediaHandle mediaHandle) {
464  return statusImpl( dl, std::move(mediaHandle) );
465  }
466 
467  MaybeAwaitable<expected<zypp::RepoStatus> > RepoDownloaderWorkflow::repoStatus( repo::DownloadContextRef dl, LazyMediaHandle<Provide> mediaHandle ) {
468  using namespace zyppng::operators;
469  return dl->zyppContext()->provider()->attachMediaIfNeeded( mediaHandle )
470  | and_then([ dl ]( ProvideMediaHandle handle ) {
471  return repoStatus( dl, std::move(handle) );
472  });
473  }
474 
475  namespace {
476  auto downloadImpl ( repo::DownloadContextRef dlCtx, ProvideMediaHandle &&mediaHandle, ProgressObserverRef &&progressObserver ) {
477  switch( dlCtx->repoInfo().type().toEnum()) {
479  return RpmmdWorkflows::download( std::move(dlCtx), std::forward<ProvideMediaHandle>(mediaHandle), std::move(progressObserver) );
481  return SuseTagsWorkflows::download( std::move(dlCtx), std::forward<ProvideMediaHandle>(mediaHandle), std::move(progressObserver) );
483  return PlaindirWorkflows::download ( std::move(dlCtx), std::forward<ProvideMediaHandle>(mediaHandle) );
485  break;
486  }
487 
488  return makeReadyTask<expected<repo::DownloadContextRef> >( expected<repo::DownloadContextRef>::error( ZYPP_EXCPT_PTR (zypp::repo::RepoUnknownTypeException(dlCtx->repoInfo()))) );
489  }
490  }
491 
492  MaybeAwaitable<expected<repo::DownloadContextRef> > RepoDownloaderWorkflow::download(repo::DownloadContextRef dl, ProvideMediaHandle mediaHandle, ProgressObserverRef progressObserver)
493  {
494  return downloadImpl( dl, std::move(mediaHandle), std::move(progressObserver) );
495  }
496 
497  MaybeAwaitable<expected<repo::DownloadContextRef> > RepoDownloaderWorkflow::download(repo::DownloadContextRef dl, LazyMediaHandle<Provide> mediaHandle, ProgressObserverRef progressObserver)
498  {
499  using namespace zyppng::operators;
500  return dl->zyppContext()->provider()->attachMediaIfNeeded( mediaHandle )
501  | and_then([ dl, po = std::move(progressObserver) ]( ProvideMediaHandle handle ) mutable {
502  return downloadImpl( dl, std::move(handle), std::move(po) );
503  });
504  }
505 }
bool fileValidated() const
Whether the signature was actually successfully verified.
#define MIL
Definition: Logger.h:130
auto mtry(Fun &&function)
Definition: mtry.h:71
thrown when it was impossible to determine this repo type.
auto transform(Transformation &&transformation)
Definition: transform.h:95
int assert_dir(const Pathname &path, unsigned mode)
Like &#39;mkdir -p&#39;.
Definition: PathInfo.cc:338
#define BLOCKTRACE(M)
Definition: Logger.h:51
MaybeAwaitable< expected< repo::DownloadContextRef > > downloadMasterIndex(repo::DownloadContextRef dl, ProvideMediaHandle mediaHandle, zypp::filesystem::Pathname masterIndex_r)
MaybeAwaitable< expected< void > > fetchGpgKeys(ContextRef ctx, zypp::RepoInfo info)
Definition: repoinfowf.cc:130
Store and operate with byte count.
Definition: ByteCount.h:31
Pathname pubkeyCachePath() const
Path where the pubkey caches.
Definition: ZConfig.cc:928
Pathname extend(const std::string &r) const
Append string r to the last component of the path.
Definition: Pathname.h:192
zypp::ManagedFile _masterIndexFile
zypp::Pathname _masterIndex
zypp::Pathname _keypath
String related utilities and Regular expression matching.
zypp::TriBool _repoSigValidated
What is known about a repository.
Definition: RepoInfo.h:71
static expected< std::decay_t< Type >, Err > make_expected_success(Type &&t)
Definition: expected.h:470
I/O context for KeyRing::verifyFileSignatureWorkflow.
static const Unit MB
1000^2 Byte
Definition: ByteCount.h:61
std::string basename() const
Return the last component of this path.
Definition: Pathname.h:137
repo::DownloadContextRef _dlContext
zypp::Pathname _sigpath
#define ZYPP_EXCPT_PTR(EXCPT)
Drops a logline and returns Exception as a std::exception_ptr.
Definition: Exception.h:463
MaybeAwaitable< expected< repo::DownloadContextRef > > download(repo::DownloadContextRef dl, ProvideMediaHandle mediaHandle, ProgressObserverRef progressObserver)
Definition: plaindir.cc:75
const Plugins & plugins()
All plugins (their addresses can be captured).
MaybeAwaitable< expected< repo::DownloadContextRef > > download(repo::DownloadContextRef dl, ProvideMediaHandle mediaHandle, ProgressObserverRef progressObserver)
Definition: rpmmd.cc:155
boost::logic::tribool TriBool
3-state boolean logic (true, false and indeterminate).
Definition: String.h:31
std::string extraValue(const std::string &key_r) const
Return extra value for key_r or throws std::out_of_range.
Definition: RepoInfo.cc:1251
Pathname repoManagerRoot() const
The RepoManager root directory.
Definition: ZConfig.cc:834
MediaHandle _media
auto or_else(Fun &&function)
Definition: expected.h:715
zypp::SigcheckPlugins _sigcheckPlugins
Convenient building of std::string via std::ostringstream Basically a std::ostringstream autoconverti...
Definition: String.h:212
std::vector< std::pair< std::string, std::string > > keyhints() const
gpg key hits shipped in keywords (bsc#1184326)
bool isExist() const
Return whether valid stat info exists.
Definition: PathInfo.h:286
Pathname dirname() const
Return all but the last component od this path.
Definition: Pathname.h:133
Interim helper class to collect global options and settings.
Definition: ZConfig.h:81
#define WAR
Definition: Logger.h:131
MaybeAwaitable< expected< zypp::RepoStatus > > repoStatus(repo::DownloadContextRef dl, ProvideMediaHandle mediaHandle)
Definition: susetags.cc:78
bool hasExtraValue(const std::string &key_r) const
Whether an extra value for key_r is set.
Definition: RepoInfo.cc:1248
ProvideMediaHandle MediaHandle
Definition: provide.h:109
MaybeAwaitable< expected< zypp::keyring::VerifyFileContext > > verifySignature(ContextRef ctx, zypp::keyring::VerifyFileContext context)
#define _(MSG)
Definition: Gettext.h:39
static expected success(ConsParams &&...params)
Definition: expected.h:178
Provide::Res ProvideRes
Definition: provide.h:154
MaybeAwaitable< expected< zypp::RepoStatus > > repoStatus(repo::DownloadContextRef dl, ProvideMediaHandle mediaHandle)
Definition: rpmmd.cc:68
MaybeAwaitable< expected< repo::DownloadContextRef > > download(repo::DownloadContextRef dl, ProvideMediaHandle mediaHandle, ProgressObserverRef progressObserver=nullptr)
void launch(const Pathname &chroot_r=Pathname())
Launch all plugins (optionally chrooted).
Class representing one GPG Public Key (PublicKeyData + ASCII armored in a tempfile).
Definition: PublicKey.h:377
Reads through a repomd.xml file and collects type, location, checksum and other data about metadata f...
Base class for Exception.
Definition: Exception.h:152
static bool isSafeKeyId(const std::string &id_r)
!<
Definition: PublicKey.h:445
auto and_then(Fun &&function)
Definition: expected.h:708
Chain< TACondition, TBCondition > chain(TACondition conda_r, TBCondition condb_r)
Convenience function for creating a Chain from two conditions conda_r and condb_r.
Definition: Functional.h:185
MaybeAwaitable< expected< repo::DownloadContextRef > > download(repo::DownloadContextRef dl, ProvideMediaHandle mediaHandle, ProgressObserverRef progressObserver)
Definition: susetags.cc:312
Wrapper class for ::stat/::lstat.
Definition: PathInfo.h:225
Interface of repomd.xml file reader.
ResultType and_then(const expected< T, E > &exp, Function &&f)
Definition: expected.h:520
MaybeAwaitable< expected< zypp::RepoStatus > > repoStatus(repo::DownloadContextRef dl, ProvideMediaHandle mediaHandle)
Track changing files or directories.
Definition: RepoStatus.h:40
static PublicKey noThrow(const Pathname &keyFile_r)
Static ctor returning an empty PublicKey rather than throwing.
Definition: PublicKey.cc:637
#define ZYPP_FWD_CURRENT_EXCPT()
Drops a logline and returns the current Exception as a std::exception_ptr.
Definition: Exception.h:471
ProvideRes Res
Definition: provide.h:111
MaybeAwaitable< expected< zypp::RepoStatus > > repoStatus(repo::DownloadContextRef dl, ProvideMediaHandle mediaHandle)
Definition: plaindir.cc:38
std::string readSignatureKeyId(const Pathname &signature)
reads the public key id from a signature
Definition: KeyRing.cc:196
static auto copyResultToDest(ProvideRef provider, const zypp::Pathname &targetPath)
Definition: provide.h:139
#define DBG
Definition: Logger.h:129
zypp::Pathname _destdir
Handle a bunch of SigcheckPlugins.
std::vector< zypp::PublicKeyData > _buddyKeys