libzypp 17.38.9
ZConfig.cc
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12#include <cstdlib>
13#include <iostream>
14#include <optional>
15#include <map>
16#include <zypp-core/APIConfig.h>
19#include <zypp-core/base/InputStream>
23
24#include <zypp/ZConfig.h>
25#include <zypp/ZYppFactory.h>
26#include <zypp/PathInfo.h>
27#include <zypp-core/parser/EconfDict>
28
29#include <zypp/sat/Pool.h>
31
32#include <zypp-media/MediaConfig>
33
34using std::endl;
35using namespace zypp::filesystem;
36using namespace zypp::parser;
37
38#undef ZYPP_BASE_LOGGER_LOGGROUP
39#define ZYPP_BASE_LOGGER_LOGGROUP "zconfig"
40
42namespace zypp
43{
44
45 namespace env {
46 inline std::optional<Pathname> ZYPP_CONF()
47 {
48 const char *env_confpath = getenv( "ZYPP_CONF" );
49 if ( env_confpath )
50 return env_confpath;
51 return std::nullopt;
52 }
53 } // namespace env
54
55
56
67 namespace
68 {
69
87 Locale _autodetectTextLocale()
88 {
90 const char * envlist[] = { "LC_ALL", "LC_MESSAGES", "LANG", NULL };
91 for ( const char ** envvar = envlist; *envvar; ++envvar )
92 {
93 const char * envlang = getenv( *envvar );
94 if ( envlang )
95 {
96 std::string envstr( envlang );
97 if ( envstr != "POSIX" && envstr != "C" )
98 {
99 Locale lang( envstr );
100 if ( lang )
101 {
102 MIL << "Found " << *envvar << "=" << envstr << endl;
103 ret = lang;
104 break;
105 }
106 }
107 }
108 }
109 MIL << "Default text locale is '" << ret << "'" << endl;
110#warning HACK AROUND BOOST_TEST_CATCH_SYSTEM_ERRORS
111 setenv( "BOOST_TEST_CATCH_SYSTEM_ERRORS", "no", 1 );
112 return ret;
113 }
114
125 struct ZyppConfIniMap : public IniDict {
126 ZyppConfIniMap( Pathname root_r = "/" )
127 : IniDict { iniMapReadFrom(root_r) }
128 {
129 pMIL( str::sconcat("zypp.conf(", root_r, "):"), *this );
130 pDBG( dump(*this) );
131 }
132
133 private:
135 IniDict iniMapReadFrom( const Pathname & root_r )
136 {
137 pMIL( "Reading zypp.conf for root", root_r );
138 std::optional<Pathname> ZYPP_CONF { env::ZYPP_CONF() };
139 if ( ZYPP_CONF ) {
140 // Read the plain file requested by $ZYPP_CONF
141 pMIL( "$ZYPP_CONF is set to", str::sconcat("'",*ZYPP_CONF,"'") );
142 PathInfo conf { root_r / *ZYPP_CONF };
143 if ( conf.isFile() ) {
144 pMIL( "$ZYPP_CONF requests reading file", conf );
145 return parser::IniDict( conf.path() );
146 } else {
147 pMIL( "$ZYPP_CONF denotes no file below root. Using builtin defaults." );
148 return parser::IniDict();
149 }
150 } else {
151 // Econf mode reading the systems settings
152 return parser::EconfDict( "/zypp/zypp.conf", root_r );
153 }
154 }
155 };
156
158 } // namespace zypp
160
162 template<class Tp>
163 struct Option
164 {
165 using value_type = Tp;
166
168 Option( value_type initial_r )
169 : _val( std::move(initial_r) )
170 {}
171
173 { set( std::move(newval_r) ); return *this; }
174
176 const value_type & get() const
177 { return _val; }
178
180 operator const value_type &() const
181 { return _val; }
182
184 void set( value_type newval_r )
185 { _val = std::move(newval_r); }
186
187 private:
189 };
190
192 template<class Tp>
193 struct DefaultOption : public Option<Tp>
194 {
195 using value_type = Tp;
197
198 explicit DefaultOption( value_type initial_r )
199 : Option<Tp>( initial_r )
200 , _default( std::move(initial_r) )
201 {}
202
204 { this->set( std::move(newval_r) ); return *this; }
205
208 { this->set( _default.get() ); }
209
212 { setDefault( std::move(newval_r) ); restoreToDefault(); }
213
215 const value_type & getDefault() const
216 { return _default.get(); }
217
219 void setDefault( value_type newval_r )
220 { _default.set( std::move(newval_r) ); }
221
222 private:
224 };
225
227 //
228 // CLASS NAME : ZConfig::Impl
229 //
236 {
237 using MultiversionSpec = std::set<std::string>;
238
241 {
254
255 bool consume( const std::string & section, const std::string & entry, const std::string & value )
256 {
257 if ( section != "main" )
258 return false;
259
260 if ( entry == "solver.focus" )
261 {
262 fromString( value, solver_focus );
263 }
264 else if ( entry == "solver.onlyRequires" )
265 {
267 }
268 else if ( entry == "solver.allowVendorChange" )
269 {
271 }
272 else if ( entry == "solver.dupAllowDowngrade" )
273 {
275 }
276 else if ( entry == "solver.dupAllowNameChange" )
277 {
279 }
280 else if ( entry == "solver.dupAllowArchChange" )
281 {
283 }
284 else if ( entry == "solver.dupAllowVendorChange" )
285 {
287 }
288 else if ( entry == "solver.cleandepsOnRemove" )
289 {
291 }
292 else if ( entry == "solver.upgradeTestcasesToKeep" )
293 {
295 }
296 else if ( entry == "solver.upgradeRemoveDroppedPackages" )
297 {
299 }
300 else
301 return false;
302
303 return true;
304 }
305
316 };
317
318 public:
322 , cfg_cache_path { "/var/cache/zypp" }
323 , cfg_metadata_path { "" } // empty - follows cfg_cache_path
324 , cfg_solvfiles_path { "" } // empty - follows cfg_cache_path
325 , cfg_packages_path { "" } // empty - follows cfg_cache_path
326 , updateMessagesNotify ( "" )
327 , repo_add_probe ( false )
328 , repo_refresh_delay ( 10 )
329 , repoLabelIsAlias ( false )
330 , download_use_deltarpm ( APIConfig(LIBZYPP_CONFIG_USE_DELTARPM_BY_DEFAULT) )
333 , download_mediaMountdir ( "/var/adm/mount" )
335 , gpgCheck ( true )
336 , repoGpgCheck ( indeterminate )
337 , pkgGpgCheck ( indeterminate )
338 , apply_locks_file ( true )
339 , pluginsPath ( "/usr/lib/zypp/plugins" )
340 , geoipEnabled ( true )
341 , geoipHosts { "download.opensuse.org" }
342 {
343 MIL << "libzypp: " LIBZYPP_VERSION_STRING << " (" << LIBZYPP_CODESTREAM << ")" << endl;
344
345 ZyppConfIniMap iniMap; // Scan the default zypp.conf settings
346
347 using EnvMap = std::map<std::string,std::string>;
348 std::optional<EnvMap> envMap;
349 for ( const auto & section : iniMap.sections() ) {
350 for ( const auto & [entry,value] : iniMap.entries( section ) ) {
351
352 if ( _initialTargetDefaults.consume( section, entry, value ) )
353 continue;
354
355 if ( _mediaConf.setConfigValue( section, entry, value ) )
356 continue;
357
358 if ( section == "main" )
359 {
360 if ( entry == "lock_timeout" )
361 {
362 str::strtonum( value, cfg_lockTimeout );
363 }
364 else if ( entry == "arch" )
365 {
366 Arch carch( value );
367 if ( carch != cfg_arch ) {
368 WAR << "Overriding system architecture (" << cfg_arch << "): " << carch << endl;
369 cfg_arch = carch;
370 }
371 }
372 else if ( entry == "cachedir" )
373 {
374 cfg_cache_path.restoreToDefault( value );
375 }
376 else if ( entry == "metadatadir" )
377 {
378 cfg_metadata_path.restoreToDefault( value );
379 }
380 else if ( entry == "solvfilesdir" )
381 {
382 cfg_solvfiles_path.restoreToDefault( value );
383 }
384 else if ( entry == "packagesdir" )
385 {
386 cfg_packages_path.restoreToDefault( value );
387 }
388 else if ( entry == "configdir" )
389 {
390 cfg_config_path = Pathname(value);
391 }
392 else if ( entry == "reposdir" )
393 {
394 cfg_known_repos_path = Pathname(value);
395 }
396 else if ( entry == "servicesdir" )
397 {
398 cfg_known_services_path = Pathname(value);
399 }
400 else if ( entry == "varsdir" )
401 {
402 cfg_vars_path = Pathname(value);
403 }
404 else if ( entry == "repo.add.probe" )
405 {
406 repo_add_probe = str::strToBool( value, repo_add_probe );
407 }
408 else if ( entry == "repo.refresh.delay" )
409 {
410 str::strtonum(value, repo_refresh_delay);
411 }
412 else if ( entry == "repo.refresh.locales" )
413 {
414 std::vector<std::string> tmp;
415 str::split( value, back_inserter( tmp ), ", \t" );
416
417 boost::function<Locale(const std::string &)> transform(
418 [](const std::string & str_r)->Locale{ return Locale(str_r); }
419 );
420 repoRefreshLocales.insert( make_transform_iterator( tmp.begin(), transform ),
421 make_transform_iterator( tmp.end(), transform ) );
422 }
423 else if ( entry == "download.use_deltarpm" )
424 {
425 download_use_deltarpm = str::strToBool( value, download_use_deltarpm );
426 }
427 else if ( entry == "download.use_deltarpm.always" )
428 {
429 download_use_deltarpm_always = str::strToBool( value, download_use_deltarpm_always );
430 }
431 else if ( entry == "download.media_preference" )
432 {
433 download_media_prefer_download.restoreToDefault( str::compareCI( value, "volatile" ) != 0 );
434 }
435 else if ( entry == "download.media_mountdir" )
436 {
437 download_mediaMountdir.restoreToDefault( Pathname(value) );
438 }
439 else if ( entry == "download.use_geoip_mirror") {
440 geoipEnabled = str::strToBool( value, geoipEnabled );
441 }
442 else if ( entry == "commit.downloadMode" )
443 {
444 commit_downloadMode.set( deserializeDownloadMode( value ) );
445 }
446 else if ( entry == "gpgcheck" )
447 {
448 gpgCheck.restoreToDefault( str::strToBool( value, gpgCheck ) );
449 }
450 else if ( entry == "repo_gpgcheck" )
451 {
452 repoGpgCheck.restoreToDefault( str::strToTriBool( value ) );
453 }
454 else if ( entry == "pkg_gpgcheck" )
455 {
456 pkgGpgCheck.restoreToDefault( str::strToTriBool( value ) );
457 }
458 else if ( entry == "vendordir" )
459 {
460 cfg_vendor_path = Pathname(value);
461 }
462 else if ( entry == "multiversiondir" )
463 {
464 cfg_multiversion_path = Pathname(value);
465 }
466 else if ( entry == "multiversion.kernels" )
467 {
468 cfg_kernel_keep_spec = value;
469 }
470 else if ( entry == "solver.checkSystemFile" )
471 {
472 solver_checkSystemFile = Pathname(value);
473 }
474 else if ( entry == "solver.checkSystemFileDir" )
475 {
476 solver_checkSystemFileDir = Pathname(value);
477 }
478 else if ( entry == "multiversion" )
479 {
480 MultiversionSpec & defSpec( _multiversionMap.getDefaultSpec() );
481 str::splitEscaped( value, std::inserter( defSpec, defSpec.end() ), ", \t" );
482 }
483 else if ( entry == "locksfile.path" )
484 {
485 locks_file = Pathname(value);
486 }
487 else if ( entry == "locksfile.apply" )
488 {
489 apply_locks_file = str::strToBool( value, apply_locks_file );
490 }
491 else if ( entry == "update.datadir" )
492 {
493 // ignore, this is a constant anyway and should not be user configurabe
494 // update_data_path = Pathname(value);
495 }
496 else if ( entry == "update.scriptsdir" )
497 {
498 // ignore, this is a constant anyway and should not be user configurabe
499 // update_scripts_path = Pathname(value);
500 }
501 else if ( entry == "update.messagessdir" )
502 {
503 // ignore, this is a constant anyway and should not be user configurabe
504 // update_messages_path = Pathname(value);
505 }
506 else if ( entry == "update.messages.notify" )
507 {
508 updateMessagesNotify.set( value );
509 }
510 else if ( entry == "rpm.install.excludedocs" )
511 {
512 rpmInstallFlags.setFlag( target::rpm::RPMINST_EXCLUDEDOCS,
513 str::strToBool( value, false ) );
514 }
515 else if ( entry == "history.logfile" )
516 {
517 history_log_path = Pathname(value);
518 }
519 else if ( entry == "ZYPP_SINGLE_RPMTRANS" || entry == "techpreview.ZYPP_SINGLE_RPMTRANS" )
520 {
521 DBG << "ZYPP_SINGLE_RPMTRANS=" << value << endl;
522 ::setenv( "ZYPP_SINGLE_RPMTRANS", value.c_str(), 0 );
523 }
524 else if ( entry == "techpreview.ZYPP_MEDIANETWORK" )
525 {
526 DBG << "techpreview.ZYPP_MEDIANETWORK=" << value << endl;
527 ::setenv( "ZYPP_MEDIANETWORK", value.c_str(), 1 );
528 }
529 else { // unknown entry
530 pWAR( "zypp.conf: Unknown entry in [main]:", entry, "=", value );
531 }
532 }
533 else if ( section == "env" )
534 {
535 if ( !envMap )
536 envMap = EnvMap();
537 auto [it, inserted] = envMap->emplace( entry, value );
538 if ( !inserted ) {
539 WAR << "zypp.conf [env]: duplicate key '" << entry << "', shadowing previous value '" << it->second << "' with '" << value << "'" << endl;
540 it->second = value;
541 }
542 }
543 else { // unknown section {
544 pWAR( "zypp.conf: Unknown section:", str::sconcat("[",section,"]"), entry, "=", value );
545 }
546 }
547 }
548
549 if ( envMap ) {
550 for ( const auto & [entry, value] : *envMap ) {
551 const char* exists = ::getenv( entry.c_str() );
552 if ( exists == nullptr ) {
553 if ( ::setenv( entry.c_str(), value.c_str(), 0 ) != 0 ) {
554 pWAR( "zypp.conf [env]: set", str::sconcat("'",entry,"=",value,"'"), ": failed", Errno() );
555 }
556 else {
557 pMIL( "zypp.conf [env]: set", str::sconcat("'",entry,"=",value,"'") );
558 }
559 }
560 else {
561 pWAR( "zypp.conf [env]: skip", str::sconcat("'",entry,"=",value,"'"), ": is already set to", str::sconcat("'",exists,"'") );
562 }
563 }
564 }
565
566 // legacy:
567 if ( getenv( "ZYPP_TESTSUITE_FAKE_ARCH" ) )
568 {
569 Arch carch( getenv( "ZYPP_TESTSUITE_FAKE_ARCH" ) );
570 if ( carch != cfg_arch )
571 {
572 WAR << "ZYPP_TESTSUITE_FAKE_ARCH: Overriding system architecture (" << cfg_arch << "): " << carch << endl;
573 cfg_arch = carch;
574 }
575 }
576 MIL << "ZConfig singleton created." << endl;
577 }
578
579 Impl(const Impl &) = delete;
580 Impl(Impl &&) = delete;
581 Impl &operator=(const Impl &) = delete;
582 Impl &operator=(Impl &&) = delete;
583 ~Impl() {}
584
593 {
594 Target_Ptr target( getZYpp()->getTarget() );
595 return target ? target->root() : _announced_root_path;
596 }
597
599 {
600 _announced_root_path = Pathname(); // first of all reset any previously _announced_root_path
601
602 Pathname newRoot { _autodetectSystemRoot() };
603 MIL << "notifyTargetChanged (" << newRoot << ")" << endl;
604
605 if ( newRoot.emptyOrRoot() ) {
606 _currentTargetDefaults.reset(); // to initial settigns from /
607 }
608 else {
610 ZyppConfIniMap iniMap { newRoot }; // Scan the zypp.conf settings for newRoot
611 for ( const auto & section : iniMap.sections() ) {
612 for ( const auto & [entry,value] : iniMap.entries( section ) ) {
613 (*_currentTargetDefaults).consume( section, entry, value );
614 }
615 }
616 }
617 }
618
619 public:
621
622 long cfg_lockTimeout = 0; // signed!
623
626
627 DefaultOption<Pathname> cfg_cache_path; // Settings from the config file are also remembered
628 DefaultOption<Pathname> cfg_metadata_path; // 'default'. Cleanup in RepoManager e.g needs to tell
629 DefaultOption<Pathname> cfg_solvfiles_path; // whether settings in effect are config values or
630 DefaultOption<Pathname> cfg_packages_path; // custom settings applied vie set...Path().
631
637
642
644
649
654
656
660
663
665 const MultiversionSpec & multiversion() const { return getMultiversion(); }
666
668
669 target::rpm::RpmInstFlags rpmInstallFlags;
670
672
673 std::string userData;
674
676
678
679 std::vector<std::string> geoipHosts;
680
681 /* Other config singleton instances */
683
684
685 public:
688 private:
690 std::optional<TargetDefaults> _currentTargetDefaults;
691
692 private:
693 // HACK for bnc#906096: let pool re-evaluate multiversion spec
694 // if target root changes. ZConfig returns data sensitive to
695 // current target root.
696 // TODO Actually we'd need to scan the target systems zypp.conf and
697 // overlay all system specific values.
699 {
700 using SpecMap = std::map<Pathname, MultiversionSpec>;
701
702 MultiversionSpec & getSpec( Pathname root_r, const Impl & zConfImpl_r ) // from system at root
703 {
704 // _specMap[] - the plain zypp.conf value
705 // _specMap[/] - combine [] and multiversion.d scan
706 // _specMap[root] - scan root/zypp.conf and root/multiversion.d
707
708 if ( root_r.empty() )
709 root_r = "/";
710 bool cacheHit = _specMap.count( root_r );
711 MultiversionSpec & ret( _specMap[root_r] ); // creates new entry on the fly
712
713 if ( ! cacheHit )
714 {
715 // bsc#1193488: If no (/root)/.../zypp.conf exists use the default zypp.conf
716 // multiversion settings. It is a legacy that the packaged multiversion setting
717 // in zypp.conf (the kernel) may differ from the builtin default (empty).
718 // But we want a missing config to behave similar to the default one, otherwise
719 // a bare metal install easily runs into trouble.
720 if ( root_r == "/" || not scanConfAt( root_r, ret, zConfImpl_r ) )
721 ret = _specMap[Pathname()];
722 scanDirAt( root_r, ret, zConfImpl_r ); // add multiversion.d at root_r
723 using zypp::operator<<;
724 MIL << "MultiversionSpec '" << root_r << "' = " << ret << endl;
725 }
726 return ret;
727 }
728
729 MultiversionSpec & getDefaultSpec() // Spec from zypp.conf parsing; called before any getSpec
730 { return _specMap[Pathname()]; }
731
732 private:
733 bool scanConfAt( const Pathname& root_r, MultiversionSpec & spec_r, const Impl & zConfImpl_r )
734 {
735 ZyppConfIniMap iniMap { root_r }; // Scan the zypp.conf settings for root
736 // TODO: iniDict lacks direct value access :(
737 for ( const auto & section : iniMap.sections() ) {
738 for ( const auto & [entry,value] : iniMap.entries( section ) ) {
739 if ( entry == "multiversion" ) {
740 str::splitEscaped( value, std::inserter( spec_r, spec_r.end() ), ", \t" );
741 return true;
742 }
743 }
744 }
745 return false;
746 }
747
748 void scanDirAt( const Pathname& root_r, MultiversionSpec & spec_r, const Impl & zConfImpl_r )
749 {
750 // NOTE: Actually we'd need to scan and use the root_r! zypp.conf values.
751 Pathname multiversionDir( zConfImpl_r.cfg_multiversion_path );
752 if ( multiversionDir.empty() )
753 multiversionDir = ( zConfImpl_r.cfg_config_path.empty()
754 ? Pathname("/etc/zypp")
755 : zConfImpl_r.cfg_config_path ) / "multiversion.d";
756
757 filesystem::dirForEach( Pathname::assertprefix( root_r, multiversionDir ),
758 [&spec_r]( const Pathname & dir_r, const char *const & name_r )->bool
759 {
760 MIL << "Parsing " << dir_r/name_r << endl;
761 iostr::simpleParseFile( InputStream( dir_r/name_r ),
762 [&spec_r]( int num_r, std::string line_r )->bool
763 {
764 DBG << " found " << line_r << endl;
765 spec_r.insert( std::move(line_r) );
766 return true;
767 } );
768 return true;
769 } );
770 }
771
772 private:
774 };
775
777 { return _multiversionMap.getSpec( _autodetectSystemRoot(), *this ); }
778
780 };
781
782
784 //
785 // METHOD NAME : ZConfig::instance
786 // METHOD TYPE : ZConfig &
787 //
789 {
790 static ZConfig _instance; // The singleton
791 return _instance;
792 }
793
795 //
796 // METHOD NAME : ZConfig::ZConfig
797 // METHOD TYPE : Ctor
798 //
800 : _pimpl( new Impl )
801 {
802 about( MIL );
803 }
804
806 //
807 // METHOD NAME : ZConfig::~ZConfig
808 // METHOD TYPE : Dtor
809 //
812
814 {
815 const char * env = getenv("ZYPP_LOCK_TIMEOUT");
816 if ( env ) {
817 return str::strtonum<long>( env );
818 }
819 return _pimpl->cfg_lockTimeout;
820 }
821
823 { return _pimpl->notifyTargetChanged(); }
824
826 { return _pimpl->_autodetectSystemRoot(); }
827
829 {
830 return ( _pimpl->cfg_repo_mgr_root_path.empty()
831 ? systemRoot() : _pimpl->cfg_repo_mgr_root_path );
832 }
833
835 { _pimpl->cfg_repo_mgr_root_path = root; }
836
838 { _pimpl->_announced_root_path = root_r; }
839
841 //
842 // system architecture
843 //
845
850
852 { return _pimpl->cfg_arch; }
853
855 {
856 if ( arch_r != _pimpl->cfg_arch )
857 {
858 WAR << "Overriding system architecture (" << _pimpl->cfg_arch << "): " << arch_r << endl;
859 _pimpl->cfg_arch = arch_r;
860 }
861 }
862
864 //
865 // text locale
866 //
868
870 {
871 static Locale _val( _autodetectTextLocale() );
872 return _val;
873 }
874
876 { return _pimpl->cfg_textLocale; }
877
878 void ZConfig::setTextLocale( const Locale & locale_r )
879 {
880 if ( locale_r != _pimpl->cfg_textLocale )
881 {
882 WAR << "Overriding text locale (" << _pimpl->cfg_textLocale << "): " << locale_r << endl;
883 _pimpl->cfg_textLocale = locale_r;
884 // Propagate changes
886 }
887 }
888
890 // user data
892
894 { return !_pimpl->userData.empty(); }
895
896 std::string ZConfig::userData() const
897 { return _pimpl->userData; }
898
899 bool ZConfig::setUserData( const std::string & str_r )
900 {
901 for_( ch, str_r.begin(), str_r.end() )
902 {
903 if ( *ch < ' ' && *ch != '\t' )
904 {
905 ERR << "New user data string rejectded: char " << (int)*ch << " at position " << (ch - str_r.begin()) << endl;
906 return false;
907 }
908 }
909 MIL << "Set user data string to '" << str_r << "'" << endl;
910 _pimpl->userData = str_r;
911 return true;
912 }
913
915
917 {
918 return ( _pimpl->cfg_cache_path.get().empty()
919 ? Pathname("/var/cache/zypp") : _pimpl->cfg_cache_path.get() );
920 }
921
923 {
924 return repoCachePath()/"pubkeys";
925 }
926
928 {
929 _pimpl->cfg_cache_path = path_r;
930 }
931
933 {
934 return ( _pimpl->cfg_metadata_path.get().empty()
935 ? (repoCachePath()/"raw") : _pimpl->cfg_metadata_path.get() );
936 }
937
939 {
940 _pimpl->cfg_metadata_path = path_r;
941 }
942
944 {
945 return ( _pimpl->cfg_solvfiles_path.get().empty()
946 ? (repoCachePath()/"solv") : _pimpl->cfg_solvfiles_path.get() );
947 }
948
950 {
951 _pimpl->cfg_solvfiles_path = path_r;
952 }
953
955 {
956 return ( _pimpl->cfg_packages_path.get().empty()
957 ? (repoCachePath()/"packages") : _pimpl->cfg_packages_path.get() );
958 }
959
961 {
962 _pimpl->cfg_packages_path = path_r;
963 }
964
966 { return _pimpl->cfg_cache_path.getDefault().empty() ? Pathname("/var/cache/zypp") : _pimpl->cfg_cache_path.getDefault(); }
967
969 { return _pimpl->cfg_metadata_path.getDefault().empty() ? (builtinRepoCachePath()/"raw") : _pimpl->cfg_metadata_path.getDefault(); }
970
972 { return _pimpl->cfg_solvfiles_path.getDefault().empty() ? (builtinRepoCachePath()/"solv") : _pimpl->cfg_solvfiles_path.getDefault(); }
973
975 { return _pimpl->cfg_packages_path.getDefault().empty() ? (builtinRepoCachePath()/"packages") : _pimpl->cfg_packages_path.getDefault(); }
976
978
980 {
981 return ( _pimpl->cfg_config_path.empty()
982 ? Pathname("/etc/zypp") : _pimpl->cfg_config_path );
983 }
984
986 {
987 return ( _pimpl->cfg_known_repos_path.empty()
988 ? (configPath()/"repos.d") : _pimpl->cfg_known_repos_path );
989 }
990
992 {
993 return ( _pimpl->cfg_known_services_path.empty()
994 ? (configPath()/"services.d") : _pimpl->cfg_known_services_path );
995 }
996
998 { return configPath()/"needreboot"; }
999
1001 { return configPath()/"needreboot.d"; }
1002
1003 void ZConfig::setGeoipEnabled( bool enable )
1004 { _pimpl->geoipEnabled = enable; }
1005
1007 { return _pimpl->geoipEnabled; }
1008
1010 { return builtinRepoCachePath()/"geoip.d"; }
1011
1012 const std::vector<std::string> ZConfig::geoipHostnames () const
1013 { return _pimpl->geoipHosts; }
1014
1016 {
1017 return ( _pimpl->cfg_vars_path.empty()
1018 ? (configPath()/"vars.d") : _pimpl->cfg_vars_path );
1019 }
1020
1022 {
1023 return ( _pimpl->cfg_vendor_path.empty()
1024 ? (configPath()/"vendors.d") : _pimpl->cfg_vendor_path );
1025 }
1026
1028 {
1029 return ( _pimpl->locks_file.empty()
1030 ? (configPath()/"locks") : _pimpl->locks_file );
1031 }
1032
1034
1036 { return _pimpl->repo_add_probe; }
1037
1039 { return _pimpl->repo_refresh_delay; }
1040
1042 { return _pimpl->repoRefreshLocales.empty() ? Target::requestedLocales("") :_pimpl->repoRefreshLocales; }
1043
1045 { return _pimpl->repoLabelIsAlias; }
1046
1047 void ZConfig::repoLabelIsAlias( bool yesno_r )
1048 { _pimpl->repoLabelIsAlias = yesno_r; }
1049
1051 { return _pimpl->download_use_deltarpm; }
1052
1054 { return download_use_deltarpm() && _pimpl->download_use_deltarpm_always; }
1055
1057 { return _pimpl->download_media_prefer_download; }
1058
1060 { _pimpl->download_media_prefer_download.set( yesno_r ); }
1061
1063 { _pimpl->download_media_prefer_download.restoreToDefault(); }
1064
1066 { return _pimpl->_mediaConf.download_max_concurrent_connections(); }
1067
1069 { return _pimpl->_mediaConf.download_min_download_speed(); }
1070
1072 { return _pimpl->_mediaConf.download_max_download_speed(); }
1073
1075 { return _pimpl->_mediaConf.download_max_silent_tries(); }
1076
1078 { return _pimpl->_mediaConf.download_transfer_timeout(); }
1079
1080 Pathname ZConfig::download_mediaMountdir() const { return _pimpl->download_mediaMountdir; }
1081 void ZConfig::set_download_mediaMountdir( Pathname newval_r ) { _pimpl->download_mediaMountdir.set( std::move(newval_r) ); }
1082 void ZConfig::set_default_download_mediaMountdir() { _pimpl->download_mediaMountdir.restoreToDefault(); }
1083
1085 { return _pimpl->commit_downloadMode; }
1086
1087
1088 bool ZConfig::gpgCheck() const { return _pimpl->gpgCheck; }
1089 TriBool ZConfig::repoGpgCheck() const { return _pimpl->repoGpgCheck; }
1090 TriBool ZConfig::pkgGpgCheck() const { return _pimpl->pkgGpgCheck; }
1091
1092 void ZConfig::setGpgCheck( bool val_r ) { _pimpl->gpgCheck.set( val_r ); }
1093 void ZConfig::setRepoGpgCheck( TriBool val_r ) { _pimpl->repoGpgCheck.set( val_r ); }
1094 void ZConfig::setPkgGpgCheck( TriBool val_r ) { _pimpl->pkgGpgCheck.set( val_r ); }
1095
1096 void ZConfig::resetGpgCheck() { _pimpl->gpgCheck.restoreToDefault(); }
1097 void ZConfig::resetRepoGpgCheck() { _pimpl->repoGpgCheck.restoreToDefault(); }
1098 void ZConfig::resetPkgGpgCheck() { _pimpl->pkgGpgCheck.restoreToDefault(); }
1099
1100
1101 ResolverFocus ZConfig::solver_focus() const { return _pimpl->targetDefaults().solver_focus; }
1102 bool ZConfig::solver_onlyRequires() const { return _pimpl->targetDefaults().solver_onlyRequires; }
1103 bool ZConfig::solver_allowVendorChange() const { return _pimpl->targetDefaults().solver_allowVendorChange; }
1104 bool ZConfig::solver_dupAllowDowngrade() const { return _pimpl->targetDefaults().solver_dupAllowDowngrade; }
1105 bool ZConfig::solver_dupAllowNameChange() const { return _pimpl->targetDefaults().solver_dupAllowNameChange; }
1106 bool ZConfig::solver_dupAllowArchChange() const { return _pimpl->targetDefaults().solver_dupAllowArchChange; }
1107 bool ZConfig::solver_dupAllowVendorChange() const { return _pimpl->targetDefaults().solver_dupAllowVendorChange; }
1108 bool ZConfig::solver_cleandepsOnRemove() const { return _pimpl->targetDefaults().solver_cleandepsOnRemove; }
1109 unsigned ZConfig::solver_upgradeTestcasesToKeep() const { return _pimpl->targetDefaults().solver_upgradeTestcasesToKeep; }
1110
1111 bool ZConfig::solverUpgradeRemoveDroppedPackages() const { return _pimpl->targetDefaults().solverUpgradeRemoveDroppedPackages; }
1112 void ZConfig::setSolverUpgradeRemoveDroppedPackages( bool val_r ) { _pimpl->targetDefaults().solverUpgradeRemoveDroppedPackages.set( val_r ); }
1113 void ZConfig::resetSolverUpgradeRemoveDroppedPackages() { _pimpl->targetDefaults().solverUpgradeRemoveDroppedPackages.restoreToDefault(); }
1114
1115
1117 { return ( _pimpl->solver_checkSystemFile.empty()
1118 ? (configPath()/"systemCheck") : _pimpl->solver_checkSystemFile ); }
1119
1121 { return ( _pimpl->solver_checkSystemFileDir.empty()
1122 ? (configPath()/"systemCheck.d") : _pimpl->solver_checkSystemFileDir ); }
1123
1124
1125 namespace
1126 {
1127 inline void sigMultiversionSpecChanged()
1128 {
1131 }
1132 }
1133
1134 const std::set<std::string> & ZConfig::multiversionSpec() const { return _pimpl->multiversion(); }
1135 void ZConfig::multiversionSpec( std::set<std::string> new_r ) { _pimpl->multiversion().swap( new_r ); sigMultiversionSpecChanged(); }
1136 void ZConfig::clearMultiversionSpec() { _pimpl->multiversion().clear(); sigMultiversionSpecChanged(); }
1137 void ZConfig::addMultiversionSpec( const std::string & name_r ) { _pimpl->multiversion().insert( name_r ); sigMultiversionSpecChanged(); }
1138 void ZConfig::removeMultiversionSpec( const std::string & name_r ) { _pimpl->multiversion().erase( name_r ); sigMultiversionSpecChanged(); }
1139
1141 { return _pimpl->apply_locks_file; }
1142
1144#if LEGACY(1735)
1145 const
1146#endif
1147 {
1148 return Pathname("/var/adm");
1149 }
1150
1152#if LEGACY(1735)
1153 const
1154#endif
1155 {
1156 return Pathname(update_dataPath()/"update-messages");
1157 }
1158
1160#if LEGACY(1735)
1161 const
1162#endif
1163 {
1164 return Pathname(update_dataPath()/"update-scripts");
1165 }
1166
1168 { return _pimpl->updateMessagesNotify; }
1169
1170 void ZConfig::setUpdateMessagesNotify( const std::string & val_r )
1171 { _pimpl->updateMessagesNotify.set( val_r ); }
1172
1174 { _pimpl->updateMessagesNotify.restoreToDefault(); }
1175
1177
1178 target::rpm::RpmInstFlags ZConfig::rpmInstallFlags() const
1179 { return _pimpl->rpmInstallFlags; }
1180
1181
1183 {
1184 return ( _pimpl->history_log_path.empty() ?
1185 Pathname("/var/log/zypp/history") : _pimpl->history_log_path );
1186 }
1187
1189 {
1190 return _pimpl->_mediaConf.credentialsGlobalDir();
1191 }
1192
1194 {
1195 return _pimpl->_mediaConf.credentialsGlobalFile();
1196 }
1197
1199
1200 std::string ZConfig::distroverpkg() const
1201 { return "system-release"; }
1202
1204
1206 { return _pimpl->pluginsPath.get(); }
1207
1209 {
1210 return _pimpl->cfg_kernel_keep_spec;
1211 }
1212
1214
1215 std::ostream & ZConfig::about( std::ostream & str ) const
1216 {
1217 str << "libzypp: " LIBZYPP_VERSION_STRING << " (" << LIBZYPP_CODESTREAM << ")" << endl;
1218
1219 str << "libsolv: " << solv_version;
1220 if ( ::strcmp( solv_version, LIBSOLV_VERSION_STRING ) )
1221 str << " (built against " << LIBSOLV_VERSION_STRING << ")";
1222 str << endl;
1223
1224 str << "TextLocale: '" << textLocale() << "' (" << defaultTextLocale() << ")" << endl;
1225 str << "SystemArchitecture: '" << systemArchitecture() << "' (" << defaultSystemArchitecture() << ")" << endl;
1226 return str;
1227 }
1228
1230} // namespace zypp
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition Easy.h:27
#define pWAR
Definition LogTools.h:316
#define pMIL
Definition LogTools.h:315
#define pDBG
Definition LogTools.h:314
#define DBG
Definition Logger.h:102
#define MIL
Definition Logger.h:103
#define ERR
Definition Logger.h:105
#define WAR
Definition Logger.h:104
Architecture.
Definition Arch.h:37
static Arch detectSystemArchitecture()
Determine system architecture evaluating uname and /proc/cpuinfo.
Definition Arch.cc:701
Convenience errno wrapper.
Definition Errno.h:26
Helper to create and pass std::istream.
Definition inputstream.h:57
'Language[_Country]' codes.
Definition Locale.h:51
static const Locale enCode
Last resort "en".
Definition Locale.h:78
static MediaConfig & instance()
static Pathname assertprefix(const Pathname &root_r, const Pathname &path_r)
Unless path_r does not already denote a path below root_r, combine them.
Definition Pathname.cc:272
LocaleSet requestedLocales() const
Languages to be supported by the system.
Definition Target.cc:94
ZConfig implementation.
Definition ZConfig.cc:236
Pathname cfg_multiversion_path
Definition ZConfig.cc:639
DefaultOption< Pathname > download_mediaMountdir
Definition ZConfig.cc:653
MediaConfig & _mediaConf
Definition ZConfig.cc:682
DefaultOption< Pathname > cfg_metadata_path
Definition ZConfig.cc:628
Pathname cfg_known_repos_path
Definition ZConfig.cc:633
Pathname cfg_known_services_path
Definition ZConfig.cc:634
Pathname _autodetectSystemRoot() const
bsc#1237044: Provide announceSystemRoot to allow commands using –root without launching a Target.
Definition ZConfig.cc:592
Pathname cfg_vars_path
Definition ZConfig.cc:635
Impl & operator=(const Impl &)=delete
Impl & operator=(Impl &&)=delete
DefaultOption< Pathname > cfg_packages_path
Definition ZConfig.cc:630
bool download_use_deltarpm_always
Definition ZConfig.cc:651
void notifyTargetChanged()
Definition ZConfig.cc:598
Pathname solver_checkSystemFile
Definition ZConfig.cc:661
Impl(const Impl &)=delete
MultiversionMap _multiversionMap
Definition ZConfig.cc:779
Pathname history_log_path
Definition ZConfig.cc:671
Pathname locks_file
Definition ZConfig.cc:641
const TargetDefaults & targetDefaults() const
Definition ZConfig.cc:686
MultiversionSpec & getMultiversion() const
Definition ZConfig.cc:776
Impl(Impl &&)=delete
LocaleSet repoRefreshLocales
Definition ZConfig.cc:647
DefaultOption< Pathname > cfg_cache_path
Definition ZConfig.cc:627
std::vector< std::string > geoipHosts
Definition ZConfig.cc:679
TargetDefaults & targetDefaults()
Definition ZConfig.cc:687
Pathname _announced_root_path
Definition ZConfig.cc:620
Option< Pathname > pluginsPath
Definition ZConfig.cc:675
std::string userData
Definition ZConfig.cc:673
std::string cfg_kernel_keep_spec
Definition ZConfig.cc:640
DefaultOption< TriBool > repoGpgCheck
Definition ZConfig.cc:658
unsigned repo_refresh_delay
Definition ZConfig.cc:646
Option< DownloadMode > commit_downloadMode
Definition ZConfig.cc:655
std::optional< TargetDefaults > _currentTargetDefaults
TargetDefaults while –root.
Definition ZConfig.cc:690
MultiversionSpec & multiversion()
Definition ZConfig.cc:664
DefaultOption< bool > download_media_prefer_download
Definition ZConfig.cc:652
std::set< std::string > MultiversionSpec
Definition ZConfig.cc:237
Pathname solver_checkSystemFileDir
Definition ZConfig.cc:662
Pathname cfg_config_path
Definition ZConfig.cc:632
TargetDefaults _initialTargetDefaults
Initial TargetDefaults from /.
Definition ZConfig.cc:689
target::rpm::RpmInstFlags rpmInstallFlags
Definition ZConfig.cc:669
const MultiversionSpec & multiversion() const
Definition ZConfig.cc:665
Pathname cfg_repo_mgr_root_path
Definition ZConfig.cc:636
DefaultOption< TriBool > pkgGpgCheck
Definition ZConfig.cc:659
DefaultOption< std::string > updateMessagesNotify
Definition ZConfig.cc:643
Pathname cfg_vendor_path
Definition ZConfig.cc:638
DefaultOption< Pathname > cfg_solvfiles_path
Definition ZConfig.cc:629
DefaultOption< bool > gpgCheck
Definition ZConfig.cc:657
bool hasUserData() const
Whether a (non empty) user data sting is defined.
Definition ZConfig.cc:893
bool solver_cleandepsOnRemove() const
Whether removing a package should also remove no longer needed requirements.
Definition ZConfig.cc:1108
std::string userData() const
User defined string value to be passed to log, history, plugins...
Definition ZConfig.cc:896
Pathname knownServicesPath() const
Path where the known services .service files are kept (configPath()/services.d).
Definition ZConfig.cc:991
void removeMultiversionSpec(const std::string &name_r)
Definition ZConfig.cc:1138
Pathname repoPackagesPath() const
Path where the repo packages are downloaded and kept (repoCachePath()/packages).
Definition ZConfig.cc:954
unsigned repo_refresh_delay() const
Amount of time in minutes that must pass before another refresh.
Definition ZConfig.cc:1038
Arch systemArchitecture() const
The system architecture zypp uses.
Definition ZConfig.cc:851
Locale textLocale() const
The locale for translated texts zypp uses.
Definition ZConfig.cc:875
const std::vector< std::string > geoipHostnames() const
All hostnames we want to rewrite using the geoip feature.
Definition ZConfig.cc:1012
ZConfig(const ZConfig &)=delete
static Pathname update_dataPath()
Path where the update items are kept (/var/adm).
Definition ZConfig.cc:1143
ResolverFocus solver_focus() const
The resolver's general attitude when resolving jobs.
Definition ZConfig.cc:1101
Pathname builtinRepoSolvfilesPath() const
The builtin config file value.
Definition ZConfig.cc:971
Pathname pluginsPath() const
Defaults to /usr/lib/zypp/plugins.
Definition ZConfig.cc:1205
Pathname repoManagerRoot() const
The RepoManager root directory.
Definition ZConfig.cc:828
void resetRepoGpgCheck()
Reset to the zconfig default.
Definition ZConfig.cc:1097
bool gpgCheck() const
Turn signature checking on/off (on).
Definition ZConfig.cc:1088
Pathname knownReposPath() const
Path where the known repositories .repo files are kept (configPath()/repos.d).
Definition ZConfig.cc:985
long download_transfer_timeout() const
Maximum time in seconds that you allow a transfer operation to take.
Definition ZConfig.cc:1077
void setRepoManagerRoot(const Pathname &root)
Sets the RepoManager root directory.
Definition ZConfig.cc:834
bool solver_dupAllowArchChange() const
DUP tune: Whether to allow package arch changes upon DUP.
Definition ZConfig.cc:1106
void setTextLocale(const Locale &locale_r)
Set the preferred locale for translated texts.
Definition ZConfig.cc:878
bool solverUpgradeRemoveDroppedPackages() const
Whether dist upgrade should remove a products dropped packages (true).
Definition ZConfig.cc:1111
void notifyTargetChanged()
internal
Definition ZConfig.cc:822
static Locale defaultTextLocale()
The autodetected preferred locale for translated texts.
Definition ZConfig.cc:869
Pathname download_mediaMountdir() const
Path where media are preferably mounted or downloaded.
Definition ZConfig.cc:1080
static Pathname update_scriptsPath()
Path where the update scripts are stored ( /var/adm/update-scripts ).
Definition ZConfig.cc:1159
void resetSolverUpgradeRemoveDroppedPackages()
Reset solverUpgradeRemoveDroppedPackages to the zypp.conf default.
Definition ZConfig.cc:1113
bool apply_locks_file() const
Whether locks file should be read and applied after start (true).
Definition ZConfig.cc:1140
bool solver_allowVendorChange() const
Whether vendor check is by default enabled.
Definition ZConfig.cc:1103
void set_default_download_mediaMountdir()
Reset to zypp.cong default.
Definition ZConfig.cc:1082
Pathname repoCachePath() const
Path where the caches are kept (/var/cache/zypp).
Definition ZConfig.cc:916
void setPkgGpgCheck(TriBool val_r)
Change the value.
Definition ZConfig.cc:1094
Pathname needrebootPath() const
Path where the custom needreboot config files are kept (configPath()/needreboot.d).
Definition ZConfig.cc:1000
bool setUserData(const std::string &str_r)
Set a new userData string.
Definition ZConfig.cc:899
Pathname systemRoot() const
The target root directory.
Definition ZConfig.cc:825
long download_max_silent_tries() const
Maximum silent tries.
Definition ZConfig.cc:1074
bool repo_add_probe() const
Whether repository urls should be probed.
Definition ZConfig.cc:1035
target::rpm::RpmInstFlags rpmInstallFlags() const
The default target::rpm::RpmInstFlags for ZYppCommitPolicy.
Definition ZConfig.cc:1178
void setUpdateMessagesNotify(const std::string &val_r)
Set a new command definition (see update.messages.notify in zypp.conf).
Definition ZConfig.cc:1170
unsigned solver_upgradeTestcasesToKeep() const
When committing a dist upgrade (e.g.
Definition ZConfig.cc:1109
Pathname repoMetadataPath() const
Path where the repo metadata is downloaded and kept (repoCachePath()/raw).
Definition ZConfig.cc:932
Pathname geoipCachePath() const
Path where the geoip caches are kept (/var/cache/zypp/geoip).
Definition ZConfig.cc:1009
Pathname vendorPath() const
Directory for equivalent vendor definitions (configPath()/vendors.d).
Definition ZConfig.cc:1021
long download_min_download_speed() const
Minimum download speed (bytes per second) until the connection is dropped.
Definition ZConfig.cc:1068
DownloadMode commit_downloadMode() const
Commit download policy to use as default.
Definition ZConfig.cc:1084
Pathname needrebootFile() const
Path of the default needreboot config file (configPath()/needreboot).
Definition ZConfig.cc:997
void setGpgCheck(bool val_r)
Change the value.
Definition ZConfig.cc:1092
bool solver_dupAllowVendorChange() const
DUP tune: Whether to allow package vendor changes upon DUP.
Definition ZConfig.cc:1107
~ZConfig()
Dtor.
Definition ZConfig.cc:810
void setGeoipEnabled(bool enable=true)
Enables or disables the use of the geoip feature of download.opensuse.org.
Definition ZConfig.cc:1003
Pathname locksFile() const
Path where zypp can find or create lock file (configPath()/locks).
Definition ZConfig.cc:1027
RW_pointer< Impl, rw_pointer::Scoped< Impl > > _pimpl
Pointer to implementation.
Definition ZConfig.h:644
Pathname repoSolvfilesPath() const
Path where the repo solv files are created and kept (repoCachePath()/solv).
Definition ZConfig.cc:943
bool geoipEnabled() const
Returns true if zypp should use the geoip feature of download.opensuse.org.
Definition ZConfig.cc:1006
static Pathname update_messagesPath()
Path where the update messages are stored ( /var/adm/update-messages ).
Definition ZConfig.cc:1151
Pathname historyLogFile() const
Path where ZYpp install history is logged.
Definition ZConfig.cc:1182
void setSystemArchitecture(const Arch &arch_r)
Override the zypp system architecture.
Definition ZConfig.cc:854
TriBool pkgGpgCheck() const
Check rpm package signatures (indeterminate - according to gpgcheck).
Definition ZConfig.cc:1090
static ZConfig & instance()
Singleton ctor.
Definition ZConfig.cc:788
void setRepoPackagesPath(const Pathname &path_r)
Set a new path as the default repo cache path.
Definition ZConfig.cc:960
void setRepoSolvfilesPath(const Pathname &path_r)
Set a new path as the default repo cache path.
Definition ZConfig.cc:949
void resetUpdateMessagesNotify()
Reset to the zypp.conf default.
Definition ZConfig.cc:1173
std::ostream & about(std::ostream &str) const
Print some detail about the current libzypp version.
Definition ZConfig.cc:1215
const std::set< std::string > & multiversionSpec() const
Definition ZConfig.cc:1134
void set_download_mediaMountdir(Pathname newval_r)
Set alternate value.
Definition ZConfig.cc:1081
bool download_use_deltarpm() const
Whether to consider using a deltarpm when downloading a package.
Definition ZConfig.cc:1050
TriBool repoGpgCheck() const
Check repo matadata signatures (indeterminate - according to gpgcheck).
Definition ZConfig.cc:1089
void set_download_media_prefer_download(bool yesno_r)
Set download_media_prefer_download to a specific value.
Definition ZConfig.cc:1059
std::string updateMessagesNotify() const
Command definition for sending update messages.
Definition ZConfig.cc:1167
void addMultiversionSpec(const std::string &name_r)
Definition ZConfig.cc:1137
Pathname builtinRepoCachePath() const
The builtin config file value.
Definition ZConfig.cc:965
Pathname builtinRepoPackagesPath() const
The builtin config file value.
Definition ZConfig.cc:974
Pathname solver_checkSystemFile() const
File in which dependencies described which has to be fulfilled for a running system.
Definition ZConfig.cc:1116
Pathname builtinRepoMetadataPath() const
The builtin config file value.
Definition ZConfig.cc:968
void set_default_download_media_prefer_download()
Set download_media_prefer_download to the configfiles default.
Definition ZConfig.cc:1062
long lockTimeout() const
The number of seconds to wait for the zypp lock to become available.
Definition ZConfig.cc:813
Pathname solver_checkSystemFileDir() const
Directory, which may or may not contain files in which dependencies described which has to be fulfill...
Definition ZConfig.cc:1120
void resetGpgCheck()
Reset to the zconfig default.
Definition ZConfig.cc:1096
void setSolverUpgradeRemoveDroppedPackages(bool val_r)
Set solverUpgradeRemoveDroppedPackages to val_r.
Definition ZConfig.cc:1112
Pathname configPath() const
Path where the configfiles are kept (/etc/zypp).
Definition ZConfig.cc:979
static Arch defaultSystemArchitecture()
The autodetected system architecture.
Definition ZConfig.cc:846
Pathname pubkeyCachePath() const
Path where the pubkey caches.
Definition ZConfig.cc:922
long download_max_concurrent_connections() const
Maximum number of concurrent connections for a single transfer.
Definition ZConfig.cc:1065
void resetPkgGpgCheck()
Reset to the zconfig default.
Definition ZConfig.cc:1098
void announceSystemRoot(const Pathname &root_r)
Announce a target root directory without launching the Target.
Definition ZConfig.cc:837
bool solver_onlyRequires() const
Solver regards required packages,patterns,... only.
Definition ZConfig.cc:1102
Pathname varsPath() const
Path containing custom repo variable definitions (configPath()/vars.d).
Definition ZConfig.cc:1015
bool solver_dupAllowNameChange() const
DUP tune: Whether to follow package renames upon DUP.
Definition ZConfig.cc:1105
bool repoLabelIsAlias() const
Whether to use repository alias or name in user messages (progress, exceptions, .....
Definition ZConfig.cc:1044
void clearMultiversionSpec()
Definition ZConfig.cc:1136
LocaleSet repoRefreshLocales() const
List of locales for which translated package descriptions should be downloaded.
Definition ZConfig.cc:1041
long download_max_download_speed() const
Maximum download speed (bytes per second).
Definition ZConfig.cc:1071
void setRepoMetadataPath(const Pathname &path_r)
Set a new path as the default repo cache path.
Definition ZConfig.cc:938
bool solver_dupAllowDowngrade() const
DUP tune: Whether to allow version downgrades upon DUP.
Definition ZConfig.cc:1104
std::string multiversionKernels() const
Definition ZConfig.cc:1208
std::string distroverpkg() const
Package telling the "product version" on systems not using /etc/product.d/baseproduct.
Definition ZConfig.cc:1200
bool download_use_deltarpm_always() const
Whether to consider using a deltarpm even when rpm is local.
Definition ZConfig.cc:1053
void setRepoCachePath(const Pathname &path_r)
Set a new path as the default repo cache path.
Definition ZConfig.cc:927
void setRepoGpgCheck(TriBool val_r)
Change the value.
Definition ZConfig.cc:1093
Pathname credentialsGlobalDir() const
Defaults to /etc/zypp/credentials.d.
Definition ZConfig.cc:1188
bool download_media_prefer_download() const
Hint which media to prefer when installing packages (download vs.
Definition ZConfig.cc:1056
Pathname credentialsGlobalFile() const
Defaults to /etc/zypp/credentials.cat.
Definition ZConfig.cc:1193
const Pathname & path() const
Return current Pathname.
Definition PathInfo.h:251
bool emptyOrRoot() const
Test for "" or "/".
Definition Pathname.h:127
bool empty() const
Test for an empty path.
Definition Pathname.h:117
void setTextLocale(const Locale &locale_r)
Set the default language for retrieving translated texts.
Definition Pool.cc:233
static Pool instance()
Singleton ctor.
Definition Pool.h:55
boost::logic::tribool TriBool
3-state boolean logic (true, false and indeterminate).
Definition String.h:31
Definition ansi.h:855
String related utilities and Regular expression matching.
Namespace intended to collect all environment variables we use.
std::optional< Pathname > ZYPP_CONF()
Definition ZConfig.cc:46
Types and functions for filesystem operations.
Definition Glob.cc:24
int dirForEach(const Pathname &dir_r, const StrMatcher &matcher_r, function< bool(const Pathname &, const char *const)> fnc_r)
Definition PathInfo.cc:32
int simpleParseFile(std::istream &str_r, ParseFlags flags_r, function< bool(int, std::string)> consume_r)
Simple lineparser optionally trimming and skipping comments.
Definition IOStream.cc:124
bool strToBool(const C_Str &str, bool default_r)
Parse str into a bool depending on the default value.
Definition String.h:500
TInt strtonum(const C_Str &str)
Parsing numbers from string.
std::string sconcat(Args &&... args)
Concat words as string.
Definition LogTools.h:276
unsigned splitEscaped(const C_Str &line_r, TOutputIterator result_r, const C_Str &sepchars_r=" \t", bool withEmpty=false)
Split line_r into words with respect to escape delimeters.
Definition String.h:665
Easy-to use interface to the ZYPP dependency resolver.
std::unordered_set< Locale > LocaleSet
Definition Locale.h:29
ResolverFocus
The resolver's general attitude.
@ Default
Request the standard behavior (as defined in zypp.conf or 'Job').
bool fromString(const std::string &val_r, ResolverFocus &ret_r)
relates: ResolverFocus Conversion from string (enumerator name, case insensitive, empty string is Def...
ZYpp::Ptr getZYpp()
relates: ZYppFactory Convenience to get the Pointer to the ZYpp instance.
Definition ZYppFactory.h:77
detail::Dump< Tp > dump(const Tp &obj_r)
Definition LogTools.h:772
DownloadMode
Supported commit download policies.
@ DownloadDefault
libzypp will decide what to do.
Mutable option with initial value also remembering a config value.
Definition ZConfig.cc:194
DefaultOption(value_type initial_r)
Definition ZConfig.cc:198
option_type _default
Definition ZConfig.cc:223
void setDefault(value_type newval_r)
Set a new default value.
Definition ZConfig.cc:219
void restoreToDefault(value_type newval_r)
Reset value to a new default.
Definition ZConfig.cc:211
DefaultOption & operator=(value_type newval_r)
Definition ZConfig.cc:203
void restoreToDefault()
Reset value to the current default.
Definition ZConfig.cc:207
Option< Tp > option_type
Definition ZConfig.cc:196
const value_type & getDefault() const
Get the current default value.
Definition ZConfig.cc:215
Mutable option.
Definition ZConfig.cc:164
const value_type & get() const
Get the value.
Definition ZConfig.cc:176
Option & operator=(value_type newval_r)
Definition ZConfig.cc:172
void set(value_type newval_r)
Set a new value.
Definition ZConfig.cc:184
Option(value_type initial_r)
No default ctor, explicit initialisation!
Definition ZConfig.cc:168
value_type _val
Definition ZConfig.cc:188
MultiversionSpec & getSpec(Pathname root_r, const Impl &zConfImpl_r)
Definition ZConfig.cc:702
MultiversionSpec & getDefaultSpec()
Definition ZConfig.cc:729
void scanDirAt(const Pathname &root_r, MultiversionSpec &spec_r, const Impl &zConfImpl_r)
Definition ZConfig.cc:748
bool scanConfAt(const Pathname &root_r, MultiversionSpec &spec_r, const Impl &zConfImpl_r)
Definition ZConfig.cc:733
std::map< Pathname, MultiversionSpec > SpecMap
Definition ZConfig.cc:700
Settings that follow a changed Target.
Definition ZConfig.cc:241
Option< bool > solver_dupAllowVendorChange
Definition ZConfig.cc:312
DefaultOption< bool > solverUpgradeRemoveDroppedPackages
Definition ZConfig.cc:315
Option< unsigned > solver_upgradeTestcasesToKeep
Definition ZConfig.cc:314
Option< bool > solver_dupAllowDowngrade
Definition ZConfig.cc:309
bool consume(const std::string &section, const std::string &entry, const std::string &value)
Definition ZConfig.cc:255
Option< bool > solver_dupAllowArchChange
Definition ZConfig.cc:311
Option< bool > solver_cleandepsOnRemove
Definition ZConfig.cc:313
Option< bool > solver_allowVendorChange
Definition ZConfig.cc:308
Option< bool > solver_dupAllowNameChange
Definition ZConfig.cc:310
static PoolImpl & myPool()
Definition PoolMember.cc:41