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