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();
288 static const std::string noAcceptanceFile =
"no-acceptance-needed\n";
292 if ( licenseTgz.empty() || ! PathInfo( licenseTgz ).isFile() )
296 cmd.push_back(
"tar" );
297 cmd.push_back(
"-t" );
298 cmd.push_back(
"-z" );
299 cmd.push_back(
"-f" );
300 cmd.push_back( licenseTgz.asString() );
305 if ( output == noAcceptanceFile )
310 MIL <<
"License for " << this->
name() <<
" has to be accepted: " << (accept?
"true":
"false" ) << endl;
317 if ( avlocales.empty() )
318 return std::string();
324 WAR <<
"License.tar.gz contains no fallback text! " << *
this << endl;
328 getLang = *avlocales.begin();
332 static const std::string licenseFileFallback(
"license.txt" );
334 ? licenseFileFallback
338 cmd.push_back(
"tar" );
339 cmd.push_back(
"-x" );
340 cmd.push_back(
"-z" );
341 cmd.push_back(
"-O" );
342 cmd.push_back(
"-f" );
344 cmd.push_back( licenseFile );
359 if ( licenseTgz.empty() || ! PathInfo( licenseTgz ).isFile() )
363 cmd.push_back(
"tar" );
364 cmd.push_back(
"-t" );
365 cmd.push_back(
"-z" );
366 cmd.push_back(
"-f" );
367 cmd.push_back( licenseTgz.asString() );
373 static const C_Str license(
"license." );
374 static const C_Str dotTxt(
".txt\n" );
377 if ( output.size() <= license.
size() + dotTxt.
size() )
380 ret.insert(
Locale( std::string( output.c_str()+license.
size(), output.size()- license.
size() - dotTxt.
size() ) ) );
398 str <<
"- url : " << *it << std::endl;
403 auto strif( [&] (
const std::string & tag_r,
const std::string & value_r ) {
404 if ( ! value_r.empty() )
405 str << tag_r << value_r << std::endl;
410 str <<
"- type : " <<
type() << std::endl;
411 str <<
"- priority : " <<
priority() << std::endl;
412 str <<
"- gpgcheck : " <<
gpgCheck() << std::endl;
416 str <<
"- keeppackages: " <<
keepPackages() << std::endl;
418 strif(
"- service : ",
service() );
428 RepoInfoBase::dumpAsIniOn(str);
442 str <<
"path="<<
path() << endl;
450 str <<
"priority=" <<
priority() << endl;
453 str <<
"gpgcheck=" << (
gpgCheck() ?
"1" :
"0") << endl;
461 str <<
"service=" <<
service() << endl;
479 <<
" priority=\"" <<
priority() <<
"\""
480 <<
" enabled=\"" <<
enabled() <<
"\""
482 <<
" gpgcheck=\"" <<
gpgCheck() <<
"\"";
484 str <<
" gpgkey=\"" <<
escape(tmpstr) <<
"\"";
486 str <<
" mirrorlist=\"" <<
escape(tmpstr) <<
"\"";
493 str <<
"<url>" <<
escape(urlit->asString()) <<
"</url>" << endl;
496 str <<
"</repo>" << endl;