47 ,
type(repo::RepoType::NONE_e)
90 std::vector<Url> rmurls = rmirrorlist->
getUrls();
93 _baseUrls.insert(rmurls.begin(), rmurls.end());
117 if ( PathInfo( (master=
metadatapath/
"/repodata/repomd.xml") ).isFile() )
128 else if ( PathInfo( (master=
metadatapath/
"/content") ).isFile() )
132 [
this](
int num_r, std::string line_r )->
bool
136 std::vector<std::string> words;
137 if (
str::split( line_r, std::back_inserter(words) ) > 1
138 && words[0].length() == 12 )
140 this->
_keywords.insert( ++words.begin(), words.end() );
173 friend Impl * rwcowClone<Impl>(
const Impl * rhs );
176 {
return new Impl( *
this ); }
183 return str <<
"RepoInfo::Impl";
200 : _pimpl( new
Impl() )
295 return replaced_urls;
342 SEC << licenseTgz << endl;
343 SEC << PathInfo(licenseTgz) << endl;
345 return ! licenseTgz.empty() && PathInfo(licenseTgz).isFile();
350 static const std::string noAcceptanceFile =
"no-acceptance-needed\n";
354 if ( licenseTgz.empty() || ! PathInfo( licenseTgz ).isFile() )
358 cmd.push_back(
"tar" );
359 cmd.push_back(
"-t" );
360 cmd.push_back(
"-z" );
361 cmd.push_back(
"-f" );
362 cmd.push_back( licenseTgz.asString() );
367 if ( output == noAcceptanceFile )
372 MIL <<
"License for " << this->
name() <<
" has to be accepted: " << (accept?
"true":
"false" ) << endl;
379 if ( avlocales.empty() )
380 return std::string();
386 WAR <<
"License.tar.gz contains no fallback text! " << *
this << endl;
390 getLang = *avlocales.begin();
394 static const std::string licenseFileFallback(
"license.txt" );
396 ? licenseFileFallback
400 cmd.push_back(
"tar" );
401 cmd.push_back(
"-x" );
402 cmd.push_back(
"-z" );
403 cmd.push_back(
"-O" );
404 cmd.push_back(
"-f" );
406 cmd.push_back( licenseFile );
421 if ( licenseTgz.empty() || ! PathInfo( licenseTgz ).isFile() )
425 cmd.push_back(
"tar" );
426 cmd.push_back(
"-t" );
427 cmd.push_back(
"-z" );
428 cmd.push_back(
"-f" );
429 cmd.push_back( licenseTgz.asString() );
435 static const C_Str license(
"license." );
436 static const C_Str dotTxt(
".txt\n" );
439 if ( output.size() <= license.
size() + dotTxt.
size() )
442 ret.insert(
Locale( std::string( output.c_str()+license.
size(), output.size()- license.
size() - dotTxt.
size() ) ) );
460 str <<
"- url : " << *it << std::endl;
465 auto strif( [&] (
const std::string & tag_r,
const std::string & value_r ) {
466 if ( ! value_r.empty() )
467 str << tag_r << value_r << std::endl;
472 str <<
"- type : " <<
type() << std::endl;
473 str <<
"- priority : " <<
priority() << std::endl;
474 str <<
"- gpgcheck : " <<
gpgCheck() << std::endl;
478 str <<
"- keeppackages: " <<
keepPackages() << std::endl;
480 strif(
"- service : ",
service() );
490 RepoInfoBase::dumpAsIniOn(str);
504 str <<
"path="<<
path() << endl;
512 str <<
"priority=" <<
priority() << endl;
515 str <<
"gpgcheck=" << (
gpgCheck() ?
"1" :
"0") << endl;
523 str <<
"service=" <<
service() << endl;
538 <<
" priority=\"" <<
priority() <<
"\""
539 <<
" enabled=\"" <<
enabled() <<
"\""
541 <<
" gpgcheck=\"" <<
gpgCheck() <<
"\"";
543 str <<
" gpgkey=\"" <<
escape(tmpstr) <<
"\"";
545 str <<
" mirrorlist=\"" <<
escape(tmpstr) <<
"\"";
552 str <<
"<url>" <<
escape(urlit->asString()) <<
"</url>" << endl;
555 str <<
"</repo>" << endl;
static const Locale noCode
No or empty code.
LocaleSet getLicenseLocales() const
Return the locales the license is available for.
std::string name() const
Repository short label.
std::string targetDistribution() const
Distribution for which is this repository meant.
void setGpgKeyUrl(const Url &gpgkey)
Key to use for gpg checking of this repository.
static unsigned defaultPriority()
The default priority (99).
std::string alias() const
unique identifier for this source.
virtual std::ostream & dumpAsIniOn(std::ostream &str) const
Write this RepoInfo object into str in a .repo file format.
void setPriority(unsigned newval_r)
Set repository priority for solver.
unsigned split(const C_Str &line_r, _OutputIterator result_r, const C_Str &sepchars_r=" \t")
Split line_r into words.
RWCOW_pointer< Impl > _pimpl
Pointer to implementation.
void setMirrorListUrl(const Url &url)
Set mirror list url.
repo::RepoVariablesUrlReplacer replacer
urls_const_iterator baseUrlsBegin() const
iterator that points at begin of repository urls
std::string getLicense(const Locale &lang_r=Locale())
Return the best license for the current (or a specified) locale.
std::set< Url > & baseUrls()
std::string escape(const C_Str &str_r, const char sep_r)
Escape desired character c using a backslash.
std::ostream & dumpOn(std::ostream &str, const zypp::shared_ptr< void > &obj)
Pathname metadataPath() const
Path where this repo metadata was read from.
std::ostream & operator<<(std::ostream &str, const RepoInfo::Impl &obj)
String related utilities and Regular expression matching.
void setProbedType(const repo::RepoType &t) const
This allows to adjust the RepoType lazy, from NONE to some probed value, even for const objects...
What is known about a repository.
std::set< std::string > _keywords
void setBaseUrl(const Url &url)
Clears current base URL list and adds url.
bool enabled() const
If enabled is false, then this repository must be ignored as if does not exists, except when checking...
urls_const_iterator baseUrlsEnd() const
iterator that points at end of repository urls
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
Pathname packagesPath() const
Path where this repo packages are cached.
unsigned priority() const
Repository priority for solver.
std::vector< std::string > Arguments
bool seekToNode(int depth_r, const std::string &name_r)
std::string asString() const
Returns a default string representation of the Url object.
boost::logic::tribool TriBool
3-state boolean logic (true, false and indeterminate).
transform_iterator< repo::RepoVariablesUrlReplacer, url_set::const_iterator > urls_const_iterator
bool keepPackages() const
Whether packages downloaded from this repository will be kept in local cache.
bool needToAcceptLicense() const
Whether the repo license has to be accepted, e.g.
std::ostream & operator<<(std::ostream &str, const Exception &obj)
Execute a program and give access to its io An object of this class encapsulates the execution of an ...
Url mirrorListUrl() const
Url of a file which contains a list of Urls If empty, the base url will be used.
void addContent(const std::string &keyword_r)
Convenience char* constructible from std::string and char*, it maps (char*)0 to an empty string...
int forEachLine(std::istream &str_r, function< bool(int, std::string)> consume_r)
Simple lineparser: Call functor consume_r for each line.
void setPath(const Pathname &path)
set the product path.
void setService(const std::string &name)
sets service which added this repository
void setMetadataPath(const Pathname &path)
set the path where the local metadata is stored
bool gpgCheck() const
Whether to check or not this repository with gpg.
std::set< Url > _baseUrls
bool startsWith(const C_Str &str_r, const C_Str &prefix_r)
alias for hasPrefix
void setType(const repo::RepoType &t)
set the repository type
bool baseUrlSet() const
whether there are manualy configured repository urls
Impl * clone() const
clone for RWCOW_pointer
void setKeepPackages(bool keep)
Set if packaqes downloaded from this repository will be kept in local cache.
std::string service() const
Gets name of the service to which this repository belongs or empty string if it has been added manual...
bool baseurl2dump() const
const std::string & asString() const
std::tr1::unordered_set< Locale > LocaleSet
bool seekToEndNode(int depth_r, const std::string &name_r)
void addBaseUrl(const Url &url)
Add a base url.
std::string receiveLine()
Read one line from the input stream.
static const RepoType NONE
std::string asString(const Patch::SeverityFlag &obj)
void setPackagesPath(const Pathname &path)
set the path where the local packages are stored
std::string asString() const
Explicit conversion to std::string.
int close()
Wait for the progamm to complete.
bool baseUrlsEmpty() const
whether repository urls are available
repo::RepoType type() const
Type of repository,.
void setProbedType(const repo::RepoType &t) const
std::string code() const
Return the locale code.
Pathname licenseTgz() const
url_set::size_type urls_size_type
bool hasSuffix(const C_Str &str_r, const C_Str &suffix_r)
Return whether str_r has suffix suffix_r.
void setTargetDistribution(const std::string &targetDistribution)
Sets the distribution for which is this repository meant.
Url getmirrorListUrl() const
bool autorefresh() const
If true, the repostory must be refreshed before creating resolvables from it.
std::set< Url > baseUrls() const
A Url under which the metadata are located, or a set of mirrors.
XmlString nodeText()
If the curent node is not empty, advances the reader to the next node, and returns the value...
bool hasLicense() const
Whether there is a license associated with the repo.
bool hasContent(const std::string &keyword_r=std::string()) const
Check for content keywords.
bool hasContent(const std::string &keyword_r) const
Url gpgKeyUrl() const
Key to use for gpg checking of this repository.
DefaultIntegral< unsigned, defaultPriority > priority
Url url() const
Pars pro toto: The first repository url.
void setGpgCheck(bool check)
Whether to check or not this repository with gpg.
static const RepoInfo noRepo
Represents no Repository (one with an empty alias).
const std::set< Url > & baseUrls() const
bool check(const std::string &sequenceinfo_r, bool quick_r)
Check via sequence info.
void addContent(const std::string &keyword_r)
Add content keywords.
virtual std::ostream & dumpAsXmlOn(std::ostream &str, const std::string &content="") const
Write an XML representation of this RepoInfo object.
std::vector< Url > getUrls() const
Functor replacing repository variables.
urls_size_type baseUrlsSize() const
number of repository urls
Easy-to use interface to the ZYPP dependency resolver.
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.
static const unsigned defaultPriority
bool hasPrefix(const C_Str &str_r, const C_Str &prefix_r)
Return whether str_r has prefix prefix_r.
Pathname path() const
Repository path.
virtual std::ostream & dumpOn(std::ostream &str) const
Write a human-readable representation of this RepoInfo object into the str stream.
detail::EscapedString escape(const std::string &in_r)
Escape xml special charaters (& -> &; from IoBind library).
Repository type enumeration.