libzypp 17.38.14
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 {
255
256 bool consume( const std::string & section, const std::string & entry, const std::string & value )
257 {
258 if ( section != "main" )
259 return false;
260
261 if ( entry == "solver.focus" )
262 {
263 fromString( value, solver_focus );
264 }
265 else if ( entry == "solver.onlyRequires" )
266 {
268 }
269 else if ( entry == "solver.allowVendorChange" )
270 {
272 }
273 else if ( entry == "solver.dupAllowDowngrade" )
274 {
276 }
277 else if ( entry == "solver.dupAllowNameChange" )
278 {
280 }
281 else if ( entry == "solver.dupAllowArchChange" )
282 {
284 }
285 else if ( entry == "solver.dupAllowVendorChange" )
286 {
288 }
289 else if ( entry == "solver.cleandepsOnRemove" )
290 {
292 }
293 else if ( entry == "solver.noUpdateProvide" )
294 {
296 }
297 else if ( entry == "solver.upgradeTestcasesToKeep" )
298 {
300 }
301 else if ( entry == "solver.upgradeRemoveDroppedPackages" )
302 {
304 }
305 else
306 return false;
307
308 return true;
309 }
310
322 };
323
324 public:
328 , cfg_cache_path { "/var/cache/zypp" }
329 , cfg_metadata_path { "" } // empty - follows cfg_cache_path
330 , cfg_solvfiles_path { "" } // empty - follows cfg_cache_path
331 , cfg_packages_path { "" } // empty - follows cfg_cache_path
332 , updateMessagesNotify ( "" )
333 , repo_add_probe ( false )
334 , repo_refresh_delay ( 10 )
335 , repoLabelIsAlias ( false )
336 , download_use_deltarpm ( APIConfig(LIBZYPP_CONFIG_USE_DELTARPM_BY_DEFAULT) )
339 , download_mediaMountdir ( "/var/adm/mount" )
341 , gpgCheck ( true )
342 , repoGpgCheck ( indeterminate )
343 , pkgGpgCheck ( indeterminate )
344 , apply_locks_file ( true )
345 , pluginsPath ( "/usr/lib/zypp/plugins" )
346 , geoipEnabled ( true )
347 , geoipHosts { "download.opensuse.org" }
348 {
349 MIL << "libzypp: " LIBZYPP_VERSION_STRING << " (" << LIBZYPP_CODESTREAM << ")" << endl;
350
351 ZyppConfIniMap iniMap; // Scan the default zypp.conf settings
352
353 using EnvMap = std::map<std::string,std::string>;
354 std::optional<EnvMap> envMap;
355 for ( const auto & section : iniMap.sections() ) {
356 for ( const auto & [entry,value] : iniMap.entries( section ) ) {
357
358 if ( _initialTargetDefaults.consume( section, entry, value ) )
359 continue;
360
361 if ( _mediaConf.setConfigValue( section, entry, value ) )
362 continue;
363
364 if ( section == "main" )
365 {
366 if ( entry == "lock_timeout" )
367 {
368 str::strtonum( value, cfg_lockTimeout );
369 }
370 else if ( entry == "arch" )
371 {
372 Arch carch( value );
373 if ( carch != cfg_arch ) {
374 WAR << "Overriding system architecture (" << cfg_arch << "): " << carch << endl;
375 cfg_arch = carch;
376 }
377 }
378 else if ( entry == "cachedir" )
379 {
380 cfg_cache_path.restoreToDefault( value );
381 }
382 else if ( entry == "metadatadir" )
383 {
384 cfg_metadata_path.restoreToDefault( value );
385 }
386 else if ( entry == "solvfilesdir" )
387 {
388 cfg_solvfiles_path.restoreToDefault( value );
389 }
390 else if ( entry == "packagesdir" )
391 {
392 cfg_packages_path.restoreToDefault( value );
393 }
394 else if ( entry == "configdir" )
395 {
396 cfg_config_path = Pathname(value);
397 }
398 else if ( entry == "reposdir" )
399 {
400 cfg_known_repos_path = Pathname(value);
401 }
402 else if ( entry == "servicesdir" )
403 {
404 cfg_known_services_path = Pathname(value);
405 }
406 else if ( entry == "varsdir" )
407 {
408 cfg_vars_path = Pathname(value);
409 }
410 else if ( entry == "repo.add.probe" )
411 {
412 repo_add_probe = str::strToBool( value, repo_add_probe );
413 }
414 else if ( entry == "repo.refresh.delay" )
415 {
416 str::strtonum(value, repo_refresh_delay);
417 }
418 else if ( entry == "repo.refresh.locales" )
419 {
420 std::vector<std::string> tmp;
421 str::split( value, back_inserter( tmp ), ", \t" );
422
423 boost::function<Locale(const std::string &)> transform(
424 [](const std::string & str_r)->Locale{ return Locale(str_r); }
425 );
426 repoRefreshLocales.insert( make_transform_iterator( tmp.begin(), transform ),
427 make_transform_iterator( tmp.end(), transform ) );
428 }
429 else if ( entry == "download.use_deltarpm" )
430 {
431 download_use_deltarpm = str::strToBool( value, download_use_deltarpm );
432 }
433 else if ( entry == "download.use_deltarpm.always" )
434 {
435 download_use_deltarpm_always = str::strToBool( value, download_use_deltarpm_always );
436 }
437 else if ( entry == "download.media_preference" )
438 {
439 download_media_prefer_download.restoreToDefault( str::compareCI( value, "volatile" ) != 0 );
440 }
441 else if ( entry == "download.media_mountdir" )
442 {
443 download_mediaMountdir.restoreToDefault( Pathname(value) );
444 }
445 else if ( entry == "download.use_geoip_mirror") {
446 geoipEnabled = str::strToBool( value, geoipEnabled );
447 }
448 else if ( entry == "commit.downloadMode" )
449 {
450 commit_downloadMode.set( deserializeDownloadMode( value ) );
451 }
452 else if ( entry == "gpgcheck" )
453 {
454 gpgCheck.restoreToDefault( str::strToBool( value, gpgCheck ) );
455 }
456 else if ( entry == "repo_gpgcheck" )
457 {
458 repoGpgCheck.restoreToDefault( str::strToTriBool( value ) );
459 }
460 else if ( entry == "pkg_gpgcheck" )
461 {
462 pkgGpgCheck.restoreToDefault( str::strToTriBool( value ) );
463 }
464 else if ( entry == "vendordir" )
465 {
466 cfg_vendor_path = Pathname(value);
467 }
468 else if ( entry == "multiversiondir" )
469 {
470 cfg_multiversion_path = Pathname(value);
471 }
472 else if ( entry == "multiversion.kernels" )
473 {
474 cfg_kernel_keep_spec = value;
475 }
476 else if ( entry == "solver.checkSystemFile" )
477 {
478 solver_checkSystemFile = Pathname(value);
479 }
480 else if ( entry == "solver.checkSystemFileDir" )
481 {
482 solver_checkSystemFileDir = Pathname(value);
483 }
484 else if ( entry == "multiversion" )
485 {
486 MultiversionSpec & defSpec( _multiversionMap.getDefaultSpec() );
487 str::splitEscaped( value, std::inserter( defSpec, defSpec.end() ), ", \t" );
488 }
489 else if ( entry == "locksfile.path" )
490 {
491 locks_file = Pathname(value);
492 }
493 else if ( entry == "locksfile.apply" )
494 {
495 apply_locks_file = str::strToBool( value, apply_locks_file );
496 }
497 else if ( entry == "update.datadir" )
498 {
499 // ignore, this is a constant anyway and should not be user configurabe
500 // update_data_path = Pathname(value);
501 }
502 else if ( entry == "update.scriptsdir" )
503 {
504 // ignore, this is a constant anyway and should not be user configurabe
505 // update_scripts_path = Pathname(value);
506 }
507 else if ( entry == "update.messagessdir" )
508 {
509 // ignore, this is a constant anyway and should not be user configurabe
510 // update_messages_path = Pathname(value);
511 }
512 else if ( entry == "update.messages.notify" )
513 {
514 updateMessagesNotify.set( value );
515 }
516 else if ( entry == "rpm.install.excludedocs" )
517 {
518 rpmInstallFlags.setFlag( target::rpm::RPMINST_EXCLUDEDOCS,
519 str::strToBool( value, false ) );
520 }
521 else if ( entry == "history.logfile" )
522 {
523 history_log_path = Pathname(value);
524 }
525 else if ( entry == "ZYPP_SINGLE_RPMTRANS" || entry == "techpreview.ZYPP_SINGLE_RPMTRANS" )
526 {
527 DBG << "ZYPP_SINGLE_RPMTRANS=" << value << endl;
528 ::setenv( "ZYPP_SINGLE_RPMTRANS", value.c_str(), 0 );
529 }
530 else if ( entry == "techpreview.ZYPP_MEDIANETWORK" )
531 {
532 DBG << "techpreview.ZYPP_MEDIANETWORK=" << value << endl;
533 ::setenv( "ZYPP_MEDIANETWORK", value.c_str(), 1 );
534 }
535 else { // unknown entry
536 pWAR( "zypp.conf: Unknown entry in [main]:", entry, "=", value );
537 }
538 }
539 else if ( section == "env" )
540 {
541 if ( !envMap )
542 envMap = EnvMap();
543 auto [it, inserted] = envMap->emplace( entry, value );
544 if ( !inserted ) {
545 WAR << "zypp.conf [env]: duplicate key '" << entry << "', shadowing previous value '" << it->second << "' with '" << value << "'" << endl;
546 it->second = value;
547 }
548 }
549 else { // unknown section {
550 pWAR( "zypp.conf: Unknown section:", str::sconcat("[",section,"]"), entry, "=", value );
551 }
552 }
553 }
554
555 if ( envMap ) {
556 for ( const auto & [entry, value] : *envMap ) {
557 const char* exists = ::getenv( entry.c_str() );
558 if ( exists == nullptr ) {
559 if ( ::setenv( entry.c_str(), value.c_str(), 0 ) != 0 ) {
560 pWAR( "zypp.conf [env]: set", str::sconcat("'",entry,"=",value,"'"), ": failed", Errno() );
561 }
562 else {
563 pMIL( "zypp.conf [env]: set", str::sconcat("'",entry,"=",value,"'") );
564 }
565 }
566 else {
567 pWAR( "zypp.conf [env]: skip", str::sconcat("'",entry,"=",value,"'"), ": is already set to", str::sconcat("'",exists,"'") );
568 }
569 }
570 }
571
572 // legacy:
573 if ( getenv( "ZYPP_TESTSUITE_FAKE_ARCH" ) )
574 {
575 Arch carch( getenv( "ZYPP_TESTSUITE_FAKE_ARCH" ) );
576 if ( carch != cfg_arch )
577 {
578 WAR << "ZYPP_TESTSUITE_FAKE_ARCH: Overriding system architecture (" << cfg_arch << "): " << carch << endl;
579 cfg_arch = carch;
580 }
581 }
582 MIL << "ZConfig singleton created." << endl;
583 }
584
585 Impl(const Impl &) = delete;
586 Impl(Impl &&) = delete;
587 Impl &operator=(const Impl &) = delete;
588 Impl &operator=(Impl &&) = delete;
589 ~Impl() {}
590
599 {
600 Target_Ptr target( getZYpp()->getTarget() );
601 return target ? target->root() : _announced_root_path;
602 }
603
605 {
606 _announced_root_path = Pathname(); // first of all reset any previously _announced_root_path
607
608 Pathname newRoot { _autodetectSystemRoot() };
609 MIL << "notifyTargetChanged (" << newRoot << ")" << endl;
610
611 if ( newRoot.emptyOrRoot() ) {
612 _currentTargetDefaults.reset(); // to initial settigns from /
613 }
614 else {
616 ZyppConfIniMap iniMap { newRoot }; // Scan the zypp.conf settings for newRoot
617 for ( const auto & section : iniMap.sections() ) {
618 for ( const auto & [entry,value] : iniMap.entries( section ) ) {
619 (*_currentTargetDefaults).consume( section, entry, value );
620 }
621 }
622 }
623 }
624
625 public:
627
628 long cfg_lockTimeout = 0; // signed!
629
632
633 DefaultOption<Pathname> cfg_cache_path; // Settings from the config file are also remembered
634 DefaultOption<Pathname> cfg_metadata_path; // 'default'. Cleanup in RepoManager e.g needs to tell
635 DefaultOption<Pathname> cfg_solvfiles_path; // whether settings in effect are config values or
636 DefaultOption<Pathname> cfg_packages_path; // custom settings applied vie set...Path().
637
643
648
650
655
660
662
666
669
671 const MultiversionSpec & multiversion() const { return getMultiversion(); }
672
674
675 target::rpm::RpmInstFlags rpmInstallFlags;
676
678
679 std::string userData;
680
682
684
685 std::vector<std::string> geoipHosts;
686
687 /* Other config singleton instances */
689
690
691 public:
694 private:
696 std::optional<TargetDefaults> _currentTargetDefaults;
697
698 private:
699 // HACK for bnc#906096: let pool re-evaluate multiversion spec
700 // if target root changes. ZConfig returns data sensitive to
701 // current target root.
702 // TODO Actually we'd need to scan the target systems zypp.conf and
703 // overlay all system specific values.
705 {
706 using SpecMap = std::map<Pathname, MultiversionSpec>;
707
708 MultiversionSpec & getSpec( Pathname root_r, const Impl & zConfImpl_r ) // from system at root
709 {
710 // _specMap[] - the plain zypp.conf value
711 // _specMap[/] - combine [] and multiversion.d scan
712 // _specMap[root] - scan root/zypp.conf and root/multiversion.d
713
714 if ( root_r.empty() )
715 root_r = "/";
716 bool cacheHit = _specMap.count( root_r );
717 MultiversionSpec & ret( _specMap[root_r] ); // creates new entry on the fly
718
719 if ( ! cacheHit )
720 {
721 // bsc#1193488: If no (/root)/.../zypp.conf exists use the default zypp.conf
722 // multiversion settings. It is a legacy that the packaged multiversion setting
723 // in zypp.conf (the kernel) may differ from the builtin default (empty).
724 // But we want a missing config to behave similar to the default one, otherwise
725 // a bare metal install easily runs into trouble.
726 if ( root_r == "/" || not scanConfAt( root_r, ret, zConfImpl_r ) )
727 ret = _specMap[Pathname()];
728 scanDirAt( root_r, ret, zConfImpl_r ); // add multiversion.d at root_r
729 using zypp::operator<<;
730 MIL << "MultiversionSpec '" << root_r << "' = " << ret << endl;
731 }
732 return ret;
733 }
734
735 MultiversionSpec & getDefaultSpec() // Spec from zypp.conf parsing; called before any getSpec
736 { return _specMap[Pathname()]; }
737
738 private:
739 bool scanConfAt( const Pathname& root_r, MultiversionSpec & spec_r, const Impl & zConfImpl_r )
740 {
741 ZyppConfIniMap iniMap { root_r }; // Scan the zypp.conf settings for root
742 // TODO: iniDict lacks direct value access :(
743 for ( const auto & section : iniMap.sections() ) {
744 for ( const auto & [entry,value] : iniMap.entries( section ) ) {
745 if ( entry == "multiversion" ) {
746 str::splitEscaped( value, std::inserter( spec_r, spec_r.end() ), ", \t" );
747 return true;
748 }
749 }
750 }
751 return false;
752 }
753
754 void scanDirAt( const Pathname& root_r, MultiversionSpec & spec_r, const Impl & zConfImpl_r )
755 {
756 // NOTE: Actually we'd need to scan and use the root_r! zypp.conf values.
757 Pathname multiversionDir( zConfImpl_r.cfg_multiversion_path );
758 if ( multiversionDir.empty() )
759 multiversionDir = ( zConfImpl_r.cfg_config_path.empty()
760 ? Pathname("/etc/zypp")
761 : zConfImpl_r.cfg_config_path ) / "multiversion.d";
762
763 filesystem::dirForEach( Pathname::assertprefix( root_r, multiversionDir ),
764 [&spec_r]( const Pathname & dir_r, const char *const & name_r )->bool
765 {
766 MIL << "Parsing " << dir_r/name_r << endl;
767 iostr::simpleParseFile( InputStream( dir_r/name_r ),
768 [&spec_r]( int num_r, std::string line_r )->bool
769 {
770 DBG << " found " << line_r << endl;
771 spec_r.insert( std::move(line_r) );
772 return true;
773 } );
774 return true;
775 } );
776 }
777
778 private:
780 };
781
783 { return _multiversionMap.getSpec( _autodetectSystemRoot(), *this ); }
784
786 };
787
788
790 //
791 // METHOD NAME : ZConfig::instance
792 // METHOD TYPE : ZConfig &
793 //
795 {
796 static ZConfig _instance; // The singleton
797 return _instance;
798 }
799
801 //
802 // METHOD NAME : ZConfig::ZConfig
803 // METHOD TYPE : Ctor
804 //
806 : _pimpl( new Impl )
807 {
808 about( MIL );
809 }
810
812 //
813 // METHOD NAME : ZConfig::~ZConfig
814 // METHOD TYPE : Dtor
815 //
818
820 {
821 const char * env = getenv("ZYPP_LOCK_TIMEOUT");
822 if ( env ) {
823 return str::strtonum<long>( env );
824 }
825 return _pimpl->cfg_lockTimeout;
826 }
827
829 { return _pimpl->notifyTargetChanged(); }
830
832 { return _pimpl->_autodetectSystemRoot(); }
833
835 {
836 return ( _pimpl->cfg_repo_mgr_root_path.empty()
837 ? systemRoot() : _pimpl->cfg_repo_mgr_root_path );
838 }
839
841 { _pimpl->cfg_repo_mgr_root_path = root; }
842
844 { _pimpl->_announced_root_path = root_r; }
845
847 //
848 // system architecture
849 //
851
856
858 { return _pimpl->cfg_arch; }
859
861 {
862 if ( arch_r != _pimpl->cfg_arch )
863 {
864 WAR << "Overriding system architecture (" << _pimpl->cfg_arch << "): " << arch_r << endl;
865 _pimpl->cfg_arch = arch_r;
866 }
867 }
868
870 //
871 // text locale
872 //
874
876 {
877 static Locale _val( _autodetectTextLocale() );
878 return _val;
879 }
880
882 { return _pimpl->cfg_textLocale; }
883
884 void ZConfig::setTextLocale( const Locale & locale_r )
885 {
886 if ( locale_r != _pimpl->cfg_textLocale )
887 {
888 WAR << "Overriding text locale (" << _pimpl->cfg_textLocale << "): " << locale_r << endl;
889 _pimpl->cfg_textLocale = locale_r;
890 // Propagate changes
892 }
893 }
894
896 // user data
898
900 { return !_pimpl->userData.empty(); }
901
902 std::string ZConfig::userData() const
903 { return _pimpl->userData; }
904
905 bool ZConfig::setUserData( const std::string & str_r )
906 {
907 for_( ch, str_r.begin(), str_r.end() )
908 {
909 if ( *ch < ' ' && *ch != '\t' )
910 {
911 ERR << "New user data string rejectded: char " << (int)*ch << " at position " << (ch - str_r.begin()) << endl;
912 return false;
913 }
914 }
915 MIL << "Set user data string to '" << str_r << "'" << endl;
916 _pimpl->userData = str_r;
917 return true;
918 }
919
921
923 {
924 return ( _pimpl->cfg_cache_path.get().empty()
925 ? Pathname("/var/cache/zypp") : _pimpl->cfg_cache_path.get() );
926 }
927
929 {
930 return repoCachePath()/"pubkeys";
931 }
932
934 {
935 _pimpl->cfg_cache_path = path_r;
936 }
937
939 {
940 return ( _pimpl->cfg_metadata_path.get().empty()
941 ? (repoCachePath()/"raw") : _pimpl->cfg_metadata_path.get() );
942 }
943
945 {
946 _pimpl->cfg_metadata_path = path_r;
947 }
948
950 {
951 return ( _pimpl->cfg_solvfiles_path.get().empty()
952 ? (repoCachePath()/"solv") : _pimpl->cfg_solvfiles_path.get() );
953 }
954
956 {
957 _pimpl->cfg_solvfiles_path = path_r;
958 }
959
961 {
962 return ( _pimpl->cfg_packages_path.get().empty()
963 ? (repoCachePath()/"packages") : _pimpl->cfg_packages_path.get() );
964 }
965
967 {
968 _pimpl->cfg_packages_path = path_r;
969 }
970
972 { return _pimpl->cfg_cache_path.getDefault().empty() ? Pathname("/var/cache/zypp") : _pimpl->cfg_cache_path.getDefault(); }
973
975 { return _pimpl->cfg_metadata_path.getDefault().empty() ? (builtinRepoCachePath()/"raw") : _pimpl->cfg_metadata_path.getDefault(); }
976
978 { return _pimpl->cfg_solvfiles_path.getDefault().empty() ? (builtinRepoCachePath()/"solv") : _pimpl->cfg_solvfiles_path.getDefault(); }
979
981 { return _pimpl->cfg_packages_path.getDefault().empty() ? (builtinRepoCachePath()/"packages") : _pimpl->cfg_packages_path.getDefault(); }
982
984
986 {
987 return ( _pimpl->cfg_config_path.empty()
988 ? Pathname("/etc/zypp") : _pimpl->cfg_config_path );
989 }
990
992 {
993 return ( _pimpl->cfg_known_repos_path.empty()
994 ? (configPath()/"repos.d") : _pimpl->cfg_known_repos_path );
995 }
996
998 {
999 return ( _pimpl->cfg_known_services_path.empty()
1000 ? (configPath()/"services.d") : _pimpl->cfg_known_services_path );
1001 }
1002
1004 { return configPath()/"needreboot"; }
1005
1007 { return configPath()/"needreboot.d"; }
1008
1009 void ZConfig::setGeoipEnabled( bool enable )
1010 { _pimpl->geoipEnabled = enable; }
1011
1013 { return _pimpl->geoipEnabled; }
1014
1016 { return builtinRepoCachePath()/"geoip.d"; }
1017
1018 const std::vector<std::string> ZConfig::geoipHostnames () const
1019 { return _pimpl->geoipHosts; }
1020
1022 {
1023 return ( _pimpl->cfg_vars_path.empty()
1024 ? (configPath()/"vars.d") : _pimpl->cfg_vars_path );
1025 }
1026
1028 {
1029 return ( _pimpl->cfg_vendor_path.empty()
1030 ? (configPath()/"vendors.d") : _pimpl->cfg_vendor_path );
1031 }
1032
1034 {
1035 return ( _pimpl->locks_file.empty()
1036 ? (configPath()/"locks") : _pimpl->locks_file );
1037 }
1038
1040
1042 { return _pimpl->repo_add_probe; }
1043
1045 { return _pimpl->repo_refresh_delay; }
1046
1048 { return _pimpl->repoRefreshLocales.empty() ? Target::requestedLocales("") :_pimpl->repoRefreshLocales; }
1049
1051 { return _pimpl->repoLabelIsAlias; }
1052
1053 void ZConfig::repoLabelIsAlias( bool yesno_r )
1054 { _pimpl->repoLabelIsAlias = yesno_r; }
1055
1057 { return _pimpl->download_use_deltarpm; }
1058
1060 { return download_use_deltarpm() && _pimpl->download_use_deltarpm_always; }
1061
1063 { return _pimpl->download_media_prefer_download; }
1064
1066 { _pimpl->download_media_prefer_download.set( yesno_r ); }
1067
1069 { _pimpl->download_media_prefer_download.restoreToDefault(); }
1070
1072 { return _pimpl->_mediaConf.download_max_concurrent_connections(); }
1073
1075 { return _pimpl->_mediaConf.download_min_download_speed(); }
1076
1078 { return _pimpl->_mediaConf.download_max_download_speed(); }
1079
1081 { return _pimpl->_mediaConf.download_max_silent_tries(); }
1082
1084 { return _pimpl->_mediaConf.download_transfer_timeout(); }
1085
1086 Pathname ZConfig::download_mediaMountdir() const { return _pimpl->download_mediaMountdir; }
1087 void ZConfig::set_download_mediaMountdir( Pathname newval_r ) { _pimpl->download_mediaMountdir.set( std::move(newval_r) ); }
1088 void ZConfig::set_default_download_mediaMountdir() { _pimpl->download_mediaMountdir.restoreToDefault(); }
1089
1091 { return _pimpl->commit_downloadMode; }
1092
1093
1094 bool ZConfig::gpgCheck() const { return _pimpl->gpgCheck; }
1095 TriBool ZConfig::repoGpgCheck() const { return _pimpl->repoGpgCheck; }
1096 TriBool ZConfig::pkgGpgCheck() const { return _pimpl->pkgGpgCheck; }
1097
1098 void ZConfig::setGpgCheck( bool val_r ) { _pimpl->gpgCheck.set( val_r ); }
1099 void ZConfig::setRepoGpgCheck( TriBool val_r ) { _pimpl->repoGpgCheck.set( val_r ); }
1100 void ZConfig::setPkgGpgCheck( TriBool val_r ) { _pimpl->pkgGpgCheck.set( val_r ); }
1101
1102 void ZConfig::resetGpgCheck() { _pimpl->gpgCheck.restoreToDefault(); }
1103 void ZConfig::resetRepoGpgCheck() { _pimpl->repoGpgCheck.restoreToDefault(); }
1104 void ZConfig::resetPkgGpgCheck() { _pimpl->pkgGpgCheck.restoreToDefault(); }
1105
1106
1107 ResolverFocus ZConfig::solver_focus() const { return _pimpl->targetDefaults().solver_focus; }
1108 bool ZConfig::solver_onlyRequires() const { return _pimpl->targetDefaults().solver_onlyRequires; }
1109 bool ZConfig::solver_allowVendorChange() const { return _pimpl->targetDefaults().solver_allowVendorChange; }
1110 bool ZConfig::solver_noUpdateProvide() const { return _pimpl->targetDefaults().solver_noUpdateProvide; }
1111 bool ZConfig::solver_dupAllowDowngrade() const { return _pimpl->targetDefaults().solver_dupAllowDowngrade; }
1112 bool ZConfig::solver_dupAllowNameChange() const { return _pimpl->targetDefaults().solver_dupAllowNameChange; }
1113 bool ZConfig::solver_dupAllowArchChange() const { return _pimpl->targetDefaults().solver_dupAllowArchChange; }
1114 bool ZConfig::solver_dupAllowVendorChange() const { return _pimpl->targetDefaults().solver_dupAllowVendorChange; }
1115 bool ZConfig::solver_cleandepsOnRemove() const { return _pimpl->targetDefaults().solver_cleandepsOnRemove; }
1116 unsigned ZConfig::solver_upgradeTestcasesToKeep() const { return _pimpl->targetDefaults().solver_upgradeTestcasesToKeep; }
1117
1118 bool ZConfig::solverUpgradeRemoveDroppedPackages() const { return _pimpl->targetDefaults().solverUpgradeRemoveDroppedPackages; }
1119 void ZConfig::setSolverUpgradeRemoveDroppedPackages( bool val_r ) { _pimpl->targetDefaults().solverUpgradeRemoveDroppedPackages.set( val_r ); }
1120 void ZConfig::resetSolverUpgradeRemoveDroppedPackages() { _pimpl->targetDefaults().solverUpgradeRemoveDroppedPackages.restoreToDefault(); }
1121
1122
1124 { return ( _pimpl->solver_checkSystemFile.empty()
1125 ? (configPath()/"systemCheck") : _pimpl->solver_checkSystemFile ); }
1126
1128 { return ( _pimpl->solver_checkSystemFileDir.empty()
1129 ? (configPath()/"systemCheck.d") : _pimpl->solver_checkSystemFileDir ); }
1130
1131
1132 namespace
1133 {
1134 inline void sigMultiversionSpecChanged()
1135 {
1138 }
1139 }
1140
1141 const std::set<std::string> & ZConfig::multiversionSpec() const { return _pimpl->multiversion(); }
1142 void ZConfig::multiversionSpec( std::set<std::string> new_r ) { _pimpl->multiversion().swap( new_r ); sigMultiversionSpecChanged(); }
1143 void ZConfig::clearMultiversionSpec() { _pimpl->multiversion().clear(); sigMultiversionSpecChanged(); }
1144 void ZConfig::addMultiversionSpec( const std::string & name_r ) { _pimpl->multiversion().insert( name_r ); sigMultiversionSpecChanged(); }
1145 void ZConfig::removeMultiversionSpec( const std::string & name_r ) { _pimpl->multiversion().erase( name_r ); sigMultiversionSpecChanged(); }
1146
1148 { return _pimpl->apply_locks_file; }
1149
1151#if LEGACY(1735)
1152 const
1153#endif
1154 {
1155 return Pathname("/var/adm");
1156 }
1157
1159#if LEGACY(1735)
1160 const
1161#endif
1162 {
1163 return Pathname(update_dataPath()/"update-messages");
1164 }
1165
1167#if LEGACY(1735)
1168 const
1169#endif
1170 {
1171 return Pathname(update_dataPath()/"update-scripts");
1172 }
1173
1175 { return _pimpl->updateMessagesNotify; }
1176
1177 void ZConfig::setUpdateMessagesNotify( const std::string & val_r )
1178 { _pimpl->updateMessagesNotify.set( val_r ); }
1179
1181 { _pimpl->updateMessagesNotify.restoreToDefault(); }
1182
1184
1185 target::rpm::RpmInstFlags ZConfig::rpmInstallFlags() const
1186 { return _pimpl->rpmInstallFlags; }
1187
1188
1190 {
1191 return ( _pimpl->history_log_path.empty() ?
1192 Pathname("/var/log/zypp/history") : _pimpl->history_log_path );
1193 }
1194
1196 {
1197 return _pimpl->_mediaConf.credentialsGlobalDir();
1198 }
1199
1201 {
1202 return _pimpl->_mediaConf.credentialsGlobalFile();
1203 }
1204
1206
1207 std::string ZConfig::distroverpkg() const
1208 { return "system-release"; }
1209
1211
1213 { return _pimpl->pluginsPath.get(); }
1214
1216 {
1217 return _pimpl->cfg_kernel_keep_spec;
1218 }
1219
1221
1222 std::ostream & ZConfig::about( std::ostream & str ) const
1223 {
1224 str << "libzypp: " LIBZYPP_VERSION_STRING << " (" << LIBZYPP_CODESTREAM << ")" << endl;
1225
1226 str << "libsolv: " << solv_version;
1227 if ( ::strcmp( solv_version, LIBSOLV_VERSION_STRING ) )
1228 str << " (built against " << LIBSOLV_VERSION_STRING << ")";
1229 str << endl;
1230
1231 str << "TextLocale: '" << textLocale() << "' (" << defaultTextLocale() << ")" << endl;
1232 str << "SystemArchitecture: '" << systemArchitecture() << "' (" << defaultSystemArchitecture() << ")" << endl;
1233 return str;
1234 }
1235
1237} // 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:645
DefaultOption< Pathname > download_mediaMountdir
Definition ZConfig.cc:659
MediaConfig & _mediaConf
Definition ZConfig.cc:688
DefaultOption< Pathname > cfg_metadata_path
Definition ZConfig.cc:634
Pathname cfg_known_repos_path
Definition ZConfig.cc:639
Pathname cfg_known_services_path
Definition ZConfig.cc:640
Pathname _autodetectSystemRoot() const
bsc#1237044: Provide announceSystemRoot to allow commands using –root without launching a Target.
Definition ZConfig.cc:598
Pathname cfg_vars_path
Definition ZConfig.cc:641
Impl & operator=(const Impl &)=delete
Impl & operator=(Impl &&)=delete
DefaultOption< Pathname > cfg_packages_path
Definition ZConfig.cc:636
bool download_use_deltarpm_always
Definition ZConfig.cc:657
void notifyTargetChanged()
Definition ZConfig.cc:604
Pathname solver_checkSystemFile
Definition ZConfig.cc:667
Impl(const Impl &)=delete
MultiversionMap _multiversionMap
Definition ZConfig.cc:785
Pathname history_log_path
Definition ZConfig.cc:677
Pathname locks_file
Definition ZConfig.cc:647
const TargetDefaults & targetDefaults() const
Definition ZConfig.cc:692
MultiversionSpec & getMultiversion() const
Definition ZConfig.cc:782
Impl(Impl &&)=delete
LocaleSet repoRefreshLocales
Definition ZConfig.cc:653
DefaultOption< Pathname > cfg_cache_path
Definition ZConfig.cc:633
std::vector< std::string > geoipHosts
Definition ZConfig.cc:685
TargetDefaults & targetDefaults()
Definition ZConfig.cc:693
Pathname _announced_root_path
Definition ZConfig.cc:626
Option< Pathname > pluginsPath
Definition ZConfig.cc:681
std::string userData
Definition ZConfig.cc:679
std::string cfg_kernel_keep_spec
Definition ZConfig.cc:646
DefaultOption< TriBool > repoGpgCheck
Definition ZConfig.cc:664
unsigned repo_refresh_delay
Definition ZConfig.cc:652
Option< DownloadMode > commit_downloadMode
Definition ZConfig.cc:661
std::optional< TargetDefaults > _currentTargetDefaults
TargetDefaults while –root.
Definition ZConfig.cc:696
MultiversionSpec & multiversion()
Definition ZConfig.cc:670
DefaultOption< bool > download_media_prefer_download
Definition ZConfig.cc:658
std::set< std::string > MultiversionSpec
Definition ZConfig.cc:237
Pathname solver_checkSystemFileDir
Definition ZConfig.cc:668
Pathname cfg_config_path
Definition ZConfig.cc:638
TargetDefaults _initialTargetDefaults
Initial TargetDefaults from /.
Definition ZConfig.cc:695
target::rpm::RpmInstFlags rpmInstallFlags
Definition ZConfig.cc:675
const MultiversionSpec & multiversion() const
Definition ZConfig.cc:671
Pathname cfg_repo_mgr_root_path
Definition ZConfig.cc:642
DefaultOption< TriBool > pkgGpgCheck
Definition ZConfig.cc:665
DefaultOption< std::string > updateMessagesNotify
Definition ZConfig.cc:649
Pathname cfg_vendor_path
Definition ZConfig.cc:644
DefaultOption< Pathname > cfg_solvfiles_path
Definition ZConfig.cc:635
DefaultOption< bool > gpgCheck
Definition ZConfig.cc:663
bool hasUserData() const
Whether a (non empty) user data sting is defined.
Definition ZConfig.cc:899
bool solver_cleandepsOnRemove() const
Whether removing a package should also remove no longer needed requirements.
Definition ZConfig.cc:1115
std::string userData() const
User defined string value to be passed to log, history, plugins...
Definition ZConfig.cc:902
Pathname knownServicesPath() const
Path where the known services .service files are kept (configPath()/services.d).
Definition ZConfig.cc:997
void removeMultiversionSpec(const std::string &name_r)
Definition ZConfig.cc:1145
Pathname repoPackagesPath() const
Path where the repo packages are downloaded and kept (repoCachePath()/packages).
Definition ZConfig.cc:960
unsigned repo_refresh_delay() const
Amount of time in minutes that must pass before another refresh.
Definition ZConfig.cc:1044
Arch systemArchitecture() const
The system architecture zypp uses.
Definition ZConfig.cc:857
Locale textLocale() const
The locale for translated texts zypp uses.
Definition ZConfig.cc:881
const std::vector< std::string > geoipHostnames() const
All hostnames we want to rewrite using the geoip feature.
Definition ZConfig.cc:1018
ZConfig(const ZConfig &)=delete
static Pathname update_dataPath()
Path where the update items are kept (/var/adm).
Definition ZConfig.cc:1150
ResolverFocus solver_focus() const
The resolver's general attitude when resolving jobs.
Definition ZConfig.cc:1107
Pathname builtinRepoSolvfilesPath() const
The builtin config file value.
Definition ZConfig.cc:977
Pathname pluginsPath() const
Defaults to /usr/lib/zypp/plugins.
Definition ZConfig.cc:1212
Pathname repoManagerRoot() const
The RepoManager root directory.
Definition ZConfig.cc:834
void resetRepoGpgCheck()
Reset to the zconfig default.
Definition ZConfig.cc:1103
bool gpgCheck() const
Turn signature checking on/off (on).
Definition ZConfig.cc:1094
Pathname knownReposPath() const
Path where the known repositories .repo files are kept (configPath()/repos.d).
Definition ZConfig.cc:991
long download_transfer_timeout() const
Maximum time in seconds that you allow a transfer operation to take.
Definition ZConfig.cc:1083
void setRepoManagerRoot(const Pathname &root)
Sets the RepoManager root directory.
Definition ZConfig.cc:840
bool solver_dupAllowArchChange() const
DUP tune: Whether to allow package arch changes upon DUP.
Definition ZConfig.cc:1113
void setTextLocale(const Locale &locale_r)
Set the preferred locale for translated texts.
Definition ZConfig.cc:884
bool solverUpgradeRemoveDroppedPackages() const
Whether dist upgrade should remove a products dropped packages (true).
Definition ZConfig.cc:1118
void notifyTargetChanged()
internal
Definition ZConfig.cc:828
static Locale defaultTextLocale()
The autodetected preferred locale for translated texts.
Definition ZConfig.cc:875
Pathname download_mediaMountdir() const
Path where media are preferably mounted or downloaded.
Definition ZConfig.cc:1086
static Pathname update_scriptsPath()
Path where the update scripts are stored ( /var/adm/update-scripts ).
Definition ZConfig.cc:1166
void resetSolverUpgradeRemoveDroppedPackages()
Reset solverUpgradeRemoveDroppedPackages to the zypp.conf default.
Definition ZConfig.cc:1120
bool apply_locks_file() const
Whether locks file should be read and applied after start (true).
Definition ZConfig.cc:1147
bool solver_allowVendorChange() const
Whether vendor check is by default enabled.
Definition ZConfig.cc:1109
void set_default_download_mediaMountdir()
Reset to zypp.cong default.
Definition ZConfig.cc:1088
bool solver_noUpdateProvide() const
Do not prefer update candidates also providing the old package.
Definition ZConfig.cc:1110
Pathname repoCachePath() const
Path where the caches are kept (/var/cache/zypp).
Definition ZConfig.cc:922
void setPkgGpgCheck(TriBool val_r)
Change the value.
Definition ZConfig.cc:1100
Pathname needrebootPath() const
Path where the custom needreboot config files are kept (configPath()/needreboot.d).
Definition ZConfig.cc:1006
bool setUserData(const std::string &str_r)
Set a new userData string.
Definition ZConfig.cc:905
Pathname systemRoot() const
The target root directory.
Definition ZConfig.cc:831
long download_max_silent_tries() const
Maximum silent tries.
Definition ZConfig.cc:1080
bool repo_add_probe() const
Whether repository urls should be probed.
Definition ZConfig.cc:1041
target::rpm::RpmInstFlags rpmInstallFlags() const
The default target::rpm::RpmInstFlags for ZYppCommitPolicy.
Definition ZConfig.cc:1185
void setUpdateMessagesNotify(const std::string &val_r)
Set a new command definition (see update.messages.notify in zypp.conf).
Definition ZConfig.cc:1177
unsigned solver_upgradeTestcasesToKeep() const
When committing a dist upgrade (e.g.
Definition ZConfig.cc:1116
Pathname repoMetadataPath() const
Path where the repo metadata is downloaded and kept (repoCachePath()/raw).
Definition ZConfig.cc:938
Pathname geoipCachePath() const
Path where the geoip caches are kept (/var/cache/zypp/geoip).
Definition ZConfig.cc:1015
Pathname vendorPath() const
Directory for equivalent vendor definitions (configPath()/vendors.d).
Definition ZConfig.cc:1027
long download_min_download_speed() const
Minimum download speed (bytes per second) until the connection is dropped.
Definition ZConfig.cc:1074
DownloadMode commit_downloadMode() const
Commit download policy to use as default.
Definition ZConfig.cc:1090
Pathname needrebootFile() const
Path of the default needreboot config file (configPath()/needreboot).
Definition ZConfig.cc:1003
void setGpgCheck(bool val_r)
Change the value.
Definition ZConfig.cc:1098
bool solver_dupAllowVendorChange() const
DUP tune: Whether to allow package vendor changes upon DUP.
Definition ZConfig.cc:1114
~ZConfig()
Dtor.
Definition ZConfig.cc:816
void setGeoipEnabled(bool enable=true)
Enables or disables the use of the geoip feature of download.opensuse.org.
Definition ZConfig.cc:1009
Pathname locksFile() const
Path where zypp can find or create lock file (configPath()/locks).
Definition ZConfig.cc:1033
RW_pointer< Impl, rw_pointer::Scoped< Impl > > _pimpl
Pointer to implementation.
Definition ZConfig.h:654
Pathname repoSolvfilesPath() const
Path where the repo solv files are created and kept (repoCachePath()/solv).
Definition ZConfig.cc:949
bool geoipEnabled() const
Returns true if zypp should use the geoip feature of download.opensuse.org.
Definition ZConfig.cc:1012
static Pathname update_messagesPath()
Path where the update messages are stored ( /var/adm/update-messages ).
Definition ZConfig.cc:1158
Pathname historyLogFile() const
Path where ZYpp install history is logged.
Definition ZConfig.cc:1189
void setSystemArchitecture(const Arch &arch_r)
Override the zypp system architecture.
Definition ZConfig.cc:860
TriBool pkgGpgCheck() const
Check rpm package signatures (indeterminate - according to gpgcheck).
Definition ZConfig.cc:1096
static ZConfig & instance()
Singleton ctor.
Definition ZConfig.cc:794
void setRepoPackagesPath(const Pathname &path_r)
Set a new path as the default repo cache path.
Definition ZConfig.cc:966
void setRepoSolvfilesPath(const Pathname &path_r)
Set a new path as the default repo cache path.
Definition ZConfig.cc:955
void resetUpdateMessagesNotify()
Reset to the zypp.conf default.
Definition ZConfig.cc:1180
std::ostream & about(std::ostream &str) const
Print some detail about the current libzypp version.
Definition ZConfig.cc:1222
const std::set< std::string > & multiversionSpec() const
Definition ZConfig.cc:1141
void set_download_mediaMountdir(Pathname newval_r)
Set alternate value.
Definition ZConfig.cc:1087
bool download_use_deltarpm() const
Whether to consider using a deltarpm when downloading a package.
Definition ZConfig.cc:1056
TriBool repoGpgCheck() const
Check repo matadata signatures (indeterminate - according to gpgcheck).
Definition ZConfig.cc:1095
void set_download_media_prefer_download(bool yesno_r)
Set download_media_prefer_download to a specific value.
Definition ZConfig.cc:1065
std::string updateMessagesNotify() const
Command definition for sending update messages.
Definition ZConfig.cc:1174
void addMultiversionSpec(const std::string &name_r)
Definition ZConfig.cc:1144
Pathname builtinRepoCachePath() const
The builtin config file value.
Definition ZConfig.cc:971
Pathname builtinRepoPackagesPath() const
The builtin config file value.
Definition ZConfig.cc:980
Pathname solver_checkSystemFile() const
File in which dependencies described which has to be fulfilled for a running system.
Definition ZConfig.cc:1123
Pathname builtinRepoMetadataPath() const
The builtin config file value.
Definition ZConfig.cc:974
void set_default_download_media_prefer_download()
Set download_media_prefer_download to the configfiles default.
Definition ZConfig.cc:1068
long lockTimeout() const
The number of seconds to wait for the zypp lock to become available.
Definition ZConfig.cc:819
Pathname solver_checkSystemFileDir() const
Directory, which may or may not contain files in which dependencies described which has to be fulfill...
Definition ZConfig.cc:1127
void resetGpgCheck()
Reset to the zconfig default.
Definition ZConfig.cc:1102
void setSolverUpgradeRemoveDroppedPackages(bool val_r)
Set solverUpgradeRemoveDroppedPackages to val_r.
Definition ZConfig.cc:1119
Pathname configPath() const
Path where the configfiles are kept (/etc/zypp).
Definition ZConfig.cc:985
static Arch defaultSystemArchitecture()
The autodetected system architecture.
Definition ZConfig.cc:852
Pathname pubkeyCachePath() const
Path where the pubkey caches.
Definition ZConfig.cc:928
long download_max_concurrent_connections() const
Maximum number of concurrent connections for a single transfer.
Definition ZConfig.cc:1071
void resetPkgGpgCheck()
Reset to the zconfig default.
Definition ZConfig.cc:1104
void announceSystemRoot(const Pathname &root_r)
Announce a target root directory without launching the Target.
Definition ZConfig.cc:843
bool solver_onlyRequires() const
Solver regards required packages,patterns,... only.
Definition ZConfig.cc:1108
Pathname varsPath() const
Path containing custom repo variable definitions (configPath()/vars.d).
Definition ZConfig.cc:1021
bool solver_dupAllowNameChange() const
DUP tune: Whether to follow package renames upon DUP.
Definition ZConfig.cc:1112
bool repoLabelIsAlias() const
Whether to use repository alias or name in user messages (progress, exceptions, .....
Definition ZConfig.cc:1050
void clearMultiversionSpec()
Definition ZConfig.cc:1143
LocaleSet repoRefreshLocales() const
List of locales for which translated package descriptions should be downloaded.
Definition ZConfig.cc:1047
long download_max_download_speed() const
Maximum download speed (bytes per second).
Definition ZConfig.cc:1077
void setRepoMetadataPath(const Pathname &path_r)
Set a new path as the default repo cache path.
Definition ZConfig.cc:944
bool solver_dupAllowDowngrade() const
DUP tune: Whether to allow version downgrades upon DUP.
Definition ZConfig.cc:1111
std::string multiversionKernels() const
Definition ZConfig.cc:1215
std::string distroverpkg() const
Package telling the "product version" on systems not using /etc/product.d/baseproduct.
Definition ZConfig.cc:1207
bool download_use_deltarpm_always() const
Whether to consider using a deltarpm even when rpm is local.
Definition ZConfig.cc:1059
void setRepoCachePath(const Pathname &path_r)
Set a new path as the default repo cache path.
Definition ZConfig.cc:933
void setRepoGpgCheck(TriBool val_r)
Change the value.
Definition ZConfig.cc:1099
Pathname credentialsGlobalDir() const
Defaults to /etc/zypp/credentials.d.
Definition ZConfig.cc:1195
bool download_media_prefer_download() const
Hint which media to prefer when installing packages (download vs.
Definition ZConfig.cc:1062
Pathname credentialsGlobalFile() const
Defaults to /etc/zypp/credentials.cat.
Definition ZConfig.cc:1200
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:708
MultiversionSpec & getDefaultSpec()
Definition ZConfig.cc:735
void scanDirAt(const Pathname &root_r, MultiversionSpec &spec_r, const Impl &zConfImpl_r)
Definition ZConfig.cc:754
bool scanConfAt(const Pathname &root_r, MultiversionSpec &spec_r, const Impl &zConfImpl_r)
Definition ZConfig.cc:739
std::map< Pathname, MultiversionSpec > SpecMap
Definition ZConfig.cc:706
Settings that follow a changed Target.
Definition ZConfig.cc:241
Option< bool > solver_dupAllowVendorChange
Definition ZConfig.cc:317
DefaultOption< bool > solverUpgradeRemoveDroppedPackages
Definition ZConfig.cc:321
Option< unsigned > solver_upgradeTestcasesToKeep
Definition ZConfig.cc:320
Option< bool > solver_dupAllowDowngrade
Definition ZConfig.cc:314
bool consume(const std::string &section, const std::string &entry, const std::string &value)
Definition ZConfig.cc:256
Option< bool > solver_dupAllowArchChange
Definition ZConfig.cc:316
Option< bool > solver_cleandepsOnRemove
Definition ZConfig.cc:318
Option< bool > solver_allowVendorChange
Definition ZConfig.cc:313
Option< bool > solver_dupAllowNameChange
Definition ZConfig.cc:315
static PoolImpl & myPool()
Definition PoolMember.cc:41