libzypp  17.32.5
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/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 )
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::create(), *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 _pimpl->metadataPath(); }
595 
597  { return _pimpl->packagesPath(); }
598 
600  { return _pimpl->usesAutoMetadataPaths(); }
601 
603  { return _pimpl->type(); }
604 
605  Url RepoInfo::mirrorListUrl() const // Variables replaced!
606  { return _pimpl->_mirrorListUrl.transformed(); }
607 
609  { return _pimpl->_mirrorListUrl.raw(); }
610 
612  { return _pimpl->gpgKeyUrls().empty(); }
613 
615  { return _pimpl->gpgKeyUrls().size(); }
616 
617  RepoInfo::url_set RepoInfo::gpgKeyUrls() const // Variables replaced!
618  { return _pimpl->gpgKeyUrls().transformed(); }
619 
621  { return _pimpl->gpgKeyUrls().raw(); }
622 
623  Url RepoInfo::gpgKeyUrl() const // Variables replaced!
624  { return( _pimpl->gpgKeyUrls().empty() ? Url() : *_pimpl->gpgKeyUrls().transformedBegin() ); }
625 
627  { return( _pimpl->gpgKeyUrls().empty() ? Url() : *_pimpl->gpgKeyUrls().rawBegin() ) ; }
628 
629  RepoInfo::url_set RepoInfo::baseUrls() const // Variables replaced!
630  { return _pimpl->baseUrls().transformed(); }
631 
633  { return _pimpl->baseUrls().raw(); }
634 
636  { return _pimpl->path; }
637 
638  std::string RepoInfo::service() const
639  { return _pimpl->service; }
640 
641  std::string RepoInfo::targetDistribution() const
642  { return _pimpl->targetDistro; }
643 
645  { return( _pimpl->baseUrls().empty() ? Url() : *_pimpl->baseUrls().rawBegin() ); }
646 
648  { return _pimpl->baseUrls().transformedBegin(); }
649 
651  { return _pimpl->baseUrls().transformedEnd(); }
652 
654  { return _pimpl->baseUrls().size(); }
655 
657  { return _pimpl->baseUrls().empty(); }
658 
659  bool RepoInfo::baseUrlSet() const
660  { return _pimpl->baseurl2dump(); }
661 
662  const std::set<std::string> & RepoInfo::contentKeywords() const
663  { return _pimpl->contentKeywords(); }
664 
665  void RepoInfo::addContent( const std::string & keyword_r )
666  { _pimpl->addContent( keyword_r ); }
667 
668  bool RepoInfo::hasContent() const
669  { return _pimpl->hasContent(); }
670 
671  bool RepoInfo::hasContent( const std::string & keyword_r ) const
672  { return _pimpl->hasContent( keyword_r ); }
673 
675 
676  bool RepoInfo::hasLicense() const
677  { return hasLicense( std::string() ); }
678 
679  bool RepoInfo::hasLicense( const std::string & name_r ) const
680  { return !_pimpl->licenseTgz( name_r ).empty(); }
681 
682 
684  { return needToAcceptLicense( std::string() ); }
685 
686  bool RepoInfo::needToAcceptLicense( const std::string & name_r ) const
687  {
688  const Pathname & licenseTgz( _pimpl->licenseTgz( name_r ) );
689  if ( licenseTgz.empty() )
690  return false; // no licenses at all
691 
693  cmd.push_back( "tar" );
694  cmd.push_back( "-t" );
695  cmd.push_back( "-z" );
696  cmd.push_back( "-f" );
697  cmd.push_back( licenseTgz.asString() );
699 
700  bool accept = true;
701  static const std::string noAcceptanceFile = "no-acceptance-needed\n";
702  for ( std::string output( prog.receiveLine() ); output.length(); output = prog.receiveLine() )
703  {
704  if ( output == noAcceptanceFile )
705  {
706  accept = false;
707  }
708  }
709  prog.close();
710  MIL << "License(" << name_r << ") in " << name() << " has to be accepted: " << (accept?"true":"false" ) << endl;
711  return accept;
712  }
713 
714 
715  std::string RepoInfo::getLicense( const Locale & lang_r )
716  { return const_cast<const RepoInfo *>(this)->getLicense( std::string(), lang_r ); }
717 
718  std::string RepoInfo::getLicense( const Locale & lang_r ) const
719  { return getLicense( std::string(), lang_r ); }
720 
721  std::string RepoInfo::getLicense( const std::string & name_r, const Locale & lang_r ) const
722  {
723  LocaleSet avlocales( getLicenseLocales( name_r ) );
724  if ( avlocales.empty() )
725  return std::string();
726 
727  Locale getLang( Locale::bestMatch( avlocales, lang_r ) );
728  if ( !getLang && avlocales.find( Locale::noCode ) == avlocales.end() )
729  {
730  WAR << "License(" << name_r << ") in " << name() << " contains no fallback text!" << endl;
731  // Using the fist locale instead of returning no text at all.
732  // So the user might recognize that there is a license, even if they
733  // can't read it.
734  getLang = *avlocales.begin();
735  }
736 
737  // now extract the license file.
738  static const std::string licenseFileFallback( "license.txt" );
739  std::string licenseFile( !getLang ? licenseFileFallback
740  : str::form( "license.%s.txt", getLang.c_str() ) );
741 
743  cmd.push_back( "tar" );
744  cmd.push_back( "-x" );
745  cmd.push_back( "-z" );
746  cmd.push_back( "-O" );
747  cmd.push_back( "-f" );
748  cmd.push_back( _pimpl->licenseTgz( name_r ).asString() ); // if it not exists, avlocales was empty.
749  cmd.push_back( licenseFile );
750 
751  std::string ret;
753  for ( std::string output( prog.receiveLine() ); output.length(); output = prog.receiveLine() )
754  {
755  ret += output;
756  }
757  prog.close();
758  return ret;
759  }
760 
761 
763  { return getLicenseLocales( std::string() ); }
764 
765  LocaleSet RepoInfo::getLicenseLocales( const std::string & name_r ) const
766  {
767  const Pathname & licenseTgz( _pimpl->licenseTgz( name_r ) );
768  if ( licenseTgz.empty() )
769  return LocaleSet();
770 
772  cmd.push_back( "tar" );
773  cmd.push_back( "-t" );
774  cmd.push_back( "-z" );
775  cmd.push_back( "-f" );
776  cmd.push_back( licenseTgz.asString() );
777 
778  LocaleSet ret;
780  for ( std::string output( prog.receiveLine() ); output.length(); output = prog.receiveLine() )
781  {
782  static const C_Str license( "license." );
783  static const C_Str dotTxt( ".txt\n" );
784  if ( str::hasPrefix( output, license ) && str::hasSuffix( output, dotTxt ) )
785  {
786  if ( output.size() <= license.size() + dotTxt.size() ) // license.txt
787  ret.insert( Locale() );
788  else
789  ret.insert( Locale( std::string( output.c_str()+license.size(), output.size()- license.size() - dotTxt.size() ) ) );
790  }
791  }
792  prog.close();
793  return ret;
794  }
795 
797 
798  std::ostream & RepoInfo::dumpOn( std::ostream & str ) const
799  {
801  if ( _pimpl->baseurl2dump() )
802  {
803  for ( const auto & url : _pimpl->baseUrls().raw() )
804  {
805  str << "- url : " << url << std::endl;
806  }
807  }
808 
809  // print if non empty value
810  auto strif( [&] ( const std::string & tag_r, const std::string & value_r ) {
811  if ( ! value_r.empty() )
812  str << tag_r << value_r << std::endl;
813  });
814 
815  strif( (_pimpl->_mirrorListForceMetalink ? "- metalink : " : "- mirrorlist : "), rawMirrorListUrl().asString() );
816  strif( "- path : ", path().asString() );
817  str << "- type : " << type() << std::endl;
818  str << "- priority : " << priority() << std::endl;
819 
820  // Yes No Default(Y) Default(N)
821 #define OUTS(T,B) ( indeterminate(T) ? (std::string("D(")+(B?"Y":"N")+")") : ((bool)T?"Y":"N") )
822  str << "- gpgcheck : " << OUTS(_pimpl->rawGpgCheck(),gpgCheck())
823  << " repo" << OUTS(_pimpl->rawRepoGpgCheck(),repoGpgCheck()) << (repoGpgCheckIsMandatory() ? "* ": " " )
824  << "sig" << asString( validRepoSignature(), "?", "Y", "N" )
825  << " pkg" << OUTS(_pimpl->rawPkgGpgCheck(),pkgGpgCheck()) << (pkgGpgCheckIsMandatory() ? "* ": " " )
826  << std::endl;
827 #undef OUTS
828 
829  for ( const auto & url : _pimpl->gpgKeyUrls().raw() )
830  {
831  str << "- gpgkey : " << url << std::endl;
832  }
833 
834  if ( ! indeterminate(_pimpl->keeppackages) )
835  str << "- keeppackages: " << keepPackages() << std::endl;
836 
837  strif( "- service : ", service() );
838  strif( "- targetdistro: ", targetDistribution() );
839  strif( "- filePath: ", filepath().asString() );
840  strif( "- metadataPath: ", metadataPath().asString() );
841  strif( "- packagesPath: ", packagesPath().asString() );
842 
843  return str;
844  }
845 
846  std::ostream & RepoInfo::dumpAsIniOn( std::ostream & str ) const
847  {
848  RepoInfoBase::dumpAsIniOn(str);
849 
850  if ( _pimpl->baseurl2dump() )
851  {
852  str << "baseurl=";
853  std::string indent;
854  for ( const auto & url : _pimpl->baseUrls().raw() )
855  {
856  str << indent << hotfix1050625::asString( url ) << endl;
857  if ( indent.empty() ) indent = " "; // "baseurl="
858  }
859  }
860 
861  if ( ! _pimpl->path.empty() )
862  str << "path="<< path() << endl;
863 
864  if ( ! (rawMirrorListUrl().asString().empty()) )
865  str << (_pimpl->_mirrorListForceMetalink ? "metalink=" : "mirrorlist=") << hotfix1050625::asString( rawMirrorListUrl() ) << endl;
866 
867  if ( type() != repo::RepoType::NONE )
868  str << "type=" << type().asString() << endl;
869 
870  if ( priority() != defaultPriority() )
871  str << "priority=" << priority() << endl;
872 
873  if ( ! indeterminate(_pimpl->rawGpgCheck()) )
874  str << "gpgcheck=" << (_pimpl->rawGpgCheck() ? "1" : "0") << endl;
875 
876  if ( ! indeterminate(_pimpl->rawRepoGpgCheck()) )
877  str << "repo_gpgcheck=" << (_pimpl->rawRepoGpgCheck() ? "1" : "0") << endl;
878 
879  if ( ! indeterminate(_pimpl->rawPkgGpgCheck()) )
880  str << "pkg_gpgcheck=" << (_pimpl->rawPkgGpgCheck() ? "1" : "0") << endl;
881 
882  {
883  std::string indent( "gpgkey=");
884  for ( const auto & url : _pimpl->gpgKeyUrls().raw() )
885  {
886  str << indent << url << endl;
887  if ( indent[0] != ' ' )
888  indent = " ";
889  }
890  }
891 
892  if (!indeterminate(_pimpl->keeppackages))
893  str << "keeppackages=" << keepPackages() << endl;
894 
895  if( ! service().empty() )
896  str << "service=" << service() << endl;
897 
898  return str;
899  }
900 
901  std::ostream & RepoInfo::dumpAsXmlOn( std::ostream & str, const std::string & content ) const
902  {
903  std::string tmpstr;
904  str
905  << "<repo"
906  << " alias=\"" << escape(alias()) << "\""
907  << " name=\"" << escape(name()) << "\"";
908  if (type() != repo::RepoType::NONE)
909  str << " type=\"" << type().asString() << "\"";
910  str
911  << " priority=\"" << priority() << "\""
912  << " enabled=\"" << enabled() << "\""
913  << " autorefresh=\"" << autorefresh() << "\""
914  << " gpgcheck=\"" << gpgCheck() << "\""
915  << " repo_gpgcheck=\"" << repoGpgCheck() << "\""
916  << " pkg_gpgcheck=\"" << pkgGpgCheck() << "\"";
917  if ( ! indeterminate(_pimpl->rawGpgCheck()) )
918  str << " raw_gpgcheck=\"" << (_pimpl->rawGpgCheck() ? "1" : "0") << "\"";
919  if ( ! indeterminate(_pimpl->rawRepoGpgCheck()) )
920  str << " raw_repo_gpgcheck=\"" << (_pimpl->rawRepoGpgCheck() ? "1" : "0") << "\"";
921  if ( ! indeterminate(_pimpl->rawPkgGpgCheck()) )
922  str << " raw_pkg_gpgcheck=\"" << (_pimpl->rawPkgGpgCheck() ? "1" : "0") << "\"";
923  if (!(tmpstr = gpgKeyUrl().asString()).empty())
924  if (!(tmpstr = gpgKeyUrl().asString()).empty())
925  str << " gpgkey=\"" << escape(tmpstr) << "\"";
926  if (!(tmpstr = mirrorListUrl().asString()).empty())
927  str << (_pimpl->_mirrorListForceMetalink ? " metalink=\"" : " mirrorlist=\"") << escape(tmpstr) << "\"";
928  str << ">" << endl;
929 
930  if ( _pimpl->baseurl2dump() )
931  {
932  for_( it, baseUrlsBegin(), baseUrlsEnd() ) // !transform iterator replaces variables
933  str << "<url>" << escape((*it).asString()) << "</url>" << endl;
934  }
935 
936  str << "</repo>" << endl;
937  return str;
938  }
939 
940 
941  std::ostream & operator<<( std::ostream & str, const RepoInfo & obj )
942  {
943  return obj.dumpOn(str);
944  }
945 
946  std::ostream & operator<<( std::ostream & str, const RepoInfo::GpgCheck & obj )
947  {
948  switch ( obj )
949  {
950 #define OUTS( V ) case RepoInfo::V: return str << #V; break
951  OUTS( GpgCheck::On );
952  OUTS( GpgCheck::Strict );
953  OUTS( GpgCheck::AllowUnsigned );
954  OUTS( GpgCheck::AllowUnsignedRepo );
955  OUTS( GpgCheck::AllowUnsignedPackage );
957  OUTS( GpgCheck::Off );
958  OUTS( GpgCheck::indeterminate );
959 #undef OUTS
960  }
961  return str << "GpgCheck::UNKNOWN";
962  }
963 
965  {
966  // We skip the check for downloading media unless a local copy of the
967  // media file exists and states that there is more than one medium.
968  bool canSkipMediaCheck = std::all_of( baseUrlsBegin(), baseUrlsEnd(), []( const zypp::Url &url ) { return url.schemeIsDownloading(); });
969  if ( canSkipMediaCheck ) {
970  const auto &mDataPath = metadataPath();
971  if ( not mDataPath.empty() ) {
972  PathInfo mediafile { mDataPath/"media.1/media" };
973  if ( mediafile.isExist() ) {
974  repo::SUSEMediaVerifier lverifier { mediafile.path() };
975  if ( lverifier && lverifier.totalMedia() > 1 ) {
976  canSkipMediaCheck = false;
977  }
978  }
979  }
980  }
981  if ( canSkipMediaCheck )
982  DBG << "Can SKIP media.1/media check for status calc of repo " << alias() << endl;
983  return not canSkipMediaCheck;
984  }
985 
987 } // namespace zypp
std::string asString(const Patch::Category &obj)
Definition: Patch.cc:122
static const Locale noCode
Empty code.
Definition: Locale.h:74
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:635
unsigned priority() const
Repository priority for solver.
Definition: RepoInfo.cc:398
Interface to gettext.
#define MIL
Definition: Logger.h:96
bool hasLicense() const
Whether there is a license associated with the repo.
Definition: RepoInfo.cc:676
url_set gpgKeyUrls() const
The list of gpgkey URLs defined for this repo.
Definition: RepoInfo.cc:617
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:626
Url rawUrl() const
Pars pro toto: The first repository raw url (no variables replaced)
Definition: RepoInfo.cc:644
TriBool rawPkgGpgCheck() const
Definition: RepoInfo.cc:311
const std::set< std::string > & contentKeywords() const
Content keywords defined.
Definition: RepoInfo.cc:662
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:638
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:925
void rawGpgCheck(TriBool val_r)
Definition: RepoInfo.cc:313
RWCOW_pointer< Impl > _pimpl
Pointer to implementation.
Definition: RepoInfo.h:565
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:28
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
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition: Easy.h:28
const char * c_str() const
String representation.
Definition: Pathname.h:110
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
url_set rawGpgKeyUrls() const
The list of raw gpgkey URLs defined for this repo (no variables replaced)
Definition: RepoInfo.cc:620
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:623
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:647
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:656
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:605
RepoInfo implementation.
Definition: RepoInfo.cc:78
bool empty() const
Test for an empty path.
Definition: Pathname.h:114
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:611
std::string escape(const C_Str &str_r, const char sep_r)
Escape desired character c using a backslash.
Definition: String.cc:372
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 ...
int unlink(const Pathname &path)
Like &#39;unlink&#39;.
Definition: PathInfo.cc:701
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:91
TriBool triBoolFromPath(const Pathname &path_r) const
Definition: RepoInfo.cc:298
std::string alias() const
unique identifier for this source.
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:608
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:124
LocaleSet getLicenseLocales() const
Return the locales the license is available for.
Definition: RepoInfo.cc:762
void setService(const std::string &name)
sets service which added this repository
Definition: RepoInfo.cc:584
#define WAR
Definition: Logger.h:97
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:659
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:668
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:718
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:890
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
int symlink(const Pathname &oldpath, const Pathname &newpath)
Like &#39;symlink&#39;.
Definition: PathInfo.cc:856
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:798
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:964
Find pathnames matching a pattern.
Definition: Glob.h:57
Pathname metadataPath() const
Path where this repo metadata was read from.
Definition: RepoInfo.cc:593
std::vector< std::string > Arguments
transform_iterator< repo::RepoVariablesUrlReplacer, url_set::const_iterator > urls_const_iterator
Definition: RepoInfo.h:110
static const RepoType NONE
Definition: RepoType.h:32
std::ostream & dumpAsXmlOn(std::ostream &str, const std::string &content="") const override
Write an XML representation of this RepoInfo object.
Definition: RepoInfo.cc:901
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:599
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:49
void setMetalinkUrl(const Url &url)
Like setMirrorListUrl but expect metalink format.
Definition: RepoInfo.cc:528
static const RepoType RPMMD
Definition: RepoType.h:29
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
void setProbedType(const repo::RepoType &t) const
Definition: RepoInfo.cc:105
static const RepoType YAST2
Definition: RepoType.h:30
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:632
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:683
std::ostream & dumpAsIniOn(std::ostream &str) const override
Write this RepoInfo object into str in a .repo file format.
Definition: RepoInfo.cc:846
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:218
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:641
Pathname packagesPath() const
Path where this repo packages are cached.
Definition: RepoInfo.cc:596
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:221
~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:650
void addContent(const std::string &keyword_r)
Add content keywords.
Definition: RepoInfo.cc:665
void rawPkgGpgCheck(TriBool val_r)
Definition: RepoInfo.cc:315
static const RepoType RPMPLAINDIR
Definition: RepoType.h:31
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:653
const std::vector< Url > & getUrls() const
static bool schemeIsDownloading(const std::string &scheme_r)
http https ftp sftp tftp
Definition: Url.cc:479
urls_size_type gpgKeyUrlsSize() const
Number of gpgkey URLs defined.
Definition: RepoInfo.cc:614
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:629
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:602
TriBool cfgRepoGpgCheck() const
Definition: RepoInfo.cc:319
const char * c_str() const
Definition: IdStringType.h:107
Pathname _packagesPath
Definition: RepoInfo.cc:363
Url manipulation class.
Definition: Url.h:91
void metadataPath(Pathname new_r)
Definition: RepoInfo.cc:335
#define DBG
Definition: Logger.h:95
std::string service
Definition: RepoInfo.cc:332
detail::EscapedString escape(const std::string &in_r)
Escape xml special charaters (& -> &; from IoBind library).
Definition: XmlEscape.h:51
Repository type enumeration.
Definition: RepoType.h:27
bool hasContent(const std::string &keyword_r) const
Definition: RepoInfo.cc:223