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