40 : repo::RepoInfoBase::
Impl()
41 , gpgcheck(indeterminate)
42 , keeppackages(indeterminate)
43 , type(repo::RepoType::NONE_e)
44 , emptybaseurls(false)
51 static const unsigned defaultPriority = 99;
55 if ( type == repo::RepoType::NONE
56 && t != repo::RepoType::NONE )
59 const_cast<Impl*
>(
this)->type = t;
64 Pathname licenseTgz()
const
65 {
return metadatapath.empty() ? Pathname() : metadatapath / path /
"license.tar.gz"; }
67 Url getmirrorListUrl()
const
68 {
return replacer(mirrorlist_url); }
70 Url &setmirrorListUrl()
71 {
return mirrorlist_url; }
73 const std::set<Url> &baseUrls()
const
75 if ( _baseUrls.empty() && ! (getmirrorListUrl().asString().empty()) )
80 DBG <<
"MetadataPath: " << metadatapath << endl;
81 if( metadatapath.empty() )
86 std::vector<Url> rmurls = rmirrorlist->
getUrls();
89 _baseUrls.insert(rmurls.begin(), rmurls.end());
94 std::set<Url> &baseUrls()
97 bool baseurl2dump()
const
98 {
return !emptybaseurls && !_baseUrls.empty(); }
118 friend Impl * rwcowClone<Impl>(
const Impl * rhs );
121 {
return new Impl( *
this ); }
128 return str <<
"RepoInfo::Impl";
145 : _pimpl( new
Impl() )
240 return replaced_urls;
280 SEC << licenseTgz << endl;
281 SEC << PathInfo(licenseTgz) << endl;
283 return ! licenseTgz.empty() && PathInfo(licenseTgz).isFile();
289 if ( avlocales.empty() )
290 return std::string();
296 WAR <<
"License.tar.gz contains no fallback text! " << *
this << endl;
300 getLang = *avlocales.begin();
304 static const std::string licenseFileFallback(
"license.txt" );
306 ? licenseFileFallback
310 cmd.push_back(
"tar" );
311 cmd.push_back(
"-x" );
312 cmd.push_back(
"-z" );
313 cmd.push_back(
"-O" );
314 cmd.push_back(
"-f" );
316 cmd.push_back( licenseFile );
331 if ( licenseTgz.empty() || ! PathInfo( licenseTgz ).isFile() )
335 cmd.push_back(
"tar" );
336 cmd.push_back(
"-t" );
337 cmd.push_back(
"-z" );
338 cmd.push_back(
"-f" );
339 cmd.push_back( licenseTgz.asString() );
345 static const C_Str license(
"license." );
346 static const C_Str dotTxt(
".txt\n" );
349 if ( output.size() <= license.
size() + dotTxt.
size() )
352 ret.insert(
Locale( std::string( output.c_str()+license.
size(), output.size()- license.
size() - dotTxt.
size() ) ) );
356 WAR <<
" " << output;
374 str <<
"- url : " << *it << std::endl;
379 auto strif( [&] (
const std::string & tag_r,
const std::string & value_r ) {
380 if ( ! value_r.empty() )
381 str << tag_r << value_r << std::endl;
386 str <<
"- type : " <<
type() << std::endl;
387 str <<
"- priority : " <<
priority() << std::endl;
388 str <<
"- gpgcheck : " <<
gpgCheck() << std::endl;
392 str <<
"- keeppackages: " <<
keepPackages() << std::endl;
394 strif(
"- service : ",
service() );
418 str <<
"path="<<
path() << endl;
426 str <<
"priority=" <<
priority() << endl;
429 str <<
"gpgcheck=" << (
gpgCheck() ?
"1" :
"0") << endl;
437 str <<
"service=" <<
service() << endl;
455 <<
" priority=\"" <<
priority() <<
"\""
456 <<
" enabled=\"" <<
enabled() <<
"\""
458 <<
" gpgcheck=\"" <<
gpgCheck() <<
"\"";
460 str <<
" gpgkey=\"" <<
escape(tmpstr) <<
"\"";
462 str <<
" mirrorlist=\"" <<
escape(tmpstr) <<
"\"";
469 str <<
"<url>" <<
escape(urlit->asString()) <<
"</url>" << endl;
472 str <<
"</repo>" << endl;