libzypp 17.38.15

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
52 using std::endl;
53 using zypp::xml::escape;
54
56 namespace 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
380 bool triBoolFromPath( const Pathname & path_r, TriBool & ret_r ) const
381 {
382 static const Pathname truePath( "true" );
383 static const Pathname falsePath( "false" );
384 static const Pathname indeterminatePath( "indeterminate" );
385
386 // Quiet readlink;
387 static const ssize_t bufsiz = 63;
388 static char buf[bufsiz+1];
389 ssize_t ret = ::readlink( path_r.c_str(), buf, bufsiz );
390 buf[ret == -1 ? 0 : ret] = '\0';
391
392 Pathname linkval( buf );
393
394 bool known = true;
395 if ( linkval == truePath )
396 ret_r = true;
397 else if ( linkval == falsePath )
398 ret_r = false;
399 else if ( linkval == indeterminatePath )
400 ret_r = indeterminate;
401 else
402 known = false;
403 return known;
404 }
405
406 TriBool triBoolFromPath( const Pathname & path_r ) const
407 { TriBool ret(indeterminate); triBoolFromPath( path_r, ret ); return ret; }
408
410
411 private:
412 TriBool _rawGpgCheck;
413 TriBool _rawRepoGpgCheck;
414 TriBool _rawPkgGpgCheck;
415
416 public:
417 TriBool rawGpgCheck() const { return _rawGpgCheck; }
418 TriBool rawRepoGpgCheck() const { return _rawRepoGpgCheck; }
419 TriBool rawPkgGpgCheck() const { return _rawPkgGpgCheck; }
420
421 void rawGpgCheck( TriBool val_r ) { _rawGpgCheck = val_r; }
422 void rawRepoGpgCheck( TriBool val_r ) { _rawRepoGpgCheck = val_r; }
423 void rawPkgGpgCheck( TriBool val_r ) { _rawPkgGpgCheck = val_r; }
424
425 bool cfgGpgCheck() const
426 { return indeterminate(_rawGpgCheck) ? ZConfig::instance().gpgCheck() : (bool)_rawGpgCheck; }
427 TriBool cfgRepoGpgCheck() const
428 { return indeterminate(_rawGpgCheck) && indeterminate(_rawRepoGpgCheck) ? ZConfig::instance().repoGpgCheck() : _rawRepoGpgCheck; }
429 TriBool cfgPkgGpgCheck() const
430 { return indeterminate(_rawGpgCheck) && indeterminate(_rawPkgGpgCheck) ? ZConfig::instance().pkgGpgCheck() : _rawPkgGpgCheck; }
431
432 private:
433 TriBool _validRepoSignature;
434 repo::RepoType _type;
435
436 private:
437 RepoVariablesReplacedUrl _cfgMirrorlistUrl;
438 RepoVariablesReplacedUrl _cfgMetalinkUrl;
439 public:
441 const RepoVariablesReplacedUrl & mirrorListUrl() const
442 { return _cfgMirrorlistUrl.transformed().isValid() ? _cfgMirrorlistUrl : _cfgMetalinkUrl; }
443
444 void setMirrorlistUrl( const Url & url_r ) // Raw
445 { _cfgMirrorlistUrl.raw() = url_r; }
446
447 void setMetalinkUrl( const Url & url_r ) // Raw
448 { _cfgMetalinkUrl.raw() = url_r; }
449
451 const RepoVariablesReplacedUrl & cfgMirrorlistUrl() const
452 { return _cfgMirrorlistUrl; }
453
454 const RepoVariablesReplacedUrl & cfgMetalinkUrl() const
455 { return _cfgMetalinkUrl; }
456
457 public:
458 TriBool keeppackages;
459 Pathname _path;
460 std::string service;
461 std::string targetDistro;
462
463 void metadataPath( Pathname new_r )
464 { _metadataPath = std::move( new_r ); }
465
466 void packagesPath( Pathname new_r )
467 {
468 _packagesPath = std::move( new_r );
469 if ( not _packagesPath.empty() && zypp::IamNotRoot() && not userMayWriteOrCreateDir( _packagesPath ) ) {
470 _alternatePackagesPath = zypp::repo::env::XDG_CACHE_HOME() / "zypp/packages" / _packagesPath.basename();
471 WAR << "systemPackagesPath " << _packagesPath << " is not user writable, may use " << *_alternatePackagesPath << endl;
472 } else {
473 _alternatePackagesPath.reset();
474 }
475 }
476
477 bool usesAutoMetadataPaths() const
478 { return str::hasSuffix( _metadataPath.asString(), "/%AUTO%" ); }
479
480 Pathname metadataPath() const
481 {
482 if ( usesAutoMetadataPaths() )
483 return _metadataPath.dirname() / "%RAW%";
484 return _metadataPath;
485 }
486
487 Pathname systemPackagesPath() const
488 {
489 if ( _packagesPath.empty() && usesAutoMetadataPaths() )
490 return _metadataPath.dirname() / "%PKG%";
491 return _packagesPath;
492 }
493
494 Pathname packagesPath() const
495 {
496 return _alternatePackagesPath ? *_alternatePackagesPath : systemPackagesPath();
497 }
498
499 Pathname predownloadPath() const
500 {
501 return packagesPath() / ".preload";
502 }
503
504 DefaultIntegral<unsigned,defaultPriority> priority;
505
506 public:
507 std::map<std::string,std::string> _extraValues;
508
513 TriBool isBuiltinExtraValue( std::string_view key_r ) const
514 {
515 static const std::set<std::string_view> _builtins { {
516 "repo_sigcheck_plugin",
517 } };
518 if ( _builtins.count( key_r ) )
519 return true;
520 if ( key_r.find( '=' ) == std::string::npos )
521 return false;
522 return indeterminate;
523 }
524
525 bool hasExtraValue( const std::string & key_r ) const
526 { return _extraValues.count( key_r ); }
527
528 std::string extraValue( const std::string & key_r ) const
529 { return _extraValues.at( key_r ); } // let it throw
530
531 bool setExtraValue( const std::string & key_r, std::string value_r )
532 {
533 _extraValues[key_r] = std::move(value_r);
534 return bool(isBuiltinExtraValue( key_r ));
535 }
536
538 template <typename Fnc>
539 void forDumpableExtraValues( Fnc && fnc_r ) const
540 {
541 for ( const auto & [k,v] : _extraValues ) {
542 TriBool dumpable = isBuiltinExtraValue( k );
543 if ( indeterminate(dumpable) )
544 continue;
545 if constexpr ( std::is_invocable_v<Fnc, std::string_view, std::string_view, bool> ) {
546 fnc_r( k, v, bool(dumpable) );
547 }
548 else if constexpr ( std::is_invocable_v<Fnc, std::string_view, std::string_view> ) {
549 fnc_r( k, v );
550 }
551 else {
552 static_assert( zyppng::always_false_v<Fnc>, "Lambda must accept (k, v) or (k, v, b)" );
553 }
554 }
555 }
556
557 private:
558 Pathname _metadataPath;
559 Pathname _packagesPath;
560 std::optional<Pathname> _alternatePackagesPath;
561
562 mutable RepoVariablesReplacedUrlList _baseUrls;
563
564 mutable RepoVariablesReplacedUrlList _mirrorUrls;
565 mutable std::chrono::steady_clock::time_point _lastMirrorUrlsUpdate = std::chrono::steady_clock::time_point::min();
566 mutable std::vector<MirroredOrigin> _repoOrigins;
567
568 mutable std::pair<FalseBool, std::set<std::string> > _keywords;
569
570 RepoVariablesReplacedUrlList _gpgKeyUrls;
571
572 friend Impl * rwcowClone<Impl>( const Impl * rhs );
574 Impl * clone() const
575 { return new Impl( *this ); }
576 };
577
578
580 inline std::ostream & operator<<( std::ostream & str, const RepoInfo::Impl & obj )
581 {
582 return str << "RepoInfo::Impl";
583 }
584
586 //
587 // CLASS NAME : RepoInfo
588 //
590
591 const RepoInfo RepoInfo::noRepo;
592
593 RepoInfo::RepoInfo()
594 : _pimpl( new Impl() )
595 {}
596
597 RepoInfo::~RepoInfo()
598 {}
599
600 unsigned RepoInfo::priority() const
601 { return _pimpl->priority; }
602
603 unsigned RepoInfo::defaultPriority()
604 { return Impl::defaultPriority; }
605
606 unsigned RepoInfo::noPriority()
607 { return Impl::noPriority; }
608
609 void RepoInfo::setPriority( unsigned newval_r )
610 { _pimpl->priority = newval_r ? newval_r : Impl::defaultPriority; }
611
612
613 bool RepoInfo::gpgCheck() const
614 { return _pimpl->cfgGpgCheck(); }
615
616 void RepoInfo::setGpgCheck( TriBool value_r )
617 { _pimpl->rawGpgCheck( value_r ); }
618
619 void RepoInfo::setGpgCheck( bool value_r ) // deprecated legacy and for squid
620 { setGpgCheck( TriBool(value_r) ); }
621
622
623 bool RepoInfo::repoGpgCheck() const
624 { return gpgCheck() || bool(_pimpl->cfgRepoGpgCheck()); }
625
626 bool RepoInfo::repoGpgCheckIsMandatory() const // may be omitted only if cfgRepoGpgCheck is explicitly false (unsigned-ok)
627 { return ( gpgCheck() && indeterminate(_pimpl->cfgRepoGpgCheck()) ) || bool(_pimpl->cfgRepoGpgCheck()); }
628
629 void RepoInfo::setRepoGpgCheck( TriBool value_r )
630 { _pimpl->rawRepoGpgCheck( value_r ); }
631
632
633 bool RepoInfo::pkgGpgCheck() const
634 { return bool(_pimpl->cfgPkgGpgCheck()) || ( gpgCheck() && !bool(validRepoSignature())/*enforced*/ ) ; }
635
636 bool RepoInfo::pkgGpgCheckIsMandatory() const
637 { return bool(_pimpl->cfgPkgGpgCheck()) || ( gpgCheck() && indeterminate(_pimpl->cfgPkgGpgCheck()) && !bool(validRepoSignature())/*enforced*/ ); }
638
639 void RepoInfo::setPkgGpgCheck( TriBool value_r )
640 { _pimpl->rawPkgGpgCheck( value_r ); }
641
642
643 void RepoInfo::getRawGpgChecks( TriBool & g_r, TriBool & r_r, TriBool & p_r ) const
644 {
645 g_r = _pimpl->rawGpgCheck();
646 r_r = _pimpl->rawRepoGpgCheck();
647 p_r = _pimpl->rawPkgGpgCheck();
648 }
649
650
651 TriBool RepoInfo::validRepoSignature() const
652 {
653 TriBool ret( _pimpl->internalValidRepoSignature() );
654 if ( ret && !repoGpgCheck() ) ret = false; // invalidate any old signature if repoGpgCheck is off
655 return ret;
656 }
657
658 void RepoInfo::setValidRepoSignature( TriBool value_r )
659 { _pimpl->internalSetValidRepoSignature( value_r ); }
660
662 namespace
663 {
664 inline bool changeGpgCheckTo( TriBool & lhs, TriBool rhs )
665 { if ( ! sameTriboolState( lhs, rhs ) ) { lhs = rhs; return true; } return false; }
666
667 inline bool changeGpgCheckTo( TriBool ogpg[3], TriBool g, TriBool r, TriBool p )
668 {
669 bool changed = false;
670 if ( changeGpgCheckTo( ogpg[0], g ) ) changed = true;
671 if ( changeGpgCheckTo( ogpg[1], r ) ) changed = true;
672 if ( changeGpgCheckTo( ogpg[2], p ) ) changed = true;
673 return changed;
674 }
675 } // namespace
677 bool RepoInfo::setGpgCheck( GpgCheck mode_r )
678 {
679 TriBool ogpg[3]; // Gpg RepoGpg PkgGpg
680 getRawGpgChecks( ogpg[0], ogpg[1], ogpg[2] );
681
682 bool changed = false;
683 switch ( mode_r )
684 {
685 case GpgCheck::On:
686 changed = changeGpgCheckTo( ogpg, true, indeterminate, indeterminate );
687 break;
688 case GpgCheck::Strict:
689 changed = changeGpgCheckTo( ogpg, true, true, true );
690 break;
691 case GpgCheck::AllowUnsigned:
692 changed = changeGpgCheckTo( ogpg, true, false, false );
693 break;
694 case GpgCheck::AllowUnsignedRepo:
695 changed = changeGpgCheckTo( ogpg, true, false, indeterminate );
696 break;
697 case GpgCheck::AllowUnsignedPackage:
698 changed = changeGpgCheckTo( ogpg, true, indeterminate, false );
699 break;
700 case GpgCheck::Default:
701 changed = changeGpgCheckTo( ogpg, indeterminate, indeterminate, indeterminate );
702 break;
703 case GpgCheck::Off:
704 changed = changeGpgCheckTo( ogpg, false, indeterminate, indeterminate );
705 break;
706 case GpgCheck::indeterminate: // no change
707 break;
708 }
709
710 if ( changed )
711 {
712 setGpgCheck ( ogpg[0] );
713 setRepoGpgCheck( ogpg[1] );
714 setPkgGpgCheck ( ogpg[2] );
715 }
716 return changed;
717 }
718
719 void RepoInfo::setMirrorlistUrl( const Url & url_r ) // Raw
720 { _pimpl->setMirrorlistUrl( url_r ); }
721
722 void RepoInfo::setMetalinkUrl( const Url & url_r ) // Raw
723 { _pimpl->setMetalinkUrl( url_r ); }
724
725 Url RepoInfo::rawCfgMirrorlistUrl() const
726 { return _pimpl->cfgMirrorlistUrl().raw(); }
727
728 Url RepoInfo::rawCfgMetalinkUrl() const
729 { return _pimpl->cfgMetalinkUrl().raw(); }
730
731#if LEGACY(1735)
732 void RepoInfo::setMirrorListUrl( const Url & url_r ) // Raw
733 { setMirrorlistUrl( url_r ); }
734 void RepoInfo::setMirrorListUrls( url_set urls ) // Raw
735 { _pimpl->setMirrorlistUrl( urls.empty() ? Url() : urls.front() ); }
736 void RepoInfo::setMetalinkUrls( url_set urls ) // Raw
737 { _pimpl->setMetalinkUrl( urls.empty() ? Url() : urls.front() ); }
738#endif
739
740 void RepoInfo::setGpgKeyUrls( url_set urls )
741 { _pimpl->gpgKeyUrls().raw().swap( urls ); }
742
743 void RepoInfo::setGpgKeyUrl( const Url & url_r )
744 {
745 _pimpl->gpgKeyUrls().raw().clear();
746 _pimpl->gpgKeyUrls().raw().push_back( url_r );
747 }
748
749 std::string RepoInfo::repoStatusString() const
750 { return _pimpl->repoStatusString(); }
751
752 void RepoInfo::addBaseUrl( Url url_r )
753 {
754 for ( const auto & url : _pimpl->baseUrls().raw() ) // Raw unique!
755 if ( url == url_r )
756 return;
757
758 _pimpl->baseUrls().raw().push_back( url_r );
759 _pimpl->resetMirrorUrls ();
760 }
761
762 void RepoInfo::setBaseUrl( Url url_r )
763 {
764 _pimpl->baseUrls().raw().clear();
765 _pimpl->resetMirrorUrls ();
766 _pimpl->baseUrls().raw().push_back( std::move(url_r) );
767 }
768
769 void RepoInfo::setBaseUrls( url_set urls )
770 {
771 _pimpl->resetMirrorUrls ();
772 _pimpl->baseUrls().raw().swap( urls );
773 }
774
775 MirroredOriginSet RepoInfo::repoOrigins() const
776 {
777 return _pimpl->repoOrigins();
778 }
779
780 bool RepoInfo::repoOriginsEmpty() const
781 {
782 return ( _pimpl->baseUrls().empty () && _pimpl->mirrorUrls().empty() );
783 }
784
785 void RepoInfo::setPath( const Pathname &path )
786 { _pimpl->_path = path.absolutename(); /* must not refer to ../ */ }
787
788 void RepoInfo::setType( const repo::RepoType &t )
789 { _pimpl->setType( t ); }
790
791 void RepoInfo::setProbedType( const repo::RepoType &t ) const
792 { _pimpl->setProbedType( t ); }
793
794
795 void RepoInfo::setMetadataPath( const Pathname &path )
796 { _pimpl->metadataPath( path ); }
797
798 void RepoInfo::setPackagesPath( const Pathname &path )
799 { _pimpl->packagesPath( path ); }
800
801 Pathname RepoInfo::predownloadPath() const
802 { return _pimpl->predownloadPath(); }
803
804 void RepoInfo::setKeepPackages( bool keep )
805 { _pimpl->keeppackages = keep; }
806
807 void RepoInfo::setService( const std::string& name )
808 { _pimpl->service = name; }
809
810 void RepoInfo::setTargetDistribution( const std::string & targetDistribution )
811 { _pimpl->targetDistro = targetDistribution; }
812
813 bool RepoInfo::keepPackages() const
814 { return indeterminate(_pimpl->keeppackages) ? false : (bool)_pimpl->keeppackages; }
815
816 bool RepoInfo::effectiveKeepPackages() const
817 { return keepPackages() || PathInfo(packagesPath().dirname()/".keep_packages").isExist(); }
818
819 Pathname RepoInfo::metadataPath() const
820 { return _pimpl->metadataPath(); }
821
822 Pathname RepoInfo::systemPackagesPath() const
823 { return _pimpl->systemPackagesPath(); }
824
825 Pathname RepoInfo::packagesPath() const
826 { return _pimpl->packagesPath(); }
827
828 bool RepoInfo::usesAutoMetadataPaths() const
829 { return _pimpl->usesAutoMetadataPaths(); }
830
831 repo::RepoType RepoInfo::type() const
832 { return _pimpl->type(); }
833
834 Url RepoInfo::mirrorListUrl() const // Variables replaced!
835 { return _pimpl->mirrorListUrl().transformed(); }
836
837 Url RepoInfo::rawMirrorListUrl() const // Raw
838 { return _pimpl->mirrorListUrl().raw(); }
839
840 bool RepoInfo::gpgKeyUrlsEmpty() const
841 { return _pimpl->gpgKeyUrls().empty(); }
842
843 RepoInfo::urls_size_type RepoInfo::gpgKeyUrlsSize() const
844 { return _pimpl->gpgKeyUrls().size(); }
845
846 RepoInfo::url_set RepoInfo::gpgKeyUrls() const // Variables replaced!
847 { return _pimpl->gpgKeyUrls().transformed(); }
848
849 RepoInfo::url_set RepoInfo::rawGpgKeyUrls() const // Raw
850 { return _pimpl->gpgKeyUrls().raw(); }
851
852 Url RepoInfo::gpgKeyUrl() const // Variables replaced!
853 { return( _pimpl->gpgKeyUrls().empty() ? Url() : *_pimpl->gpgKeyUrls().transformedBegin() ); }
854
855 Url RepoInfo::rawGpgKeyUrl() const // Raw
856 { return( _pimpl->gpgKeyUrls().empty() ? Url() : *_pimpl->gpgKeyUrls().rawBegin() ) ; }
857
858 RepoInfo::url_set RepoInfo::baseUrls() const // Variables replaced!
859 { return _pimpl->baseUrls().transformed(); }
860
861 RepoInfo::url_set RepoInfo::rawBaseUrls() const // Raw
862 { return _pimpl->baseUrls().raw(); }
863
864 Pathname RepoInfo::path() const
865 { return _pimpl->_path; }
866
867 std::string RepoInfo::service() const
868 { return _pimpl->service; }
869
870 std::string RepoInfo::targetDistribution() const
871 { return _pimpl->targetDistro; }
872
873 Url RepoInfo::rawUrl() const
874 { return _pimpl->baseUrl().raw(); }
875
876 Url RepoInfo::location() const
877 { return _pimpl->location (); }
878
879 RepoInfo::urls_const_iterator RepoInfo::baseUrlsBegin() const
880 { return _pimpl->baseUrls().transformedBegin(); }
881
882 RepoInfo::urls_const_iterator RepoInfo::baseUrlsEnd() const
883 { return _pimpl->baseUrls().transformedEnd(); }
884
885 RepoInfo::urls_size_type RepoInfo::baseUrlsSize() const
886 { return _pimpl->baseUrls().size(); }
887
888 bool RepoInfo::baseUrlsEmpty() const
889 { return _pimpl->baseUrls().empty(); }
890
891 bool RepoInfo::baseUrlSet() const
892 { return _pimpl->baseurl2dump(); }
893
894 Url RepoInfo::url() const
895 {
896 return _pimpl->baseUrl().transformed();
897 }
898
899 const std::set<std::string> & RepoInfo::contentKeywords() const
900 { return _pimpl->contentKeywords(); }
901
902 void RepoInfo::addContent( const std::string & keyword_r )
903 { _pimpl->addContent( keyword_r ); }
904
905 bool RepoInfo::hasContent() const
906 { return _pimpl->hasContent(); }
907
908 bool RepoInfo::hasContent( const std::string & keyword_r ) const
909 { return _pimpl->hasContent( keyword_r ); }
910
912
913 bool RepoInfo::hasLicense() const
914 { return hasLicense( std::string() ); }
915
916 bool RepoInfo::hasLicense( const std::string & name_r ) const
917 { return !_pimpl->licenseTgz( name_r ).empty(); }
918
919
920 bool RepoInfo::needToAcceptLicense() const
921 { return needToAcceptLicense( std::string() ); }
922
923 bool RepoInfo::needToAcceptLicense( const std::string & name_r ) const
924 {
925 const Pathname & licenseTgz( _pimpl->licenseTgz( name_r ) );
926 if ( licenseTgz.empty() )
927 return false; // no licenses at all
928
929 ExternalProgram::Arguments cmd;
930 cmd.push_back( "tar" );
931 cmd.push_back( "-t" );
932 cmd.push_back( "-z" );
933 cmd.push_back( "-f" );
934 cmd.push_back( licenseTgz.asString() );
935 ExternalProgram prog( cmd, ExternalProgram::Stderr_To_Stdout );
936
937 bool accept = true;
938 static const std::string noAcceptanceFile = "no-acceptance-needed\n";
939 for ( std::string output( prog.receiveLine() ); output.length(); output = prog.receiveLine() )
940 {
941 if ( output == noAcceptanceFile )
942 {
943 accept = false;
944 }
945 }
946 prog.close();
947 MIL << "License(" << name_r << ") in " << name() << " has to be accepted: " << (accept?"true":"false" ) << endl;
948 return accept;
949 }
950
951
952 std::string RepoInfo::getLicense( const Locale & lang_r )
953 { return const_cast<const RepoInfo *>(this)->getLicense( std::string(), lang_r ); }
954
955 std::string RepoInfo::getLicense( const Locale & lang_r ) const
956 { return getLicense( std::string(), lang_r ); }
957
958 std::string RepoInfo::getLicense( const std::string & name_r, const Locale & lang_r ) const
959 {
960 LocaleSet avlocales( getLicenseLocales( name_r ) );
961 if ( avlocales.empty() )
962 return std::string();
963
964 Locale getLang( Locale::bestMatch( avlocales, lang_r ) );
965 if ( !getLang && avlocales.find( Locale::noCode ) == avlocales.end() )
966 {
967 WAR << "License(" << name_r << ") in " << name() << " contains no fallback text!" << endl;
968 // Using the fist locale instead of returning no text at all.
969 // So the user might recognize that there is a license, even if they
970 // can't read it.
971 getLang = *avlocales.begin();
972 }
973
974 // now extract the license file.
975 static const std::string licenseFileFallback( "license.txt" );
976 std::string licenseFile( !getLang ? licenseFileFallback
977 : str::form( "license.%s.txt", getLang.c_str() ) );
978
979 ExternalProgram::Arguments cmd;
980 cmd.push_back( "tar" );
981 cmd.push_back( "-x" );
982 cmd.push_back( "-z" );
983 cmd.push_back( "-O" );
984 cmd.push_back( "-f" );
985 cmd.push_back( _pimpl->licenseTgz( name_r ).asString() ); // if it not exists, avlocales was empty.
986 cmd.push_back( licenseFile );
987
988 std::string ret;
989 ExternalProgram prog( cmd, ExternalProgram::Discard_Stderr );
990 for ( std::string output( prog.receiveLine() ); output.length(); output = prog.receiveLine() )
991 {
992 ret += output;
993 }
994 prog.close();
995 return ret;
996 }
997
998
999 LocaleSet RepoInfo::getLicenseLocales() const
1000 { return getLicenseLocales( std::string() ); }
1001
1002 LocaleSet RepoInfo::getLicenseLocales( const std::string & name_r ) const
1003 {
1004 const Pathname & licenseTgz( _pimpl->licenseTgz( name_r ) );
1005 if ( licenseTgz.empty() )
1006 return LocaleSet();
1007
1008 ExternalProgram::Arguments cmd;
1009 cmd.push_back( "tar" );
1010 cmd.push_back( "-t" );
1011 cmd.push_back( "-z" );
1012 cmd.push_back( "-f" );
1013 cmd.push_back( licenseTgz.asString() );
1014
1015 LocaleSet ret;
1016 ExternalProgram prog( cmd, ExternalProgram::Stderr_To_Stdout );
1017 for ( std::string output( prog.receiveLine() ); output.length(); output = prog.receiveLine() )
1018 {
1019 static const C_Str license( "license." );
1020 static const C_Str dotTxt( ".txt\n" );
1021 if ( str::hasPrefix( output, license ) && str::hasSuffix( output, dotTxt ) )
1022 {
1023 if ( output.size() <= license.size() + dotTxt.size() ) // license.txt
1024 ret.insert( Locale() );
1025 else
1026 ret.insert( Locale( std::string( output.c_str()+license.size(), output.size()- license.size() - dotTxt.size() ) ) );
1027 }
1028 }
1029 prog.close();
1030 return ret;
1031 }
1032
1034
1035 std::ostream & RepoInfo::dumpOn( std::ostream & str ) const
1036 {
1037 RepoInfoBase::dumpOn(str);
1038 if ( _pimpl->baseurl2dump() )
1039 {
1040 for ( const auto & url : _pimpl->baseUrls().raw() )
1041 {
1042 str << "- url : " << url << std::endl;
1043 }
1044 }
1045
1046 // print if non empty value
1047 auto strif( [&] ( const std::string & tag_r, const std::string & value_r ) {
1048 if ( ! value_r.empty() )
1049 str << tag_r << value_r << std::endl;
1050 });
1051
1052 strif( "- mirrorlist : ", _pimpl->cfgMirrorlistUrl().raw().asString() );
1053 strif( "- metalink : ", _pimpl->cfgMetalinkUrl().raw().asString() );
1054 strif( "- path : ", path().asString() );
1055 str << "- type : " << type() << std::endl;
1056 str << "- priority : " << priority() << std::endl;
1057
1058 // Yes No Default(Y) Default(N)
1059#define OUTS(T,B) ( indeterminate(T) ? (std::string("D(")+(B?"Y":"N")+")") : ((bool)T?"Y":"N") )
1060 str << "- gpgcheck : " << OUTS(_pimpl->rawGpgCheck(),gpgCheck())
1061 << " repo" << OUTS(_pimpl->rawRepoGpgCheck(),repoGpgCheck()) << (repoGpgCheckIsMandatory() ? "* ": " " )
1062 << "sig" << asString( validRepoSignature(), "?", "Y", "N" )
1063 << " pkg" << OUTS(_pimpl->rawPkgGpgCheck(),pkgGpgCheck()) << (pkgGpgCheckIsMandatory() ? "* ": " " )
1064 << std::endl;
1065#undef OUTS
1066
1067 for ( const auto & url : _pimpl->gpgKeyUrls().raw() )
1068 {
1069 str << "- gpgkey : " << url << std::endl;
1070 }
1071
1072 if ( ! indeterminate(_pimpl->keeppackages) )
1073 str << "- keeppackages: " << keepPackages() << std::endl;
1074
1075 strif( "- service : ", service() );
1076 strif( "- targetdistro: ", targetDistribution() );
1077 strif( "- filePath : ", filepath().asString() );
1078 strif( "- metadataPath: ", metadataPath().asString() );
1079 strif( "- packagesPath: ", packagesPath().asString() );
1080
1081 _pimpl->forDumpableExtraValues( [&]( std::string_view k, std::string_view v, bool builtin_r ) {
1082 str << ( builtin_r ? "- " : "# " ) << k << ": " << v << std::endl;
1083 } );
1084 return str;
1085 }
1086
1087 std::ostream & RepoInfo::dumpAsIniOn( std::ostream & str ) const
1088 {
1089 // libzypp/#638: Add a note to service maintained repo entries
1090 if( ! service().empty() ) {
1091 str << "# Repository '"<<alias()<<"' is maintained by the '"<<service()<<"' service." << endl;
1092 str << "# Manual changes may be overwritten by a service refresh." << endl;
1093 str << "# See also 'man zypper', section 'Services'." << endl;
1094 }
1095 RepoInfoBase::dumpAsIniOn(str);
1096
1097 if ( _pimpl->baseurl2dump() )
1098 {
1099 str << "baseurl=";
1100 std::string indent;
1101 for ( const auto & url : _pimpl->baseUrls().raw() )
1102 {
1103 str << indent << hotfix1050625::asString( url ) << endl;
1104 if ( indent.empty() ) indent = " "; // "baseurl="
1105 }
1106 }
1107
1108 if ( ! path().empty() )
1109 str << "path="<< path() << endl;
1110
1111 if ( ! _pimpl->cfgMirrorlistUrl().raw().asString().empty() )
1112 str << "mirrorlist=" << hotfix1050625::asString( _pimpl->cfgMirrorlistUrl().raw() ) << endl;
1113
1114 if ( ! _pimpl->cfgMetalinkUrl().raw().asString().empty() )
1115 str << "metalink=" << hotfix1050625::asString( _pimpl->cfgMetalinkUrl().raw() ) << endl;
1116
1117 if ( type() != repo::RepoType::NONE )
1118 str << "type=" << type().asString() << endl;
1119
1120 if ( priority() != defaultPriority() )
1121 str << "priority=" << priority() << endl;
1122
1123 if ( ! indeterminate(_pimpl->rawGpgCheck()) )
1124 str << "gpgcheck=" << (_pimpl->rawGpgCheck() ? "1" : "0") << endl;
1125
1126 if ( ! indeterminate(_pimpl->rawRepoGpgCheck()) )
1127 str << "repo_gpgcheck=" << (_pimpl->rawRepoGpgCheck() ? "1" : "0") << endl;
1128
1129 if ( ! indeterminate(_pimpl->rawPkgGpgCheck()) )
1130 str << "pkg_gpgcheck=" << (_pimpl->rawPkgGpgCheck() ? "1" : "0") << endl;
1131
1132 {
1133 std::string indent( "gpgkey=");
1134 for ( const auto & url : _pimpl->gpgKeyUrls().raw() )
1135 {
1136 str << indent << url << endl;
1137 if ( indent[0] != ' ' )
1138 indent = " ";
1139 }
1140 }
1141
1142 if (!indeterminate(_pimpl->keeppackages))
1143 str << "keeppackages=" << keepPackages() << endl;
1144
1145 if( ! service().empty() )
1146 str << "service=" << service() << endl;
1147
1148 _pimpl->forDumpableExtraValues( [&]( std::string_view k, std::string_view v ) {
1149 str << k << "=" << v << endl;
1150 } );
1151
1152 return str;
1153 }
1154
1155 std::ostream & RepoInfo::dumpAsXmlOn( std::ostream & str, const std::string & content ) const
1156 {
1157 std::string tmpstr;
1158 str
1159 << "<repo"
1160 << " alias=\"" << escape(alias()) << "\""
1161 << " name=\"" << escape(name()) << "\"";
1162 if (type() != repo::RepoType::NONE)
1163 str << " type=\"" << type().asString() << "\"";
1164 str
1165 << " priority=\"" << priority() << "\""
1166 << " enabled=\"" << enabled() << "\""
1167 << " autorefresh=\"" << autorefresh() << "\""
1168 << " gpgcheck=\"" << gpgCheck() << "\""
1169 << " repo_gpgcheck=\"" << repoGpgCheck() << "\""
1170 << " pkg_gpgcheck=\"" << pkgGpgCheck() << "\"";
1171 if ( ! indeterminate(_pimpl->rawGpgCheck()) )
1172 str << " raw_gpgcheck=\"" << (_pimpl->rawGpgCheck() ? "1" : "0") << "\"";
1173 if ( ! indeterminate(_pimpl->rawRepoGpgCheck()) )
1174 str << " raw_repo_gpgcheck=\"" << (_pimpl->rawRepoGpgCheck() ? "1" : "0") << "\"";
1175 if ( ! indeterminate(_pimpl->rawPkgGpgCheck()) )
1176 str << " raw_pkg_gpgcheck=\"" << (_pimpl->rawPkgGpgCheck() ? "1" : "0") << "\"";
1177 if (!(tmpstr = gpgKeyUrl().asString()).empty())
1178 str << " gpgkey=\"" << escape(tmpstr) << "\"";
1179 if ( ! (tmpstr = _pimpl->cfgMirrorlistUrl().transformed().asString()).empty() )
1180 str << " mirrorlist=\"" << escape(tmpstr) << "\"";
1181 if ( ! (tmpstr = _pimpl->cfgMetalinkUrl().transformed().asString()).empty() )
1182 str << " metalink=\"" << escape(tmpstr) << "\"";
1183 str << ">" << endl;
1184
1185 if ( _pimpl->baseurl2dump() )
1186 {
1187 for_( it, baseUrlsBegin(), baseUrlsEnd() ) // !transform iterator replaces variables
1188 str << "<url>" << escape((*it).asString()) << "</url>" << endl;
1189 }
1190
1191 _pimpl->forDumpableExtraValues( [&]( std::string_view k, std::string_view v ) {
1192 str << "<extra key=\"" << escape(std::string(k)) << "\">"
1193 << escape(std::string(v))
1194 << "</extra>" << endl;
1195 } );
1196
1197 str << "</repo>" << endl;
1198 return str;
1199 }
1200
1201
1202 std::ostream & operator<<( std::ostream & str, const RepoInfo & obj )
1203 {
1204 return obj.dumpOn(str);
1205 }
1206
1207 std::ostream & operator<<( std::ostream & str, const RepoInfo::GpgCheck & obj )
1208 {
1209 switch ( obj )
1210 {
1211#define OUTS( V ) case RepoInfo::V: return str << #V; break
1212 OUTS( GpgCheck::On );
1213 OUTS( GpgCheck::Strict );
1214 OUTS( GpgCheck::AllowUnsigned );
1215 OUTS( GpgCheck::AllowUnsignedRepo );
1216 OUTS( GpgCheck::AllowUnsignedPackage );
1217 OUTS( GpgCheck::Default );
1218 OUTS( GpgCheck::Off );
1219 OUTS( GpgCheck::indeterminate );
1220#undef OUTS
1221 }
1222 return str << "GpgCheck::UNKNOWN";
1223 }
1224
1225 bool RepoInfo::requireStatusWithMediaFile () const
1226 {
1227 // We skip the check for downloading media unless a local copy of the
1228 // media file exists and states that there is more than one medium.
1229 const auto &origins = _pimpl->repoOrigins ();
1230 bool canSkipMediaCheck = std::all_of( origins.begin(), origins.end(), []( const MirroredOrigin &origin ) { return origin.authority().url().schemeIsDownloading(); });
1231 if ( canSkipMediaCheck ) {
1232 const auto &mDataPath = metadataPath();
1233 if ( not mDataPath.empty() ) {
1234 PathInfo mediafile { mDataPath/"media.1/media" };
1235 if ( mediafile.isExist() ) {
1236 repo::SUSEMediaVerifier lverifier { mediafile.path() };
1237 if ( lverifier && lverifier.totalMedia() > 1 ) {
1238 canSkipMediaCheck = false;
1239 }
1240 }
1241 }
1242 }
1243 if ( canSkipMediaCheck )
1244 DBG << "Can SKIP media.1/media check for status calc of repo " << alias() << endl;
1245 return not canSkipMediaCheck;
1246 }
1247
1248 bool RepoInfo::hasExtraValue( const std::string & key_r ) const
1249 { return _pimpl->hasExtraValue( key_r ); }
1250
1251 std::string RepoInfo::extraValue( const std::string & key_r ) const
1252 { return _pimpl->extraValue( key_r ); }
1253
1254 bool RepoInfo::setExtraValue( const std::string & key_r, std::string value_r )
1255 { return _pimpl->setExtraValue( key_r, std::move(value_r) ); }
1256
1257
1259} // 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:129
MIL
#define MIL
Definition Logger.h:130
WAR
#define WAR
Definition Logger.h:131
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::IdStringType::c_str
const char * c_str() const
Definition IdStringType.h:115
zypp::InputStream::InputStream
InputStream()
Default ctor providing std::cin.
Definition inputstream.cc:63
zypp::Locale
'Language[_Country]' codes.
Definition Locale.h:51
zypp::Locale::noCode
static const Locale noCode
Empty code.
Definition Locale.h:75
zypp::Locale::Locale
Locale()
Default Ctor: noCode.
Definition Locale.cc:180
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::PathInfo::PathInfo
PathInfo()
Definition PathInfo.cc:131
zypp::RepoInfo::setPkgGpgCheck
void setPkgGpgCheck(TriBool value_r)
Set the value for pkgGpgCheck (or indeterminate to use the default).
Definition RepoInfo.cc:639
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:1155
zypp::RepoInfo::setGpgKeyUrls
void setGpgKeyUrls(url_set urls)
Set a list of gpgkey URLs defined for this repo.
Definition RepoInfo.cc:740
zypp::RepoInfo::setMetalinkUrl
void setMetalinkUrl(const Url &url)
Set the raw metalink url.
Definition RepoInfo.cc:722
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:1035
zypp::RepoInfo::metadataPath
Pathname metadataPath() const
Path where this repo metadata was read from.
Definition RepoInfo.cc:819
zypp::RepoInfo::hasExtraValue
bool hasExtraValue(const std::string &key_r) const
Whether an extra value for key_r is set.
Definition RepoInfo.cc:1248
zypp::RepoInfo::setMirrorlistUrl
void setMirrorlistUrl(const Url &url)
Set the raw mirrorlist url.
Definition RepoInfo.cc:719
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:743
zypp::RepoInfo::usesAutoMetadataPaths
bool usesAutoMetadataPaths() const
Whether metadataPath uses AUTO% setup.
Definition RepoInfo.cc:828
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:888
zypp::RepoInfo::predownloadPath
Pathname predownloadPath() const
Path where this repo packages are predownloaded.
Definition RepoInfo.cc:801
zypp::RepoInfo::hasContent
bool hasContent() const
Check for content keywords.
Definition RepoInfo.cc:905
zypp::RepoInfo::repoOrigins
MirroredOriginSet repoOrigins() const
The repodata origins.
Definition RepoInfo.cc:775
zypp::RepoInfo::setKeepPackages
void setKeepPackages(bool keep)
Set if packaqes downloaded from this repository will be kept in local cache.
Definition RepoInfo.cc:804
zypp::RepoInfo::gpgKeyUrls
url_set gpgKeyUrls() const
The list of gpgkey URLs defined for this repo.
Definition RepoInfo.cc:846
zypp::RepoInfo::rawGpgKeyUrl
Url rawGpgKeyUrl() const
(leagcy API) The 1st raw gpgkey URL defined for this repo (no variables replaced)
Definition RepoInfo.cc:855
zypp::RepoInfo::~RepoInfo
~RepoInfo() override
Definition RepoInfo.cc:597
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:873
zypp::RepoInfo::type
repo::RepoType type() const
Type of repository,.
Definition RepoInfo.cc:831
zypp::RepoInfo::rawGpgKeyUrls
url_set rawGpgKeyUrls() const
The list of raw gpgkey URLs defined for this repo (no variables replaced).
Definition RepoInfo.cc:849
zypp::RepoInfo::noPriority
static unsigned noPriority()
The least priority (unsigned(-1)).
Definition RepoInfo.cc:606
zypp::RepoInfo::baseUrlsSize
urls_size_type baseUrlsSize() const
number of repository urls
Definition RepoInfo.cc:885
zypp::RepoInfo::keepPackages
bool keepPackages() const
Whether packages downloaded from this repository will be kept in local cache.
Definition RepoInfo.cc:813
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:894
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:762
zypp::RepoInfo::contentKeywords
const std::set< std::string > & contentKeywords() const
Content keywords defined.
Definition RepoInfo.cc:899
zypp::RepoInfo::baseUrlsEnd
urls_const_iterator baseUrlsEnd() const
iterator that points at end of repository urls
Definition RepoInfo.cc:882
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:876
zypp::RepoInfo::setPackagesPath
void setPackagesPath(const Pathname &path)
set the path where the local packages are stored
Definition RepoInfo.cc:798
zypp::RepoInfo::rawCfgMetalinkUrl
Url rawCfgMetalinkUrl() const
The configured raw metalink url.
Definition RepoInfo.cc:728
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:955
zypp::RepoInfo::baseUrlSet
bool baseUrlSet() const
Whether there are manualy configured repository urls.
Definition RepoInfo.cc:891
zypp::RepoInfo::setService
void setService(const std::string &name)
sets service which added this repository
Definition RepoInfo.cc:807
zypp::RepoInfo::setExtraValue
bool setExtraValue(const std::string &key_r, std::string value_r)
Remember extra value_r for key_r.
Definition RepoInfo.cc:1254
zypp::RepoInfo::setGpgCheck
void setGpgCheck(TriBool value_r)
Set the value for gpgCheck (or indeterminate to use the default).
Definition RepoInfo.cc:616
zypp::RepoInfo::effectiveKeepPackages
bool effectiveKeepPackages() const
keepPackages unless the package cache itself enforces keeping the packages.
Definition RepoInfo.cc:816
zypp::RepoInfo::path
Pathname path() const
Repository path.
Definition RepoInfo.cc:864
zypp::RepoInfo::gpgKeyUrlsSize
urls_size_type gpgKeyUrlsSize() const
Number of gpgkey URLs defined.
Definition RepoInfo.cc:843
zypp::RepoInfo::getLicenseLocales
LocaleSet getLicenseLocales() const
Return the locales the license is available for.
Definition RepoInfo.cc:999
zypp::RepoInfo::baseUrls
url_set baseUrls() const
The complete set of repository urls as configured.
Definition RepoInfo.cc:858
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:1225
zypp::RepoInfo::addBaseUrl
void addBaseUrl(Url url)
Add a base url.
Definition RepoInfo.cc:752
zypp::RepoInfo::pkgGpgCheckIsMandatory
bool pkgGpgCheckIsMandatory() const
Mandatory check (pkgGpgCheck is not off) must ask to confirm using unsigned packages.
Definition RepoInfo.cc:636
zypp::RepoInfo::rawBaseUrls
url_set rawBaseUrls() const
The complete set of raw repository urls (no variables replaced).
Definition RepoInfo.cc:861
zypp::RepoInfo::mirrorListUrl
Url mirrorListUrl() const
Url of a file which contains a list of repository urls.
Definition RepoInfo.cc:834
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:791
zypp::RepoInfo::setBaseUrls
void setBaseUrls(url_set urls)
Clears current base URL list and adds an url_set.
Definition RepoInfo.cc:769
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:867
zypp::RepoInfo::setTargetDistribution
void setTargetDistribution(const std::string &targetDistribution)
Sets the distribution for which is this repository meant.
Definition RepoInfo.cc:810
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:1087
zypp::RepoInfo::priority
unsigned priority() const
Repository priority for solver.
Definition RepoInfo.cc:600
zypp::RepoInfo::gpgCheck
bool gpgCheck() const
Whether default signature checking should be performed.
Definition RepoInfo.cc:613
zypp::RepoInfo::setPath
void setPath(const Pathname &path)
set the product path.
Definition RepoInfo.cc:785
zypp::RepoInfo::gpgKeyUrl
Url gpgKeyUrl() const
(leagcy API) The 1st gpgkey URL defined for this repo
Definition RepoInfo.cc:852
zypp::RepoInfo::setValidRepoSignature
void setValidRepoSignature(TriBool value_r)
Set the value for validRepoSignature (or indeterminate if unsigned).
Definition RepoInfo.cc:658
zypp::RepoInfo::RepoInfo
RepoInfo()
Definition RepoInfo.cc:593
zypp::RepoInfo::defaultPriority
static unsigned defaultPriority()
The default priority (99).
Definition RepoInfo.cc:603
zypp::RepoInfo::needToAcceptLicense
bool needToAcceptLicense() const
Whether the repo license has to be accepted, e.g.
Definition RepoInfo.cc:920
zypp::RepoInfo::setPriority
void setPriority(unsigned newval_r)
Set repository priority for solver.
Definition RepoInfo.cc:609
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:879
zypp::RepoInfo::hasLicense
bool hasLicense() const
Whether there is a license associated with the repo.
Definition RepoInfo.cc:913
zypp::RepoInfo::repoGpgCheckIsMandatory
bool repoGpgCheckIsMandatory() const
Mandatory check (repoGpgCheck is on) must ask to confirm using unsigned repos.
Definition RepoInfo.cc:626
zypp::RepoInfo::setMetadataPath
void setMetadataPath(const Pathname &path)
Set the path where the local metadata is stored.
Definition RepoInfo.cc:795
zypp::RepoInfo::validRepoSignature
TriBool validRepoSignature() const
Whether the repo metadata are signed and successfully validated or indeterminate if unsigned.
Definition RepoInfo.cc:651
zypp::RepoInfo::setRepoGpgCheck
void setRepoGpgCheck(TriBool value_r)
Set the value for repoGpgCheck (or indeterminate to use the default).
Definition RepoInfo.cc:629
zypp::RepoInfo::operator<<
friend std::ostream & operator<<(std::ostream &str, const RepoInfo &obj)
relates: RepoInfo Stream output
Definition RepoInfo.cc:1202
zypp::RepoInfo::packagesPath
Pathname packagesPath() const
packagesPath Checks if the effective user is allowed to write into the system package cache.
Definition RepoInfo.cc:825
zypp::RepoInfo::addContent
void addContent(const std::string &keyword_r)
Add content keywords.
Definition RepoInfo.cc:902
zypp::RepoInfo::repoGpgCheck
bool repoGpgCheck() const
Whether the signature of repo metadata should be checked for this repo.
Definition RepoInfo.cc:623
zypp::RepoInfo::targetDistribution
std::string targetDistribution() const
Distribution for which is this repository meant.
Definition RepoInfo.cc:870
zypp::RepoInfo::getRawGpgChecks
void getRawGpgChecks(TriBool &g_r, TriBool &r_r, TriBool &p_r) const
Raw values for RepoManager.
Definition RepoInfo.cc:643
zypp::RepoInfo::setType
void setType(const repo::RepoType &t)
set the repository type
Definition RepoInfo.cc:788
zypp::RepoInfo::pkgGpgCheck
bool pkgGpgCheck() const
Whether the signature of rpm packages should be checked for this repo.
Definition RepoInfo.cc:633
zypp::RepoInfo::repoStatusString
std::string repoStatusString() const
A string value to track changes requiring a refresh.
Definition RepoInfo.cc:749
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:837
zypp::RepoInfo::gpgKeyUrlsEmpty
bool gpgKeyUrlsEmpty() const
Whether gpgkey URLs are defined.
Definition RepoInfo.cc:840
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:1251
zypp::RepoInfo::systemPackagesPath
Pathname systemPackagesPath() const
Returns a path to the system-defined package cache.
Definition RepoInfo.cc:822
zypp::RepoInfo::rawCfgMirrorlistUrl
Url rawCfgMirrorlistUrl() const
The configured raw mirrorlist url.
Definition RepoInfo.cc:725
zypp::RepoInfo::repoOriginsEmpty
bool repoOriginsEmpty() const
whether repo origins are available
Definition RepoInfo.cc:780
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:1094
zypp::ZConfig::pkgGpgCheck
TriBool pkgGpgCheck() const
Check rpm package signatures (indeterminate - according to gpgcheck).
Definition ZConfig.cc:1096
zypp::ZConfig::instance
static ZConfig & instance()
Singleton ctor.
Definition ZConfig.cc:794
zypp::ZConfig::repoGpgCheck
TriBool repoGpgCheck() const
Check repo matadata signatures (indeterminate - according to gpgcheck).
Definition ZConfig.cc:1095
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::dirname
Pathname dirname() const
Return all but the last component od this path.
Definition Pathname.h:133
zypp::filesystem::Pathname::emptyOrRoot
bool emptyOrRoot() const
Test for "" or "/".
Definition Pathname.h:127
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::basename
std::string basename() const
Return the last component of this path.
Definition Pathname.h:137
zypp::filesystem::Pathname::empty
bool empty() const
Test for an empty path.
Definition Pathname.h:117
zypp::filesystem::Pathname::absolutename
Pathname absolutename() const
Return this path, adding a leading '/' if relative.
Definition Pathname.h:148
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:416
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
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:1136
zypp::JobReport::repoRefreshMirrorlist
static const ContentType repoRefreshMirrorlist
Definition ZYppCallbacks.h:1114
zypp::RepoInfo::Impl
RepoInfo implementation.
Definition RepoInfo.cc:105
zypp::RepoInfo::Impl::_type
repo::RepoType _type
Definition RepoInfo.cc:434
zypp::RepoInfo::Impl::_packagesPath
Pathname _packagesPath
Definition RepoInfo.cc:559
zypp::RepoInfo::Impl::rawPkgGpgCheck
TriBool rawPkgGpgCheck() const
Definition RepoInfo.cc:419
zypp::RepoInfo::Impl::_rawRepoGpgCheck
TriBool _rawRepoGpgCheck
need to check repo sign.: Y/N/(ZConf(Y/N/gpgCheck))
Definition RepoInfo.cc:413
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:380
zypp::RepoInfo::Impl::triBoolFromPath
TriBool triBoolFromPath(const Pathname &path_r) const
Definition RepoInfo.cc:406
zypp::RepoInfo::Impl::Impl
Impl(const Impl &)=default
zypp::RepoInfo::Impl::packagesPath
void packagesPath(Pathname new_r)
Definition RepoInfo.cc:466
zypp::RepoInfo::Impl::rawRepoGpgCheck
void rawRepoGpgCheck(TriBool val_r)
Definition RepoInfo.cc:422
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:423
zypp::RepoInfo::Impl::predownloadPath
Pathname predownloadPath() const
Definition RepoInfo.cc:499
zypp::RepoInfo::Impl::_metadataPath
Pathname _metadataPath
Definition RepoInfo.cc:558
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:574
zypp::RepoInfo::Impl::metadataPath
Pathname metadataPath() const
Definition RepoInfo.cc:480
zypp::RepoInfo::Impl::priority
DefaultIntegral< unsigned, defaultPriority > priority
Definition RepoInfo.cc:504
zypp::RepoInfo::Impl::_cfgMetalinkUrl
RepoVariablesReplacedUrl _cfgMetalinkUrl
Definition RepoInfo.cc:438
zypp::RepoInfo::Impl::cfgGpgCheck
bool cfgGpgCheck() const
Definition RepoInfo.cc:425
zypp::RepoInfo::Impl::setMetalinkUrl
void setMetalinkUrl(const Url &url_r)
Definition RepoInfo.cc:447
zypp::RepoInfo::Impl::setExtraValue
bool setExtraValue(const std::string &key_r, std::string value_r)
Definition RepoInfo.cc:531
zypp::RepoInfo::Impl::cfgMirrorlistUrl
const RepoVariablesReplacedUrl & cfgMirrorlistUrl() const
Config file writing needs to tell them appart.
Definition RepoInfo.cc:451
zypp::RepoInfo::Impl::_alternatePackagesPath
std::optional< Pathname > _alternatePackagesPath
in case _packagesPath is not writable
Definition RepoInfo.cc:560
zypp::RepoInfo::Impl::hasExtraValue
bool hasExtraValue(const std::string &key_r) const
Definition RepoInfo.cc:525
zypp::RepoInfo::Impl::setMirrorlistUrl
void setMirrorlistUrl(const Url &url_r)
Definition RepoInfo.cc:444
zypp::RepoInfo::Impl::_mirrorUrls
RepoVariablesReplacedUrlList _mirrorUrls
possible mirrors as fetched via mirrorlist or metalink
Definition RepoInfo.cc:564
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:565
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:429
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:454
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:570
zypp::RepoInfo::Impl::~Impl
~Impl()
Definition RepoInfo.cc:120
zypp::RepoInfo::Impl::_baseUrls
RepoVariablesReplacedUrlList _baseUrls
baseUrls as configured
Definition RepoInfo.cc:562
zypp::RepoInfo::Impl::operator=
Impl & operator=(Impl &&)=delete
zypp::RepoInfo::Impl::_repoOrigins
std::vector< MirroredOrigin > _repoOrigins
Definition RepoInfo.cc:566
zypp::RepoInfo::Impl::service
std::string service
Definition RepoInfo.cc:460
zypp::RepoInfo::Impl::_extraValues
std::map< std::string, std::string > _extraValues
Basically raw .repo file key-value lines.
Definition RepoInfo.cc:507
zypp::RepoInfo::Impl::rawGpgCheck
void rawGpgCheck(TriBool val_r)
Definition RepoInfo.cc:421
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:412
zypp::RepoInfo::Impl::packagesPath
Pathname packagesPath() const
Definition RepoInfo.cc:494
zypp::RepoInfo::Impl::mirrorListUrl
const RepoVariablesReplacedUrl & mirrorListUrl() const
THE mirrorListUrl to work with (either_cfgMirrorlistUrl or _cfgMetalinkUrl).
Definition RepoInfo.cc:441
zypp::RepoInfo::Impl::metadataPath
void metadataPath(Pathname new_r)
Definition RepoInfo.cc:463
zypp::RepoInfo::Impl::_path
Pathname _path
Definition RepoInfo.cc:459
zypp::RepoInfo::Impl::rawGpgCheck
TriBool rawGpgCheck() const
Definition RepoInfo.cc:417
zypp::RepoInfo::Impl::rawRepoGpgCheck
TriBool rawRepoGpgCheck() const
Definition RepoInfo.cc:418
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:461
zypp::RepoInfo::Impl::gpgKeyUrls
const RepoVariablesReplacedUrlList & gpgKeyUrls() const
Definition RepoInfo.cc:275
zypp::RepoInfo::Impl::cfgRepoGpgCheck
TriBool cfgRepoGpgCheck() const
Definition RepoInfo.cc:427
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:414
zypp::RepoInfo::Impl::extraValue
std::string extraValue(const std::string &key_r) const
Definition RepoInfo.cc:528
zypp::RepoInfo::Impl::keeppackages
TriBool keeppackages
Definition RepoInfo.cc:458
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:433
zypp::RepoInfo::Impl::type
repo::RepoType type() const
Definition RepoInfo.cc:135
zypp::RepoInfo::Impl::systemPackagesPath
Pathname systemPackagesPath() const
Definition RepoInfo.cc:487
zypp::RepoInfo::Impl::operator=
Impl & operator=(const Impl &)=delete
zypp::RepoInfo::Impl::_cfgMirrorlistUrl
RepoVariablesReplacedUrl _cfgMirrorlistUrl
Definition RepoInfo.cc:437
zypp::RepoInfo::Impl::forDumpableExtraValues
void forDumpableExtraValues(Fnc &&fnc_r) const
Filter discarding not dumpable extra values.
Definition RepoInfo.cc:539
zypp::RepoInfo::Impl::_keywords
std::pair< FalseBool, std::set< std::string > > _keywords
Definition RepoInfo.cc:568
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:477
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:513
zypp::base::ContainerTransform::transformedBegin
TransformedConstIterator transformedBegin() const
Definition ValueTransform.h:148
zypp::base::ContainerTransform::transformed
Container transformed() const
Return copy with transformed variables (expensive).
Definition ValueTransform.h:155
zypp::base::ContainerTransform::raw
const Container & raw() const
Get the raw value.
Definition ValueTransform.h:134
zypp::base::ContainerTransform::empty
bool empty() const
Definition ValueTransform.h:119
zypp::base::ContainerTransform::rawBegin
RawConstIterator rawBegin() const
Definition ValueTransform.h:127
zypp::base::ContainerTransform::transformator
const Transformator & transformator() const
Return the transformator.
Definition ValueTransform.h:167
zypp::base::ContainerTransform::clear
void clear()
Clear the container.
Definition ValueTransform.h:142
zypp::base::ContainerTransform::size
size_type size() const
Definition ValueTransform.h:122
zypp::base::ContainerTransform::transformedEnd
TransformedConstIterator transformedEnd() const
Definition ValueTransform.h:151
zypp::base::ValueTransform::raw
const RawType & raw() const
Get the raw value.
Definition ValueTransform.h:59
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