libzypp  17.36.1
RepoInfo.cc
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
13 #include <iostream>
14 #include <vector>
15 #include <fstream>
16 
17 #include <zypp/base/Gettext.h>
18 #include <zypp/base/LogTools.h>
19 #include <zypp-core/base/DefaultIntegral>
21 
22 #include <zypp/ManagedFile.h>
23 #include <zypp-common/PublicKey.h>
24 #include <zypp/MediaSetAccess.h>
25 #include <zypp/RepoInfo.h>
26 #include <zypp/Glob.h>
27 #include <zypp/TriBool.h>
28 #include <zypp/Pathname.h>
29 #include <zypp/ZConfig.h>
32 #include <zypp/ExternalProgram.h>
33 
34 #include <zypp/base/IOStream.h>
35 #include <zypp-core/base/InputStream>
36 #include <zypp/parser/xml/Reader.h>
37 
38 
39 #include <zypp/base/StrMatcher.h>
40 #include <zypp/KeyRing.h>
41 #include <zypp/TmpPath.h>
42 #include <zypp/ZYppFactory.h>
43 #include <zypp/ZYppCallbacks.h>
44 
46 
47 using std::endl;
48 using zypp::xml::escape;
49 
51 namespace zypp
52 {
53 
54  namespace
55  {
56  repo::RepoType probeCache( const Pathname & path_r )
57  {
58  repo::RepoType ret = repo::RepoType::NONE;
59  if ( PathInfo(path_r).isDir() )
60  {
61  if ( PathInfo(path_r/"/repodata/repomd.xml").isFile() )
62  { ret = repo::RepoType::RPMMD; }
63  else if ( PathInfo(path_r/"/content").isFile() )
64  { ret = repo::RepoType::YAST2; }
65  else if ( PathInfo(path_r/"/cookie").isFile() )
67  }
68  DBG << "Probed cached type " << ret << " at " << path_r << endl;
69  return ret;
70  }
71  } // namespace
72 
74  //
75  // CLASS NAME : RepoInfo::Impl
76  //
79  {
80  Impl()
81  : _rawGpgCheck( indeterminate )
82  , _rawRepoGpgCheck( indeterminate )
83  , _rawPkgGpgCheck( indeterminate )
84  , _validRepoSignature( indeterminate )
85  , _type(repo::RepoType::NONE_e)
86  , keeppackages(indeterminate)
88  , emptybaseurls(false)
89  {}
90 
91  Impl(const Impl &) = default;
92  Impl(Impl &&) = delete;
93  Impl &operator=(const Impl &) = delete;
94  Impl &operator=(Impl &&) = delete;
95 
96  ~Impl() {}
97 
98  public:
99  static const unsigned defaultPriority = 99;
100  static const unsigned noPriority = unsigned(-1);
101 
102  void setType( const repo::RepoType & t )
103  { _type = t; }
104 
105  void setProbedType( const repo::RepoType & t ) const
106  {
108  { const_cast<Impl*>(this)->_type = t; }
109  }
110 
112  {
113  if ( _type == repo::RepoType::NONE && not metadataPath().empty() )
114  setProbedType( probeCache( metadataPath() / path ) );
115  return _type;
116  }
117 
118  public:
120  Pathname licenseTgz( const std::string & name_r ) const
121  {
122  Pathname ret;
123  if ( !metadataPath().empty() )
124  {
125  std::string licenseStem( "license" );
126  if ( !name_r.empty() )
127  {
128  licenseStem += "-";
129  licenseStem += name_r;
130  }
131 
133  // TODO: REPOMD: this assumes we know the name of the tarball. In fact
134  // we'd need to get the file from repomd.xml (<data type="license[-name_r]">)
135  g.add( metadataPath() / path / ("repodata/*"+licenseStem+".tar.gz") );
136  if ( g.empty() )
137  g.add( metadataPath() / path / (licenseStem+".tar.gz") );
138 
139  if ( !g.empty() )
140  ret = *g.begin();
141  }
142  return ret;
143  }
144 
146  {
147  const Url & mlurl( _mirrorListUrl.transformed() ); // Variables replaced!
148  if ( _baseUrls.empty() && ! mlurl.asString().empty() )
149  {
150  emptybaseurls = true;
151  DBG << "MetadataPath: " << metadataPath() << endl;
153  _baseUrls.raw().insert( _baseUrls.raw().end(), rmurls.getUrls().begin(), rmurls.getUrls().end() );
154  }
155  return _baseUrls;
156  }
157 
159  { return _baseUrls; }
160 
161  bool baseurl2dump() const
162  { return !emptybaseurls && !_baseUrls.empty(); }
163 
164 
166  { return _gpgKeyUrls; }
167 
169  { return _gpgKeyUrls; }
170 
171 
172  const std::set<std::string> & contentKeywords() const
173  { hasContent()/*init if not yet done*/; return _keywords.second; }
174 
175  void addContent( const std::string & keyword_r )
176  { _keywords.second.insert( keyword_r ); if ( ! hasContent() ) _keywords.first = true; }
177 
178  bool hasContent() const
179  {
180  if ( !_keywords.first && ! metadataPath().empty() )
181  {
182  // HACK directly check master index file until RepoManager offers
183  // some content probing and zypper uses it.
185  MIL << "Empty keywords...." << metadataPath() << endl;
186  Pathname master;
187  if ( PathInfo( (master=metadataPath()/"/repodata/repomd.xml") ).isFile() )
188  {
189  //MIL << "GO repomd.." << endl;
190  xml::Reader reader( master );
191  while ( reader.seekToNode( 2, "content" ) )
192  {
193  _keywords.second.insert( reader.nodeText().asString() );
194  reader.seekToEndNode( 2, "content" );
195  }
196  _keywords.first = true; // valid content in _keywords even if empty
197  }
198  else if ( PathInfo( (master=metadataPath()/"/content") ).isFile() )
199  {
200  //MIL << "GO content.." << endl;
201  iostr::forEachLine( InputStream( master ),
202  [this]( int num_r, const std::string& line_r )->bool
203  {
204  if ( str::startsWith( line_r, "REPOKEYWORDS" ) )
205  {
206  std::vector<std::string> words;
207  if ( str::split( line_r, std::back_inserter(words) ) > 1
208  && words[0].length() == 12 /*"REPOKEYWORDS"*/ )
209  {
210  this->_keywords.second.insert( ++words.begin(), words.end() );
211  }
212  return true; // mult. occurrances are ok.
213  }
214  return( ! str::startsWith( line_r, "META " ) ); // no need to parse into META section.
215  } );
216  _keywords.first = true; // valid content in _keywords even if empty
217  }
219  }
220  return _keywords.first;
221  }
222 
223  bool hasContent( const std::string & keyword_r ) const
224  { return( hasContent() && _keywords.second.find( keyword_r ) != _keywords.second.end() ); }
225 
231  {
232  if ( ! indeterminate(_validRepoSignature) )
233  return _validRepoSignature;
234  // check metadata:
235  if ( ! metadataPath().empty() )
236  {
237  // A missing ".repo_gpgcheck" might be plaindir(no Downloader) or not yet refreshed signed repo!
238  TriBool linkval = triBoolFromPath( metadataPath() / ".repo_gpgcheck" );
239  return linkval;
240  }
241  return indeterminate;
242  }
243 
245  {
246  if ( PathInfo(metadataPath()).isDir() )
247  {
248  Pathname gpgcheckFile( metadataPath() / ".repo_gpgcheck" );
249  if ( PathInfo(gpgcheckFile).isExist() )
250  {
251  TriBool linkval( indeterminate );
252  if ( triBoolFromPath( gpgcheckFile, linkval ) && linkval == value_r )
253  return; // existing symlink fits value_r
254  else
255  filesystem::unlink( gpgcheckFile ); // will write a new one
256  }
257  filesystem::symlink( asString(value_r), gpgcheckFile );
258  }
259  _validRepoSignature = value_r;
260  }
261 
267  {
268  TriBool linkval( true ); // want to see it being switched to indeterminate
269  return triBoolFromPath( metadataPath() / ".repo_gpgcheck", linkval ) && indeterminate(linkval);
270  }
271 
272  bool triBoolFromPath( const Pathname & path_r, TriBool & ret_r ) const
273  {
274  static const Pathname truePath( "true" );
275  static const Pathname falsePath( "false" );
276  static const Pathname indeterminatePath( "indeterminate" );
277 
278  // Quiet readlink;
279  static const ssize_t bufsiz = 63;
280  static char buf[bufsiz+1];
281  ssize_t ret = ::readlink( path_r.c_str(), buf, bufsiz );
282  buf[ret == -1 ? 0 : ret] = '\0';
283 
284  Pathname linkval( buf );
285 
286  bool known = true;
287  if ( linkval == truePath )
288  ret_r = true;
289  else if ( linkval == falsePath )
290  ret_r = false;
291  else if ( linkval == indeterminatePath )
292  ret_r = indeterminate;
293  else
294  known = false;
295  return known;
296  }
297 
298  TriBool triBoolFromPath( const Pathname & path_r ) const
299  { TriBool ret(indeterminate); triBoolFromPath( path_r, ret ); return ret; }
300 
302 
303  private:
307 
308  public:
309  TriBool rawGpgCheck() const { return _rawGpgCheck; }
312 
313  void rawGpgCheck( TriBool val_r ) { _rawGpgCheck = val_r; }
314  void rawRepoGpgCheck( TriBool val_r ) { _rawRepoGpgCheck = val_r; }
315  void rawPkgGpgCheck( TriBool val_r ) { _rawPkgGpgCheck = val_r; }
316 
317  bool cfgGpgCheck() const
318  { return indeterminate(_rawGpgCheck) ? ZConfig::instance().gpgCheck() : (bool)_rawGpgCheck; }
320  { return indeterminate(_rawGpgCheck) && indeterminate(_rawRepoGpgCheck) ? ZConfig::instance().repoGpgCheck() : _rawRepoGpgCheck; }
322  { return indeterminate(_rawGpgCheck) && indeterminate(_rawPkgGpgCheck) ? ZConfig::instance().pkgGpgCheck() : _rawPkgGpgCheck; }
323 
324  private:
327  public:
332  std::string service;
333  std::string targetDistro;
334 
335  void metadataPath( Pathname new_r )
336  { _metadataPath = std::move( new_r ); }
337 
338  void packagesPath( Pathname new_r )
339  { _packagesPath = std::move( new_r ); }
340 
342  { return str::hasSuffix( _metadataPath.asString(), "/%AUTO%" ); }
343 
345  {
346  if ( usesAutoMetadataPaths() )
347  return _metadataPath.dirname() / "%RAW%";
348  return _metadataPath;
349  }
350 
352  {
354  return _metadataPath.dirname() / "%PKG%";
355  return _packagesPath;
356  }
357 
359  mutable bool emptybaseurls;
360 
361  private:
364 
366  mutable std::pair<FalseBool, std::set<std::string> > _keywords;
367 
369 
370  friend Impl * rwcowClone<Impl>( const Impl * rhs );
372  Impl * clone() const
373  { return new Impl( *this ); }
374  };
376 
378  inline std::ostream & operator<<( std::ostream & str, const RepoInfo::Impl & obj )
379  {
380  return str << "RepoInfo::Impl";
381  }
382 
384  //
385  // CLASS NAME : RepoInfo
386  //
388 
390 
392  : _pimpl( new Impl() )
393  {}
394 
396  {}
397 
398  unsigned RepoInfo::priority() const
399  { return _pimpl->priority; }
400 
402  { return Impl::defaultPriority; }
403 
405  { return Impl::noPriority; }
406 
407  void RepoInfo::setPriority( unsigned newval_r )
408  { _pimpl->priority = newval_r ? newval_r : Impl::defaultPriority; }
409 
410 
411  bool RepoInfo::gpgCheck() const
412  { return _pimpl->cfgGpgCheck(); }
413 
415  { _pimpl->rawGpgCheck( value_r ); }
416 
417  void RepoInfo::setGpgCheck( bool value_r ) // deprecated legacy and for squid
418  { setGpgCheck( TriBool(value_r) ); }
419 
420 
422  { return gpgCheck() || bool(_pimpl->cfgRepoGpgCheck()); }
423 
425  {
426  bool ret = ( gpgCheck() && indeterminate(_pimpl->cfgRepoGpgCheck()) ) || bool(_pimpl->cfgRepoGpgCheck());
427  if ( ret && _pimpl->internalUnsignedConfirmed() ) // relax if unsigned repo was confirmed in the past
428  ret = false;
429  return ret;
430  }
431 
433  { _pimpl->rawRepoGpgCheck( value_r ); }
434 
435 
437  { return bool(_pimpl->cfgPkgGpgCheck()) || ( gpgCheck() && !bool(validRepoSignature())/*enforced*/ ) ; }
438 
440  { return bool(_pimpl->cfgPkgGpgCheck()) || ( gpgCheck() && indeterminate(_pimpl->cfgPkgGpgCheck()) && !bool(validRepoSignature())/*enforced*/ ); }
441 
443  { _pimpl->rawPkgGpgCheck( value_r ); }
444 
445 
446  void RepoInfo::getRawGpgChecks( TriBool & g_r, TriBool & r_r, TriBool & p_r ) const
447  {
448  g_r = _pimpl->rawGpgCheck();
449  r_r = _pimpl->rawRepoGpgCheck();
450  p_r = _pimpl->rawPkgGpgCheck();
451  }
452 
453 
455  {
457  if ( ret && !repoGpgCheck() ) ret = false; // invalidate any old signature if repoGpgCheck is off
458  return ret;
459  }
460 
462  { _pimpl->internalSetValidRepoSignature( value_r ); }
463 
465  namespace
466  {
467  inline bool changeGpgCheckTo( TriBool & lhs, TriBool rhs )
468  { if ( ! sameTriboolState( lhs, rhs ) ) { lhs = rhs; return true; } return false; }
469 
470  inline bool changeGpgCheckTo( TriBool ogpg[3], TriBool g, TriBool r, TriBool p )
471  {
472  bool changed = false;
473  if ( changeGpgCheckTo( ogpg[0], g ) ) changed = true;
474  if ( changeGpgCheckTo( ogpg[1], r ) ) changed = true;
475  if ( changeGpgCheckTo( ogpg[2], p ) ) changed = true;
476  return changed;
477  }
478  } // namespace
481  {
482  TriBool ogpg[3]; // Gpg RepoGpg PkgGpg
483  getRawGpgChecks( ogpg[0], ogpg[1], ogpg[2] );
484 
485  bool changed = false;
486  switch ( mode_r )
487  {
488  case GpgCheck::On:
489  changed = changeGpgCheckTo( ogpg, true, indeterminate, indeterminate );
490  break;
491  case GpgCheck::Strict:
492  changed = changeGpgCheckTo( ogpg, true, true, true );
493  break;
495  changed = changeGpgCheckTo( ogpg, true, false, false );
496  break;
498  changed = changeGpgCheckTo( ogpg, true, false, indeterminate );
499  break;
501  changed = changeGpgCheckTo( ogpg, true, indeterminate, false );
502  break;
503  case GpgCheck::Default:
504  changed = changeGpgCheckTo( ogpg, indeterminate, indeterminate, indeterminate );
505  break;
506  case GpgCheck::Off:
507  changed = changeGpgCheckTo( ogpg, false, indeterminate, indeterminate );
508  break;
509  case GpgCheck::indeterminate: // no change
510  break;
511  }
512 
513  if ( changed )
514  {
515  setGpgCheck ( ogpg[0] );
516  setRepoGpgCheck( ogpg[1] );
517  setPkgGpgCheck ( ogpg[2] );
518  }
519  return changed;
520  }
521 
522  void RepoInfo::setMirrorListUrl( const Url & url_r ) // Raw
523  { _pimpl->_mirrorListUrl.raw() = url_r; _pimpl->_mirrorListForceMetalink = false; }
524 
526  { setMirrorListUrl( urls.empty() ? Url() : urls.front() ); }
527 
528  void RepoInfo::setMetalinkUrl( const Url & url_r ) // Raw
529  { _pimpl->_mirrorListUrl.raw() = url_r; _pimpl->_mirrorListForceMetalink = true; }
530 
531  void RepoInfo::setMetalinkUrls( url_set urls ) // Raw
532  { setMetalinkUrl( urls.empty() ? Url() : urls.front() ); }
533 
535  { _pimpl->gpgKeyUrls().raw().swap( urls ); }
536 
537  void RepoInfo::setGpgKeyUrl( const Url & url_r )
538  {
539  _pimpl->gpgKeyUrls().raw().clear();
540  _pimpl->gpgKeyUrls().raw().push_back( url_r );
541  }
542 
543 
544  Pathname RepoInfo::provideKey(const std::string &keyID_r, const Pathname &targetDirectory_r) const {
545  return zyppng::RepoInfoWorkflow::provideKey( zyppng::SyncContext::defaultContext(), *this, keyID_r, targetDirectory_r );
546  }
547 
548  void RepoInfo::addBaseUrl( Url url_r )
549  {
550  for ( const auto & url : _pimpl->baseUrls().raw() ) // Raw unique!
551  if ( url == url_r )
552  return;
553  _pimpl->baseUrls().raw().push_back( std::move(url_r) );
554  }
555 
556  void RepoInfo::setBaseUrl( Url url_r )
557  {
558  _pimpl->baseUrls().raw().clear();
559  _pimpl->baseUrls().raw().push_back( std::move(url_r) );
560  }
561 
563  { _pimpl->baseUrls().raw().swap( urls ); }
564 
565  void RepoInfo::setPath( const Pathname &path )
566  { _pimpl->path = path; }
567 
569  { _pimpl->setType( t ); }
570 
572  { _pimpl->setProbedType( t ); }
573 
574 
576  { _pimpl->metadataPath( path ); }
577 
579  { _pimpl->packagesPath( path ); }
580 
581  void RepoInfo::setKeepPackages( bool keep )
582  { _pimpl->keeppackages = keep; }
583 
584  void RepoInfo::setService( const std::string& name )
585  { _pimpl->service = name; }
586 
587  void RepoInfo::setTargetDistribution( const std::string & targetDistribution )
589 
591  { return indeterminate(_pimpl->keeppackages) ? false : (bool)_pimpl->keeppackages; }
592 
594  { return keepPackages() || PathInfo(packagesPath().dirname()/".keep_packages").isExist(); }
595 
597  { return _pimpl->metadataPath(); }
598 
600  { return _pimpl->packagesPath(); }
601 
603  { return _pimpl->usesAutoMetadataPaths(); }
604 
606  { return _pimpl->type(); }
607 
608  Url RepoInfo::mirrorListUrl() const // Variables replaced!
609  { return _pimpl->_mirrorListUrl.transformed(); }
610 
612  { return _pimpl->_mirrorListUrl.raw(); }
613 
615  { return _pimpl->gpgKeyUrls().empty(); }
616 
618  { return _pimpl->gpgKeyUrls().size(); }
619 
620  RepoInfo::url_set RepoInfo::gpgKeyUrls() const // Variables replaced!
621  { return _pimpl->gpgKeyUrls().transformed(); }
622 
624  { return _pimpl->gpgKeyUrls().raw(); }
625 
626  Url RepoInfo::gpgKeyUrl() const // Variables replaced!
627  { return( _pimpl->gpgKeyUrls().empty() ? Url() : *_pimpl->gpgKeyUrls().transformedBegin() ); }
628 
630  { return( _pimpl->gpgKeyUrls().empty() ? Url() : *_pimpl->gpgKeyUrls().rawBegin() ) ; }
631 
632  RepoInfo::url_set RepoInfo::baseUrls() const // Variables replaced!
633  { return _pimpl->baseUrls().transformed(); }
634 
636  { return _pimpl->baseUrls().raw(); }
637 
639  { return _pimpl->path; }
640 
641  std::string RepoInfo::service() const
642  { return _pimpl->service; }
643 
644  std::string RepoInfo::targetDistribution() const
645  { return _pimpl->targetDistro; }
646 
648  { return( _pimpl->baseUrls().empty() ? Url() : *_pimpl->baseUrls().rawBegin() ); }
649 
651  { return _pimpl->baseUrls().transformedBegin(); }
652 
654  { return _pimpl->baseUrls().transformedEnd(); }
655 
657  { return _pimpl->baseUrls().size(); }
658 
660  { return _pimpl->baseUrls().empty(); }
661 
662  bool RepoInfo::baseUrlSet() const
663  { return _pimpl->baseurl2dump(); }
664 
665  const std::set<std::string> & RepoInfo::contentKeywords() const
666  { return _pimpl->contentKeywords(); }
667 
668  void RepoInfo::addContent( const std::string & keyword_r )
669  { _pimpl->addContent( keyword_r ); }
670 
671  bool RepoInfo::hasContent() const
672  { return _pimpl->hasContent(); }
673 
674  bool RepoInfo::hasContent( const std::string & keyword_r ) const
675  { return _pimpl->hasContent( keyword_r ); }
676 
678 
679  bool RepoInfo::hasLicense() const
680  { return hasLicense( std::string() ); }
681 
682  bool RepoInfo::hasLicense( const std::string & name_r ) const
683  { return !_pimpl->licenseTgz( name_r ).empty(); }
684 
685 
687  { return needToAcceptLicense( std::string() ); }
688 
689  bool RepoInfo::needToAcceptLicense( const std::string & name_r ) const
690  {
691  const Pathname & licenseTgz( _pimpl->licenseTgz( name_r ) );
692  if ( licenseTgz.empty() )
693  return false; // no licenses at all
694 
696  cmd.push_back( "tar" );
697  cmd.push_back( "-t" );
698  cmd.push_back( "-z" );
699  cmd.push_back( "-f" );
700  cmd.push_back( licenseTgz.asString() );
702 
703  bool accept = true;
704  static const std::string noAcceptanceFile = "no-acceptance-needed\n";
705  for ( std::string output( prog.receiveLine() ); output.length(); output = prog.receiveLine() )
706  {
707  if ( output == noAcceptanceFile )
708  {
709  accept = false;
710  }
711  }
712  prog.close();
713  MIL << "License(" << name_r << ") in " << name() << " has to be accepted: " << (accept?"true":"false" ) << endl;
714  return accept;
715  }
716 
717 
718  std::string RepoInfo::getLicense( const Locale & lang_r )
719  { return const_cast<const RepoInfo *>(this)->getLicense( std::string(), lang_r ); }
720 
721  std::string RepoInfo::getLicense( const Locale & lang_r ) const
722  { return getLicense( std::string(), lang_r ); }
723 
724  std::string RepoInfo::getLicense( const std::string & name_r, const Locale & lang_r ) const
725  {
726  LocaleSet avlocales( getLicenseLocales( name_r ) );
727  if ( avlocales.empty() )
728  return std::string();
729 
730  Locale getLang( Locale::bestMatch( avlocales, lang_r ) );
731  if ( !getLang && avlocales.find( Locale::noCode ) == avlocales.end() )
732  {
733  WAR << "License(" << name_r << ") in " << name() << " contains no fallback text!" << endl;
734  // Using the fist locale instead of returning no text at all.
735  // So the user might recognize that there is a license, even if they
736  // can't read it.
737  getLang = *avlocales.begin();
738  }
739 
740  // now extract the license file.
741  static const std::string licenseFileFallback( "license.txt" );
742  std::string licenseFile( !getLang ? licenseFileFallback
743  : str::form( "license.%s.txt", getLang.c_str() ) );
744 
746  cmd.push_back( "tar" );
747  cmd.push_back( "-x" );
748  cmd.push_back( "-z" );
749  cmd.push_back( "-O" );
750  cmd.push_back( "-f" );
751  cmd.push_back( _pimpl->licenseTgz( name_r ).asString() ); // if it not exists, avlocales was empty.
752  cmd.push_back( licenseFile );
753 
754  std::string ret;
756  for ( std::string output( prog.receiveLine() ); output.length(); output = prog.receiveLine() )
757  {
758  ret += output;
759  }
760  prog.close();
761  return ret;
762  }
763 
764 
766  { return getLicenseLocales( std::string() ); }
767 
768  LocaleSet RepoInfo::getLicenseLocales( const std::string & name_r ) const
769  {
770  const Pathname & licenseTgz( _pimpl->licenseTgz( name_r ) );
771  if ( licenseTgz.empty() )
772  return LocaleSet();
773 
775  cmd.push_back( "tar" );
776  cmd.push_back( "-t" );
777  cmd.push_back( "-z" );
778  cmd.push_back( "-f" );
779  cmd.push_back( licenseTgz.asString() );
780 
781  LocaleSet ret;
783  for ( std::string output( prog.receiveLine() ); output.length(); output = prog.receiveLine() )
784  {
785  static const C_Str license( "license." );
786  static const C_Str dotTxt( ".txt\n" );
787  if ( str::hasPrefix( output, license ) && str::hasSuffix( output, dotTxt ) )
788  {
789  if ( output.size() <= license.size() + dotTxt.size() ) // license.txt
790  ret.insert( Locale() );
791  else
792  ret.insert( Locale( std::string( output.c_str()+license.size(), output.size()- license.size() - dotTxt.size() ) ) );
793  }
794  }
795  prog.close();
796  return ret;
797  }
798 
800 
801  std::ostream & RepoInfo::dumpOn( std::ostream & str ) const
802  {
804  if ( _pimpl->baseurl2dump() )
805  {
806  for ( const auto & url : _pimpl->baseUrls().raw() )
807  {
808  str << "- url : " << url << std::endl;
809  }
810  }
811 
812  // print if non empty value
813  auto strif( [&] ( const std::string & tag_r, const std::string & value_r ) {
814  if ( ! value_r.empty() )
815  str << tag_r << value_r << std::endl;
816  });
817 
818  strif( (_pimpl->_mirrorListForceMetalink ? "- metalink : " : "- mirrorlist : "), rawMirrorListUrl().asString() );
819  strif( "- path : ", path().asString() );
820  str << "- type : " << type() << std::endl;
821  str << "- priority : " << priority() << std::endl;
822 
823  // Yes No Default(Y) Default(N)
824 #define OUTS(T,B) ( indeterminate(T) ? (std::string("D(")+(B?"Y":"N")+")") : ((bool)T?"Y":"N") )
825  str << "- gpgcheck : " << OUTS(_pimpl->rawGpgCheck(),gpgCheck())
826  << " repo" << OUTS(_pimpl->rawRepoGpgCheck(),repoGpgCheck()) << (repoGpgCheckIsMandatory() ? "* ": " " )
827  << "sig" << asString( validRepoSignature(), "?", "Y", "N" )
828  << " pkg" << OUTS(_pimpl->rawPkgGpgCheck(),pkgGpgCheck()) << (pkgGpgCheckIsMandatory() ? "* ": " " )
829  << std::endl;
830 #undef OUTS
831 
832  for ( const auto & url : _pimpl->gpgKeyUrls().raw() )
833  {
834  str << "- gpgkey : " << url << std::endl;
835  }
836 
837  if ( ! indeterminate(_pimpl->keeppackages) )
838  str << "- keeppackages: " << keepPackages() << std::endl;
839 
840  strif( "- service : ", service() );
841  strif( "- targetdistro: ", targetDistribution() );
842  strif( "- filePath: ", filepath().asString() );
843  strif( "- metadataPath: ", metadataPath().asString() );
844  strif( "- packagesPath: ", packagesPath().asString() );
845 
846  return str;
847  }
848 
849  std::ostream & RepoInfo::dumpAsIniOn( std::ostream & str ) const
850  {
851  RepoInfoBase::dumpAsIniOn(str);
852 
853  if ( _pimpl->baseurl2dump() )
854  {
855  str << "baseurl=";
856  std::string indent;
857  for ( const auto & url : _pimpl->baseUrls().raw() )
858  {
859  str << indent << hotfix1050625::asString( url ) << endl;
860  if ( indent.empty() ) indent = " "; // "baseurl="
861  }
862  }
863 
864  if ( ! _pimpl->path.empty() )
865  str << "path="<< path() << endl;
866 
867  if ( ! (rawMirrorListUrl().asString().empty()) )
868  str << (_pimpl->_mirrorListForceMetalink ? "metalink=" : "mirrorlist=") << hotfix1050625::asString( rawMirrorListUrl() ) << endl;
869 
870  if ( type() != repo::RepoType::NONE )
871  str << "type=" << type().asString() << endl;
872 
873  if ( priority() != defaultPriority() )
874  str << "priority=" << priority() << endl;
875 
876  if ( ! indeterminate(_pimpl->rawGpgCheck()) )
877  str << "gpgcheck=" << (_pimpl->rawGpgCheck() ? "1" : "0") << endl;
878 
879  if ( ! indeterminate(_pimpl->rawRepoGpgCheck()) )
880  str << "repo_gpgcheck=" << (_pimpl->rawRepoGpgCheck() ? "1" : "0") << endl;
881 
882  if ( ! indeterminate(_pimpl->rawPkgGpgCheck()) )
883  str << "pkg_gpgcheck=" << (_pimpl->rawPkgGpgCheck() ? "1" : "0") << endl;
884 
885  {
886  std::string indent( "gpgkey=");
887  for ( const auto & url : _pimpl->gpgKeyUrls().raw() )
888  {
889  str << indent << url << endl;
890  if ( indent[0] != ' ' )
891  indent = " ";
892  }
893  }
894 
895  if (!indeterminate(_pimpl->keeppackages))
896  str << "keeppackages=" << keepPackages() << endl;
897 
898  if( ! service().empty() )
899  str << "service=" << service() << endl;
900 
901  return str;
902  }
903 
904  std::ostream & RepoInfo::dumpAsXmlOn( std::ostream & str, const std::string & content ) const
905  {
906  std::string tmpstr;
907  str
908  << "<repo"
909  << " alias=\"" << escape(alias()) << "\""
910  << " name=\"" << escape(name()) << "\"";
911  if (type() != repo::RepoType::NONE)
912  str << " type=\"" << type().asString() << "\"";
913  str
914  << " priority=\"" << priority() << "\""
915  << " enabled=\"" << enabled() << "\""
916  << " autorefresh=\"" << autorefresh() << "\""
917  << " gpgcheck=\"" << gpgCheck() << "\""
918  << " repo_gpgcheck=\"" << repoGpgCheck() << "\""
919  << " pkg_gpgcheck=\"" << pkgGpgCheck() << "\"";
920  if ( ! indeterminate(_pimpl->rawGpgCheck()) )
921  str << " raw_gpgcheck=\"" << (_pimpl->rawGpgCheck() ? "1" : "0") << "\"";
922  if ( ! indeterminate(_pimpl->rawRepoGpgCheck()) )
923  str << " raw_repo_gpgcheck=\"" << (_pimpl->rawRepoGpgCheck() ? "1" : "0") << "\"";
924  if ( ! indeterminate(_pimpl->rawPkgGpgCheck()) )
925  str << " raw_pkg_gpgcheck=\"" << (_pimpl->rawPkgGpgCheck() ? "1" : "0") << "\"";
926  if (!(tmpstr = gpgKeyUrl().asString()).empty())
927  if (!(tmpstr = gpgKeyUrl().asString()).empty())
928  str << " gpgkey=\"" << escape(tmpstr) << "\"";
929  if (!(tmpstr = mirrorListUrl().asString()).empty())
930  str << (_pimpl->_mirrorListForceMetalink ? " metalink=\"" : " mirrorlist=\"") << escape(tmpstr) << "\"";
931  str << ">" << endl;
932 
933  if ( _pimpl->baseurl2dump() )
934  {
935  for_( it, baseUrlsBegin(), baseUrlsEnd() ) // !transform iterator replaces variables
936  str << "<url>" << escape((*it).asString()) << "</url>" << endl;
937  }
938 
939  str << "</repo>" << endl;
940  return str;
941  }
942 
943 
944  std::ostream & operator<<( std::ostream & str, const RepoInfo & obj )
945  {
946  return obj.dumpOn(str);
947  }
948 
949  std::ostream & operator<<( std::ostream & str, const RepoInfo::GpgCheck & obj )
950  {
951  switch ( obj )
952  {
953 #define OUTS( V ) case RepoInfo::V: return str << #V; break
954  OUTS( GpgCheck::On );
955  OUTS( GpgCheck::Strict );
956  OUTS( GpgCheck::AllowUnsigned );
957  OUTS( GpgCheck::AllowUnsignedRepo );
958  OUTS( GpgCheck::AllowUnsignedPackage );
960  OUTS( GpgCheck::Off );
961  OUTS( GpgCheck::indeterminate );
962 #undef OUTS
963  }
964  return str << "GpgCheck::UNKNOWN";
965  }
966 
968  {
969  // We skip the check for downloading media unless a local copy of the
970  // media file exists and states that there is more than one medium.
971  bool canSkipMediaCheck = std::all_of( baseUrlsBegin(), baseUrlsEnd(), []( const zypp::Url &url ) { return url.schemeIsDownloading(); });
972  if ( canSkipMediaCheck ) {
973  const auto &mDataPath = metadataPath();
974  if ( not mDataPath.empty() ) {
975  PathInfo mediafile { mDataPath/"media.1/media" };
976  if ( mediafile.isExist() ) {
977  repo::SUSEMediaVerifier lverifier { mediafile.path() };
978  if ( lverifier && lverifier.totalMedia() > 1 ) {
979  canSkipMediaCheck = false;
980  }
981  }
982  }
983  }
984  if ( canSkipMediaCheck )
985  DBG << "Can SKIP media.1/media check for status calc of repo " << alias() << endl;
986  return not canSkipMediaCheck;
987  }
988 
990 } // namespace zypp
std::string asString(const Patch::Category &obj)
Definition: Patch.cc:122
static const Locale noCode
Empty code.
Definition: Locale.h:75
Pathname filepath() const
File where this repo was read from.
void setBaseUrl(Url url)
Clears current base URL list and adds url.
Definition: RepoInfo.cc:556
Pathname path() const
Repository path.
Definition: RepoInfo.cc:638
unsigned priority() const
Repository priority for solver.
Definition: RepoInfo.cc:398
Interface to gettext.
#define MIL
Definition: Logger.h:100
bool hasLicense() const
Whether there is a license associated with the repo.
Definition: RepoInfo.cc:679
url_set gpgKeyUrls() const
The list of gpgkey URLs defined for this repo.
Definition: RepoInfo.cc:620
ZYPP_API detail::EscapedString escape(const std::string &in_r)
Escape xml special charaters (& -> &; from IoBind library).
Definition: XmlEscape.h:51
void setGpgKeyUrl(const Url &gpgkey)
(leagcy API) Set the gpgkey URL defined for this repo
Definition: RepoInfo.cc:537
static unsigned defaultPriority()
The default priority (99).
Definition: RepoInfo.cc:401
Url rawGpgKeyUrl() const
(leagcy API) The 1st raw gpgkey URL defined for this repo (no variables replaced) ...
Definition: RepoInfo.cc:629
Url rawUrl() const
Pars pro toto: The first repository raw url (no variables replaced)
Definition: RepoInfo.cc:647
TriBool rawPkgGpgCheck() const
Definition: RepoInfo.cc:311
const std::set< std::string > & contentKeywords() const
Content keywords defined.
Definition: RepoInfo.cc:665
Implementation of the traditional SUSE media verifier.
boost::logic::tribool TriBool
3-state boolean logic (true, false and indeterminate).
Definition: String.h:30
void packagesPath(Pathname new_r)
Definition: RepoInfo.cc:338
bool _mirrorListForceMetalink
Definition: RepoInfo.cc:330
static ZConfig & instance()
Singleton ctor.
Definition: ZConfig.cc:925
std::string service() const
Gets name of the service to which this repository belongs or empty string if it has been added manual...
Definition: RepoInfo.cc:641
bool usesAutoMetadataPaths() const
Definition: RepoInfo.cc:341
void setProbedType(const repo::RepoType &t) const
This allows to adjust the RepoType lazy, from NONE to some probed value, even for const objects...
Definition: RepoInfo.cc:571
void setPriority(unsigned newval_r)
Set repository priority for solver.
Definition: RepoInfo.cc:407
int readlink(const Pathname &symlink_r, Pathname &target_r)
Like &#39;readlink&#39;.
Definition: PathInfo.cc:929
void rawGpgCheck(TriBool val_r)
Definition: RepoInfo.cc:313
RWCOW_pointer< Impl > _pimpl
Pointer to implementation.
Definition: RepoInfo.h:574
Pathname provideKey(const std::string &keyID_r, const Pathname &targetDirectory_r) const
downloads all configured gpg keys into the defined directory
Definition: RepoInfo.cc:544
void setMirrorListUrl(const Url &url)
Set mirror list url.
Definition: RepoInfo.cc:522
std::unordered_set< Locale > LocaleSet
Definition: Locale.h:29
static SyncContextRef defaultContext()
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition: Easy.h:27
const char * c_str() const
String representation.
Definition: Pathname.h:112
std::ostream & operator<<(std::ostream &str, const RepoInfo::Impl &obj)
Definition: RepoInfo.cc:378
bool pkgGpgCheckIsMandatory() const
Mandatory check (pkgGpgCheck is not off) must ask to confirm using unsigned packages.
Definition: RepoInfo.cc:439
int forEachLine(std::istream &str_r, const function< bool(int, std::string)> &consume_r)
Simple lineparser: Call functor consume_r for each line.
Definition: IOStream.cc:100
url_set rawGpgKeyUrls() const
The list of raw gpgkey URLs defined for this repo (no variables replaced)
Definition: RepoInfo.cc:623
String related utilities and Regular expression matching.
bool hasContent() const
Definition: RepoInfo.cc:178
std::ostream & operator<<(std::ostream &str, const SerialNumber &obj)
Definition: SerialNumber.cc:52
What is known about a repository.
Definition: RepoInfo.h:71
void setGpgCheck(TriBool value_r)
Set the value for gpgCheck (or indeterminate to use the default).
Definition: RepoInfo.cc:414
TriBool _rawPkgGpgCheck
need to check pkg sign.: Y/N/(ZConf(Y/N/gpgCheck))
Definition: RepoInfo.cc:306
Helper to create and pass std::istream.
Definition: inputstream.h:56
std::string receiveLine()
Read one line from the input stream.
Request the standard behavior (as defined in zypp.conf or &#39;Job&#39;)
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
Definition: String.cc:37
bool enabled() const
If enabled is false, then this repository must be ignored as if does not exists, except when checking...
void internalSetValidRepoSignature(TriBool value_r)
Definition: RepoInfo.cc:244
Url gpgKeyUrl() const
(leagcy API) The 1st gpgkey URL defined for this repo
Definition: RepoInfo.cc:626
TriBool internalValidRepoSignature() const
Signature check result needs to be stored/retrieved from _metadataPath.
Definition: RepoInfo.cc:230
#define OUTS(T, B)
bool repoGpgCheck() const
Whether the signature of repo metadata should be checked for this repo.
Definition: RepoInfo.cc:421
base::ContainerTransform< std::list< Url >, repo::RepoVariablesUrlReplacer > RepoVariablesReplacedUrlList
bool triBoolFromPath(const Pathname &path_r, TriBool &ret_r) const
Definition: RepoInfo.cc:272
const_iterator begin() const
Iterator pointing to the first result.
Definition: Glob.h:197
void setValidRepoSignature(TriBool value_r)
Set the value for validRepoSignature (or indeterminate if unsigned).
Definition: RepoInfo.cc:461
urls_const_iterator baseUrlsBegin() const
iterator that points at begin of repository urls
Definition: RepoInfo.cc:650
bool seekToNode(int depth_r, const std::string &name_r)
Definition: Reader.cc:194
void setMirrorListUrls(url_set urls)
Like setMirrorListUrl but take an url_set.
Definition: RepoInfo.cc:525
bool baseUrlsEmpty() const
whether repository urls are available
Definition: RepoInfo.cc:659
size_type size() const
Definition: String.h:108
Pathname _metadataPath
Definition: RepoInfo.cc:362
const std::string & asString() const
Definition: RepoType.cc:56
RepoVariablesReplacedUrlList _baseUrls
Definition: RepoInfo.cc:365
static Locale bestMatch(const LocaleSet &avLocales_r, Locale requested_r=Locale())
Return the best match for Locale requested_r within the available avLocales_r.
Definition: Locale.cc:213
Url url() const
Pars pro toto: The first repository url.
Definition: RepoInfo.h:136
Url mirrorListUrl() const
Url of a file which contains a list of repository urls.
Definition: RepoInfo.cc:608
RepoInfo implementation.
Definition: RepoInfo.cc:78
bool empty() const
Test for an empty path.
Definition: Pathname.h:116
bool keepPackages() const
Whether packages downloaded from this repository will be kept in local cache.
Definition: RepoInfo.cc:590
unsigned split(const C_Str &line_r, TOutputIterator result_r, const C_Str &sepchars_r=" \, const Trim trim_r=NO_TRIM)
Split line_r into words.
Definition: String.h:531
bool gpgKeyUrlsEmpty() const
Whether gpgkey URLs are defined.
Definition: RepoInfo.cc:614
GpgCheck
Some predefined settings.
Definition: RepoInfo.h:373
TriBool pkgGpgCheck() const
Check rpm package signatures (indeterminate - according to gpgcheck)
Definition: ZConfig.cc:1216
bool pkgGpgCheck() const
Whether the signature of rpm packages should be checked for this repo.
Definition: RepoInfo.cc:436
Pathname packagesPath() const
Definition: RepoInfo.cc:351
Execute a program and give access to its io An object of this class encapsulates the execution of an ...
bool repoGpgCheckIsMandatory() const
Mandatory check (repoGpgCheck is on) must ask to confirm using unsigned repos.
Definition: RepoInfo.cc:424
RepoVariablesReplacedUrlList & baseUrls()
Definition: RepoInfo.cc:158
void setRepoGpgCheck(TriBool value_r)
Set the value for repoGpgCheck (or indeterminate to use the default).
Definition: RepoInfo.cc:432
const std::string & asString() const
String representation.
Definition: Pathname.h:93
TriBool triBoolFromPath(const Pathname &path_r) const
Definition: RepoInfo.cc:298
std::string alias() const
unique identifier for this source.
bool isExist() const
Return whether valid stat info exists.
Definition: PathInfo.h:286
std::string escape(const C_Str &str_r, const char sep_r)
Escape desired character c using a backslash.
Definition: String.cc:372
void addContent(const std::string &keyword_r)
Definition: RepoInfo.cc:175
bool gpgCheck() const
Turn signature checking on/off (on)
Definition: ZConfig.cc:1214
Convenience char* constructible from std::string and char*, it maps (char*)0 to an empty string...
Definition: String.h:90
Url rawMirrorListUrl() const
The raw mirrorListUrl (no variables replaced).
Definition: RepoInfo.cc:611
void setPath(const Pathname &path)
set the product path.
Definition: RepoInfo.cc:565
TriBool validRepoSignature() const
Whether the repo metadata are signed and successfully validated or indeterminate if unsigned...
Definition: RepoInfo.cc:454
Pathname dirname() const
Return all but the last component od this path.
Definition: Pathname.h:126
LocaleSet getLicenseLocales() const
Return the locales the license is available for.
Definition: RepoInfo.cc:765
void setService(const std::string &name)
sets service which added this repository
Definition: RepoInfo.cc:584
#define WAR
Definition: Logger.h:101
void setMetadataPath(const Pathname &path)
Set the path where the local metadata is stored.
Definition: RepoInfo.cc:575
bool baseUrlSet() const
Whether there are manualy configured repository urls.
Definition: RepoInfo.cc:662
RepoVariablesReplacedUrlList & gpgKeyUrls()
Definition: RepoInfo.cc:168
bool startsWith(const C_Str &str_r, const C_Str &prefix_r)
alias for hasPrefix
Definition: String.h:1085
int close() override
Wait for the progamm to complete.
void getRawGpgChecks(TriBool &g_r, TriBool &r_r, TriBool &p_r) const
Raw values for RepoManager.
Definition: RepoInfo.cc:446
void setType(const repo::RepoType &t)
set the repository type
Definition: RepoInfo.cc:568
TriBool repoGpgCheck() const
Check repo matadata signatures (indeterminate - according to gpgcheck)
Definition: ZConfig.cc:1215
bool gpgCheck() const
Whether default signature checking should be performed.
Definition: RepoInfo.cc:411
TriBool _rawGpgCheck
default gpgcheck behavior: Y/N/ZConf
Definition: RepoInfo.cc:304
TriBool _validRepoSignature
have signed and valid repo metadata
Definition: RepoInfo.cc:325
bool hasContent() const
Check for content keywords.
Definition: RepoInfo.cc:671
std::pair< FalseBool, std::set< std::string > > _keywords
Definition: RepoInfo.cc:366
void setKeepPackages(bool keep)
Set if packaqes downloaded from this repository will be kept in local cache.
Definition: RepoInfo.cc:581
std::string getLicense(const Locale &lang_r=Locale()) const
Return the best license for the current (or a specified) locale.
Definition: RepoInfo.cc:721
bool baseurl2dump() const
Definition: RepoInfo.cc:161
bool empty() const
Whether matches were found.
Definition: Glob.h:189
base::ValueTransform< Url, repo::RepoVariablesUrlReplacer > RepoVariablesReplacedUrl
std::string asString(const Url &url_r)
Definition: Url.cc:910
url_set::size_type urls_size_type
Definition: RepoInfo.h:109
std::ostream & dumpOn(std::ostream &str, const Capability &obj)
Definition: Capability.cc:580
bool seekToEndNode(int depth_r, const std::string &name_r)
Definition: Reader.cc:214
const RepoVariablesReplacedUrlList & baseUrls() const
Definition: RepoInfo.cc:145
TriBool cfgPkgGpgCheck() const
Definition: RepoInfo.cc:321
std::ostream & dumpOn(std::ostream &str) const override
Write a human-readable representation of this RepoInfo object into the str stream.
Definition: RepoInfo.cc:801
std::list< Url > url_set
Definition: RepoInfo.h:108
bool cfgGpgCheck() const
Definition: RepoInfo.cc:317
TriBool _rawRepoGpgCheck
need to check repo sign.: Y/N/(ZConf(Y/N/gpgCheck))
Definition: RepoInfo.cc:305
bool requireStatusWithMediaFile() const
Returns true if this repository requires the media.1/media file to be included in the metadata status...
Definition: RepoInfo.cc:967
Find pathnames matching a pattern.
Definition: Glob.h:57
Pathname metadataPath() const
Path where this repo metadata was read from.
Definition: RepoInfo.cc:596
std::vector< std::string > Arguments
transform_iterator< repo::RepoVariablesUrlReplacer, url_set::const_iterator > urls_const_iterator
Definition: RepoInfo.h:110
int unlink(const Pathname &path)
Like &#39;unlink&#39;.
Definition: PathInfo.cc:705
static const RepoType NONE
Definition: RepoType.h:33
std::ostream & dumpAsXmlOn(std::ostream &str, const std::string &content="") const override
Write an XML representation of this RepoInfo object.
Definition: RepoInfo.cc:904
static const unsigned noPriority
Definition: RepoInfo.cc:100
repo::RepoType type() const
Definition: RepoInfo.cc:111
repo::RepoType _type
Definition: RepoInfo.cc:326
bool usesAutoMetadataPaths() const
Whether metadataPath uses AUTO% setup.
Definition: RepoInfo.cc:602
int add(const Pathname &pattern_r, Flags flags_r=Flags())
Add pathnames matching pattern_r to the current result.
Definition: Glob.h:155
void setPackagesPath(const Pathname &path)
set the path where the local packages are stored
Definition: RepoInfo.cc:578
&#39;Language[_Country]&#39; codes.
Definition: Locale.h:50
void setMetalinkUrl(const Url &url)
Like setMirrorListUrl but expect metalink format.
Definition: RepoInfo.cc:528
static const RepoType RPMMD
Definition: RepoType.h:30
void setGpgKeyUrls(url_set urls)
Set a list of gpgkey URLs defined for this repo.
Definition: RepoInfo.cc:534
const std::set< std::string > & contentKeywords() const
Definition: RepoInfo.cc:172
int symlink(const Pathname &oldpath, const Pathname &newpath)
Like &#39;symlink&#39;.
Definition: PathInfo.cc:860
void setProbedType(const repo::RepoType &t) const
Definition: RepoInfo.cc:105
static const RepoType YAST2
Definition: RepoType.h:31
bool hasSuffix(const C_Str &str_r, const C_Str &suffix_r)
Return whether str_r has suffix suffix_r.
Definition: String.h:1041
void rawRepoGpgCheck(TriBool val_r)
Definition: RepoInfo.cc:314
url_set rawBaseUrls() const
The complete set of raw repository urls (no variables replaced)
Definition: RepoInfo.cc:635
void setTargetDistribution(const std::string &targetDistribution)
Sets the distribution for which is this repository meant.
Definition: RepoInfo.cc:587
bool needToAcceptLicense() const
Whether the repo license has to be accepted, e.g.
Definition: RepoInfo.cc:686
std::ostream & dumpAsIniOn(std::ostream &str) const override
Write this RepoInfo object into str in a .repo file format.
Definition: RepoInfo.cc:849
Impl & operator=(const Impl &)=delete
XmlString nodeText()
If the current node is not empty, advances the reader to the next node, and returns the value...
Definition: Reader.cc:122
zypp::Pathname provideKey(SyncContextRef ctx, zypp::RepoInfo info, std::string keyID_r, zypp::Pathname targetDirectory_r)
Definition: repoinfowf.cc:212
void addBaseUrl(Url url)
Add a base url.
Definition: RepoInfo.cc:548
const RepoVariablesReplacedUrlList & gpgKeyUrls() const
Definition: RepoInfo.cc:165
std::string name() const
Repository name.
std::string asString() const
Explicit conversion to std::string.
Definition: XmlString.h:77
Pathname licenseTgz(const std::string &name_r) const
Path to a license tarball in case it exists in the repo.
Definition: RepoInfo.cc:120
void setType(const repo::RepoType &t)
Definition: RepoInfo.cc:102
bool internalUnsignedConfirmed() const
We definitely have a symlink pointing to "indeterminate" (for repoGpgCheckIsMandatory)? I.e.
Definition: RepoInfo.cc:266
RepoVariablesReplacedUrlList _gpgKeyUrls
Definition: RepoInfo.cc:368
TriBool rawRepoGpgCheck() const
Definition: RepoInfo.cc:310
RepoVariablesReplacedUrl _mirrorListUrl
Definition: RepoInfo.cc:329
DefaultIntegral< unsigned, defaultPriority > priority
Definition: RepoInfo.cc:358
std::string targetDistribution() const
Distribution for which is this repository meant.
Definition: RepoInfo.cc:644
Pathname packagesPath() const
Path where this repo packages are cached.
Definition: RepoInfo.cc:599
void setBaseUrls(url_set urls)
Clears current base URL list and adds an url_set.
Definition: RepoInfo.cc:562
std::string targetDistro
Definition: RepoInfo.cc:333
Wrapper class for ::stat/::lstat.
Definition: PathInfo.h:225
~RepoInfo() override
Definition: RepoInfo.cc:395
static const RepoInfo noRepo
Represents no Repository (one with an empty alias).
Definition: RepoInfo.h:85
void setMetalinkUrls(url_set urls)
Like setMirrorListUrls but expect metalink format.
Definition: RepoInfo.cc:531
urls_const_iterator baseUrlsEnd() const
iterator that points at end of repository urls
Definition: RepoInfo.cc:653
void addContent(const std::string &keyword_r)
Add content keywords.
Definition: RepoInfo.cc:668
void rawPkgGpgCheck(TriBool val_r)
Definition: RepoInfo.cc:315
static const RepoType RPMPLAINDIR
Definition: RepoType.h:32
bool autorefresh() const
If true, the repostory must be refreshed before creating resolvables from it.
urls_size_type baseUrlsSize() const
number of repository urls
Definition: RepoInfo.cc:656
const std::vector< Url > & getUrls() const
static bool schemeIsDownloading(const std::string &scheme_r)
http https ftp sftp tftp
Definition: Url.cc:493
urls_size_type gpgKeyUrlsSize() const
Number of gpgkey URLs defined.
Definition: RepoInfo.cc:617
Pathname metadataPath() const
Definition: RepoInfo.cc:344
TriBool rawGpgCheck() const
Definition: RepoInfo.cc:309
Easy-to use interface to the ZYPP dependency resolver.
Definition: Application.cc:19
static const unsigned defaultPriority
Definition: RepoInfo.cc:99
Impl * clone() const
clone for RWCOW_pointer
Definition: RepoInfo.cc:372
static unsigned noPriority()
The least priority (unsigned(-1)).
Definition: RepoInfo.cc:404
bool hasPrefix(const C_Str &str_r, const C_Str &prefix_r)
Return whether str_r has prefix prefix_r.
Definition: String.h:1027
url_set baseUrls() const
The complete set of repository urls.
Definition: RepoInfo.cc:632
void setPkgGpgCheck(TriBool value_r)
Set the value for pkgGpgCheck (or indeterminate to use the default).
Definition: RepoInfo.cc:442
repo::RepoType type() const
Type of repository,.
Definition: RepoInfo.cc:605
TriBool cfgRepoGpgCheck() const
Definition: RepoInfo.cc:319
const char * c_str() const
Definition: IdStringType.h:107
Pathname _packagesPath
Definition: RepoInfo.cc:363
bool effectiveKeepPackages() const
keepPackages unless the package cache itself enforces keeping the packages.
Definition: RepoInfo.cc:593
Url manipulation class.
Definition: Url.h:92
void metadataPath(Pathname new_r)
Definition: RepoInfo.cc:335
#define DBG
Definition: Logger.h:99
std::string service
Definition: RepoInfo.cc:332
Repository type enumeration.
Definition: RepoType.h:28
bool hasContent(const std::string &keyword_r) const
Definition: RepoInfo.cc:223