libzypp: zypp/RepoInfo.cc Source File

libzypp 17.38.11

RepoInfo.cc
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12#include <type_traits>
13#include <iostream>
14#include <vector>
15#include <map>
16#include <string_view>
17
18#include <zypp-core/base/Gettext.h>
19#include <zypp-core/base/LogTools.h>
20#include <zypp-core/base/DefaultIntegral>
21#include <zypp-core/parser/xml/XmlEscape.h>
22#include <zypp-core/ng/meta/type_traits.h>
23
24#include <zypp/ManagedFile.h>
25#include <zypp-common/PublicKey.h>
26#include <zypp/MediaSetAccess.h>
27#include <zypp/RepoInfo.h>
28#include <zypp/Glob.h>
29#include <zypp-core/TriBool.h>
30#include <zypp-core/Pathname.h>
31#include <zypp/ZConfig.h>
32#include <zypp/repo/RepoMirrorList.h>
33#include <zypp/repo/SUSEMediaVerifier.h>
34#include <zypp-core/ExternalProgram.h>
35
36#include <zypp-core/base/IOStream.h>
37#include <zypp-core/base/InputStream>
38#include <zypp/parser/xml/Reader.h>
39
40
41#include <zypp/base/StrMatcher.h>
42#include <zypp/KeyRing.h>
43#include <zypp/TmpPath.h>
44#include <zypp/ZYppFactory.h>
45#include <zypp/ZYppCallbacks.h>
46
47#include <zypp/ng/workflows/repoinfowf.h>
48#include <zypp-curl/private/curlhelper_p.h>
49
50#include <zypp/repo/PackageProvider.h>
51
52using std::endl;
53using zypp::xml::escape;
54
56namespace zypp
57{
58
59 namespace
60 {
61 repo::RepoType probeCache( const Pathname & path_r )
62 {
63 repo::RepoType ret = repo::RepoType::NONE;
64 if ( PathInfo(path_r).isDir() )
65 {
66 if ( PathInfo(path_r/"/repodata/repomd.xml").isFile() )
67 { ret = repo::RepoType::RPMMD; }
68 else if ( PathInfo(path_r/"/content").isFile() )
69 { ret = repo::RepoType::YAST2; }
70 else if ( PathInfo(path_r/"/cookie").isFile() )
71 { ret = repo::RepoType::RPMPLAINDIR; }
72 }
73 DBG << "Probed cached type " << ret << " at " << path_r << endl;
74 return ret;
75 }
76 } // namespace
77
78 namespace repo {
79 namespace env {
83 inline filesystem::Pathname XDG_CACHE_HOME()
84 {
85 filesystem::Pathname ret;
86 const char * envp = getenv( "XDG_CACHE_HOME" );
87 if ( envp && *envp )
88 ret = envp;
89 else
90 {
91 ret = getenv( "HOME" );
92 ret /= ".cache";
93 }
94 return ret;
95 }
96 }
97 }
98
100 //
101 // CLASS NAME : RepoInfo::Impl
102 //
104 struct RepoInfo::Impl
105 {
106 Impl()
107 : _rawGpgCheck( indeterminate )
108 , _rawRepoGpgCheck( indeterminate )
109 , _rawPkgGpgCheck( indeterminate )
110 , _validRepoSignature( indeterminate )
111 , _type(repo::RepoType::NONE_e)
112 , keeppackages(indeterminate)
113 {}
114
115 Impl(const Impl &) = default;
116 Impl(Impl &&) = delete;
117 Impl &operator=(const Impl &) = delete;
118 Impl &operator=(Impl &&) = delete;
119
120 ~Impl() {}
121
122 public:
123 static const unsigned defaultPriority = 99;
124 static const unsigned noPriority = unsigned(-1);
125
126 void setType( const repo::RepoType & t )
127 { _type = t; }
128
129 void setProbedType( const repo::RepoType & t ) const
130 {
131 if ( _type == repo::RepoType::NONE && t != repo::RepoType::NONE )
132 { const_cast<Impl*>(this)->_type = t; }
133 }
134
135 repo::RepoType type() const
136 {
137 if ( _type == repo::RepoType::NONE && not metadataPath().empty() )
138 setProbedType( probeCache( metadataPath() / path ) );
139 return _type;
140 }
141
142 public:
144 Pathname licenseTgz( const std::string & name_r ) const
145 {
146 Pathname ret;
147 if ( !metadataPath().empty() )
148 {
149 std::string licenseStem( "license" );
150 if ( !name_r.empty() )
151 {
152 licenseStem += "-";
153 licenseStem += name_r;
154 }
155
156 filesystem::Glob g;
157 // TODO: REPOMD: this assumes we know the name of the tarball. In fact
158 // we'd need to get the file from repomd.xml (<data type="license[-name_r]">)
159 g.add( metadataPath() / path / ("repodata/*"+licenseStem+".tar.gz") );
160 if ( g.empty() )
161 g.add( metadataPath() / path / (licenseStem+".tar.gz") );
162
163 if ( !g.empty() )
164 ret = *g.begin();
165 }
166 return ret;
167 }
168
169 RepoVariablesReplacedUrl baseUrl() const {
170 if ( !_baseUrls.empty() ) {
171 return RepoVariablesReplacedUrl( _baseUrls.raw().front(), _baseUrls.transformator() );
172 }
173 if ( !mirrorUrls().empty() ){
174 return RepoVariablesReplacedUrl( _mirrorUrls.raw().front(), _mirrorUrls.transformator() );
175 }
176 return RepoVariablesReplacedUrl();
177 }
178
179 const RepoVariablesReplacedUrlList & baseUrls() const
180 {
181 return _baseUrls;
182 }
183
184 Url location() const {
185 if ( !_baseUrls.empty() )
186 return *_baseUrls.transformedBegin ();
187 return mirrorListUrl().transformed();
188 }
189
190 void resetMirrorUrls() const {
191 _mirrorUrls.clear ();
192 _lastMirrorUrlsUpdate = std::chrono::steady_clock::time_point::min();
193 }
194
200 RepoVariablesReplacedUrlList & mirrorUrls() const
201 {
202 // do not change order of calculation, using std::chrono::steady_clock::now() - _lastMirrorUrlsUpdate
203 // will overflow the internal counter if _lastMirrorUrlsUpdate is still time_point::min and result
204 // in a negative value.
205 if ( ( std::chrono::steady_clock::now() - std::chrono::hours(1) ) < _lastMirrorUrlsUpdate )
206 return _mirrorUrls;
207
208 _mirrorUrls.clear();
209 _lastMirrorUrlsUpdate = std::chrono::steady_clock::now();
210
211 bool isAutoMirrorList = false; // bsc#1243901 Allows mirrorlist parsing to fail if automatically switched on
212
213 Url mlurl( mirrorListUrl().transformed() ); // Variables replaced!
214 if ( mlurl.asString().empty()
215 && _baseUrls.raw().size() == 1
216 && repo::RepoMirrorList::urlSupportsMirrorLink( *_baseUrls.transformedBegin() ) ) {
217
218 mlurl = *_baseUrls.transformedBegin ();
219 if ( !path.emptyOrRoot () )
220 mlurl.setPathName(path);
221 mlurl.pathNameSetTrailingSlash();
222 mlurl.setQueryParam("mirrorlist", std::string() );
223
224 MIL << "Detected opensuse.org baseUrl with no mirrors, requesting them from : " << mlurl.asString() << std::endl;
225 isAutoMirrorList = true;
226 }
227
228 if ( !mlurl.asString().empty() ) {
229 try {
230 DBG << "MetadataPath: " << metadataPath() << endl;
231 repo::RepoMirrorList rmurls( mlurl, metadataPath() );
232
233 // propagate internally used URL params like 'proxy' to the mirrors
234 const auto &tf = [urlTemplate =mirrorListUrl().transformed()]( const zypp::Url &in ){
235 return internal::propagateQueryParams ( in , urlTemplate );
236 };
237
238 _mirrorUrls.raw().insert( _mirrorUrls.raw().end(), make_transform_iterator( rmurls.getUrls().begin(), tf ), make_transform_iterator( rmurls.getUrls().end(), tf ) );
239 } catch ( const zypp::Exception & e ) {
240 // failed to fetch the mirrorlist/metalink, if we still have a baseUrl we can go on, otherwise this is a error
241 MIL << "Mirrorlist failed, repo either returns invalid data or has no mirrors at all!" << std::endl;
242 if ( !isAutoMirrorList ) {
243 callback::UserData data( JobReport::repoRefreshMirrorlist );
244 data.set("error", e );
245 JobReport::warning( _("Failed to fetch mirrorlist/metalink data."), data );
246
247 // in case of error, we want to try again asap
248 _lastMirrorUrlsUpdate = std::chrono::steady_clock::time_point::min();
249 }
250 }
251 }
252 return _mirrorUrls;
253 }
254
255 MirroredOriginSet repoOrigins() const
256 {
257 MirroredOriginSet origins;
258 std::for_each( _baseUrls.transformedBegin(), _baseUrls.transformedEnd(), [&]( OriginEndpoint ep ) {
259 origins.addAuthorityEndpoint( std::move(ep) );
260 });
261
262 const auto &mirrs = mirrorUrls ();
263 origins.addEndpoints( mirrs.transformedBegin(), mirrs.transformedEnd() );
264
265 return origins;
266 }
267
268 RepoVariablesReplacedUrlList & baseUrls()
269 { return _baseUrls; }
270
271 bool baseurl2dump() const
272 { return !_baseUrls.empty(); }
273
274
275 const RepoVariablesReplacedUrlList & gpgKeyUrls() const
276 { return _gpgKeyUrls; }
277
278 RepoVariablesReplacedUrlList & gpgKeyUrls()
279 { return _gpgKeyUrls; }
280
281 std::string repoStatusString() const
282 {
283 if ( mirrorListUrl().transformed().isValid() )
284 return mirrorListUrl().transformed().asString();
285 if ( !baseUrls().empty() )
286 return (*baseUrls().transformedBegin()).asString();
287 return std::string();
288 }
289
290 const std::set<std::string> & contentKeywords() const
291 { hasContent()/*init if not yet done*/; return _keywords.second; }
292
293 void addContent( const std::string & keyword_r )
294 { _keywords.second.insert( keyword_r ); if ( ! hasContent() ) _keywords.first = true; }
295
296 bool hasContent() const
297 {
298 if ( !_keywords.first && ! metadataPath().empty() )
299 {
300 // HACK directly check master index file until RepoManager offers
301 // some content probing and zypper uses it.
303 MIL << "Empty keywords...." << metadataPath() << endl;
304 Pathname master;
305 if ( PathInfo( (master=metadataPath()/"/repodata/repomd.xml") ).isFile() )
306 {
307 //MIL << "GO repomd.." << endl;
308 xml::Reader reader( master );
309 while ( reader.seekToNode( 2, "content" ) )
310 {
311 _keywords.second.insert( reader.nodeText().asString() );
312 reader.seekToEndNode( 2, "content" );
313 }
314 _keywords.first = true; // valid content in _keywords even if empty
315 }
316 else if ( PathInfo( (master=metadataPath()/"/content") ).isFile() )
317 {
318 //MIL << "GO content.." << endl;
319 iostr::forEachLine( InputStream( master ),
320 [this]( int num_r, const std::string& line_r )->bool
321 {
322 if ( str::startsWith( line_r, "REPOKEYWORDS" ) )
323 {
324 std::vector<std::string> words;
325 if ( str::split( line_r, std::back_inserter(words) ) > 1
326 && words[0].length() == 12 /*"REPOKEYWORDS"*/ )
327 {
328 this->_keywords.second.insert( ++words.begin(), words.end() );
329 }
330 return true; // mult. occurrances are ok.
331 }
332 return( ! str::startsWith( line_r, "META " ) ); // no need to parse into META section.
333 } );
334 _keywords.first = true; // valid content in _keywords even if empty
335 }
337 }
338 return _keywords.first;
339 }
340
341 bool hasContent( const std::string & keyword_r ) const
342 { return( hasContent() && _keywords.second.find( keyword_r ) != _keywords.second.end() ); }
343
348 TriBool internalValidRepoSignature() const
349 {
350 if ( ! indeterminate(_validRepoSignature) )
351 return _validRepoSignature;
352 // check metadata:
353 if ( ! metadataPath().empty() )
354 {
355 // A missing ".repo_gpgcheck" might be plaindir(no Downloader) or not yet refreshed signed repo!
356 TriBool linkval = triBoolFromPath( metadataPath() / ".repo_gpgcheck" );
357 return linkval;
358 }
359 return indeterminate;
360 }
361
362 void internalSetValidRepoSignature( TriBool value_r )
363 {
364 if ( PathInfo(metadataPath()).isDir() )
365 {
366 Pathname gpgcheckFile( metadataPath() / ".repo_gpgcheck" );
367 if ( PathInfo(gpgcheckFile).isExist() )
368 {
369 TriBool linkval( indeterminate );
370 if ( triBoolFromPath( gpgcheckFile, linkval ) && linkval == value_r )
371 return; // existing symlink fits value_r
372 else
373 filesystem::unlink( gpgcheckFile ); // will write a new one
374 }
375 filesystem::symlink( asString(value_r), gpgcheckFile );
376 }
377 _validRepoSignature = value_r;
378 }
379
384 bool internalUnsignedConfirmed() const
385 {
386 TriBool linkval( true ); // want to see it being switched to indeterminate
387 return triBoolFromPath( metadataPath() / ".repo_gpgcheck", linkval ) && indeterminate(linkval);
388 }
389
390 bool triBoolFromPath( const Pathname & path_r, TriBool & ret_r ) const
391 {
392 static const Pathname truePath( "true" );
393 static const Pathname falsePath( "false" );
394 static const Pathname indeterminatePath( "indeterminate" );
395
396 // Quiet readlink;
397 static const ssize_t bufsiz = 63;
398 static char buf[bufsiz+1];
399 ssize_t ret = ::readlink( path_r.c_str(), buf, bufsiz );
400 buf[ret == -1 ? 0 : ret] = '\0';
401
402 Pathname linkval( buf );
403
404 bool known = true;
405 if ( linkval == truePath )
406 ret_r = true;
407 else if ( linkval == falsePath )
408 ret_r = false;
409 else if ( linkval == indeterminatePath )
410 ret_r = indeterminate;
411 else
412 known = false;
413 return known;
414 }
415
416 TriBool triBoolFromPath( const Pathname & path_r ) const
417 { TriBool ret(indeterminate); triBoolFromPath( path_r, ret ); return ret; }
418
420
421 private:
422 TriBool _rawGpgCheck;
423 TriBool _rawRepoGpgCheck;
424 TriBool _rawPkgGpgCheck;
425
426 public:
427 TriBool rawGpgCheck() const { return _rawGpgCheck; }
428 TriBool rawRepoGpgCheck() const { return _rawRepoGpgCheck; }
429 TriBool rawPkgGpgCheck() const { return _rawPkgGpgCheck; }
430
431 void rawGpgCheck( TriBool val_r ) { _rawGpgCheck = val_r; }
432 void rawRepoGpgCheck( TriBool val_r ) { _rawRepoGpgCheck = val_r; }
433 void rawPkgGpgCheck( TriBool val_r ) { _rawPkgGpgCheck = val_r; }
434
435 bool cfgGpgCheck() const
436 { return indeterminate(_rawGpgCheck) ? ZConfig::instance().gpgCheck() : (bool)_rawGpgCheck; }
437 TriBool cfgRepoGpgCheck() const
438 { return indeterminate(_rawGpgCheck) && indeterminate(_rawRepoGpgCheck) ? ZConfig::instance().repoGpgCheck() : _rawRepoGpgCheck; }
439 TriBool cfgPkgGpgCheck() const
440 { return indeterminate(_rawGpgCheck) && indeterminate(_rawPkgGpgCheck) ? ZConfig::instance().pkgGpgCheck() : _rawPkgGpgCheck; }
441
442 private:
443 TriBool _validRepoSignature;
444 repo::RepoType _type;
445
446 private:
447 RepoVariablesReplacedUrl _cfgMirrorlistUrl;
448 RepoVariablesReplacedUrl _cfgMetalinkUrl;
449 public:
451 const RepoVariablesReplacedUrl & mirrorListUrl() const
452 { return _cfgMirrorlistUrl.transformed().isValid() ? _cfgMirrorlistUrl : _cfgMetalinkUrl; }
453
454 void setMirrorlistUrl( const Url & url_r ) // Raw
455 { _cfgMirrorlistUrl.raw() = url_r; }
456
457 void setMetalinkUrl( const Url & url_r ) // Raw
458 { _cfgMetalinkUrl.raw() = url_r; }
459
461 const RepoVariablesReplacedUrl & cfgMirrorlistUrl() const
462 { return _cfgMirrorlistUrl; }
463
464 const RepoVariablesReplacedUrl & cfgMetalinkUrl() const
465 { return _cfgMetalinkUrl; }
466
467 public:
468 TriBool keeppackages;
469 Pathname path;
470 std::string service;
471 std::string targetDistro;
472
473 void metadataPath( Pathname new_r )
474 { _metadataPath = std::move( new_r ); }
475
476 void packagesPath( Pathname new_r )
477 {
478 _packagesPath = std::move( new_r );
479 if ( not _packagesPath.empty() && zypp::IamNotRoot() && not userMayWriteOrCreateDir( _packagesPath ) ) {
480 _alternatePackagesPath = zypp::repo::env::XDG_CACHE_HOME() / "zypp/packages" / _packagesPath.basename();
481 WAR << "systemPackagesPath " << _packagesPath << " is not user writable, may use " << *_alternatePackagesPath << endl;
482 } else {
483 _alternatePackagesPath.reset();
484 }
485 }
486
487 bool usesAutoMetadataPaths() const
488 { return str::hasSuffix( _metadataPath.asString(), "/%AUTO%" ); }
489
490 Pathname metadataPath() const
491 {
492 if ( usesAutoMetadataPaths() )
493 return _metadataPath.dirname() / "%RAW%";
494 return _metadataPath;
495 }
496
497 Pathname systemPackagesPath() const
498 {
499 if ( _packagesPath.empty() && usesAutoMetadataPaths() )
500 return _metadataPath.dirname() / "%PKG%";
501 return _packagesPath;
502 }
503
504 Pathname packagesPath() const
505 {
506 return _alternatePackagesPath ? *_alternatePackagesPath : systemPackagesPath();
507 }
508
509 Pathname predownloadPath() const
510 {
511 return packagesPath() / ".preload";
512 }
513
514 DefaultIntegral<unsigned,defaultPriority> priority;
515
516 public:
517 std::map<std::string,std::string> _extraValues;
518
523 TriBool isBuiltinExtraValue( std::string_view key_r ) const
524 {
525 static const std::set<std::string_view> _builtins { {
526 "repo_sigcheck_plugin",
527 } };
528 if ( _builtins.count( key_r ) )
529 return true;
530 if ( key_r.find( '=' ) == std::string::npos )
531 return false;
532 return indeterminate;
533 }
534
535 bool hasExtraValue( const std::string & key_r ) const
536 { return _extraValues.count( key_r ); }
537
538 std::string extraValue( const std::string & key_r ) const
539 { return _extraValues.at( key_r ); } // let it throw
540
541 bool setExtraValue( const std::string & key_r, std::string value_r )
542 {
543 _extraValues[key_r] = std::move(value_r);
544 return bool(isBuiltinExtraValue( key_r ));
545 }
546
548 template <typename Fnc>
549 void forDumpableExtraValues( Fnc && fnc_r ) const
550 {
551 for ( const auto & [k,v] : _extraValues ) {
552 TriBool dumpable = isBuiltinExtraValue( k );
553 if ( indeterminate(dumpable) )
554 continue;
555 if constexpr ( std::is_invocable_v<Fnc, std::string_view, std::string_view, bool> ) {
556 fnc_r( k, v, bool(dumpable) );
557 }
558 else if constexpr ( std::is_invocable_v<Fnc, std::string_view, std::string_view> ) {
559 fnc_r( k, v );
560 }
561 else {
562 static_assert( zyppng::always_false_v<Fnc>, "Lambda must accept (k, v) or (k, v, b)" );
563 }
564 }
565 }
566
567 private:
568 Pathname _metadataPath;
569 Pathname _packagesPath;
570 std::optional<Pathname> _alternatePackagesPath;
571
572 mutable RepoVariablesReplacedUrlList _baseUrls;
573
574 mutable RepoVariablesReplacedUrlList _mirrorUrls;
575 mutable std::chrono::steady_clock::time_point _lastMirrorUrlsUpdate = std::chrono::steady_clock::time_point::min();
576 mutable std::vector<MirroredOrigin> _repoOrigins;
577
578 mutable std::pair<FalseBool, std::set<std::string> > _keywords;
579
580 RepoVariablesReplacedUrlList _gpgKeyUrls;
581
582 friend Impl * rwcowClone<Impl>( const Impl * rhs );
584 Impl * clone() const
585 { return new Impl( *this ); }
586 };
587
588
590 inline std::ostream & operator<<( std::ostream & str, const RepoInfo::Impl & obj )
591 {
592 return str << "RepoInfo::Impl";
593 }
594
596 //
597 // CLASS NAME : RepoInfo
598 //
600
601 const RepoInfo RepoInfo::noRepo;
602
603 RepoInfo::RepoInfo()
604 : _pimpl( new Impl() )
605 {}
606
607 RepoInfo::~RepoInfo()
608 {}
609
610 unsigned RepoInfo::priority() const
611 { return _pimpl->priority; }
612
613 unsigned RepoInfo::defaultPriority()
614 { return Impl::defaultPriority; }
615
616 unsigned RepoInfo::noPriority()
617 { return Impl::noPriority; }
618
619 void RepoInfo::setPriority( unsigned newval_r )
620 { _pimpl->priority = newval_r ? newval_r : Impl::defaultPriority; }
621
622
623 bool RepoInfo::gpgCheck() const
624 { return _pimpl->cfgGpgCheck(); }
625
626 void RepoInfo::setGpgCheck( TriBool value_r )
627 { _pimpl->rawGpgCheck( value_r ); }
628
629 void RepoInfo::setGpgCheck( bool value_r ) // deprecated legacy and for squid
630 { setGpgCheck( TriBool(value_r) ); }
631
632
633 bool RepoInfo::repoGpgCheck() const
634 { return gpgCheck() || bool(_pimpl->cfgRepoGpgCheck()); }
635
636 bool RepoInfo::repoGpgCheckIsMandatory() const
637 {
638 bool ret = ( gpgCheck() && indeterminate(_pimpl->cfgRepoGpgCheck()) ) || bool(_pimpl->cfgRepoGpgCheck());
639 if ( ret && _pimpl->internalUnsignedConfirmed() ) // relax if unsigned repo was confirmed in the past
640 ret = false;
641 return ret;
642 }
643
644 void RepoInfo::setRepoGpgCheck( TriBool value_r )
645 { _pimpl->rawRepoGpgCheck( value_r ); }
646
647
648 bool RepoInfo::pkgGpgCheck() const
649 { return bool(_pimpl->cfgPkgGpgCheck()) || ( gpgCheck() && !bool(validRepoSignature())/*enforced*/ ) ; }
650
651 bool RepoInfo::pkgGpgCheckIsMandatory() const
652 { return bool(_pimpl->cfgPkgGpgCheck()) || ( gpgCheck() && indeterminate(_pimpl->cfgPkgGpgCheck()) && !bool(validRepoSignature())/*enforced*/ ); }
653
654 void RepoInfo::setPkgGpgCheck( TriBool value_r )
655 { _pimpl->rawPkgGpgCheck( value_r ); }
656
657
658 void RepoInfo::getRawGpgChecks( TriBool & g_r, TriBool & r_r, TriBool & p_r ) const
659 {
660 g_r = _pimpl->rawGpgCheck();
661 r_r = _pimpl->rawRepoGpgCheck();
662 p_r = _pimpl->rawPkgGpgCheck();
663 }
664
665
666 TriBool RepoInfo::validRepoSignature() const
667 {
668 TriBool ret( _pimpl->internalValidRepoSignature() );
669 if ( ret && !repoGpgCheck() ) ret = false; // invalidate any old signature if repoGpgCheck is off
670 return ret;
671 }
672
673 void RepoInfo::setValidRepoSignature( TriBool value_r )
674 { _pimpl->internalSetValidRepoSignature( value_r ); }
675
677 namespace
678 {
679 inline bool changeGpgCheckTo( TriBool & lhs, TriBool rhs )
680 { if ( ! sameTriboolState( lhs, rhs ) ) { lhs = rhs; return true; } return false; }
681
682 inline bool changeGpgCheckTo( TriBool ogpg[3], TriBool g, TriBool r, TriBool p )
683 {
684 bool changed = false;
685 if ( changeGpgCheckTo( ogpg[0], g ) ) changed = true;
686 if ( changeGpgCheckTo( ogpg[1], r ) ) changed = true;
687 if ( changeGpgCheckTo( ogpg[2], p ) ) changed = true;
688 return changed;
689 }
690 } // namespace
692 bool RepoInfo::setGpgCheck( GpgCheck mode_r )
693 {
694 TriBool ogpg[3]; // Gpg RepoGpg PkgGpg
695 getRawGpgChecks( ogpg[0], ogpg[1], ogpg[2] );
696
697 bool changed = false;
698 switch ( mode_r )
699 {
700 case GpgCheck::On:
701 changed = changeGpgCheckTo( ogpg, true, indeterminate, indeterminate );
702 break;
703 case GpgCheck::Strict:
704 changed = changeGpgCheckTo( ogpg, true, true, true );
705 break;
706 case GpgCheck::AllowUnsigned:
707 changed = changeGpgCheckTo( ogpg, true, false, false );
708 break;
709 case GpgCheck::AllowUnsignedRepo:
710 changed = changeGpgCheckTo( ogpg, true, false, indeterminate );
711 break;
712 case GpgCheck::AllowUnsignedPackage:
713 changed = changeGpgCheckTo( ogpg, true, indeterminate, false );
714 break;
715 case GpgCheck::Default:
716 changed = changeGpgCheckTo( ogpg, indeterminate, indeterminate, indeterminate );
717 break;
718 case GpgCheck::Off:
719 changed = changeGpgCheckTo( ogpg, false, indeterminate, indeterminate );
720 break;
721 case GpgCheck::indeterminate: // no change
722 break;
723 }
724
725 if ( changed )
726 {
727 setGpgCheck ( ogpg[0] );
728 setRepoGpgCheck( ogpg[1] );
729 setPkgGpgCheck ( ogpg[2] );
730 }
731 return changed;
732 }
733
734 void RepoInfo::setMirrorlistUrl( const Url & url_r ) // Raw
735 { _pimpl->setMirrorlistUrl( url_r ); }
736
737 void RepoInfo::setMetalinkUrl( const Url & url_r ) // Raw
738 { _pimpl->setMetalinkUrl( url_r ); }
739
740 Url RepoInfo::rawCfgMirrorlistUrl() const
741 { return _pimpl->cfgMirrorlistUrl().raw(); }
742
743 Url RepoInfo::rawCfgMetalinkUrl() const
744 { return _pimpl->cfgMetalinkUrl().raw(); }
745
746#if LEGACY(1735)
747 void RepoInfo::setMirrorListUrl( const Url & url_r ) // Raw
748 { setMirrorlistUrl( url_r ); }
749 void RepoInfo::setMirrorListUrls( url_set urls ) // Raw
750 { _pimpl->setMirrorlistUrl( urls.empty() ? Url() : urls.front() ); }
751 void RepoInfo::setMetalinkUrls( url_set urls ) // Raw
752 { _pimpl->setMetalinkUrl( urls.empty() ? Url() : urls.front() ); }
753#endif
754
755 void RepoInfo::setGpgKeyUrls( url_set urls )
756 { _pimpl->gpgKeyUrls().raw().swap( urls ); }
757
758 void RepoInfo::setGpgKeyUrl( const Url & url_r )
759 {
760 _pimpl->gpgKeyUrls().raw().clear();
761 _pimpl->gpgKeyUrls().raw().push_back( url_r );
762 }
763
764 std::string RepoInfo::repoStatusString() const
765 { return _pimpl->repoStatusString(); }
766
767 void RepoInfo::addBaseUrl( Url url_r )
768 {
769 for ( const auto & url : _pimpl->baseUrls().raw() ) // Raw unique!
770 if ( url == url_r )
771 return;
772
773 _pimpl->baseUrls().raw().push_back( url_r );
774 _pimpl->resetMirrorUrls ();
775 }
776
777 void RepoInfo::setBaseUrl( Url url_r )
778 {
779 _pimpl->baseUrls().raw().clear();
780 _pimpl->resetMirrorUrls ();
781 _pimpl->baseUrls().raw().push_back( std::move(url_r) );
782 }
783
784 void RepoInfo::setBaseUrls( url_set urls )
785 {
786 _pimpl->resetMirrorUrls ();
787 _pimpl->baseUrls().raw().swap( urls );
788 }
789
790 MirroredOriginSet RepoInfo::repoOrigins() const
791 {
792 return _pimpl->repoOrigins();
793 }
794
795 bool RepoInfo::repoOriginsEmpty() const
796 {
797 return ( _pimpl->baseUrls().empty () && _pimpl->mirrorUrls().empty() );
798 }
799
800 void RepoInfo::setPath( const Pathname &path )
801 { _pimpl->path = path; }
802
803 void RepoInfo::setType( const repo::RepoType &t )
804 { _pimpl->setType( t ); }
805
806 void RepoInfo::setProbedType( const repo::RepoType &t ) const
807 { _pimpl->setProbedType( t ); }
808
809
810 void RepoInfo::setMetadataPath( const Pathname &path )
811 { _pimpl->metadataPath( path ); }
812
813 void RepoInfo::setPackagesPath( const Pathname &path )
814 { _pimpl->packagesPath( path ); }
815
816 Pathname RepoInfo::predownloadPath() const
817 { return _pimpl->predownloadPath(); }
818
819 void RepoInfo::setKeepPackages( bool keep )
820 { _pimpl->keeppackages = keep; }
821
822 void RepoInfo::setService( const std::string& name )
823 { _pimpl->service = name; }
824
825 void RepoInfo::setTargetDistribution( const std::string & targetDistribution )
826 { _pimpl->targetDistro = targetDistribution; }
827
828 bool RepoInfo::keepPackages() const
829 { return indeterminate(_pimpl->keeppackages) ? false : (bool)_pimpl->keeppackages; }
830
831 bool RepoInfo::effectiveKeepPackages() const
832 { return keepPackages() || PathInfo(packagesPath().dirname()/".keep_packages").isExist(); }
833
834 Pathname RepoInfo::metadataPath() const
835 { return _pimpl->metadataPath(); }
836
837 Pathname RepoInfo::systemPackagesPath() const
838 { return _pimpl->systemPackagesPath(); }
839
840 Pathname RepoInfo::packagesPath() const
841 { return _pimpl->packagesPath(); }
842
843 bool RepoInfo::usesAutoMetadataPaths() const
844 { return _pimpl->usesAutoMetadataPaths(); }
845
846 repo::RepoType RepoInfo::type() const
847 { return _pimpl->type(); }
848
849 Url RepoInfo::mirrorListUrl() const // Variables replaced!
850 { return _pimpl->mirrorListUrl().transformed(); }
851
852 Url RepoInfo::rawMirrorListUrl() const // Raw
853 { return _pimpl->mirrorListUrl().raw(); }
854
855 bool RepoInfo::gpgKeyUrlsEmpty() const
856 { return _pimpl->gpgKeyUrls().empty(); }
857
858 RepoInfo::urls_size_type RepoInfo::gpgKeyUrlsSize() const
859 { return _pimpl->gpgKeyUrls().size(); }
860
861 RepoInfo::url_set RepoInfo::gpgKeyUrls() const // Variables replaced!
862 { return _pimpl->gpgKeyUrls().transformed(); }
863
864 RepoInfo::url_set RepoInfo::rawGpgKeyUrls() const // Raw
865 { return _pimpl->gpgKeyUrls().raw(); }
866
867 Url RepoInfo::gpgKeyUrl() const // Variables replaced!
868 { return( _pimpl->gpgKeyUrls().empty() ? Url() : *_pimpl->gpgKeyUrls().transformedBegin() ); }
869
870 Url RepoInfo::rawGpgKeyUrl() const // Raw
871 { return( _pimpl->gpgKeyUrls().empty() ? Url() : *_pimpl->gpgKeyUrls().rawBegin() ) ; }
872
873 RepoInfo::url_set RepoInfo::baseUrls() const // Variables replaced!
874 { return _pimpl->baseUrls().transformed(); }
875
876 RepoInfo::url_set RepoInfo::rawBaseUrls() const // Raw
877 { return _pimpl->baseUrls().raw(); }
878
879 Pathname RepoInfo::path() const
880 { return _pimpl->path; }
881
882 std::string RepoInfo::service() const
883 { return _pimpl->service; }
884
885 std::string RepoInfo::targetDistribution() const
886 { return _pimpl->targetDistro; }
887
888 Url RepoInfo::rawUrl() const
889 { return _pimpl->baseUrl().raw(); }
890
891 Url RepoInfo::location() const
892 { return _pimpl->location (); }
893
894 RepoInfo::urls_const_iterator RepoInfo::baseUrlsBegin() const
895 { return _pimpl->baseUrls().transformedBegin(); }
896
897 RepoInfo::urls_const_iterator RepoInfo::baseUrlsEnd() const
898 { return _pimpl->baseUrls().transformedEnd(); }
899
900 RepoInfo::urls_size_type RepoInfo::baseUrlsSize() const
901 { return _pimpl->baseUrls().size(); }
902
903 bool RepoInfo::baseUrlsEmpty() const
904 { return _pimpl->baseUrls().empty(); }
905
906 bool RepoInfo::baseUrlSet() const
907 { return _pimpl->baseurl2dump(); }
908
909 Url RepoInfo::url() const
910 {
911 return _pimpl->baseUrl().transformed();
912 }
913
914 const std::set<std::string> & RepoInfo::contentKeywords() const
915 { return _pimpl->contentKeywords(); }
916
917 void RepoInfo::addContent( const std::string & keyword_r )
918 { _pimpl->addContent( keyword_r ); }
919
920 bool RepoInfo::hasContent() const
921 { return _pimpl->hasContent(); }
922
923 bool RepoInfo::hasContent( const std::string & keyword_r ) const
924 { return _pimpl->hasContent( keyword_r ); }
925
927
928 bool RepoInfo::hasLicense() const
929 { return hasLicense( std::string() ); }
930
931 bool RepoInfo::hasLicense( const std::string & name_r ) const
932 { return !_pimpl->licenseTgz( name_r ).empty(); }
933
934
935 bool RepoInfo::needToAcceptLicense() const
936 { return needToAcceptLicense( std::string() ); }
937
938 bool RepoInfo::needToAcceptLicense( const std::string & name_r ) const
939 {
940 const Pathname & licenseTgz( _pimpl->licenseTgz( name_r ) );
941 if ( licenseTgz.empty() )
942 return false; // no licenses at all
943
944 ExternalProgram::Arguments cmd;
945 cmd.push_back( "tar" );
946 cmd.push_back( "-t" );
947 cmd.push_back( "-z" );
948 cmd.push_back( "-f" );
949 cmd.push_back( licenseTgz.asString() );
950 ExternalProgram prog( cmd, ExternalProgram::Stderr_To_Stdout );
951
952 bool accept = true;
953 static const std::string noAcceptanceFile = "no-acceptance-needed\n";
954 for ( std::string output( prog.receiveLine() ); output.length(); output = prog.receiveLine() )
955 {
956 if ( output == noAcceptanceFile )
957 {
958 accept = false;
959 }
960 }
961 prog.close();
962 MIL << "License(" << name_r << ") in " << name() << " has to be accepted: " << (accept?"true":"false" ) << endl;
963 return accept;
964 }
965
966
967 std::string RepoInfo::getLicense( const Locale & lang_r )
968 { return const_cast<const RepoInfo *>(this)->getLicense( std::string(), lang_r ); }
969
970 std::string RepoInfo::getLicense( const Locale & lang_r ) const
971 { return getLicense( std::string(), lang_r ); }
972
973 std::string RepoInfo::getLicense( const std::string & name_r, const Locale & lang_r ) const
974 {
975 LocaleSet avlocales( getLicenseLocales( name_r ) );
976 if ( avlocales.empty() )
977 return std::string();
978
979 Locale getLang( Locale::bestMatch( avlocales, lang_r ) );
980 if ( !getLang && avlocales.find( Locale::noCode ) == avlocales.end() )
981 {
982 WAR << "License(" << name_r << ") in " << name() << " contains no fallback text!" << endl;
983 // Using the fist locale instead of returning no text at all.
984 // So the user might recognize that there is a license, even if they
985 // can't read it.
986 getLang = *avlocales.begin();
987 }
988
989 // now extract the license file.
990 static const std::string licenseFileFallback( "license.txt" );
991 std::string licenseFile( !getLang ? licenseFileFallback
992 : str::form( "license.%s.txt", getLang.c_str() ) );
993
994 ExternalProgram::Arguments cmd;
995 cmd.push_back( "tar" );
996 cmd.push_back( "-x" );
997 cmd.push_back( "-z" );
998 cmd.push_back( "-O" );
999 cmd.push_back( "-f" );
1000 cmd.push_back( _pimpl->licenseTgz( name_r ).asString() ); // if it not exists, avlocales was empty.
1001 cmd.push_back( licenseFile );
1002
1003 std::string ret;
1004 ExternalProgram prog( cmd, ExternalProgram::Discard_Stderr );
1005 for ( std::string output( prog.receiveLine() ); output.length(); output = prog.receiveLine() )
1006 {
1007 ret += output;
1008 }
1009 prog.close();
1010 return ret;
1011 }
1012
1013
1014 LocaleSet RepoInfo::getLicenseLocales() const
1015 { return getLicenseLocales( std::string() ); }
1016
1017 LocaleSet RepoInfo::getLicenseLocales( const std::string & name_r ) const
1018 {
1019 const Pathname & licenseTgz( _pimpl->licenseTgz( name_r ) );
1020 if ( licenseTgz.empty() )
1021 return LocaleSet();
1022
1023 ExternalProgram::Arguments cmd;
1024 cmd.push_back( "tar" );
1025 cmd.push_back( "-t" );
1026 cmd.push_back( "-z" );
1027 cmd.push_back( "-f" );
1028 cmd.push_back( licenseTgz.asString() );
1029
1030 LocaleSet ret;
1031 ExternalProgram prog( cmd, ExternalProgram::Stderr_To_Stdout );
1032 for ( std::string output( prog.receiveLine() ); output.length(); output = prog.receiveLine() )
1033 {
1034 static const C_Str license( "license." );
1035 static const C_Str dotTxt( ".txt\n" );
1036 if ( str::hasPrefix( output, license ) && str::hasSuffix( output, dotTxt ) )
1037 {
1038 if ( output.size() <= license.size() + dotTxt.size() ) // license.txt
1039 ret.insert( Locale() );
1040 else
1041 ret.insert( Locale( std::string( output.c_str()+license.size(), output.size()- license.size() - dotTxt.size() ) ) );
1042 }
1043 }
1044 prog.close();
1045 return ret;
1046 }
1047
1049
1050 std::ostream & RepoInfo::dumpOn( std::ostream & str ) const
1051 {
1052 RepoInfoBase::dumpOn(str);
1053 if ( _pimpl->baseurl2dump() )
1054 {
1055 for ( const auto & url : _pimpl->baseUrls().raw() )
1056 {
1057 str << "- url : " << url << std::endl;
1058 }
1059 }
1060
1061 // print if non empty value
1062 auto strif( [&] ( const std::string & tag_r, const std::string & value_r ) {
1063 if ( ! value_r.empty() )
1064 str << tag_r << value_r << std::endl;
1065 });
1066
1067 strif( "- mirrorlist : ", _pimpl->cfgMirrorlistUrl().raw().asString() );
1068 strif( "- metalink : ", _pimpl->cfgMetalinkUrl().raw().asString() );
1069 strif( "- path : ", path().asString() );
1070 str << "- type : " << type() << std::endl;
1071 str << "- priority : " << priority() << std::endl;
1072
1073 // Yes No Default(Y) Default(N)
1074#define OUTS(T,B) ( indeterminate(T) ? (std::string("D(")+(B?"Y":"N")+")") : ((bool)T?"Y":"N") )
1075 str << "- gpgcheck : " << OUTS(_pimpl->rawGpgCheck(),gpgCheck())
1076 << " repo" << OUTS(_pimpl->rawRepoGpgCheck(),repoGpgCheck()) << (repoGpgCheckIsMandatory() ? "* ": " " )
1077 << "sig" << asString( validRepoSignature(), "?", "Y", "N" )
1078 << " pkg" << OUTS(_pimpl->rawPkgGpgCheck(),pkgGpgCheck()) << (pkgGpgCheckIsMandatory() ? "* ": " " )
1079 << std::endl;
1080#undef OUTS
1081
1082 for ( const auto & url : _pimpl->gpgKeyUrls().raw() )
1083 {
1084 str << "- gpgkey : " << url << std::endl;
1085 }
1086
1087 if ( ! indeterminate(_pimpl->keeppackages) )
1088 str << "- keeppackages: " << keepPackages() << std::endl;
1089
1090 strif( "- service : ", service() );
1091 strif( "- targetdistro: ", targetDistribution() );
1092 strif( "- filePath : ", filepath().asString() );
1093 strif( "- metadataPath: ", metadataPath().asString() );
1094 strif( "- packagesPath: ", packagesPath().asString() );
1095
1096 _pimpl->forDumpableExtraValues( [&]( std::string_view k, std::string_view v, bool builtin_r ) {
1097 str << ( builtin_r ? "- " : "# " ) << k << ": " << v << std::endl;
1098 } );
1099 return str;
1100 }
1101
1102 std::ostream & RepoInfo::dumpAsIniOn( std::ostream & str ) const
1103 {
1104 // libzypp/#638: Add a note to service maintained repo entries
1105 if( ! service().empty() ) {
1106 str << "# Repository '"<<alias()<<"' is maintained by the '"<<service()<<"' service." << endl;
1107 str << "# Manual changes may be overwritten by a service refresh." << endl;
1108 str << "# See also 'man zypper', section 'Services'." << endl;
1109 }
1110 RepoInfoBase::dumpAsIniOn(str);
1111
1112 if ( _pimpl->baseurl2dump() )
1113 {
1114 str << "baseurl=";
1115 std::string indent;
1116 for ( const auto & url : _pimpl->baseUrls().raw() )
1117 {
1118 str << indent << hotfix1050625::asString( url ) << endl;
1119 if ( indent.empty() ) indent = " "; // "baseurl="
1120 }
1121 }
1122
1123 if ( ! _pimpl->path.empty() )
1124 str << "path="<< path() << endl;
1125
1126 if ( ! _pimpl->cfgMirrorlistUrl().raw().asString().empty() )
1127 str << "mirrorlist=" << hotfix1050625::asString( _pimpl->cfgMirrorlistUrl().raw() ) << endl;
1128
1129 if ( ! _pimpl->cfgMetalinkUrl().raw().asString().empty() )
1130 str << "metalink=" << hotfix1050625::asString( _pimpl->cfgMetalinkUrl().raw() ) << endl;
1131
1132 if ( type() != repo::RepoType::NONE )
1133 str << "type=" << type().asString() << endl;
1134
1135 if ( priority() != defaultPriority() )
1136 str << "priority=" << priority() << endl;
1137
1138 if ( ! indeterminate(_pimpl->rawGpgCheck()) )
1139 str << "gpgcheck=" << (_pimpl->rawGpgCheck() ? "1" : "0") << endl;
1140
1141 if ( ! indeterminate(_pimpl->rawRepoGpgCheck()) )
1142 str << "repo_gpgcheck=" << (_pimpl->rawRepoGpgCheck() ? "1" : "0") << endl;
1143
1144 if ( ! indeterminate(_pimpl->rawPkgGpgCheck()) )
1145 str << "pkg_gpgcheck=" << (_pimpl->rawPkgGpgCheck() ? "1" : "0") << endl;
1146
1147 {
1148 std::string indent( "gpgkey=");
1149 for ( const auto & url : _pimpl->gpgKeyUrls().raw() )
1150 {
1151 str << indent << url << endl;
1152 if ( indent[0] != ' ' )
1153 indent = " ";
1154 }
1155 }
1156
1157 if (!indeterminate(_pimpl->keeppackages))
1158 str << "keeppackages=" << keepPackages() << endl;
1159
1160 if( ! service().empty() )
1161 str << "service=" << service() << endl;
1162
1163 _pimpl->forDumpableExtraValues( [&]( std::string_view k, std::string_view v ) {
1164 str << k << "=" << v << endl;
1165 } );
1166
1167 return str;
1168 }
1169
1170 std::ostream & RepoInfo::dumpAsXmlOn( std::ostream & str, const std::string & content ) const
1171 {
1172 std::string tmpstr;
1173 str
1174 << "<repo"
1175 << " alias=\"" << escape(alias()) << "\""
1176 << " name=\"" << escape(name()) << "\"";
1177 if (type() != repo::RepoType::NONE)
1178 str << " type=\"" << type().asString() << "\"";
1179 str
1180 << " priority=\"" << priority() << "\""
1181 << " enabled=\"" << enabled() << "\""
1182 << " autorefresh=\"" << autorefresh() << "\""
1183 << " gpgcheck=\"" << gpgCheck() << "\""
1184 << " repo_gpgcheck=\"" << repoGpgCheck() << "\""
1185 << " pkg_gpgcheck=\"" << pkgGpgCheck() << "\"";
1186 if ( ! indeterminate(_pimpl->rawGpgCheck()) )
1187 str << " raw_gpgcheck=\"" << (_pimpl->rawGpgCheck() ? "1" : "0") << "\"";
1188 if ( ! indeterminate(_pimpl->rawRepoGpgCheck()) )
1189 str << " raw_repo_gpgcheck=\"" << (_pimpl->rawRepoGpgCheck() ? "1" : "0") << "\"";
1190 if ( ! indeterminate(_pimpl->rawPkgGpgCheck()) )
1191 str << " raw_pkg_gpgcheck=\"" << (_pimpl->rawPkgGpgCheck() ? "1" : "0") << "\"";
1192 if (!(tmpstr = gpgKeyUrl().asString()).empty())
1193 str << " gpgkey=\"" << escape(tmpstr) << "\"";
1194 if ( ! (tmpstr = _pimpl->cfgMirrorlistUrl().transformed().asString()).empty() )
1195 str << " mirrorlist=\"" << escape(tmpstr) << "\"";
1196 if ( ! (tmpstr = _pimpl->cfgMetalinkUrl().transformed().asString()).empty() )
1197 str << " metalink=\"" << escape(tmpstr) << "\"";
1198 str << ">" << endl;
1199
1200 if ( _pimpl->baseurl2dump() )
1201 {
1202 for_( it, baseUrlsBegin(), baseUrlsEnd() ) // !transform iterator replaces variables
1203 str << "<url>" << escape((*it).asString()) << "</url>" << endl;
1204 }
1205
1206 _pimpl->forDumpableExtraValues( [&]( std::string_view k, std::string_view v ) {
1207 str << "<extra key=\"" << escape(std::string(k)) << "\">"
1208 << escape(std::string(v))
1209 << "</extra>" << endl;
1210 } );
1211
1212 str << "</repo>" << endl;
1213 return str;
1214 }
1215
1216
1217 std::ostream & operator<<( std::ostream & str, const RepoInfo & obj )
1218 {
1219 return obj.dumpOn(str);
1220 }
1221
1222 std::ostream & operator<<( std::ostream & str, const RepoInfo::GpgCheck & obj )
1223 {
1224 switch ( obj )
1225 {
1226#define OUTS( V ) case RepoInfo::V: return str << #V; break
1227 OUTS( GpgCheck::On );
1228 OUTS( GpgCheck::Strict );
1229 OUTS( GpgCheck::AllowUnsigned );
1230 OUTS( GpgCheck::AllowUnsignedRepo );
1231 OUTS( GpgCheck::AllowUnsignedPackage );
1232 OUTS( GpgCheck::Default );
1233 OUTS( GpgCheck::Off );
1234 OUTS( GpgCheck::indeterminate );
1235#undef OUTS
1236 }
1237 return str << "GpgCheck::UNKNOWN";
1238 }
1239
1240 bool RepoInfo::requireStatusWithMediaFile () const
1241 {
1242 // We skip the check for downloading media unless a local copy of the
1243 // media file exists and states that there is more than one medium.
1244 const auto &origins = _pimpl->repoOrigins ();
1245 bool canSkipMediaCheck = std::all_of( origins.begin(), origins.end(), []( const MirroredOrigin &origin ) { return origin.authority().url().schemeIsDownloading(); });
1246 if ( canSkipMediaCheck ) {
1247 const auto &mDataPath = metadataPath();
1248 if ( not mDataPath.empty() ) {
1249 PathInfo mediafile { mDataPath/"media.1/media" };
1250 if ( mediafile.isExist() ) {
1251 repo::SUSEMediaVerifier lverifier { mediafile.path() };
1252 if ( lverifier && lverifier.totalMedia() > 1 ) {
1253 canSkipMediaCheck = false;
1254 }
1255 }
1256 }
1257 }
1258 if ( canSkipMediaCheck )
1259 DBG << "Can SKIP media.1/media check for status calc of repo " << alias() << endl;
1260 return not canSkipMediaCheck;
1261 }
1262
1263 bool RepoInfo::hasExtraValue( const std::string & key_r ) const
1264 { return _pimpl->hasExtraValue( key_r ); }
1265
1266 std::string RepoInfo::extraValue( const std::string & key_r ) const
1267 { return _pimpl->extraValue( key_r ); }
1268
1269 bool RepoInfo::setExtraValue( const std::string & key_r, std::string value_r )
1270 { return _pimpl->setExtraValue( key_r, std::move(value_r) ); }
1271
1272
1274} // namespace zypp
OUTS
#define OUTS(VAL)
for_
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition Easy.h:27
ExternalProgram.h
Gettext.h
_
#define _(MSG)
Definition Gettext.h:39
Glob.h
IOStream.h
KeyRing.h
LogTools.h
DBG
#define DBG
Definition Logger.h:102
MIL
#define MIL
Definition Logger.h:103
WAR
#define WAR
Definition Logger.h:104
MediaSetAccess.h
PackageProvider.h
Pathname.h
PublicKey.h
Reader.h
escape
ZYPP_API detail::EscapedString escape(const std::string &in_r)
Escape xml special charaters (& -> &; from IoBind library).
Definition XmlEscape.h:51
RepoInfo.h
RepoMirrorList.h
SUSEMediaVerifier.h
StrMatcher.h
TriBool.h
XmlEscape.h
ZConfig.h
ZYppCallbacks.h
ZYppFactory.h
bool
zypp::C_Str
Convenience char* constructible from std::string and char*, it maps (char*)0 to an empty string.
Definition String.h:92
zypp::C_Str::size
size_type size() const
Definition String.h:109
zypp::DefaultIntegral
Integral type with defined initial value when default constructed.
Definition defaultintegral.h:42
zypp::Exception
Base class for Exception.
Definition Exception.h:153
zypp::ExternalProgram
Execute a program and give access to its io An object of this class encapsulates the execution of an ...
Definition ExternalProgram.h:64
zypp::ExternalProgram::close
int close() override
Wait for the progamm to complete.
Definition ExternalProgram.cc:357
zypp::ExternalProgram::Arguments
std::vector< std::string > Arguments
Definition ExternalProgram.h:68
zypp::ExternalProgram::Discard_Stderr
@ Discard_Stderr
Definition ExternalProgram.h:76
zypp::ExternalProgram::Stderr_To_Stdout
@ Stderr_To_Stdout
Definition ExternalProgram.h:77
zypp::InputStream
Helper to create and pass std::istream.
Definition inputstream.h:57
zypp::Locale
'Language[_Country]' codes.
Definition Locale.h:51
zypp::Locale::noCode
static const Locale noCode
Empty code.
Definition Locale.h:75
zypp::Locale::bestMatch
static Locale bestMatch(const LocaleSet &avLocales_r, Locale requested_r=Locale())
Return the best match for Locale requested_r within the available avLocales_r.
Definition Locale.cc:215
zypp::MirroredOriginSet
A smart container that manages a collection of MirroredOrigin objects, automatically grouping endpoin...
Definition MirroredOrigin.h:336
zypp::MirroredOriginSet::addEndpoints
void addEndpoints(InputIterator first, InputIterator last)
A convenience method to add multiple endpoints from a range.
Definition MirroredOrigin.h:398
zypp::MirroredOrigin
Manages a data source characterized by an authoritative URL and a list of mirror URLs.
Definition MirroredOrigin.h:170
zypp::OriginEndpoint
Represents a single, configurable network endpoint, combining a URL with specific access settings.
Definition MirroredOrigin.h:41
zypp::RepoInfo::setPkgGpgCheck
void setPkgGpgCheck(TriBool value_r)
Set the value for pkgGpgCheck (or indeterminate to use the default).
Definition RepoInfo.cc:654
zypp::RepoInfo::dumpAsXmlOn
std::ostream & dumpAsXmlOn(std::ostream &str, const std::string &content="") const override
Write an XML representation of this RepoInfo object.
Definition RepoInfo.cc:1170
zypp::RepoInfo::setGpgKeyUrls
void setGpgKeyUrls(url_set urls)
Set a list of gpgkey URLs defined for this repo.
Definition RepoInfo.cc:755
zypp::RepoInfo::setMetalinkUrl
void setMetalinkUrl(const Url &url)
Set the raw metalink url.
Definition RepoInfo.cc:737
zypp::RepoInfo::dumpOn
std::ostream & dumpOn(std::ostream &str) const override
Write a human-readable representation of this RepoInfo object into the str stream.
Definition RepoInfo.cc:1050
zypp::RepoInfo::metadataPath
Pathname metadataPath() const
Path where this repo metadata was read from.
Definition RepoInfo.cc:834
zypp::RepoInfo::hasExtraValue
bool hasExtraValue(const std::string &key_r) const
Whether an extra value for key_r is set.
Definition RepoInfo.cc:1263
zypp::RepoInfo::setMirrorlistUrl
void setMirrorlistUrl(const Url &url)
Set the raw mirrorlist url.
Definition RepoInfo.cc:734
zypp::RepoInfo::urls_size_type
url_set::size_type urls_size_type
Definition RepoInfo.h:109
zypp::RepoInfo::setGpgKeyUrl
void setGpgKeyUrl(const Url &gpgkey)
(leagcy API) Set the gpgkey URL defined for this repo
Definition RepoInfo.cc:758
zypp::RepoInfo::usesAutoMetadataPaths
bool usesAutoMetadataPaths() const
Whether metadataPath uses AUTO% setup.
Definition RepoInfo.cc:843
zypp::RepoInfo::GpgCheck
GpgCheck
Some predefined settings.
Definition RepoInfo.h:422
zypp::RepoInfo::GpgCheck::Strict
@ Strict
Definition RepoInfo.h:425
zypp::RepoInfo::GpgCheck::indeterminate
@ indeterminate
Definition RepoInfo.h:423
zypp::RepoInfo::GpgCheck::On
@ On
Definition RepoInfo.h:424
zypp::RepoInfo::GpgCheck::AllowUnsignedPackage
@ AllowUnsignedPackage
Definition RepoInfo.h:428
zypp::RepoInfo::GpgCheck::Default
@ Default
Definition RepoInfo.h:429
zypp::RepoInfo::GpgCheck::AllowUnsigned
@ AllowUnsigned
Definition RepoInfo.h:426
zypp::RepoInfo::GpgCheck::AllowUnsignedRepo
@ AllowUnsignedRepo
Definition RepoInfo.h:427
zypp::RepoInfo::GpgCheck::Off
@ Off
Definition RepoInfo.h:430
zypp::RepoInfo::baseUrlsEmpty
bool baseUrlsEmpty() const
whether repository urls are available
Definition RepoInfo.cc:903
zypp::RepoInfo::predownloadPath
Pathname predownloadPath() const
Path where this repo packages are predownloaded.
Definition RepoInfo.cc:816
zypp::RepoInfo::hasContent
bool hasContent() const
Check for content keywords.
Definition RepoInfo.cc:920
zypp::RepoInfo::repoOrigins
MirroredOriginSet repoOrigins() const
The repodata origins.
Definition RepoInfo.cc:790
zypp::RepoInfo::setKeepPackages
void setKeepPackages(bool keep)
Set if packaqes downloaded from this repository will be kept in local cache.
Definition RepoInfo.cc:819
zypp::RepoInfo::gpgKeyUrls
url_set gpgKeyUrls() const
The list of gpgkey URLs defined for this repo.
Definition RepoInfo.cc:861
zypp::RepoInfo::rawGpgKeyUrl
Url rawGpgKeyUrl() const
(leagcy API) The 1st raw gpgkey URL defined for this repo (no variables replaced)
Definition RepoInfo.cc:870
zypp::RepoInfo::~RepoInfo
~RepoInfo() override
Definition RepoInfo.cc:607
zypp::RepoInfo::urls_const_iterator
transform_iterator< repo::RepoVariablesUrlReplacer, url_set::const_iterator > urls_const_iterator
Definition RepoInfo.h:110
zypp::RepoInfo::rawUrl
Url rawUrl() const
Pars pro toto: The first repository raw url (no variables replaced) this is either rawBaseUrls()....
Definition RepoInfo.cc:888
zypp::RepoInfo::type
repo::RepoType type() const
Type of repository,.
Definition RepoInfo.cc:846
zypp::RepoInfo::rawGpgKeyUrls
url_set rawGpgKeyUrls() const
The list of raw gpgkey URLs defined for this repo (no variables replaced).
Definition RepoInfo.cc:864
zypp::RepoInfo::noPriority
static unsigned noPriority()
The least priority (unsigned(-1)).
Definition RepoInfo.cc:616
zypp::RepoInfo::baseUrlsSize
urls_size_type baseUrlsSize() const
number of repository urls
Definition RepoInfo.cc:900
zypp::RepoInfo::keepPackages
bool keepPackages() const
Whether packages downloaded from this repository will be kept in local cache.
Definition RepoInfo.cc:828
zypp::RepoInfo::url
Url url() const
Pars pro toto: The first repository url, this is either baseUrls().front() or if no baseUrl is define...
Definition RepoInfo.cc:909
zypp::RepoInfo::noRepo
static const RepoInfo noRepo
Represents no Repository (one with an empty alias).
Definition RepoInfo.h:85
zypp::RepoInfo::setBaseUrl
void setBaseUrl(Url url)
Clears current base URL list and adds url.
Definition RepoInfo.cc:777
zypp::RepoInfo::contentKeywords
const std::set< std::string > & contentKeywords() const
Content keywords defined.
Definition RepoInfo.cc:914
zypp::RepoInfo::baseUrlsEnd
urls_const_iterator baseUrlsEnd() const
iterator that points at end of repository urls
Definition RepoInfo.cc:897
zypp::RepoInfo::location
Url location() const
Returns the location URL for the repository, this is either the first configured baseUrl or a configu...
Definition RepoInfo.cc:891
zypp::RepoInfo::setPackagesPath
void setPackagesPath(const Pathname &path)
set the path where the local packages are stored
Definition RepoInfo.cc:813
zypp::RepoInfo::rawCfgMetalinkUrl
Url rawCfgMetalinkUrl() const
The configured raw metalink url.
Definition RepoInfo.cc:743
zypp::RepoInfo::getLicense
std::string getLicense(const Locale &lang_r=Locale()) const
Return the best license for the current (or a specified) locale.
Definition RepoInfo.cc:970
zypp::RepoInfo::baseUrlSet
bool baseUrlSet() const
Whether there are manualy configured repository urls.
Definition RepoInfo.cc:906
zypp::RepoInfo::setService
void setService(const std::string &name)
sets service which added this repository
Definition RepoInfo.cc:822
zypp::RepoInfo::setExtraValue
bool setExtraValue(const std::string &key_r, std::string value_r)
Remember extra value_r for key_r.
Definition RepoInfo.cc:1269
zypp::RepoInfo::setGpgCheck
void setGpgCheck(TriBool value_r)
Set the value for gpgCheck (or indeterminate to use the default).
Definition RepoInfo.cc:626
zypp::RepoInfo::effectiveKeepPackages
bool effectiveKeepPackages() const
keepPackages unless the package cache itself enforces keeping the packages.
Definition RepoInfo.cc:831
zypp::RepoInfo::path
Pathname path() const
Repository path.
Definition RepoInfo.cc:879
zypp::RepoInfo::gpgKeyUrlsSize
urls_size_type gpgKeyUrlsSize() const
Number of gpgkey URLs defined.
Definition RepoInfo.cc:858
zypp::RepoInfo::getLicenseLocales
LocaleSet getLicenseLocales() const
Return the locales the license is available for.
Definition RepoInfo.cc:1014
zypp::RepoInfo::baseUrls
url_set baseUrls() const
The complete set of repository urls as configured.
Definition RepoInfo.cc:873
zypp::RepoInfo::requireStatusWithMediaFile
bool requireStatusWithMediaFile() const
Returns true if this repository requires the media.1/media file to be included in the metadata status...
Definition RepoInfo.cc:1240
zypp::RepoInfo::addBaseUrl
void addBaseUrl(Url url)
Add a base url.
Definition RepoInfo.cc:767
zypp::RepoInfo::pkgGpgCheckIsMandatory
bool pkgGpgCheckIsMandatory() const
Mandatory check (pkgGpgCheck is not off) must ask to confirm using unsigned packages.
Definition RepoInfo.cc:651
zypp::RepoInfo::rawBaseUrls
url_set rawBaseUrls() const
The complete set of raw repository urls (no variables replaced).
Definition RepoInfo.cc:876
zypp::RepoInfo::mirrorListUrl
Url mirrorListUrl() const
Url of a file which contains a list of repository urls.
Definition RepoInfo.cc:849
zypp::RepoInfo::setProbedType
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:806
zypp::RepoInfo::setBaseUrls
void setBaseUrls(url_set urls)
Clears current base URL list and adds an url_set.
Definition RepoInfo.cc:784
zypp::RepoInfo::service
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:882
zypp::RepoInfo::setTargetDistribution
void setTargetDistribution(const std::string &targetDistribution)
Sets the distribution for which is this repository meant.
Definition RepoInfo.cc:825
zypp::RepoInfo::dumpAsIniOn
std::ostream & dumpAsIniOn(std::ostream &str) const override
Write this RepoInfo object into str in a .repo file format.
Definition RepoInfo.cc:1102
zypp::RepoInfo::priority
unsigned priority() const
Repository priority for solver.
Definition RepoInfo.cc:610
zypp::RepoInfo::gpgCheck
bool gpgCheck() const
Whether default signature checking should be performed.
Definition RepoInfo.cc:623
zypp::RepoInfo::setPath
void setPath(const Pathname &path)
set the product path.
Definition RepoInfo.cc:800
zypp::RepoInfo::gpgKeyUrl
Url gpgKeyUrl() const
(leagcy API) The 1st gpgkey URL defined for this repo
Definition RepoInfo.cc:867
zypp::RepoInfo::setValidRepoSignature
void setValidRepoSignature(TriBool value_r)
Set the value for validRepoSignature (or indeterminate if unsigned).
Definition RepoInfo.cc:673
zypp::RepoInfo::RepoInfo
RepoInfo()
Definition RepoInfo.cc:603
zypp::RepoInfo::defaultPriority
static unsigned defaultPriority()
The default priority (99).
Definition RepoInfo.cc:613
zypp::RepoInfo::needToAcceptLicense
bool needToAcceptLicense() const
Whether the repo license has to be accepted, e.g.
Definition RepoInfo.cc:935
zypp::RepoInfo::setPriority
void setPriority(unsigned newval_r)
Set repository priority for solver.
Definition RepoInfo.cc:619
zypp::RepoInfo::_pimpl
RWCOW_pointer< Impl > _pimpl
Pointer to implementation.
Definition RepoInfo.h:655
zypp::RepoInfo::baseUrlsBegin
urls_const_iterator baseUrlsBegin() const
iterator that points at begin of repository urls
Definition RepoInfo.cc:894
zypp::RepoInfo::hasLicense
bool hasLicense() const
Whether there is a license associated with the repo.
Definition RepoInfo.cc:928
zypp::RepoInfo::repoGpgCheckIsMandatory
bool repoGpgCheckIsMandatory() const
Mandatory check (repoGpgCheck is on) must ask to confirm using unsigned repos.
Definition RepoInfo.cc:636
zypp::RepoInfo::setMetadataPath
void setMetadataPath(const Pathname &path)
Set the path where the local metadata is stored.
Definition RepoInfo.cc:810
zypp::RepoInfo::validRepoSignature
TriBool validRepoSignature() const
Whether the repo metadata are signed and successfully validated or indeterminate if unsigned.
Definition RepoInfo.cc:666
zypp::RepoInfo::setRepoGpgCheck
void setRepoGpgCheck(TriBool value_r)
Set the value for repoGpgCheck (or indeterminate to use the default).
Definition RepoInfo.cc:644
zypp::RepoInfo::packagesPath
Pathname packagesPath() const
packagesPath Checks if the effective user is allowed to write into the system package cache.
Definition RepoInfo.cc:840
zypp::RepoInfo::addContent
void addContent(const std::string &keyword_r)
Add content keywords.
Definition RepoInfo.cc:917
zypp::RepoInfo::repoGpgCheck
bool repoGpgCheck() const
Whether the signature of repo metadata should be checked for this repo.
Definition RepoInfo.cc:633
zypp::RepoInfo::targetDistribution
std::string targetDistribution() const
Distribution for which is this repository meant.
Definition RepoInfo.cc:885
zypp::RepoInfo::getRawGpgChecks
void getRawGpgChecks(TriBool &g_r, TriBool &r_r, TriBool &p_r) const
Raw values for RepoManager.
Definition RepoInfo.cc:658
zypp::RepoInfo::setType
void setType(const repo::RepoType &t)
set the repository type
Definition RepoInfo.cc:803
zypp::RepoInfo::pkgGpgCheck
bool pkgGpgCheck() const
Whether the signature of rpm packages should be checked for this repo.
Definition RepoInfo.cc:648
zypp::RepoInfo::repoStatusString
std::string repoStatusString() const
A string value to track changes requiring a refresh.
Definition RepoInfo.cc:764
zypp::RepoInfo::url_set
std::list< Url > url_set
Definition RepoInfo.h:108
zypp::RepoInfo::rawMirrorListUrl
Url rawMirrorListUrl() const
The raw mirrorListUrl (no variables replaced).
Definition RepoInfo.cc:852
zypp::RepoInfo::gpgKeyUrlsEmpty
bool gpgKeyUrlsEmpty() const
Whether gpgkey URLs are defined.
Definition RepoInfo.cc:855
zypp::RepoInfo::extraValue
std::string extraValue(const std::string &key_r) const
Return extra value for key_r or throws std::out_of_range.
Definition RepoInfo.cc:1266
zypp::RepoInfo::systemPackagesPath
Pathname systemPackagesPath() const
Returns a path to the system-defined package cache.
Definition RepoInfo.cc:837
zypp::RepoInfo::rawCfgMirrorlistUrl
Url rawCfgMirrorlistUrl() const
The configured raw mirrorlist url.
Definition RepoInfo.cc:740
zypp::RepoInfo::repoOriginsEmpty
bool repoOriginsEmpty() const
whether repo origins are available
Definition RepoInfo.cc:795
zypp::Url
Url manipulation class.
Definition Url.h:93
zypp::Url::asString
std::string asString() const
Returns a default string representation of the Url object.
Definition Url.cc:524
zypp::Url::setPathName
void setPathName(const std::string &path, EEncoding eflag=zypp::url::E_DECODED)
Set the path name.
Definition Url.cc:791
zypp::Url::setQueryParam
void setQueryParam(const std::string &param, const std::string &value)
Set or add value for the specified query parameter.
Definition Url.cc:903
zypp::Url::pathNameSetTrailingSlash
void pathNameSetTrailingSlash(bool apply_r=true)
Apply or remove a trailing '/' from pathName.
Definition Url.cc:838
zypp::ZConfig::gpgCheck
bool gpgCheck() const
Turn signature checking on/off (on).
Definition ZConfig.cc:1088
zypp::ZConfig::pkgGpgCheck
TriBool pkgGpgCheck() const
Check rpm package signatures (indeterminate - according to gpgcheck).
Definition ZConfig.cc:1090
zypp::ZConfig::instance
static ZConfig & instance()
Singleton ctor.
Definition ZConfig.cc:788
zypp::ZConfig::repoGpgCheck
TriBool repoGpgCheck() const
Check repo matadata signatures (indeterminate - according to gpgcheck).
Definition ZConfig.cc:1089
zypp::callback::UserData
Typesafe passing of user data via callbacks.
Definition UserData.h:40
zypp::callback::UserData::set
bool set(const std::string &key_r, AnyType val_r)
Set the value for key (nonconst version always returns true).
Definition UserData.h:119
zypp::externalprogram::ExternalDataSource::receiveLine
std::string receiveLine()
Read one line from the input stream.
Definition ExternalDataSource.cc:115
zypp::filesystem::Glob
Find pathnames matching a pattern.
Definition Glob.h:58
zypp::filesystem::Glob::empty
bool empty() const
Whether matches were found.
Definition Glob.h:189
zypp::filesystem::Glob::begin
const_iterator begin() const
Iterator pointing to the first result.
Definition Glob.h:197
zypp::filesystem::Glob::add
int add(const Pathname &pattern_r, Flags flags_r=Flags())
Add pathnames matching pattern_r to the current result.
Definition Glob.h:155
zypp::filesystem::PathInfo
Wrapper class for stat/lstat.
Definition PathInfo.h:226
zypp::filesystem::PathInfo::path
const Pathname & path() const
Return current Pathname.
Definition PathInfo.h:251
zypp::filesystem::PathInfo::isExist
bool isExist() const
Return whether valid stat info exists.
Definition PathInfo.h:286
zypp::filesystem::Pathname
Pathname.
Definition Pathname.h:48
zypp::filesystem::Pathname::c_str
const char * c_str() const
String representation.
Definition Pathname.h:113
zypp::filesystem::Pathname::asString
const std::string & asString() const
String representation.
Definition Pathname.h:94
zypp::filesystem::Pathname::empty
bool empty() const
Test for an empty path.
Definition Pathname.h:117
zypp::repo::RepoInfoBase::filepath
Pathname filepath() const
File where this repo was read from.
Definition RepoInfoBase.cc:133
zypp::repo::RepoInfoBase::autorefresh
bool autorefresh() const
If true, the repostory must be refreshed before creating resolvables from it.
Definition RepoInfoBase.cc:107
zypp::repo::RepoInfoBase::name
std::string name() const
Repository name.
Definition RepoInfoBase.cc:116
zypp::repo::RepoInfoBase::enabled
bool enabled() const
If enabled is false, then this repository must be ignored as if does not exists, except when checking...
Definition RepoInfoBase.cc:104
zypp::repo::RepoInfoBase::alias
std::string alias() const
unique identifier for this source.
Definition RepoInfoBase.cc:110
zypp::repo::RepoMirrorList
Definition RepoMirrorList.h:22
zypp::repo::RepoMirrorList::urlSupportsMirrorLink
static bool urlSupportsMirrorLink(const zypp::Url &url)
Definition RepoMirrorList.cc:417
zypp::repo::RepoMirrorList::getUrls
const std::vector< Url > & getUrls() const
Definition RepoMirrorList.h:31
zypp::repo::SUSEMediaVerifier
Implementation of the traditional SUSE media verifier.
Definition SUSEMediaVerifier.h:28
zypp::repo::SUSEMediaVerifier::totalMedia
media::MediaNr totalMedia() const
The total number of media in this set (or 0 if not known).
Definition SUSEMediaVerifier.cc:145
zypp::xml::Reader
xmlTextReader based interface to iterate xml streams.
Definition Reader.h:96
zypp::xml::Reader::seekToEndNode
bool seekToEndNode(int depth_r, const std::string &name_r)
Definition Reader.cc:214
zypp::xml::Reader::nodeText
XmlString nodeText()
If the current node is not empty, advances the reader to the next node, and returns the value.
Definition Reader.cc:122
zypp::xml::Reader::seekToNode
bool seekToNode(int depth_r, const std::string &name_r)
Definition Reader.cc:194
zypp::xml::XmlString::asString
std::string asString() const
Explicit conversion to std::string.
Definition XmlString.h:77
zyppng::IdStringType::c_str
const char * c_str() const
Definition IdStringType.h:115
curlhelper_p.h
zypp::TriBool
boost::logic::tribool TriBool
3-state boolean logic (true, false and indeterminate).
Definition String.h:31
internal::propagateQueryParams
zypp::Url propagateQueryParams(zypp::Url url_r, const zypp::Url &template_r)
Definition curlhelper.cc:432
str
String related utilities and Regular expression matching.
zypp::filesystem::symlink
int symlink(const Pathname &oldpath, const Pathname &newpath)
Like 'symlink'.
Definition PathInfo.cc:874
zypp::filesystem::unlink
int unlink(const Pathname &path)
Like 'unlink'.
Definition PathInfo.cc:719
zypp::hotfix1050625::asString
std::string asString(const Url &url_r)
Definition Url.cc:957
zypp::iostr::forEachLine
int forEachLine(std::istream &str_r, const function< bool(int, std::string)> &consume_r)
Simple lineparser: Call functor consume_r for each line.
Definition IOStream.cc:100
zypp::repo::env
Definition RepoInfo.cc:79
zypp::repo::env::XDG_CACHE_HOME
filesystem::Pathname XDG_CACHE_HOME()
XDG_CACHE_HOME: base directory relative to which user specific non-essential data files should be sto...
Definition RepoInfo.cc:83
zypp::repo
Definition DeltaCandidates.cc:30
zypp::str::hasSuffix
bool hasSuffix(const C_Str &str_r, const C_Str &suffix_r)
Return whether str_r has suffix suffix_r.
Definition String.h:1111
zypp::str::hasPrefix
bool hasPrefix(const C_Str &str_r, const C_Str &prefix_r)
Return whether str_r has prefix prefix_r.
Definition String.h:1097
zypp::str::startsWith
bool startsWith(const C_Str &str_r, const C_Str &prefix_r)
alias for hasPrefix
Definition String.h:1155
zypp::str::form
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
Definition String.cc:39
zypp::str::split
unsigned split(const C_Str &line_r, TOutputIterator result_r, const C_Str &sepchars_r=" \t", const Trim trim_r=NO_TRIM)
Split line_r into words.
Definition String.h:602
zypp::xml::escape
ZYPP_API detail::EscapedString escape(const std::string &in_r)
Escape xml special charaters (& -> &; from IoBind library).
Definition XmlEscape.h:51
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition CodePitfalls.doc:2
zypp::LocaleSet
std::unordered_set< Locale > LocaleSet
Definition Locale.h:29
zypp::always_false_v
constexpr bool always_false_v
Definition LogControl.cc:60
zypp::RepoVariablesReplacedUrl
base::ValueTransform< Url, repo::RepoVariablesUrlReplacer > RepoVariablesReplacedUrl
relates: RepoVariablesUrlReplacer Helper managing repo variables replaced urls
Definition RepoVariables.h:133
zypp::RepoVariablesReplacedUrlList
base::ContainerTransform< std::list< Url >, repo::RepoVariablesUrlReplacer > RepoVariablesReplacedUrlList
relates: RepoVariablesUrlReplacer Helper managing repo variables replaced url lists
Definition RepoVariables.h:136
zypp::IamNotRoot
bool IamNotRoot()
Definition PathInfo.h:42
zypp::asString
std::string asString(const Patch::Category &obj)
relates: Patch::Category string representation.
Definition Patch.cc:122
zypp::operator<<
std::ostream & operator<<(std::ostream &str, const Capabilities &obj)
relates: Capabilities Stream output
Definition Capabilities.cc:65
zyppng::Url
zypp::Url Url
Definition url.h:15
repoinfowf.h
zypp::JobReport::warning
static bool warning(const std::string &msg_r, const UserData &userData_r=UserData())
send warning text
Definition ZYppCallbacks.h:1103
zypp::JobReport::repoRefreshMirrorlist
static const ContentType repoRefreshMirrorlist
Definition ZYppCallbacks.h:1081
zypp::RepoInfo::Impl
RepoInfo implementation.
Definition RepoInfo.cc:105
zypp::RepoInfo::Impl::_type
repo::RepoType _type
Definition RepoInfo.cc:444
zypp::RepoInfo::Impl::_packagesPath
Pathname _packagesPath
Definition RepoInfo.cc:569
zypp::RepoInfo::Impl::rawPkgGpgCheck
TriBool rawPkgGpgCheck() const
Definition RepoInfo.cc:429
zypp::RepoInfo::Impl::_rawRepoGpgCheck
TriBool _rawRepoGpgCheck
need to check repo sign.: Y/N/(ZConf(Y/N/gpgCheck))
Definition RepoInfo.cc:423
zypp::RepoInfo::Impl::internalValidRepoSignature
TriBool internalValidRepoSignature() const
Signature check result needs to be stored/retrieved from _metadataPath.
Definition RepoInfo.cc:348
zypp::RepoInfo::Impl::repoStatusString
std::string repoStatusString() const
Definition RepoInfo.cc:281
zypp::RepoInfo::Impl::triBoolFromPath
bool triBoolFromPath(const Pathname &path_r, TriBool &ret_r) const
Definition RepoInfo.cc:390
zypp::RepoInfo::Impl::internalUnsignedConfirmed
bool internalUnsignedConfirmed() const
We definitely have a symlink pointing to "indeterminate" (for repoGpgCheckIsMandatory)?
Definition RepoInfo.cc:384
zypp::RepoInfo::Impl::triBoolFromPath
TriBool triBoolFromPath(const Pathname &path_r) const
Definition RepoInfo.cc:416
zypp::RepoInfo::Impl::Impl
Impl(const Impl &)=default
zypp::RepoInfo::Impl::packagesPath
void packagesPath(Pathname new_r)
Definition RepoInfo.cc:476
zypp::RepoInfo::Impl::rawRepoGpgCheck
void rawRepoGpgCheck(TriBool val_r)
Definition RepoInfo.cc:432
zypp::RepoInfo::Impl::mirrorUrls
RepoVariablesReplacedUrlList & mirrorUrls() const
Fetch the repo mirrors from the server.
Definition RepoInfo.cc:200
zypp::RepoInfo::Impl::rawPkgGpgCheck
void rawPkgGpgCheck(TriBool val_r)
Definition RepoInfo.cc:433
zypp::RepoInfo::Impl::predownloadPath
Pathname predownloadPath() const
Definition RepoInfo.cc:509
zypp::RepoInfo::Impl::_metadataPath
Pathname _metadataPath
Definition RepoInfo.cc:568
zypp::RepoInfo::Impl::licenseTgz
Pathname licenseTgz(const std::string &name_r) const
Path to a license tarball in case it exists in the repo.
Definition RepoInfo.cc:144
zypp::RepoInfo::Impl::clone
Impl * clone() const
clone for RWCOW_pointer
Definition RepoInfo.cc:584
zypp::RepoInfo::Impl::metadataPath
Pathname metadataPath() const
Definition RepoInfo.cc:490
zypp::RepoInfo::Impl::priority
DefaultIntegral< unsigned, defaultPriority > priority
Definition RepoInfo.cc:514
zypp::RepoInfo::Impl::_cfgMetalinkUrl
RepoVariablesReplacedUrl _cfgMetalinkUrl
Definition RepoInfo.cc:448
zypp::RepoInfo::Impl::cfgGpgCheck
bool cfgGpgCheck() const
Definition RepoInfo.cc:435
zypp::RepoInfo::Impl::setMetalinkUrl
void setMetalinkUrl(const Url &url_r)
Definition RepoInfo.cc:457
zypp::RepoInfo::Impl::setExtraValue
bool setExtraValue(const std::string &key_r, std::string value_r)
Definition RepoInfo.cc:541
zypp::RepoInfo::Impl::cfgMirrorlistUrl
const RepoVariablesReplacedUrl & cfgMirrorlistUrl() const
Config file writing needs to tell them appart.
Definition RepoInfo.cc:461
zypp::RepoInfo::Impl::_alternatePackagesPath
std::optional< Pathname > _alternatePackagesPath
in case _packagesPath is not writable
Definition RepoInfo.cc:570
zypp::RepoInfo::Impl::hasExtraValue
bool hasExtraValue(const std::string &key_r) const
Definition RepoInfo.cc:535
zypp::RepoInfo::Impl::setMirrorlistUrl
void setMirrorlistUrl(const Url &url_r)
Definition RepoInfo.cc:454
zypp::RepoInfo::Impl::_mirrorUrls
RepoVariablesReplacedUrlList _mirrorUrls
possible mirrors as fetched via mirrorlist or metalink
Definition RepoInfo.cc:574
zypp::RepoInfo::Impl::setType
void setType(const repo::RepoType &t)
Definition RepoInfo.cc:126
zypp::RepoInfo::Impl::rwcowClone
friend Impl * rwcowClone(const Impl *rhs)
zypp::RepoInfo::Impl::baseUrl
RepoVariablesReplacedUrl baseUrl() const
Definition RepoInfo.cc:169
zypp::RepoInfo::Impl::_lastMirrorUrlsUpdate
std::chrono::steady_clock::time_point _lastMirrorUrlsUpdate
Definition RepoInfo.cc:575
zypp::RepoInfo::Impl::hasContent
bool hasContent(const std::string &keyword_r) const
Definition RepoInfo.cc:341
zypp::RepoInfo::Impl::contentKeywords
const std::set< std::string > & contentKeywords() const
Definition RepoInfo.cc:290
zypp::RepoInfo::Impl::cfgPkgGpgCheck
TriBool cfgPkgGpgCheck() const
Definition RepoInfo.cc:439
zypp::RepoInfo::Impl::location
Url location() const
Definition RepoInfo.cc:184
zypp::RepoInfo::Impl::baseurl2dump
bool baseurl2dump() const
Definition RepoInfo.cc:271
zypp::RepoInfo::Impl::cfgMetalinkUrl
const RepoVariablesReplacedUrl & cfgMetalinkUrl() const
Config file writing needs to tell them appart.
Definition RepoInfo.cc:464
zypp::RepoInfo::Impl::baseUrls
const RepoVariablesReplacedUrlList & baseUrls() const
Definition RepoInfo.cc:179
zypp::RepoInfo::Impl::hasContent
bool hasContent() const
Definition RepoInfo.cc:296
zypp::RepoInfo::Impl::_gpgKeyUrls
RepoVariablesReplacedUrlList _gpgKeyUrls
Definition RepoInfo.cc:580
zypp::RepoInfo::Impl::~Impl
~Impl()
Definition RepoInfo.cc:120
zypp::RepoInfo::Impl::_baseUrls
RepoVariablesReplacedUrlList _baseUrls
baseUrls as configured
Definition RepoInfo.cc:572
zypp::RepoInfo::Impl::operator=
Impl & operator=(Impl &&)=delete
zypp::RepoInfo::Impl::_repoOrigins
std::vector< MirroredOrigin > _repoOrigins
Definition RepoInfo.cc:576
zypp::RepoInfo::Impl::service
std::string service
Definition RepoInfo.cc:470
zypp::RepoInfo::Impl::_extraValues
std::map< std::string, std::string > _extraValues
Basically raw .repo file key-value lines.
Definition RepoInfo.cc:517
zypp::RepoInfo::Impl::rawGpgCheck
void rawGpgCheck(TriBool val_r)
Definition RepoInfo.cc:431
zypp::RepoInfo::Impl::addContent
void addContent(const std::string &keyword_r)
Definition RepoInfo.cc:293
zypp::RepoInfo::Impl::_rawGpgCheck
TriBool _rawGpgCheck
default gpgcheck behavior: Y/N/ZConf
Definition RepoInfo.cc:422
zypp::RepoInfo::Impl::packagesPath
Pathname packagesPath() const
Definition RepoInfo.cc:504
zypp::RepoInfo::Impl::mirrorListUrl
const RepoVariablesReplacedUrl & mirrorListUrl() const
THE mirrorListUrl to work with (either_cfgMirrorlistUrl or _cfgMetalinkUrl).
Definition RepoInfo.cc:451
zypp::RepoInfo::Impl::metadataPath
void metadataPath(Pathname new_r)
Definition RepoInfo.cc:473
zypp::RepoInfo::Impl::rawGpgCheck
TriBool rawGpgCheck() const
Definition RepoInfo.cc:427
zypp::RepoInfo::Impl::rawRepoGpgCheck
TriBool rawRepoGpgCheck() const
Definition RepoInfo.cc:428
zypp::RepoInfo::Impl::internalSetValidRepoSignature
void internalSetValidRepoSignature(TriBool value_r)
Definition RepoInfo.cc:362
zypp::RepoInfo::Impl::resetMirrorUrls
void resetMirrorUrls() const
Definition RepoInfo.cc:190
zypp::RepoInfo::Impl::targetDistro
std::string targetDistro
Definition RepoInfo.cc:471
zypp::RepoInfo::Impl::gpgKeyUrls
const RepoVariablesReplacedUrlList & gpgKeyUrls() const
Definition RepoInfo.cc:275
zypp::RepoInfo::Impl::cfgRepoGpgCheck
TriBool cfgRepoGpgCheck() const
Definition RepoInfo.cc:437
zypp::RepoInfo::Impl::path
Pathname path
Definition RepoInfo.cc:469
zypp::RepoInfo::Impl::defaultPriority
static const unsigned defaultPriority
Definition RepoInfo.cc:123
zypp::RepoInfo::Impl::_rawPkgGpgCheck
TriBool _rawPkgGpgCheck
need to check pkg sign.: Y/N/(ZConf(Y/N/gpgCheck))
Definition RepoInfo.cc:424
zypp::RepoInfo::Impl::extraValue
std::string extraValue(const std::string &key_r) const
Definition RepoInfo.cc:538
zypp::RepoInfo::Impl::keeppackages
TriBool keeppackages
Definition RepoInfo.cc:468
zypp::RepoInfo::Impl::setProbedType
void setProbedType(const repo::RepoType &t) const
Definition RepoInfo.cc:129
zypp::RepoInfo::Impl::repoOrigins
MirroredOriginSet repoOrigins() const
Definition RepoInfo.cc:255
zypp::RepoInfo::Impl::baseUrls
RepoVariablesReplacedUrlList & baseUrls()
Definition RepoInfo.cc:268
zypp::RepoInfo::Impl::_validRepoSignature
TriBool _validRepoSignature
have signed and valid repo metadata
Definition RepoInfo.cc:443
zypp::RepoInfo::Impl::type
repo::RepoType type() const
Definition RepoInfo.cc:135
zypp::RepoInfo::Impl::systemPackagesPath
Pathname systemPackagesPath() const
Definition RepoInfo.cc:497
zypp::RepoInfo::Impl::operator=
Impl & operator=(const Impl &)=delete
zypp::RepoInfo::Impl::_cfgMirrorlistUrl
RepoVariablesReplacedUrl _cfgMirrorlistUrl
Definition RepoInfo.cc:447
zypp::RepoInfo::Impl::forDumpableExtraValues
void forDumpableExtraValues(Fnc &&fnc_r) const
Filter discarding not dumpable extra values.
Definition RepoInfo.cc:549
zypp::RepoInfo::Impl::_keywords
std::pair< FalseBool, std::set< std::string > > _keywords
Definition RepoInfo.cc:578
zypp::RepoInfo::Impl::gpgKeyUrls
RepoVariablesReplacedUrlList & gpgKeyUrls()
Definition RepoInfo.cc:278
zypp::RepoInfo::Impl::Impl
Impl()
Definition RepoInfo.cc:106
zypp::RepoInfo::Impl::usesAutoMetadataPaths
bool usesAutoMetadataPaths() const
Definition RepoInfo.cc:487
zypp::RepoInfo::Impl::noPriority
static const unsigned noPriority
Definition RepoInfo.cc:124
zypp::RepoInfo::Impl::Impl
Impl(Impl &&)=delete
zypp::RepoInfo::Impl::isBuiltinExtraValue
TriBool isBuiltinExtraValue(std::string_view key_r) const
Return bool whether a dumpable key_r is known; indeterminate if the key must not be dumped.
Definition RepoInfo.cc:523
zypp::base::ValueTransform::transformed
TransformedType transformed() const
Return a transformed copy of the raw value.
Definition ValueTransform.h:68
zypp::repo::RepoType
Repository type enumeration.
Definition RepoType.h:29
zypp::repo::RepoType::YAST2
static const RepoType YAST2
Definition RepoType.h:31
zypp::repo::RepoType::asString
const std::string & asString() const
Definition RepoType.cc:56
zypp::repo::RepoType::RPMMD
static const RepoType RPMMD
Definition RepoType.h:30
zypp::repo::RepoType::NONE
static const RepoType NONE
Definition RepoType.h:33
zypp::repo::RepoType::RPMPLAINDIR
static const RepoType RPMPLAINDIR
Definition RepoType.h:32
type_traits.h
ManagedFile.h
TmpPath.h