libzypp  17.36.4
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  const std::set<std::string> & contentKeywords() const
172  { hasContent()/*init if not yet done*/; return _keywords.second; }
173 
174  void addContent( const std::string & keyword_r )
175  { _keywords.second.insert( keyword_r ); if ( ! hasContent() ) _keywords.first = true; }
176 
177  bool hasContent() const
178  {
179  if ( !_keywords.first && ! metadataPath().empty() )
180  {
181  // HACK directly check master index file until RepoManager offers
182  // some content probing and zypper uses it.
184  MIL << "Empty keywords...." << metadataPath() << endl;
185  Pathname master;
186  if ( PathInfo( (master=metadataPath()/"/repodata/repomd.xml") ).isFile() )
187  {
188  //MIL << "GO repomd.." << endl;
189  xml::Reader reader( master );
190  while ( reader.seekToNode( 2, "content" ) )
191  {
192  _keywords.second.insert( reader.nodeText().asString() );
193  reader.seekToEndNode( 2, "content" );
194  }
195  _keywords.first = true; // valid content in _keywords even if empty
196  }
197  else if ( PathInfo( (master=metadataPath()/"/content") ).isFile() )
198  {
199  //MIL << "GO content.." << endl;
200  iostr::forEachLine( InputStream( master ),
201  [this]( int num_r, const std::string& line_r )->bool
202  {
203  if ( str::startsWith( line_r, "REPOKEYWORDS" ) )
204  {
205  std::vector<std::string> words;
206  if ( str::split( line_r, std::back_inserter(words) ) > 1
207  && words[0].length() == 12 /*"REPOKEYWORDS"*/ )
208  {
209  this->_keywords.second.insert( ++words.begin(), words.end() );
210  }
211  return true; // mult. occurrances are ok.
212  }
213  return( ! str::startsWith( line_r, "META " ) ); // no need to parse into META section.
214  } );
215  _keywords.first = true; // valid content in _keywords even if empty
216  }
218  }
219  return _keywords.first;
220  }
221 
222  bool hasContent( const std::string & keyword_r ) const
223  { return( hasContent() && _keywords.second.find( keyword_r ) != _keywords.second.end() ); }
224 
230  {
231  if ( ! indeterminate(_validRepoSignature) )
232  return _validRepoSignature;
233  // check metadata:
234  if ( ! metadataPath().empty() )
235  {
236  // A missing ".repo_gpgcheck" might be plaindir(no Downloader) or not yet refreshed signed repo!
237  TriBool linkval = triBoolFromPath( metadataPath() / ".repo_gpgcheck" );
238  return linkval;
239  }
240  return indeterminate;
241  }
242 
244  {
245  if ( PathInfo(metadataPath()).isDir() )
246  {
247  Pathname gpgcheckFile( metadataPath() / ".repo_gpgcheck" );
248  if ( PathInfo(gpgcheckFile).isExist() )
249  {
250  TriBool linkval( indeterminate );
251  if ( triBoolFromPath( gpgcheckFile, linkval ) && linkval == value_r )
252  return; // existing symlink fits value_r
253  else
254  filesystem::unlink( gpgcheckFile ); // will write a new one
255  }
256  filesystem::symlink( asString(value_r), gpgcheckFile );
257  }
258  _validRepoSignature = value_r;
259  }
260 
266  {
267  TriBool linkval( true ); // want to see it being switched to indeterminate
268  return triBoolFromPath( metadataPath() / ".repo_gpgcheck", linkval ) && indeterminate(linkval);
269  }
270 
271  bool triBoolFromPath( const Pathname & path_r, TriBool & ret_r ) const
272  {
273  static const Pathname truePath( "true" );
274  static const Pathname falsePath( "false" );
275  static const Pathname indeterminatePath( "indeterminate" );
276 
277  // Quiet readlink;
278  static const ssize_t bufsiz = 63;
279  static char buf[bufsiz+1];
280  ssize_t ret = ::readlink( path_r.c_str(), buf, bufsiz );
281  buf[ret == -1 ? 0 : ret] = '\0';
282 
283  Pathname linkval( buf );
284 
285  bool known = true;
286  if ( linkval == truePath )
287  ret_r = true;
288  else if ( linkval == falsePath )
289  ret_r = false;
290  else if ( linkval == indeterminatePath )
291  ret_r = indeterminate;
292  else
293  known = false;
294  return known;
295  }
296 
297  TriBool triBoolFromPath( const Pathname & path_r ) const
298  { TriBool ret(indeterminate); triBoolFromPath( path_r, ret ); return ret; }
299 
301 
302  private:
306 
307  public:
308  TriBool rawGpgCheck() const { return _rawGpgCheck; }
311 
312  void rawGpgCheck( TriBool val_r ) { _rawGpgCheck = val_r; }
313  void rawRepoGpgCheck( TriBool val_r ) { _rawRepoGpgCheck = val_r; }
314  void rawPkgGpgCheck( TriBool val_r ) { _rawPkgGpgCheck = val_r; }
315 
316  bool cfgGpgCheck() const
317  { return indeterminate(_rawGpgCheck) ? ZConfig::instance().gpgCheck() : (bool)_rawGpgCheck; }
319  { return indeterminate(_rawGpgCheck) && indeterminate(_rawRepoGpgCheck) ? ZConfig::instance().repoGpgCheck() : _rawRepoGpgCheck; }
321  { return indeterminate(_rawGpgCheck) && indeterminate(_rawPkgGpgCheck) ? ZConfig::instance().pkgGpgCheck() : _rawPkgGpgCheck; }
322 
323  private:
326  public:
331  std::string service;
332  std::string targetDistro;
333 
334  void metadataPath( Pathname new_r )
335  { _metadataPath = std::move( new_r ); }
336 
337  void packagesPath( Pathname new_r )
338  { _packagesPath = std::move( new_r ); }
339 
341  { return str::hasSuffix( _metadataPath.asString(), "/%AUTO%" ); }
342 
344  {
345  if ( usesAutoMetadataPaths() )
346  return _metadataPath.dirname() / "%RAW%";
347  return _metadataPath;
348  }
349 
351  {
353  return _metadataPath.dirname() / "%PKG%";
354  return _packagesPath;
355  }
356 
358  {
359  return packagesPath() / ".preload";
360  }
361 
363  mutable bool emptybaseurls;
364 
365  private:
368 
370  mutable std::pair<FalseBool, std::set<std::string> > _keywords;
371 
373 
374  friend Impl * rwcowClone<Impl>( const Impl * rhs );
376  Impl * clone() const
377  { return new Impl( *this ); }
378  };
380 
382  inline std::ostream & operator<<( std::ostream & str, const RepoInfo::Impl & obj )
383  {
384  return str << "RepoInfo::Impl";
385  }
386 
388  //
389  // CLASS NAME : RepoInfo
390  //
392 
394 
396  : _pimpl( new Impl() )
397  {}
398 
400  {}
401 
402  unsigned RepoInfo::priority() const
403  { return _pimpl->priority; }
404 
406  { return Impl::defaultPriority; }
407 
409  { return Impl::noPriority; }
410 
411  void RepoInfo::setPriority( unsigned newval_r )
412  { _pimpl->priority = newval_r ? newval_r : Impl::defaultPriority; }
413 
414 
415  bool RepoInfo::gpgCheck() const
416  { return _pimpl->cfgGpgCheck(); }
417 
419  { _pimpl->rawGpgCheck( value_r ); }
420 
421  void RepoInfo::setGpgCheck( bool value_r ) // deprecated legacy and for squid
422  { setGpgCheck( TriBool(value_r) ); }
423 
424 
426  { return gpgCheck() || bool(_pimpl->cfgRepoGpgCheck()); }
427 
429  {
430  bool ret = ( gpgCheck() && indeterminate(_pimpl->cfgRepoGpgCheck()) ) || bool(_pimpl->cfgRepoGpgCheck());
431  if ( ret && _pimpl->internalUnsignedConfirmed() ) // relax if unsigned repo was confirmed in the past
432  ret = false;
433  return ret;
434  }
435 
437  { _pimpl->rawRepoGpgCheck( value_r ); }
438 
439 
441  { return bool(_pimpl->cfgPkgGpgCheck()) || ( gpgCheck() && !bool(validRepoSignature())/*enforced*/ ) ; }
442 
444  { return bool(_pimpl->cfgPkgGpgCheck()) || ( gpgCheck() && indeterminate(_pimpl->cfgPkgGpgCheck()) && !bool(validRepoSignature())/*enforced*/ ); }
445 
447  { _pimpl->rawPkgGpgCheck( value_r ); }
448 
449 
450  void RepoInfo::getRawGpgChecks( TriBool & g_r, TriBool & r_r, TriBool & p_r ) const
451  {
452  g_r = _pimpl->rawGpgCheck();
453  r_r = _pimpl->rawRepoGpgCheck();
454  p_r = _pimpl->rawPkgGpgCheck();
455  }
456 
457 
459  {
461  if ( ret && !repoGpgCheck() ) ret = false; // invalidate any old signature if repoGpgCheck is off
462  return ret;
463  }
464 
466  { _pimpl->internalSetValidRepoSignature( value_r ); }
467 
469  namespace
470  {
471  inline bool changeGpgCheckTo( TriBool & lhs, TriBool rhs )
472  { if ( ! sameTriboolState( lhs, rhs ) ) { lhs = rhs; return true; } return false; }
473 
474  inline bool changeGpgCheckTo( TriBool ogpg[3], TriBool g, TriBool r, TriBool p )
475  {
476  bool changed = false;
477  if ( changeGpgCheckTo( ogpg[0], g ) ) changed = true;
478  if ( changeGpgCheckTo( ogpg[1], r ) ) changed = true;
479  if ( changeGpgCheckTo( ogpg[2], p ) ) changed = true;
480  return changed;
481  }
482  } // namespace
485  {
486  TriBool ogpg[3]; // Gpg RepoGpg PkgGpg
487  getRawGpgChecks( ogpg[0], ogpg[1], ogpg[2] );
488 
489  bool changed = false;
490  switch ( mode_r )
491  {
492  case GpgCheck::On:
493  changed = changeGpgCheckTo( ogpg, true, indeterminate, indeterminate );
494  break;
495  case GpgCheck::Strict:
496  changed = changeGpgCheckTo( ogpg, true, true, true );
497  break;
499  changed = changeGpgCheckTo( ogpg, true, false, false );
500  break;
502  changed = changeGpgCheckTo( ogpg, true, false, indeterminate );
503  break;
505  changed = changeGpgCheckTo( ogpg, true, indeterminate, false );
506  break;
507  case GpgCheck::Default:
508  changed = changeGpgCheckTo( ogpg, indeterminate, indeterminate, indeterminate );
509  break;
510  case GpgCheck::Off:
511  changed = changeGpgCheckTo( ogpg, false, indeterminate, indeterminate );
512  break;
513  case GpgCheck::indeterminate: // no change
514  break;
515  }
516 
517  if ( changed )
518  {
519  setGpgCheck ( ogpg[0] );
520  setRepoGpgCheck( ogpg[1] );
521  setPkgGpgCheck ( ogpg[2] );
522  }
523  return changed;
524  }
525 
526  void RepoInfo::setMirrorListUrl( const Url & url_r ) // Raw
527  { _pimpl->_mirrorListUrl.raw() = url_r; _pimpl->_mirrorListForceMetalink = false; }
528 
530  { setMirrorListUrl( urls.empty() ? Url() : urls.front() ); }
531 
532  void RepoInfo::setMetalinkUrl( const Url & url_r ) // Raw
533  { _pimpl->_mirrorListUrl.raw() = url_r; _pimpl->_mirrorListForceMetalink = true; }
534 
535  void RepoInfo::setMetalinkUrls( url_set urls ) // Raw
536  { setMetalinkUrl( urls.empty() ? Url() : urls.front() ); }
537 
539  { _pimpl->gpgKeyUrls().raw().swap( urls ); }
540 
541  void RepoInfo::setGpgKeyUrl( const Url & url_r )
542  {
543  _pimpl->gpgKeyUrls().raw().clear();
544  _pimpl->gpgKeyUrls().raw().push_back( url_r );
545  }
546 
547 
548  Pathname RepoInfo::provideKey(const std::string &keyID_r, const Pathname &targetDirectory_r) const {
549  return zyppng::RepoInfoWorkflow::provideKey( zyppng::SyncContext::defaultContext(), *this, keyID_r, targetDirectory_r );
550  }
551 
552  void RepoInfo::addBaseUrl( Url url_r )
553  {
554  for ( const auto & url : _pimpl->baseUrls().raw() ) // Raw unique!
555  if ( url == url_r )
556  return;
557  _pimpl->baseUrls().raw().push_back( std::move(url_r) );
558  }
559 
560  void RepoInfo::setBaseUrl( Url url_r )
561  {
562  _pimpl->baseUrls().raw().clear();
563  _pimpl->baseUrls().raw().push_back( std::move(url_r) );
564  }
565 
567  { _pimpl->baseUrls().raw().swap( urls ); }
568 
569  void RepoInfo::setPath( const Pathname &path )
570  { _pimpl->path = path; }
571 
573  { _pimpl->setType( t ); }
574 
576  { _pimpl->setProbedType( t ); }
577 
578 
580  { _pimpl->metadataPath( path ); }
581 
583  { _pimpl->packagesPath( path ); }
584 
586  { return _pimpl->predownloadPath(); }
587 
588  void RepoInfo::setKeepPackages( bool keep )
589  { _pimpl->keeppackages = keep; }
590 
591  void RepoInfo::setService( const std::string& name )
592  { _pimpl->service = name; }
593 
594  void RepoInfo::setTargetDistribution( const std::string & targetDistribution )
596 
598  { return indeterminate(_pimpl->keeppackages) ? false : (bool)_pimpl->keeppackages; }
599 
601  { return keepPackages() || PathInfo(packagesPath().dirname()/".keep_packages").isExist(); }
602 
604  { return _pimpl->metadataPath(); }
605 
607  { return _pimpl->packagesPath(); }
608 
610  { return _pimpl->usesAutoMetadataPaths(); }
611 
613  { return _pimpl->type(); }
614 
615  Url RepoInfo::mirrorListUrl() const // Variables replaced!
616  { return _pimpl->_mirrorListUrl.transformed(); }
617 
619  { return _pimpl->_mirrorListUrl.raw(); }
620 
622  { return _pimpl->gpgKeyUrls().empty(); }
623 
625  { return _pimpl->gpgKeyUrls().size(); }
626 
627  RepoInfo::url_set RepoInfo::gpgKeyUrls() const // Variables replaced!
628  { return _pimpl->gpgKeyUrls().transformed(); }
629 
631  { return _pimpl->gpgKeyUrls().raw(); }
632 
633  Url RepoInfo::gpgKeyUrl() const // Variables replaced!
634  { return( _pimpl->gpgKeyUrls().empty() ? Url() : *_pimpl->gpgKeyUrls().transformedBegin() ); }
635 
637  { return( _pimpl->gpgKeyUrls().empty() ? Url() : *_pimpl->gpgKeyUrls().rawBegin() ) ; }
638 
639  RepoInfo::url_set RepoInfo::baseUrls() const // Variables replaced!
640  { return _pimpl->baseUrls().transformed(); }
641 
643  { return _pimpl->baseUrls().raw(); }
644 
646  { return _pimpl->path; }
647 
648  std::string RepoInfo::service() const
649  { return _pimpl->service; }
650 
651  std::string RepoInfo::targetDistribution() const
652  { return _pimpl->targetDistro; }
653 
655  { return( _pimpl->baseUrls().empty() ? Url() : *_pimpl->baseUrls().rawBegin() ); }
656 
658  { return _pimpl->baseUrls().transformedBegin(); }
659 
661  { return _pimpl->baseUrls().transformedEnd(); }
662 
664  { return _pimpl->baseUrls().size(); }
665 
667  { return _pimpl->baseUrls().empty(); }
668 
669  bool RepoInfo::baseUrlSet() const
670  { return _pimpl->baseurl2dump(); }
671 
672  const std::set<std::string> & RepoInfo::contentKeywords() const
673  { return _pimpl->contentKeywords(); }
674 
675  void RepoInfo::addContent( const std::string & keyword_r )
676  { _pimpl->addContent( keyword_r ); }
677 
678  bool RepoInfo::hasContent() const
679  { return _pimpl->hasContent(); }
680 
681  bool RepoInfo::hasContent( const std::string & keyword_r ) const
682  { return _pimpl->hasContent( keyword_r ); }
683 
685 
686  bool RepoInfo::hasLicense() const
687  { return hasLicense( std::string() ); }
688 
689  bool RepoInfo::hasLicense( const std::string & name_r ) const
690  { return !_pimpl->licenseTgz( name_r ).empty(); }
691 
692 
694  { return needToAcceptLicense( std::string() ); }
695 
696  bool RepoInfo::needToAcceptLicense( const std::string & name_r ) const
697  {
698  const Pathname & licenseTgz( _pimpl->licenseTgz( name_r ) );
699  if ( licenseTgz.empty() )
700  return false; // no licenses at all
701 
703  cmd.push_back( "tar" );
704  cmd.push_back( "-t" );
705  cmd.push_back( "-z" );
706  cmd.push_back( "-f" );
707  cmd.push_back( licenseTgz.asString() );
709 
710  bool accept = true;
711  static const std::string noAcceptanceFile = "no-acceptance-needed\n";
712  for ( std::string output( prog.receiveLine() ); output.length(); output = prog.receiveLine() )
713  {
714  if ( output == noAcceptanceFile )
715  {
716  accept = false;
717  }
718  }
719  prog.close();
720  MIL << "License(" << name_r << ") in " << name() << " has to be accepted: " << (accept?"true":"false" ) << endl;
721  return accept;
722  }
723 
724 
725  std::string RepoInfo::getLicense( const Locale & lang_r )
726  { return const_cast<const RepoInfo *>(this)->getLicense( std::string(), lang_r ); }
727 
728  std::string RepoInfo::getLicense( const Locale & lang_r ) const
729  { return getLicense( std::string(), lang_r ); }
730 
731  std::string RepoInfo::getLicense( const std::string & name_r, const Locale & lang_r ) const
732  {
733  LocaleSet avlocales( getLicenseLocales( name_r ) );
734  if ( avlocales.empty() )
735  return std::string();
736 
737  Locale getLang( Locale::bestMatch( avlocales, lang_r ) );
738  if ( !getLang && avlocales.find( Locale::noCode ) == avlocales.end() )
739  {
740  WAR << "License(" << name_r << ") in " << name() << " contains no fallback text!" << endl;
741  // Using the fist locale instead of returning no text at all.
742  // So the user might recognize that there is a license, even if they
743  // can't read it.
744  getLang = *avlocales.begin();
745  }
746 
747  // now extract the license file.
748  static const std::string licenseFileFallback( "license.txt" );
749  std::string licenseFile( !getLang ? licenseFileFallback
750  : str::form( "license.%s.txt", getLang.c_str() ) );
751 
753  cmd.push_back( "tar" );
754  cmd.push_back( "-x" );
755  cmd.push_back( "-z" );
756  cmd.push_back( "-O" );
757  cmd.push_back( "-f" );
758  cmd.push_back( _pimpl->licenseTgz( name_r ).asString() ); // if it not exists, avlocales was empty.
759  cmd.push_back( licenseFile );
760 
761  std::string ret;
763  for ( std::string output( prog.receiveLine() ); output.length(); output = prog.receiveLine() )
764  {
765  ret += output;
766  }
767  prog.close();
768  return ret;
769  }
770 
771 
773  { return getLicenseLocales( std::string() ); }
774 
775  LocaleSet RepoInfo::getLicenseLocales( const std::string & name_r ) const
776  {
777  const Pathname & licenseTgz( _pimpl->licenseTgz( name_r ) );
778  if ( licenseTgz.empty() )
779  return LocaleSet();
780 
782  cmd.push_back( "tar" );
783  cmd.push_back( "-t" );
784  cmd.push_back( "-z" );
785  cmd.push_back( "-f" );
786  cmd.push_back( licenseTgz.asString() );
787 
788  LocaleSet ret;
790  for ( std::string output( prog.receiveLine() ); output.length(); output = prog.receiveLine() )
791  {
792  static const C_Str license( "license." );
793  static const C_Str dotTxt( ".txt\n" );
794  if ( str::hasPrefix( output, license ) && str::hasSuffix( output, dotTxt ) )
795  {
796  if ( output.size() <= license.size() + dotTxt.size() ) // license.txt
797  ret.insert( Locale() );
798  else
799  ret.insert( Locale( std::string( output.c_str()+license.size(), output.size()- license.size() - dotTxt.size() ) ) );
800  }
801  }
802  prog.close();
803  return ret;
804  }
805 
807 
808  std::ostream & RepoInfo::dumpOn( std::ostream & str ) const
809  {
811  if ( _pimpl->baseurl2dump() )
812  {
813  for ( const auto & url : _pimpl->baseUrls().raw() )
814  {
815  str << "- url : " << url << std::endl;
816  }
817  }
818 
819  // print if non empty value
820  auto strif( [&] ( const std::string & tag_r, const std::string & value_r ) {
821  if ( ! value_r.empty() )
822  str << tag_r << value_r << std::endl;
823  });
824 
825  strif( (_pimpl->_mirrorListForceMetalink ? "- metalink : " : "- mirrorlist : "), rawMirrorListUrl().asString() );
826  strif( "- path : ", path().asString() );
827  str << "- type : " << type() << std::endl;
828  str << "- priority : " << priority() << std::endl;
829 
830  // Yes No Default(Y) Default(N)
831 #define OUTS(T,B) ( indeterminate(T) ? (std::string("D(")+(B?"Y":"N")+")") : ((bool)T?"Y":"N") )
832  str << "- gpgcheck : " << OUTS(_pimpl->rawGpgCheck(),gpgCheck())
833  << " repo" << OUTS(_pimpl->rawRepoGpgCheck(),repoGpgCheck()) << (repoGpgCheckIsMandatory() ? "* ": " " )
834  << "sig" << asString( validRepoSignature(), "?", "Y", "N" )
835  << " pkg" << OUTS(_pimpl->rawPkgGpgCheck(),pkgGpgCheck()) << (pkgGpgCheckIsMandatory() ? "* ": " " )
836  << std::endl;
837 #undef OUTS
838 
839  for ( const auto & url : _pimpl->gpgKeyUrls().raw() )
840  {
841  str << "- gpgkey : " << url << std::endl;
842  }
843 
844  if ( ! indeterminate(_pimpl->keeppackages) )
845  str << "- keeppackages: " << keepPackages() << std::endl;
846 
847  strif( "- service : ", service() );
848  strif( "- targetdistro: ", targetDistribution() );
849  strif( "- filePath: ", filepath().asString() );
850  strif( "- metadataPath: ", metadataPath().asString() );
851  strif( "- packagesPath: ", packagesPath().asString() );
852 
853  return str;
854  }
855 
856  std::ostream & RepoInfo::dumpAsIniOn( std::ostream & str ) const
857  {
858  RepoInfoBase::dumpAsIniOn(str);
859 
860  if ( _pimpl->baseurl2dump() )
861  {
862  str << "baseurl=";
863  std::string indent;
864  for ( const auto & url : _pimpl->baseUrls().raw() )
865  {
866  str << indent << hotfix1050625::asString( url ) << endl;
867  if ( indent.empty() ) indent = " "; // "baseurl="
868  }
869  }
870 
871  if ( ! _pimpl->path.empty() )
872  str << "path="<< path() << endl;
873 
874  if ( ! (rawMirrorListUrl().asString().empty()) )
875  str << (_pimpl->_mirrorListForceMetalink ? "metalink=" : "mirrorlist=") << hotfix1050625::asString( rawMirrorListUrl() ) << endl;
876 
877  if ( type() != repo::RepoType::NONE )
878  str << "type=" << type().asString() << endl;
879 
880  if ( priority() != defaultPriority() )
881  str << "priority=" << priority() << endl;
882 
883  if ( ! indeterminate(_pimpl->rawGpgCheck()) )
884  str << "gpgcheck=" << (_pimpl->rawGpgCheck() ? "1" : "0") << endl;
885 
886  if ( ! indeterminate(_pimpl->rawRepoGpgCheck()) )
887  str << "repo_gpgcheck=" << (_pimpl->rawRepoGpgCheck() ? "1" : "0") << endl;
888 
889  if ( ! indeterminate(_pimpl->rawPkgGpgCheck()) )
890  str << "pkg_gpgcheck=" << (_pimpl->rawPkgGpgCheck() ? "1" : "0") << endl;
891 
892  {
893  std::string indent( "gpgkey=");
894  for ( const auto & url : _pimpl->gpgKeyUrls().raw() )
895  {
896  str << indent << url << endl;
897  if ( indent[0] != ' ' )
898  indent = " ";
899  }
900  }
901 
902  if (!indeterminate(_pimpl->keeppackages))
903  str << "keeppackages=" << keepPackages() << endl;
904 
905  if( ! service().empty() )
906  str << "service=" << service() << endl;
907 
908  return str;
909  }
910 
911  std::ostream & RepoInfo::dumpAsXmlOn( std::ostream & str, const std::string & content ) const
912  {
913  std::string tmpstr;
914  str
915  << "<repo"
916  << " alias=\"" << escape(alias()) << "\""
917  << " name=\"" << escape(name()) << "\"";
918  if (type() != repo::RepoType::NONE)
919  str << " type=\"" << type().asString() << "\"";
920  str
921  << " priority=\"" << priority() << "\""
922  << " enabled=\"" << enabled() << "\""
923  << " autorefresh=\"" << autorefresh() << "\""
924  << " gpgcheck=\"" << gpgCheck() << "\""
925  << " repo_gpgcheck=\"" << repoGpgCheck() << "\""
926  << " pkg_gpgcheck=\"" << pkgGpgCheck() << "\"";
927  if ( ! indeterminate(_pimpl->rawGpgCheck()) )
928  str << " raw_gpgcheck=\"" << (_pimpl->rawGpgCheck() ? "1" : "0") << "\"";
929  if ( ! indeterminate(_pimpl->rawRepoGpgCheck()) )
930  str << " raw_repo_gpgcheck=\"" << (_pimpl->rawRepoGpgCheck() ? "1" : "0") << "\"";
931  if ( ! indeterminate(_pimpl->rawPkgGpgCheck()) )
932  str << " raw_pkg_gpgcheck=\"" << (_pimpl->rawPkgGpgCheck() ? "1" : "0") << "\"";
933  if (!(tmpstr = gpgKeyUrl().asString()).empty())
934  if (!(tmpstr = gpgKeyUrl().asString()).empty())
935  str << " gpgkey=\"" << escape(tmpstr) << "\"";
936  if (!(tmpstr = mirrorListUrl().asString()).empty())
937  str << (_pimpl->_mirrorListForceMetalink ? " metalink=\"" : " mirrorlist=\"") << escape(tmpstr) << "\"";
938  str << ">" << endl;
939 
940  if ( _pimpl->baseurl2dump() )
941  {
942  for_( it, baseUrlsBegin(), baseUrlsEnd() ) // !transform iterator replaces variables
943  str << "<url>" << escape((*it).asString()) << "</url>" << endl;
944  }
945 
946  str << "</repo>" << endl;
947  return str;
948  }
949 
950 
951  std::ostream & operator<<( std::ostream & str, const RepoInfo & obj )
952  {
953  return obj.dumpOn(str);
954  }
955 
956  std::ostream & operator<<( std::ostream & str, const RepoInfo::GpgCheck & obj )
957  {
958  switch ( obj )
959  {
960 #define OUTS( V ) case RepoInfo::V: return str << #V; break
961  OUTS( GpgCheck::On );
962  OUTS( GpgCheck::Strict );
963  OUTS( GpgCheck::AllowUnsigned );
964  OUTS( GpgCheck::AllowUnsignedRepo );
965  OUTS( GpgCheck::AllowUnsignedPackage );
967  OUTS( GpgCheck::Off );
968  OUTS( GpgCheck::indeterminate );
969 #undef OUTS
970  }
971  return str << "GpgCheck::UNKNOWN";
972  }
973 
975  {
976  // We skip the check for downloading media unless a local copy of the
977  // media file exists and states that there is more than one medium.
978  bool canSkipMediaCheck = std::all_of( baseUrlsBegin(), baseUrlsEnd(), []( const zypp::Url &url ) { return url.schemeIsDownloading(); });
979  if ( canSkipMediaCheck ) {
980  const auto &mDataPath = metadataPath();
981  if ( not mDataPath.empty() ) {
982  PathInfo mediafile { mDataPath/"media.1/media" };
983  if ( mediafile.isExist() ) {
984  repo::SUSEMediaVerifier lverifier { mediafile.path() };
985  if ( lverifier && lverifier.totalMedia() > 1 ) {
986  canSkipMediaCheck = false;
987  }
988  }
989  }
990  }
991  if ( canSkipMediaCheck )
992  DBG << "Can SKIP media.1/media check for status calc of repo " << alias() << endl;
993  return not canSkipMediaCheck;
994  }
995 
997 } // 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:560
Pathname path() const
Repository path.
Definition: RepoInfo.cc:645
unsigned priority() const
Repository priority for solver.
Definition: RepoInfo.cc:402
Interface to gettext.
#define MIL
Definition: Logger.h:100
bool hasLicense() const
Whether there is a license associated with the repo.
Definition: RepoInfo.cc:686
url_set gpgKeyUrls() const
The list of gpgkey URLs defined for this repo.
Definition: RepoInfo.cc:627
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:541
static unsigned defaultPriority()
The default priority (99).
Definition: RepoInfo.cc:405
Url rawGpgKeyUrl() const
(leagcy API) The 1st raw gpgkey URL defined for this repo (no variables replaced) ...
Definition: RepoInfo.cc:636
Url rawUrl() const
Pars pro toto: The first repository raw url (no variables replaced)
Definition: RepoInfo.cc:654
TriBool rawPkgGpgCheck() const
Definition: RepoInfo.cc:310
const std::set< std::string > & contentKeywords() const
Content keywords defined.
Definition: RepoInfo.cc:672
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:337
bool _mirrorListForceMetalink
Definition: RepoInfo.cc:329
static ZConfig & instance()
Singleton ctor.
Definition: ZConfig.cc:935
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:648
bool usesAutoMetadataPaths() const
Definition: RepoInfo.cc:340
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:575
void setPriority(unsigned newval_r)
Set repository priority for solver.
Definition: RepoInfo.cc:411
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:312
RWCOW_pointer< Impl > _pimpl
Pointer to implementation.
Definition: RepoInfo.h:579
Pathname provideKey(const std::string &keyID_r, const Pathname &targetDirectory_r) const
downloads all configured gpg keys into the defined directory
Definition: RepoInfo.cc:548
void setMirrorListUrl(const Url &url)
Set mirror list url.
Definition: RepoInfo.cc:526
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:382
bool pkgGpgCheckIsMandatory() const
Mandatory check (pkgGpgCheck is not off) must ask to confirm using unsigned packages.
Definition: RepoInfo.cc:443
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:630
String related utilities and Regular expression matching.
bool hasContent() const
Definition: RepoInfo.cc:177
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:418
TriBool _rawPkgGpgCheck
need to check pkg sign.: Y/N/(ZConf(Y/N/gpgCheck))
Definition: RepoInfo.cc:305
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:243
Url gpgKeyUrl() const
(leagcy API) The 1st gpgkey URL defined for this repo
Definition: RepoInfo.cc:633
TriBool internalValidRepoSignature() const
Signature check result needs to be stored/retrieved from _metadataPath.
Definition: RepoInfo.cc:229
#define OUTS(T, B)
bool repoGpgCheck() const
Whether the signature of repo metadata should be checked for this repo.
Definition: RepoInfo.cc:425
base::ContainerTransform< std::list< Url >, repo::RepoVariablesUrlReplacer > RepoVariablesReplacedUrlList
bool triBoolFromPath(const Pathname &path_r, TriBool &ret_r) const
Definition: RepoInfo.cc:271
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:465
urls_const_iterator baseUrlsBegin() const
iterator that points at begin of repository urls
Definition: RepoInfo.cc:657
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:529
bool baseUrlsEmpty() const
whether repository urls are available
Definition: RepoInfo.cc:666
size_type size() const
Definition: String.h:108
Pathname _metadataPath
Definition: RepoInfo.cc:366
const std::string & asString() const
Definition: RepoType.cc:56
RepoVariablesReplacedUrlList _baseUrls
Definition: RepoInfo.cc:369
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:615
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:597
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:621
GpgCheck
Some predefined settings.
Definition: RepoInfo.h:378
TriBool pkgGpgCheck() const
Check rpm package signatures (indeterminate - according to gpgcheck)
Definition: ZConfig.cc:1229
bool pkgGpgCheck() const
Whether the signature of rpm packages should be checked for this repo.
Definition: RepoInfo.cc:440
Pathname packagesPath() const
Definition: RepoInfo.cc:350
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:428
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:436
const std::string & asString() const
String representation.
Definition: Pathname.h:93
TriBool triBoolFromPath(const Pathname &path_r) const
Definition: RepoInfo.cc:297
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:174
bool gpgCheck() const
Turn signature checking on/off (on)
Definition: ZConfig.cc:1227
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:618
void setPath(const Pathname &path)
set the product path.
Definition: RepoInfo.cc:569
TriBool validRepoSignature() const
Whether the repo metadata are signed and successfully validated or indeterminate if unsigned...
Definition: RepoInfo.cc:458
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:772
void setService(const std::string &name)
sets service which added this repository
Definition: RepoInfo.cc:591
#define WAR
Definition: Logger.h:101
void setMetadataPath(const Pathname &path)
Set the path where the local metadata is stored.
Definition: RepoInfo.cc:579
bool baseUrlSet() const
Whether there are manualy configured repository urls.
Definition: RepoInfo.cc:669
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:450
void setType(const repo::RepoType &t)
set the repository type
Definition: RepoInfo.cc:572
TriBool repoGpgCheck() const
Check repo matadata signatures (indeterminate - according to gpgcheck)
Definition: ZConfig.cc:1228
bool gpgCheck() const
Whether default signature checking should be performed.
Definition: RepoInfo.cc:415
TriBool _rawGpgCheck
default gpgcheck behavior: Y/N/ZConf
Definition: RepoInfo.cc:303
TriBool _validRepoSignature
have signed and valid repo metadata
Definition: RepoInfo.cc:324
bool hasContent() const
Check for content keywords.
Definition: RepoInfo.cc:678
std::pair< FalseBool, std::set< std::string > > _keywords
Definition: RepoInfo.cc:370
Pathname predownloadPath() const
Definition: RepoInfo.cc:357
void setKeepPackages(bool keep)
Set if packaqes downloaded from this repository will be kept in local cache.
Definition: RepoInfo.cc:588
std::string getLicense(const Locale &lang_r=Locale()) const
Return the best license for the current (or a specified) locale.
Definition: RepoInfo.cc:728
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:320
std::ostream & dumpOn(std::ostream &str) const override
Write a human-readable representation of this RepoInfo object into the str stream.
Definition: RepoInfo.cc:808
std::list< Url > url_set
Definition: RepoInfo.h:108
bool cfgGpgCheck() const
Definition: RepoInfo.cc:316
TriBool _rawRepoGpgCheck
need to check repo sign.: Y/N/(ZConf(Y/N/gpgCheck))
Definition: RepoInfo.cc:304
bool requireStatusWithMediaFile() const
Returns true if this repository requires the media.1/media file to be included in the metadata status...
Definition: RepoInfo.cc:974
Find pathnames matching a pattern.
Definition: Glob.h:57
Pathname metadataPath() const
Path where this repo metadata was read from.
Definition: RepoInfo.cc:603
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:911
static const unsigned noPriority
Definition: RepoInfo.cc:100
repo::RepoType type() const
Definition: RepoInfo.cc:111
repo::RepoType _type
Definition: RepoInfo.cc:325
Pathname predownloadPath() const
Path where this repo packages are predownloaded.
Definition: RepoInfo.cc:585
bool usesAutoMetadataPaths() const
Whether metadataPath uses AUTO% setup.
Definition: RepoInfo.cc:609
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:582
&#39;Language[_Country]&#39; codes.
Definition: Locale.h:50
void setMetalinkUrl(const Url &url)
Like setMirrorListUrl but expect metalink format.
Definition: RepoInfo.cc:532
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:538
const std::set< std::string > & contentKeywords() const
Definition: RepoInfo.cc:171
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:313
url_set rawBaseUrls() const
The complete set of raw repository urls (no variables replaced)
Definition: RepoInfo.cc:642
void setTargetDistribution(const std::string &targetDistribution)
Sets the distribution for which is this repository meant.
Definition: RepoInfo.cc:594
bool needToAcceptLicense() const
Whether the repo license has to be accepted, e.g.
Definition: RepoInfo.cc:693
std::ostream & dumpAsIniOn(std::ostream &str) const override
Write this RepoInfo object into str in a .repo file format.
Definition: RepoInfo.cc:856
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:552
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:265
RepoVariablesReplacedUrlList _gpgKeyUrls
Definition: RepoInfo.cc:372
TriBool rawRepoGpgCheck() const
Definition: RepoInfo.cc:309
RepoVariablesReplacedUrl _mirrorListUrl
Definition: RepoInfo.cc:328
DefaultIntegral< unsigned, defaultPriority > priority
Definition: RepoInfo.cc:362
std::string targetDistribution() const
Distribution for which is this repository meant.
Definition: RepoInfo.cc:651
Pathname packagesPath() const
Path where this repo packages are cached.
Definition: RepoInfo.cc:606
void setBaseUrls(url_set urls)
Clears current base URL list and adds an url_set.
Definition: RepoInfo.cc:566
std::string targetDistro
Definition: RepoInfo.cc:332
Wrapper class for ::stat/::lstat.
Definition: PathInfo.h:225
~RepoInfo() override
Definition: RepoInfo.cc:399
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:535
urls_const_iterator baseUrlsEnd() const
iterator that points at end of repository urls
Definition: RepoInfo.cc:660
void addContent(const std::string &keyword_r)
Add content keywords.
Definition: RepoInfo.cc:675
void rawPkgGpgCheck(TriBool val_r)
Definition: RepoInfo.cc:314
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:663
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:624
Pathname metadataPath() const
Definition: RepoInfo.cc:343
TriBool rawGpgCheck() const
Definition: RepoInfo.cc:308
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:376
static unsigned noPriority()
The least priority (unsigned(-1)).
Definition: RepoInfo.cc:408
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:639
void setPkgGpgCheck(TriBool value_r)
Set the value for pkgGpgCheck (or indeterminate to use the default).
Definition: RepoInfo.cc:446
repo::RepoType type() const
Type of repository,.
Definition: RepoInfo.cc:612
TriBool cfgRepoGpgCheck() const
Definition: RepoInfo.cc:318
const char * c_str() const
Definition: IdStringType.h:107
Pathname _packagesPath
Definition: RepoInfo.cc:367
bool effectiveKeepPackages() const
keepPackages unless the package cache itself enforces keeping the packages.
Definition: RepoInfo.cc:600
Url manipulation class.
Definition: Url.h:92
void metadataPath(Pathname new_r)
Definition: RepoInfo.cc:334
#define DBG
Definition: Logger.h:99
std::string service
Definition: RepoInfo.cc:331
Repository type enumeration.
Definition: RepoType.h:28
bool hasContent(const std::string &keyword_r) const
Definition: RepoInfo.cc:222