51 ,
type(repo::RepoType::NONE_e)
78 if (
_baseUrls.empty() && ! mlurl.asString().empty() )
107 if ( PathInfo( (master=
metadatapath/
"/repodata/repomd.xml") ).isFile() )
118 else if ( PathInfo( (master=
metadatapath/
"/content") ).isFile() )
122 [
this](
int num_r, std::string line_r )->
bool
126 std::vector<std::string> words;
127 if (
str::split( line_r, std::back_inserter(words) ) > 1
128 && words[0].length() == 12 )
130 this->
_keywords.insert( ++words.begin(), words.end() );
157 return indeterminate;
164 Pathname gpgcheckFile(
metadatapath /
".repo_gpgcheck" );
165 if ( PathInfo(gpgcheckFile).isExist() )
167 TriBool linkval( indeterminate );
180 static const Pathname truePath(
"true" );
181 static const Pathname falsePath(
"false" );
182 static const Pathname indeterminatePath(
"indeterminate" );
185 if ( linkval == truePath )
187 else if ( linkval == falsePath )
189 else if ( linkval == indeterminatePath )
190 ret_r = indeterminate;
225 friend Impl * rwcowClone<Impl>(
const Impl * rhs );
228 {
return new Impl( *
this ); }
235 return str <<
"RepoInfo::Impl";
247 : _pimpl( new
Impl() )
423 return ! licenseTgz.empty() && PathInfo(licenseTgz).isFile();
428 static const std::string noAcceptanceFile =
"no-acceptance-needed\n";
432 if ( licenseTgz.empty() || ! PathInfo( licenseTgz ).isFile() )
436 cmd.push_back(
"tar" );
437 cmd.push_back(
"-t" );
438 cmd.push_back(
"-z" );
439 cmd.push_back(
"-f" );
440 cmd.push_back( licenseTgz.asString() );
445 if ( output == noAcceptanceFile )
450 MIL <<
"License for " <<
name() <<
" has to be accepted: " << (accept?
"true":
"false" ) << endl;
460 if ( avlocales.empty() )
461 return std::string();
467 WAR <<
"License.tar.gz contains no fallback text! " << *
this << endl;
471 getLang = *avlocales.begin();
475 static const std::string licenseFileFallback(
"license.txt" );
477 ? licenseFileFallback
481 cmd.push_back(
"tar" );
482 cmd.push_back(
"-x" );
483 cmd.push_back(
"-z" );
484 cmd.push_back(
"-O" );
485 cmd.push_back(
"-f" );
487 cmd.push_back( licenseFile );
502 if ( licenseTgz.empty() || ! PathInfo( licenseTgz ).isFile() )
506 cmd.push_back(
"tar" );
507 cmd.push_back(
"-t" );
508 cmd.push_back(
"-z" );
509 cmd.push_back(
"-f" );
510 cmd.push_back( licenseTgz.asString() );
516 static const C_Str license(
"license." );
517 static const C_Str dotTxt(
".txt\n" );
520 if ( output.size() <= license.
size() + dotTxt.
size() )
523 ret.insert(
Locale( std::string( output.c_str()+license.
size(), output.size()- license.
size() - dotTxt.
size() ) ) );
539 str <<
"- url : " <<
url << std::endl;
544 auto strif( [&] (
const std::string & tag_r,
const std::string & value_r ) {
545 if ( ! value_r.empty() )
546 str << tag_r << value_r << std::endl;
551 str <<
"- type : " <<
type() << std::endl;
552 str <<
"- priority : " <<
priority() << std::endl;
555 #define OUTS(T,B) ( indeterminate(T) ? (std::string("D(")+(B?"Y":"N")+")") : ((bool)T?"Y":"N") )
566 str <<
"- keeppackages: " <<
keepPackages() << std::endl;
568 strif(
"- service : ",
service() );
578 RepoInfoBase::dumpAsIniOn(str);
586 str << indent <<
url << endl;
587 if ( indent.empty() ) indent =
" ";
592 str <<
"path="<<
path() << endl;
600 str <<
"priority=" <<
priority() << endl;
618 str <<
"service=" <<
service() << endl;
633 <<
" priority=\"" <<
priority() <<
"\""
634 <<
" enabled=\"" <<
enabled() <<
"\""
636 <<
" gpgcheck=\"" <<
gpgCheck() <<
"\""
640 str <<
" gpgkey=\"" <<
escape(tmpstr) <<
"\"";
642 str <<
" mirrorlist=\"" <<
escape(tmpstr) <<
"\"";
648 str <<
"<url>" <<
escape((*it).asString()) <<
"</url>" << endl;
651 str <<
"</repo>" << endl;
static const Locale noCode
No or empty code.
LocaleSet getLicenseLocales() const
Return the locales the license is available for.
TriBool internalValidRepoSignature() const
Signature check result needs to be stored/retrieved from _metadatapath.
std::string name() const
Repository name.
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.
TriBool repoGpgCheck() const
Check repo matadata signatures (indeterminate - according to gpgcheck)
Url rawUrl() const
Pars pro toto: The first repository raw url (no variables replaced)
virtual std::ostream & dumpAsIniOn(std::ostream &str) const
Write this RepoInfo object into str in a .repo file format.
TriBool _pkgGpgCheck
need to check pkg sign.: Y/N/(ZConf(Y/N/gpgCheck && no valid repo sign.))
static ZConfig & instance()
Singleton ctor.
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.
int readlink(const Pathname &symlink_r, Pathname &target_r)
Like 'readlink'.
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 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)
bool pkgGpgCheck() const
Whether the signature of rpm packages should be checked for this repo.
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.
void setGpgCheck(TriBool value_r)
Set the value for gpgCheck (or indeterminate to use the default).
std::set< std::string > _keywords
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
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...
RepoVariablesReplacedUrl _gpgKeyUrl
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.
void internalSetValidRepoSignature(TriBool value_r)
Pathname packagesPath() const
Path where this repo packages are cached.
base::ValueTransform< Url, repo::RepoVariablesUrlReplacer > RepoVariablesReplacedUrl
unsigned priority() const
Repository priority for solver.
TriBool triBoolFromPath(const Pathname &path_r) const
void setValidRepoSignature(TriBool value_r)
Set the value for validRepoSignature (or indeterminate if unsigned).
std::vector< std::string > Arguments
bool repoGpgCheck() const
Whether the signature of repo metadata should be checked for this repo.
bool seekToNode(int depth_r, const std::string &name_r)
TriBool _gpgCheck
default gpgcheck behavior: Y/N/ZConf
boost::logic::tribool TriBool
3-state boolean logic (true, false and indeterminate).
transform_iterator< repo::RepoVariablesUrlReplacer, url_set::const_iterator > urls_const_iterator
RepoVariablesReplacedUrlList _baseUrls
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.
Url rawMirrorListUrl() const
The raw mirrorListUrl (no variables replaced).
bool gpgCheck() const
Turn signature checking on/off (on)
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 ...
int unlink(const Pathname &path)
Like 'unlink'.
RepoVariablesReplacedUrlList & baseUrls()
void setRepoGpgCheck(TriBool value_r)
Set the value for repoGpgCheck (or indeterminate to use the default).
Url mirrorListUrl() const
Url of a file which contains a list of repository urls.
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.
TriBool pkgGpgCheck() const
Check rpm package signatures (indeterminate - according to gpgcheck)
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 default signature checking should be performed for this repo.
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
TriBool _validRepoSignature
have signed and valid repo metadata
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)
int symlink(const Pathname &oldpath, const Pathname &newpath)
Like 'symlink'.
void addBaseUrl(const Url &url)
Add a base url.
std::string receiveLine()
Read one line from the input stream.
static const RepoType NONE
base::ContainerTransform< std::list< Url >, repo::RepoVariablesUrlReplacer > RepoVariablesReplacedUrlList
std::string asString(const Patch::SeverityFlag &obj)
void setPackagesPath(const Pathname &path)
set the path where the local packages are stored
url_set baseUrls() const
The complete set of repository urls.
const std::vector< Url > & getUrls() const
url_set rawBaseUrls() const
The complete set of raw repository urls (no variables replaced)
std::string asString() const
Explicit conversion to std::string.
int close()
Wait for the progamm to complete.
TriBool _repoGpgCheck
need to check repo sign.: Y/N/(ZConf(Y/N/gpgCheck))
bool baseUrlsEmpty() const
whether repository urls are available
repo::RepoType type() const
Type of repository,.
void setProbedType(const repo::RepoType &t) const
bool triBoolFromPath(const Pathname &path_r, TriBool &ret_r) 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.
std::string getLicense(const Locale &lang_r=Locale()) const
Return the best license for the current (or a specified) locale.
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...
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.
RepoVariablesReplacedUrl _mirrorListUrl
DefaultIntegral< unsigned, defaultPriority > priority
Url url() const
Pars pro toto: The first repository url.
static const RepoInfo noRepo
Represents no Repository (one with an empty alias).
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.
TriBool validRepoSignature() const
Whether the repo metadata are signed and successfully validated or indeterminate if unsigned...
Functor replacing repository variables.
urls_size_type baseUrlsSize() const
number of repository urls
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.
const RepoVariablesReplacedUrlList & baseUrls() const
void setPkgGpgCheck(TriBool value_r)
Set the value for pkgGpgCheck (or indeterminate to use the default).
Url rawGpgKeyUrl() const
The raw gpgKeyUrl (no variables replaced).
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.
xmlTextReader based interface to iterate xml streams.