libzypp  14.36.0
RepoInfo.cc
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #include <iostream>
13 #include <vector>
14 
15 #include "zypp/base/LogTools.h"
18 
19 #include "zypp/RepoInfo.h"
20 #include "zypp/TriBool.h"
21 #include "zypp/Pathname.h"
23 #include "zypp/ExternalProgram.h"
24 #include "zypp/media/MediaAccess.h"
25 
26 #include "zypp/base/IOStream.h"
27 #include "zypp/base/InputStream.h"
28 #include "zypp/parser/xml/Reader.h"
29 
30 using std::endl;
31 using zypp::xml::escape;
32 
34 namespace zypp
35 {
36 
38  //
39  // CLASS NAME : RepoInfo::Impl
40  //
43  {
44  Impl()
45  : gpgcheck(indeterminate)
46  , keeppackages(indeterminate)
47  , type(repo::RepoType::NONE_e)
48  , emptybaseurls(false)
49  {}
50 
52  {}
53 
54  public:
55  static const unsigned defaultPriority = 99;
56 
57  void setProbedType( const repo::RepoType & t ) const
58  {
60  && t != repo::RepoType::NONE )
61  {
62  // lazy init!
63  const_cast<Impl*>(this)->type = t;
64  }
65  }
66 
67  public:
68  Pathname licenseTgz() const
69  { return metadatapath.empty() ? Pathname() : metadatapath / path / "license.tar.gz"; }
70 
72  {
73  const Url & mlurl( _mirrorListUrl.transformed() ); // Variables replaced!
74  if ( _baseUrls.empty() && ! mlurl.asString().empty() )
75  {
76  emptybaseurls = true;
77  DBG << "MetadataPath: " << metadatapath << endl;
78  repo::RepoMirrorList rmurls( mlurl, metadatapath );
79  _baseUrls.raw().insert( _baseUrls.raw().end(), rmurls.getUrls().begin(), rmurls.getUrls().end() );
80  }
81  return _baseUrls;
82  }
83 
85  { return _baseUrls; }
86 
87  bool baseurl2dump() const
88  { return !emptybaseurls && !_baseUrls.empty(); }
89 
90 
91  void addContent( const std::string & keyword_r )
92  { _keywords.insert( keyword_r ); }
93 
94  bool hasContent( const std::string & keyword_r ) const
95  {
96  if ( _keywords.empty() && ! metadatapath.empty() )
97  {
98  // HACK directly check master index file until RepoManager offers
99  // some content probing ans zypepr uses it.
101  MIL << "Empty keywords...." << metadatapath << endl;
102  Pathname master;
103  if ( PathInfo( (master=metadatapath/"/repodata/repomd.xml") ).isFile() )
104  {
105  //MIL << "GO repomd.." << endl;
106  xml::Reader reader( master );
107  while ( reader.seekToNode( 2, "content" ) )
108  {
109  _keywords.insert( reader.nodeText().asString() );
110  reader.seekToEndNode( 2, "content" );
111  }
112  _keywords.insert( "" ); // valid content in _keywords even if empty
113  }
114  else if ( PathInfo( (master=metadatapath/"/content") ).isFile() )
115  {
116  //MIL << "GO content.." << endl;
117  iostr::forEachLine( InputStream( master ),
118  [this]( int num_r, std::string line_r )->bool
119  {
120  if ( str::startsWith( line_r, "REPOKEYWORDS" ) )
121  {
122  std::vector<std::string> words;
123  if ( str::split( line_r, std::back_inserter(words) ) > 1
124  && words[0].length() == 12 /*"REPOKEYWORDS"*/ )
125  {
126  this->_keywords.insert( ++words.begin(), words.end() );
127  }
128  return true; // mult. occurrances are ok.
129  }
130  return( ! str::startsWith( line_r, "META " ) ); // no need to parse into META section.
131  } );
132  _keywords.insert( "" );
133  }
135  }
136  return( _keywords.find( keyword_r ) != _keywords.end() );
137  }
138 
139  public:
145  Pathname path;
146  std::string service;
147  std::string targetDistro;
148  Pathname metadatapath;
149  Pathname packagespath;
151  mutable bool emptybaseurls;
153 
154  private:
156  mutable std::set<std::string> _keywords;
157 
158  friend Impl * rwcowClone<Impl>( const Impl * rhs );
160  Impl * clone() const
161  { return new Impl( *this ); }
162  };
164 
166  inline std::ostream & operator<<( std::ostream & str, const RepoInfo::Impl & obj )
167  {
168  return str << "RepoInfo::Impl";
169  }
170 
172  //
173  // CLASS NAME : RepoInfo
174  //
176 
178 
180  //
181  // METHOD NAME : RepoInfo::RepoInfo
182  // METHOD TYPE : Ctor
183  //
185  : _pimpl( new Impl() )
186  {}
187 
189  //
190  // METHOD NAME : RepoInfo::~RepoInfo
191  // METHOD TYPE : Dtor
192  //
194  {
195  //MIL << std::endl;
196  }
197 
198  unsigned RepoInfo::priority() const
199  { return _pimpl->priority; }
200 
202  { return Impl::defaultPriority; }
203 
204  void RepoInfo::setPriority( unsigned newval_r )
205  { _pimpl->priority = newval_r ? newval_r : Impl::defaultPriority; }
206 
208  { _pimpl->gpgcheck = check; }
209 
210  void RepoInfo::setMirrorListUrl( const Url & url_r ) // Raw
211  { _pimpl->_mirrorListUrl.raw() = url_r; }
212 
213  void RepoInfo::setGpgKeyUrl( const Url & url_r )
214  { _pimpl->_gpgKeyUrl.raw() = url_r; }
215 
216  void RepoInfo::addBaseUrl( const Url & url_r )
217  {
218  for ( const auto & url : _pimpl->baseUrls().raw() ) // Raw unique!
219  if ( url == url_r )
220  return;
221  _pimpl->baseUrls().raw().push_back( url_r );
222  }
223 
224  void RepoInfo::setBaseUrl( const Url & url_r )
225  {
226  _pimpl->baseUrls().raw().clear();
227  _pimpl->baseUrls().raw().push_back( url_r );
228  }
229 
230  void RepoInfo::setPath( const Pathname &path )
231  { _pimpl->path = path; }
232 
234  { _pimpl->type = t; }
235 
237  { _pimpl->setProbedType( t ); }
238 
239 
240  void RepoInfo::setMetadataPath( const Pathname &path )
241  { _pimpl->metadatapath = path; }
242 
243  void RepoInfo::setPackagesPath( const Pathname &path )
244  { _pimpl->packagespath = path; }
245 
246  void RepoInfo::setKeepPackages( bool keep )
247  { _pimpl->keeppackages = keep; }
248 
249  void RepoInfo::setService( const std::string& name )
250  { _pimpl->service = name; }
251 
252  void RepoInfo::setTargetDistribution( const std::string & targetDistribution )
254 
255  bool RepoInfo::gpgCheck() const
256  { return indeterminate(_pimpl->gpgcheck) ? true : (bool)_pimpl->gpgcheck; }
257 
259  { return indeterminate(_pimpl->keeppackages) ? false : (bool)_pimpl->keeppackages; }
260 
261  Pathname RepoInfo::metadataPath() const
262  { return _pimpl->metadatapath; }
263 
264  Pathname RepoInfo::packagesPath() const
265  { return _pimpl->packagespath; }
266 
268  { return _pimpl->type; }
269 
270  Url RepoInfo::mirrorListUrl() const // Variables replaced!
271  { return _pimpl->_mirrorListUrl.transformed(); }
272 
274  { return _pimpl->_mirrorListUrl.raw(); }
275 
276  Url RepoInfo::gpgKeyUrl() const // Variables replaced!
277  { return _pimpl->_gpgKeyUrl.transformed(); }
278 
280  { return _pimpl->_gpgKeyUrl.raw(); }
281 
282  RepoInfo::url_set RepoInfo::baseUrls() const // Variables replaced!
283  { return _pimpl->baseUrls().transformed(); }
284 
286  { return _pimpl->baseUrls().raw(); }
287 
288  Pathname RepoInfo::path() const
289  { return _pimpl->path; }
290 
291  std::string RepoInfo::service() const
292  { return _pimpl->service; }
293 
294  std::string RepoInfo::targetDistribution() const
295  { return _pimpl->targetDistro; }
296 
298  { return( _pimpl->baseUrls().empty() ? Url() : *_pimpl->baseUrls().rawBegin() ); }
299 
301  { return _pimpl->baseUrls().transformedBegin(); }
302 
304  { return _pimpl->baseUrls().transformedEnd(); }
305 
307  { return _pimpl->baseUrls().size(); }
308 
310  { return _pimpl->baseUrls().empty(); }
311 
312  bool RepoInfo::baseUrlSet() const
313  { return _pimpl->baseurl2dump(); }
314 
315 
316  void RepoInfo::addContent( const std::string & keyword_r )
317  { _pimpl->addContent( keyword_r ); }
318 
319  bool RepoInfo::hasContent( const std::string & keyword_r ) const
320  { return _pimpl->hasContent( keyword_r ); }
321 
323 
324  bool RepoInfo::hasLicense() const
325  {
326  Pathname licenseTgz( _pimpl->licenseTgz() );
327  return ! licenseTgz.empty() && PathInfo(licenseTgz).isFile();
328  }
329 
331  {
332  static const std::string noAcceptanceFile = "no-acceptance-needed\n";
333  bool accept = true;
334 
335  Pathname licenseTgz( _pimpl->licenseTgz() );
336  if ( licenseTgz.empty() || ! PathInfo( licenseTgz ).isFile() )
337  return false; // no licenses at all
338 
340  cmd.push_back( "tar" );
341  cmd.push_back( "-t" );
342  cmd.push_back( "-z" );
343  cmd.push_back( "-f" );
344  cmd.push_back( licenseTgz.asString() );
345 
347  for ( std::string output( prog.receiveLine() ); output.length(); output = prog.receiveLine() )
348  {
349  if ( output == noAcceptanceFile )
350  {
351  accept = false;
352  }
353  }
354  MIL << "License for " << name() << " has to be accepted: " << (accept?"true":"false" ) << endl;
355  return accept;
356  }
357 
358  std::string RepoInfo::getLicense( const Locale & lang_r )
359  { return const_cast<const RepoInfo *>(this)->getLicense( lang_r ); }
360 
361  std::string RepoInfo::getLicense( const Locale & lang_r ) const
362  {
363  LocaleSet avlocales( getLicenseLocales() );
364  if ( avlocales.empty() )
365  return std::string();
366 
367  Locale getLang( Locale::bestMatch( avlocales, lang_r ) );
368  if ( getLang == Locale::noCode
369  && avlocales.find( Locale::noCode ) == avlocales.end() )
370  {
371  WAR << "License.tar.gz contains no fallback text! " << *this << endl;
372  // Using the fist locale instead of returning no text at all.
373  // So the user might recognize that there is a license, even if he
374  // can't read it.
375  getLang = *avlocales.begin();
376  }
377 
378  // now extract the license file.
379  static const std::string licenseFileFallback( "license.txt" );
380  std::string licenseFile( getLang == Locale::noCode
381  ? licenseFileFallback
382  : str::form( "license.%s.txt", getLang.code().c_str() ) );
383 
385  cmd.push_back( "tar" );
386  cmd.push_back( "-x" );
387  cmd.push_back( "-z" );
388  cmd.push_back( "-O" );
389  cmd.push_back( "-f" );
390  cmd.push_back( _pimpl->licenseTgz().asString() ); // if it not exists, avlocales was empty.
391  cmd.push_back( licenseFile );
392 
393  std::string ret;
395  for ( std::string output( prog.receiveLine() ); output.length(); output = prog.receiveLine() )
396  {
397  ret += output;
398  }
399  prog.close();
400  return ret;
401  }
402 
404  {
405  Pathname licenseTgz( _pimpl->licenseTgz() );
406  if ( licenseTgz.empty() || ! PathInfo( licenseTgz ).isFile() )
407  return LocaleSet();
408 
410  cmd.push_back( "tar" );
411  cmd.push_back( "-t" );
412  cmd.push_back( "-z" );
413  cmd.push_back( "-f" );
414  cmd.push_back( licenseTgz.asString() );
415 
416  LocaleSet ret;
418  for ( std::string output( prog.receiveLine() ); output.length(); output = prog.receiveLine() )
419  {
420  static const C_Str license( "license." );
421  static const C_Str dotTxt( ".txt\n" );
422  if ( str::hasPrefix( output, license ) && str::hasSuffix( output, dotTxt ) )
423  {
424  if ( output.size() <= license.size() + dotTxt.size() ) // license.txt
425  ret.insert( Locale() );
426  else
427  ret.insert( Locale( std::string( output.c_str()+license.size(), output.size()- license.size() - dotTxt.size() ) ) );
428  }
429  }
430  prog.close();
431  return ret;
432  }
433 
435 
436  std::ostream & RepoInfo::dumpOn( std::ostream & str ) const
437  {
439  if ( _pimpl->baseurl2dump() )
440  {
441  for ( const auto & url : _pimpl->baseUrls().raw() )
442  {
443  str << "- url : " << url << std::endl;
444  }
445  }
446 
447  // print if non empty value
448  auto strif( [&] ( const std::string & tag_r, const std::string & value_r ) {
449  if ( ! value_r.empty() )
450  str << tag_r << value_r << std::endl;
451  });
452 
453  strif( "- mirrorlist : ", rawMirrorListUrl().asString() );
454  strif( "- path : ", path().asString() );
455  str << "- type : " << type() << std::endl;
456  str << "- priority : " << priority() << std::endl;
457  str << "- gpgcheck : " << gpgCheck() << std::endl;
458  strif( "- gpgkey : ", rawGpgKeyUrl().asString() );
459 
460  if ( ! indeterminate(_pimpl->keeppackages) )
461  str << "- keeppackages: " << keepPackages() << std::endl;
462 
463  strif( "- service : ", service() );
464  strif( "- targetdistro: ", targetDistribution() );
465  strif( "- metadataPath: ", metadataPath().asString() );
466  strif( "- packagesPath: ", packagesPath().asString() );
467 
468  return str;
469  }
470 
471  std::ostream & RepoInfo::dumpAsIniOn( std::ostream & str ) const
472  {
473  RepoInfoBase::dumpAsIniOn(str);
474 
475  if ( _pimpl->baseurl2dump() )
476  {
477  str << "baseurl=";
478  std::string indent;
479  for ( const auto & url : _pimpl->baseUrls().raw() )
480  {
481  str << indent << url << endl;
482  if ( indent.empty() ) indent = " "; // "baseurl="
483  }
484  }
485 
486  if ( ! _pimpl->path.empty() )
487  str << "path="<< path() << endl;
488 
489  if ( ! (rawMirrorListUrl().asString().empty()) )
490  str << "mirrorlist=" << rawMirrorListUrl() << endl;
491 
492  str << "type=" << type().asString() << endl;
493 
494  if ( priority() != defaultPriority() )
495  str << "priority=" << priority() << endl;
496 
497  if (!indeterminate(_pimpl->gpgcheck))
498  str << "gpgcheck=" << (gpgCheck() ? "1" : "0") << endl;
499 
500  if ( ! (rawGpgKeyUrl().asString().empty()) )
501  str << "gpgkey=" << rawGpgKeyUrl() << endl;
502 
503  if (!indeterminate(_pimpl->keeppackages))
504  str << "keeppackages=" << keepPackages() << endl;
505 
506  if( ! service().empty() )
507  str << "service=" << service() << endl;
508 
509  return str;
510  }
511 
512  std::ostream & RepoInfo::dumpAsXmlOn( std::ostream & str, const std::string & content ) const
513  {
514  std::string tmpstr;
515  str
516  << "<repo"
517  << " alias=\"" << escape(alias()) << "\""
518  << " name=\"" << escape(name()) << "\"";
519  if (type() != repo::RepoType::NONE)
520  str << " type=\"" << type().asString() << "\"";
521  str
522  << " priority=\"" << priority() << "\""
523  << " enabled=\"" << enabled() << "\""
524  << " autorefresh=\"" << autorefresh() << "\""
525  << " gpgcheck=\"" << gpgCheck() << "\"";
526  if (!(tmpstr = gpgKeyUrl().asString()).empty())
527  str << " gpgkey=\"" << escape(tmpstr) << "\"";
528  if (!(tmpstr = mirrorListUrl().asString()).empty())
529  str << " mirrorlist=\"" << escape(tmpstr) << "\"";
530  str << ">" << endl;
531 
532  if ( _pimpl->baseurl2dump() )
533  {
534  for_( it, baseUrlsBegin(), baseUrlsEnd() ) // !transform iterator replaces variables
535  str << "<url>" << escape((*it).asString()) << "</url>" << endl;
536  }
537 
538  str << "</repo>" << endl;
539  return str;
540  }
541 
542 
543  std::ostream & operator<<( std::ostream & str, const RepoInfo & obj )
544  {
545  return obj.dumpOn(str);
546  }
547 
548 
550 } // namespace zypp
static const Locale noCode
No or empty code.
Definition: Locale.h:71
LocaleSet getLicenseLocales() const
Return the locales the license is available for.
Definition: RepoInfo.cc:403
std::string name() const
Repository name.
std::string targetDistribution() const
Distribution for which is this repository meant.
Definition: RepoInfo.cc:294
#define MIL
Definition: Logger.h:47
void setGpgKeyUrl(const Url &gpgkey)
Key to use for gpg checking of this repository.
Definition: RepoInfo.cc:213
static unsigned defaultPriority()
The default priority (99).
Definition: RepoInfo.cc:201
std::string alias() const
unique identifier for this source.
Url rawUrl() const
Pars pro toto: The first repository raw url (no variables replaced)
Definition: RepoInfo.cc:297
virtual std::ostream & dumpAsIniOn(std::ostream &str) const
Write this RepoInfo object into str in a .repo file format.
Definition: RepoInfo.cc:471
void setPriority(unsigned newval_r)
Set repository priority for solver.
Definition: RepoInfo.cc:204
unsigned split(const C_Str &line_r, _OutputIterator result_r, const C_Str &sepchars_r=" \t")
Split line_r into words.
Definition: String.h:464
RWCOW_pointer< Impl > _pimpl
Pointer to implementation.
Definition: RepoInfo.h:412
void setMirrorListUrl(const Url &url)
Set mirror list url.
Definition: RepoInfo.cc:210
repo::RepoVariablesUrlReplacer replacer
Definition: RepoInfo.cc:152
urls_const_iterator baseUrlsBegin() const
iterator that points at begin of repository urls
Definition: RepoInfo.cc:300
std::string escape(const C_Str &str_r, const char sep_r)
Escape desired character c using a backslash.
Definition: String.cc:345
std::ostream & dumpOn(std::ostream &str, const zypp::shared_ptr< void > &obj)
Definition: PtrTypes.h:151
Pathname metadataPath() const
Path where this repo metadata was read from.
Definition: RepoInfo.cc:261
std::ostream & operator<<(std::ostream &str, const RepoInfo::Impl &obj)
Definition: RepoInfo.cc:166
Pathname metadatapath
Definition: RepoInfo.cc:148
String related utilities and Regular expression matching.
std::list< Url > url_set
Definition: RepoInfo.h:98
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:236
What is known about a repository.
Definition: RepoInfo.h:70
std::set< std::string > _keywords
Definition: RepoInfo.cc:156
Helper to create and pass std::istream.
Definition: InputStream.h:56
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition: Easy.h:27
void setBaseUrl(const Url &url)
Clears current base URL list and adds url.
Definition: RepoInfo.cc:224
bool enabled() const
If enabled is false, then this repository must be ignored as if does not exists, except when checking...
RepoVariablesReplacedUrl _gpgKeyUrl
Definition: RepoInfo.cc:142
urls_const_iterator baseUrlsEnd() const
iterator that points at end of repository urls
Definition: RepoInfo.cc:303
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
Definition: String.cc:34
Pathname packagesPath() const
Path where this repo packages are cached.
Definition: RepoInfo.cc:264
base::ValueTransform< Url, repo::RepoVariablesUrlReplacer > RepoVariablesReplacedUrl
Definition: RepoVariables.h:81
unsigned priority() const
Repository priority for solver.
Definition: RepoInfo.cc:198
std::vector< std::string > Arguments
bool seekToNode(int depth_r, const std::string &name_r)
Definition: Reader.cc:212
boost::logic::tribool TriBool
3-state boolean logic (true, false and indeterminate).
Definition: TriBool.h:39
transform_iterator< repo::RepoVariablesUrlReplacer, url_set::const_iterator > urls_const_iterator
Definition: RepoInfo.h:100
RepoVariablesReplacedUrlList _baseUrls
Definition: RepoInfo.cc:155
RepoInfo implementation.
Definition: RepoInfo.cc:42
bool keepPackages() const
Whether packages downloaded from this repository will be kept in local cache.
Definition: RepoInfo.cc:258
bool needToAcceptLicense() const
Whether the repo license has to be accepted, e.g.
Definition: RepoInfo.cc:330
Url rawMirrorListUrl() const
The raw mirrorListUrl (no variables replaced).
Definition: RepoInfo.cc:273
virtual ~RepoInfo()
Definition: RepoInfo.cc:193
std::ostream & operator<<(std::ostream &str, const Exception &obj)
Definition: Exception.cc:120
Execute a program and give access to its io An object of this class encapsulates the execution of an ...
RepoVariablesReplacedUrlList & baseUrls()
Definition: RepoInfo.cc:84
Url mirrorListUrl() const
Url of a file which contains a list of repository urls.
Definition: RepoInfo.cc:270
void addContent(const std::string &keyword_r)
Definition: RepoInfo.cc:91
Convenience char* constructible from std::string and char*, it maps (char*)0 to an empty string...
Definition: String.h:111
int forEachLine(std::istream &str_r, function< bool(int, std::string)> consume_r)
Simple lineparser: Call functor consume_r for each line.
Definition: IOStream.cc:100
void setPath(const Pathname &path)
set the product path.
Definition: RepoInfo.cc:230
void setService(const std::string &name)
sets service which added this repository
Definition: RepoInfo.cc:249
#define WAR
Definition: Logger.h:48
void setMetadataPath(const Pathname &path)
set the path where the local metadata is stored
Definition: RepoInfo.cc:240
bool gpgCheck() const
Whether to check or not this repository with gpg.
Definition: RepoInfo.cc:255
bool startsWith(const C_Str &str_r, const C_Str &prefix_r)
alias for hasPrefix
Definition: String.h:1009
void setType(const repo::RepoType &t)
set the repository type
Definition: RepoInfo.cc:233
bool baseUrlSet() const
Whether there are manualy configured repository urls.
Definition: RepoInfo.cc:312
Impl * clone() const
clone for RWCOW_pointer
Definition: RepoInfo.cc:160
void setKeepPackages(bool keep)
Set if packaqes downloaded from this repository will be kept in local cache.
Definition: RepoInfo.cc:246
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:291
bool baseurl2dump() const
Definition: RepoInfo.cc:87
const std::string & asString() const
Definition: RepoType.cc:56
std::tr1::unordered_set< Locale > LocaleSet
Definition: Locale.h:28
bool seekToEndNode(int depth_r, const std::string &name_r)
Definition: Reader.cc:232
void addBaseUrl(const Url &url)
Add a base url.
Definition: RepoInfo.cc:216
std::string receiveLine()
Read one line from the input stream.
static const RepoType NONE
Definition: RepoType.h:32
base::ContainerTransform< std::list< Url >, repo::RepoVariablesUrlReplacer > RepoVariablesReplacedUrlList
Definition: RepoVariables.h:84
std::string asString(const Patch::SeverityFlag &obj)
Definition: Patch.cc:166
void setPackagesPath(const Pathname &path)
set the path where the local packages are stored
Definition: RepoInfo.cc:243
url_set baseUrls() const
The complete set of repository urls.
Definition: RepoInfo.cc:282
const std::vector< Url > & getUrls() const
url_set rawBaseUrls() const
The complete set of raw repository urls (no variables replaced)
Definition: RepoInfo.cc:285
std::string asString() const
Explicit conversion to std::string.
Definition: XmlString.h:77
int close()
Wait for the progamm to complete.
bool baseUrlsEmpty() const
whether repository urls are available
Definition: RepoInfo.cc:309
repo::RepoType type() const
Type of repository,.
Definition: RepoInfo.cc:267
void setProbedType(const repo::RepoType &t) const
Definition: RepoInfo.cc:57
std::string code() const
Return the locale code.
Definition: Locale.cc:207
Pathname licenseTgz() const
Definition: RepoInfo.cc:68
url_set::size_type urls_size_type
Definition: RepoInfo.h:99
bool hasSuffix(const C_Str &str_r, const C_Str &suffix_r)
Return whether str_r has suffix suffix_r.
Definition: String.h:987
void setTargetDistribution(const std::string &targetDistribution)
Sets the distribution for which is this repository meant.
Definition: RepoInfo.cc:252
std::string getLicense(const Locale &lang_r=Locale()) const
Return the best license for the current (or a specified) locale.
Definition: RepoInfo.cc:361
bool autorefresh() const
If true, the repostory must be refreshed before creating resolvables from it.
XmlString nodeText()
If the curent node is not empty, advances the reader to the next node, and returns the value...
Definition: Reader.cc:140
Pathname packagespath
Definition: RepoInfo.cc:149
bool hasLicense() const
Whether there is a license associated with the repo.
Definition: RepoInfo.cc:324
bool hasContent(const std::string &keyword_r=std::string()) const
Check for content keywords.
Definition: RepoInfo.cc:319
bool hasContent(const std::string &keyword_r) const
Definition: RepoInfo.cc:94
Url gpgKeyUrl() const
Key to use for gpg checking of this repository.
Definition: RepoInfo.cc:276
RepoVariablesReplacedUrl _mirrorListUrl
Definition: RepoInfo.cc:143
DefaultIntegral< unsigned, defaultPriority > priority
Definition: RepoInfo.cc:150
Url url() const
Pars pro toto: The first repository url.
Definition: RepoInfo.h:126
void setGpgCheck(bool check)
Whether to check or not this repository with gpg.
Definition: RepoInfo.cc:207
std::string targetDistro
Definition: RepoInfo.cc:147
static const RepoInfo noRepo
Represents no Repository (one with an empty alias).
Definition: RepoInfo.h:79
bool check(const std::string &sequenceinfo_r, bool quick_r)
Check via sequence info.
void addContent(const std::string &keyword_r)
Add content keywords.
Definition: RepoInfo.cc:316
size_type size() const
Definition: String.h:125
virtual std::ostream & dumpAsXmlOn(std::ostream &str, const std::string &content="") const
Write an XML representation of this RepoInfo object.
Definition: RepoInfo.cc:512
repo::RepoType type
Definition: RepoInfo.cc:144
Functor replacing repository variables.
Definition: RepoVariables.h:67
urls_size_type baseUrlsSize() const
number of repository urls
Definition: RepoInfo.cc:306
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:1
static Locale bestMatch(const LocaleSet &avLocales_r, const Locale &requested_r=Locale())
Return the best match for Locale requested_r within the available avLocales_r.
Definition: Locale.cc:229
static const unsigned defaultPriority
Definition: RepoInfo.cc:55
bool hasPrefix(const C_Str &str_r, const C_Str &prefix_r)
Return whether str_r has prefix prefix_r.
Definition: String.h:979
const RepoVariablesReplacedUrlList & baseUrls() const
Definition: RepoInfo.cc:71
Url rawGpgKeyUrl() const
The raw gpgKeyUrl (no variables replaced).
Definition: RepoInfo.cc:279
Url manipulation class.
Definition: Url.h:87
Pathname path() const
Repository path.
Definition: RepoInfo.cc:288
virtual std::ostream & dumpOn(std::ostream &str) const
Write a human-readable representation of this RepoInfo object into the str stream.
Definition: RepoInfo.cc:436
#define DBG
Definition: Logger.h:46
std::string service
Definition: RepoInfo.cc:146
detail::EscapedString escape(const std::string &in_r)
Escape xml special charaters (& -> &; from IoBind library).
Definition: XmlEscape.h:51
Repository type enumeration.
Definition: RepoType.h:27