1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/ZConfig.cc
15 #include <sys/utsname.h>
16 #if __GLIBC_PREREQ (2,16)
17 #include <sys/auxv.h> // getauxval for PPC64P7 detection
20 #include <solv/solvversion.h>
24 #include "zypp/base/Logger.h"
25 #include "zypp/base/IOStream.h"
26 #include "zypp/base/InputStream.h"
27 #include "zypp/base/String.h"
29 #include "zypp/ZConfig.h"
30 #include "zypp/ZYppFactory.h"
31 #include "zypp/PathInfo.h"
32 #include "zypp/parser/IniDict.h"
34 #include "zypp/sat/Pool.h"
37 using namespace zypp::filesystem;
38 using namespace zypp::parser;
40 #undef ZYPP_BASE_LOGGER_LOGGROUP
41 #define ZYPP_BASE_LOGGER_LOGGROUP "zconfig"
43 ///////////////////////////////////////////////////////////////////
45 { /////////////////////////////////////////////////////////////////
46 /** \addtogroup ZyppConfig Zypp Configuration Options
48 * The global \c zypp.conf configuration file is per default located in \c /etc/zypp/.
49 * An alternate config file can be set using the environment varaible \c ZYPP_CONF=<PATH>
50 * (see \ref zypp-envars).
52 * \section ZyppConfig_ZyppConfSample Sample zypp.conf
53 * \include ../zypp.conf
55 ///////////////////////////////////////////////////////////////////
57 { /////////////////////////////////////////////////////////////////
59 /** Determine system architecture evaluating \c uname and \c /proc/cpuinfo.
61 Arch _autodetectSystemArchitecture()
64 if ( ::uname( &buf ) < 0 )
66 ERR << "Can't determine system architecture" << endl;
70 Arch architecture( buf.machine );
71 MIL << "Uname architecture is '" << buf.machine << "'" << endl;
73 if ( architecture == Arch_i686 )
75 // some CPUs report i686 but dont implement cx8 and cmov
76 // check for both flags in /proc/cpuinfo and downgrade
77 // to i586 if either is missing (cf bug #18885)
78 std::ifstream cpuinfo( "/proc/cpuinfo" );
81 for( iostr::EachLine in( cpuinfo ); in; in.next() )
83 if ( str::hasPrefix( *in, "flags" ) )
85 if ( in->find( "cx8" ) == std::string::npos
86 || in->find( "cmov" ) == std::string::npos )
88 architecture = Arch_i586;
89 WAR << "CPU lacks 'cx8' or 'cmov': architecture downgraded to '" << architecture << "'" << endl;
97 ERR << "Cant open " << PathInfo("/proc/cpuinfo") << endl;
100 else if ( architecture == Arch_sparc || architecture == Arch_sparc64 )
102 // Check for sun4[vum] to get the real arch. (bug #566291)
103 std::ifstream cpuinfo( "/proc/cpuinfo" );
106 for( iostr::EachLine in( cpuinfo ); in; in.next() )
108 if ( str::hasPrefix( *in, "type" ) )
110 if ( in->find( "sun4v" ) != std::string::npos )
112 architecture = ( architecture == Arch_sparc64 ? Arch_sparc64v : Arch_sparcv9v );
113 WAR << "CPU has 'sun4v': architecture upgraded to '" << architecture << "'" << endl;
115 else if ( in->find( "sun4u" ) != std::string::npos )
117 architecture = ( architecture == Arch_sparc64 ? Arch_sparc64 : Arch_sparcv9 );
118 WAR << "CPU has 'sun4u': architecture upgraded to '" << architecture << "'" << endl;
120 else if ( in->find( "sun4m" ) != std::string::npos )
122 architecture = Arch_sparcv8;
123 WAR << "CPU has 'sun4m': architecture upgraded to '" << architecture << "'" << endl;
131 ERR << "Cant open " << PathInfo("/proc/cpuinfo") << endl;
134 else if ( architecture == Arch_armv7l || architecture == Arch_armv6l )
136 std::ifstream platform( "/etc/rpm/platform" );
139 for( iostr::EachLine in( platform ); in; in.next() )
141 if ( str::hasPrefix( *in, "armv7hl-" ) )
143 architecture = Arch_armv7hl;
144 WAR << "/etc/rpm/platform contains armv7hl-: architecture upgraded to '" << architecture << "'" << endl;
147 if ( str::hasPrefix( *in, "armv6hl-" ) )
149 architecture = Arch_armv6hl;
150 WAR << "/etc/rpm/platform contains armv6hl-: architecture upgraded to '" << architecture << "'" << endl;
156 #if __GLIBC_PREREQ (2,16)
157 else if ( architecture == Arch_ppc64 )
159 const char * platform = (const char *)getauxval( AT_PLATFORM );
161 if ( platform && sscanf( platform, "power%d", &powerlvl ) == 1 && powerlvl > 6 )
162 architecture = Arch_ppc64p7;
168 /** The locale to be used for texts and messages.
170 * For the encoding to be used the preference is
172 * LC_ALL, LC_CTYPE, LANG
174 * For the language of the messages to be used, the preference is
176 * LANGUAGE, LC_ALL, LC_MESSAGES, LANG
178 * Note that LANGUAGE can contain more than one locale name, it can be
179 * a list of locale names like for example
181 * LANGUAGE=ja_JP.UTF-8:de_DE.UTF-8:fr_FR.UTF-8
183 * \todo Support dynamic fallbacklists defined by LANGUAGE
185 Locale _autodetectTextLocale()
188 const char * envlist[] = { "LC_ALL", "LC_MESSAGES", "LANG", NULL };
189 for ( const char ** envvar = envlist; *envvar; ++envvar )
191 const char * envlang = getenv( *envvar );
194 std::string envstr( envlang );
195 if ( envstr != "POSIX" && envstr != "C" )
197 Locale lang( envstr );
198 if ( ! lang.code().empty() )
200 MIL << "Found " << *envvar << "=" << envstr << endl;
207 MIL << "Default text locale is '" << ret << "'" << endl;
208 #warning HACK AROUND BOOST_TEST_CATCH_SYSTEM_ERRORS
209 setenv( "BOOST_TEST_CATCH_SYSTEM_ERRORS", "no", 1 );
213 /////////////////////////////////////////////////////////////////
215 ///////////////////////////////////////////////////////////////////
217 /** Mutable option. */
221 typedef _Tp value_type;
223 /** No default ctor, explicit initialisation! */
224 Option( const value_type & initial_r )
228 /** Get the value. */
229 const value_type & get() const
232 /** Autoconversion to value_type. */
233 operator const value_type &() const
236 /** Set a new value. */
237 void set( const value_type & newval_r )
240 /** Non-const reference to set a new value. */
248 /** Mutable option with initial value also remembering a config value. */
250 struct DefaultOption : public Option<_Tp>
252 typedef _Tp value_type;
253 typedef Option<_Tp> option_type;
255 DefaultOption( const value_type & initial_r )
256 : Option<_Tp>( initial_r ), _default( initial_r )
259 /** Reset value to the current default. */
260 void restoreToDefault()
261 { this->set( _default.get() ); }
263 /** Reset value to a new default. */
264 void restoreToDefault( const value_type & newval_r )
265 { setDefault( newval_r ); restoreToDefault(); }
267 /** Get the current default value. */
268 const value_type & getDefault() const
269 { return _default.get(); }
271 /** Set a new default value. */
272 void setDefault( const value_type & newval_r )
273 { _default.set( newval_r ); }
276 option_type _default;
279 ///////////////////////////////////////////////////////////////////
281 // CLASS NAME : ZConfig::Impl
283 /** ZConfig implementation.
284 * \todo Enrich section and entry definition by some comment
285 * (including the default setting and provide some method to
286 * write this into a sample zypp.conf.
291 Impl( const Pathname & override_r = Pathname() )
292 : _parsedZyppConf ( override_r )
293 , cfg_arch ( defaultSystemArchitecture() )
294 , cfg_textLocale ( defaultTextLocale() )
295 , updateMessagesNotify ( "single | /usr/lib/zypp/notify-message -p %p" )
296 , repo_add_probe ( false )
297 , repo_refresh_delay ( 10 )
298 , repoLabelIsAlias ( false )
299 , download_use_deltarpm ( true )
300 , download_use_deltarpm_always ( false )
301 , download_media_prefer_download( true )
302 , download_max_concurrent_connections( 5 )
303 , download_min_download_speed ( 0 )
304 , download_max_download_speed ( 0 )
305 , download_max_silent_tries ( 5 )
306 , download_transfer_timeout ( 180 )
307 , commit_downloadMode ( DownloadDefault )
309 , repoGpgCheck ( indeterminate )
310 , pkgGpgCheck ( indeterminate )
311 , solver_onlyRequires ( false )
312 , solver_allowVendorChange ( false )
313 , solver_cleandepsOnRemove ( false )
314 , solver_upgradeTestcasesToKeep ( 2 )
315 , solverUpgradeRemoveDroppedPackages( true )
316 , apply_locks_file ( true )
317 , pluginsPath ( "/usr/lib/zypp/plugins" )
319 MIL << "libzypp: " << VERSION << " built " << __DATE__ << " " << __TIME__ << endl;
320 // override_r has higest prio
321 // ZYPP_CONF might override /etc/zypp/zypp.conf
322 if ( _parsedZyppConf.empty() )
324 const char *env_confpath = getenv( "ZYPP_CONF" );
325 _parsedZyppConf = env_confpath ? env_confpath : "/etc/zypp/zypp.conf";
329 // Inject this into ZConfig. Be shure this is
330 // allocated via new. See: reconfigureZConfig
331 INT << "Reconfigure to " << _parsedZyppConf << endl;
332 ZConfig::instance()._pimpl.reset( this );
334 if ( PathInfo(_parsedZyppConf).isExist() )
336 parser::IniDict dict( _parsedZyppConf );
337 for ( IniDict::section_const_iterator sit = dict.sectionsBegin();
338 sit != dict.sectionsEnd();
341 string section(*sit);
342 //MIL << section << endl;
343 for ( IniDict::entry_const_iterator it = dict.entriesBegin(*sit);
344 it != dict.entriesEnd(*sit);
347 string entry(it->first);
348 string value(it->second);
349 //DBG << (*it).first << "=" << (*it).second << endl;
350 if ( section == "main" )
352 if ( entry == "arch" )
355 if ( carch != cfg_arch )
357 WAR << "Overriding system architecture (" << cfg_arch << "): " << carch << endl;
361 else if ( entry == "cachedir" )
363 cfg_cache_path = Pathname(value);
365 else if ( entry == "metadatadir" )
367 cfg_metadata_path = Pathname(value);
369 else if ( entry == "solvfilesdir" )
371 cfg_solvfiles_path = Pathname(value);
373 else if ( entry == "packagesdir" )
375 cfg_packages_path = Pathname(value);
377 else if ( entry == "configdir" )
379 cfg_config_path = Pathname(value);
381 else if ( entry == "reposdir" )
383 cfg_known_repos_path = Pathname(value);
385 else if ( entry == "servicesdir" )
387 cfg_known_services_path = Pathname(value);
389 else if ( entry == "repo.add.probe" )
391 repo_add_probe = str::strToBool( value, repo_add_probe );
393 else if ( entry == "repo.refresh.delay" )
395 str::strtonum(value, repo_refresh_delay);
397 else if ( entry == "repo.refresh.locales" )
399 std::vector<std::string> tmp;
400 str::split( value, back_inserter( tmp ), ", \t" );
402 boost::function<Locale(const std::string &)> transform(
403 [](const std::string & str_r)->Locale{ return Locale(str_r); }
405 repoRefreshLocales.insert( make_transform_iterator( tmp.begin(), transform ),
406 make_transform_iterator( tmp.end(), transform ) );
408 else if ( entry == "download.use_deltarpm" )
410 download_use_deltarpm = str::strToBool( value, download_use_deltarpm );
412 else if ( entry == "download.use_deltarpm.always" )
414 download_use_deltarpm_always = str::strToBool( value, download_use_deltarpm_always );
416 else if ( entry == "download.media_preference" )
418 download_media_prefer_download.restoreToDefault( str::compareCI( value, "volatile" ) != 0 );
420 else if ( entry == "download.max_concurrent_connections" )
422 str::strtonum(value, download_max_concurrent_connections);
424 else if ( entry == "download.min_download_speed" )
426 str::strtonum(value, download_min_download_speed);
428 else if ( entry == "download.max_download_speed" )
430 str::strtonum(value, download_max_download_speed);
432 else if ( entry == "download.max_silent_tries" )
434 str::strtonum(value, download_max_silent_tries);
436 else if ( entry == "download.transfer_timeout" )
438 str::strtonum(value, download_transfer_timeout);
439 if ( download_transfer_timeout < 0 ) download_transfer_timeout = 0;
440 else if ( download_transfer_timeout > 3600 ) download_transfer_timeout = 3600;
442 else if ( entry == "commit.downloadMode" )
444 commit_downloadMode.set( deserializeDownloadMode( value ) );
446 else if ( entry == "gpgcheck" )
448 gpgCheck.set( str::strToBool( value, gpgCheck ) );
450 else if ( entry == "repo_gpgcheck" )
452 repoGpgCheck.set( str::strToTriBool( value ) );
454 else if ( entry == "pkg_gpgcheck" )
456 pkgGpgCheck.set( str::strToTriBool( value ) );
458 else if ( entry == "vendordir" )
460 cfg_vendor_path = Pathname(value);
462 else if ( entry == "multiversiondir" )
464 cfg_multiversion_path = Pathname(value);
466 else if ( entry == "solver.onlyRequires" )
468 solver_onlyRequires.set( str::strToBool( value, solver_onlyRequires ) );
470 else if ( entry == "solver.allowVendorChange" )
472 solver_allowVendorChange.set( str::strToBool( value, solver_allowVendorChange ) );
474 else if ( entry == "solver.cleandepsOnRemove" )
476 solver_cleandepsOnRemove.set( str::strToBool( value, solver_cleandepsOnRemove ) );
478 else if ( entry == "solver.upgradeTestcasesToKeep" )
480 solver_upgradeTestcasesToKeep.set( str::strtonum<unsigned>( value ) );
482 else if ( entry == "solver.upgradeRemoveDroppedPackages" )
484 solverUpgradeRemoveDroppedPackages.restoreToDefault( str::strToBool( value, solverUpgradeRemoveDroppedPackages.getDefault() ) );
486 else if ( entry == "solver.checkSystemFile" )
488 solver_checkSystemFile = Pathname(value);
490 else if ( entry == "multiversion" )
492 str::split( value, inserter( _multiversion, _multiversion.end() ), ", \t" );
494 else if ( entry == "locksfile.path" )
496 locks_file = Pathname(value);
498 else if ( entry == "locksfile.apply" )
500 apply_locks_file = str::strToBool( value, apply_locks_file );
502 else if ( entry == "update.datadir" )
504 update_data_path = Pathname(value);
506 else if ( entry == "update.scriptsdir" )
508 update_scripts_path = Pathname(value);
510 else if ( entry == "update.messagessdir" )
512 update_messages_path = Pathname(value);
514 else if ( entry == "update.messages.notify" )
516 updateMessagesNotify.set( value );
518 else if ( entry == "rpm.install.excludedocs" )
520 rpmInstallFlags.setFlag( target::rpm::RPMINST_EXCLUDEDOCS,
521 str::strToBool( value, false ) );
523 else if ( entry == "history.logfile" )
525 history_log_path = Pathname(value);
527 else if ( entry == "credentials.global.dir" )
529 credentials_global_dir_path = Pathname(value);
531 else if ( entry == "credentials.global.file" )
533 credentials_global_file_path = Pathname(value);
541 MIL << _parsedZyppConf << " not found, using defaults instead." << endl;
542 _parsedZyppConf = _parsedZyppConf.extend( " (NOT FOUND)" );
546 if ( getenv( "ZYPP_TESTSUITE_FAKE_ARCH" ) )
548 Arch carch( getenv( "ZYPP_TESTSUITE_FAKE_ARCH" ) );
549 if ( carch != cfg_arch )
551 WAR << "ZYPP_TESTSUITE_FAKE_ARCH: Overriding system architecture (" << cfg_arch << "): " << carch << endl;
555 MIL << "ZConfig singleton created." << endl;
562 /** Remember any parsed zypp.conf. */
563 Pathname _parsedZyppConf;
566 Locale cfg_textLocale;
568 Pathname cfg_cache_path;
569 Pathname cfg_metadata_path;
570 Pathname cfg_solvfiles_path;
571 Pathname cfg_packages_path;
573 Pathname cfg_config_path;
574 Pathname cfg_known_repos_path;
575 Pathname cfg_known_services_path;
577 Pathname cfg_vendor_path;
578 Pathname cfg_multiversion_path;
581 Pathname update_data_path;
582 Pathname update_scripts_path;
583 Pathname update_messages_path;
584 DefaultOption<std::string> updateMessagesNotify;
587 unsigned repo_refresh_delay;
588 LocaleSet repoRefreshLocales;
589 bool repoLabelIsAlias;
591 bool download_use_deltarpm;
592 bool download_use_deltarpm_always;
593 DefaultOption<bool> download_media_prefer_download;
595 int download_max_concurrent_connections;
596 int download_min_download_speed;
597 int download_max_download_speed;
598 int download_max_silent_tries;
599 int download_transfer_timeout;
601 Option<DownloadMode> commit_downloadMode;
603 Option<bool> gpgCheck;
604 Option<TriBool> repoGpgCheck;
605 Option<TriBool> pkgGpgCheck;
607 Option<bool> solver_onlyRequires;
608 Option<bool> solver_allowVendorChange;
609 Option<bool> solver_cleandepsOnRemove;
610 Option<unsigned> solver_upgradeTestcasesToKeep;
611 DefaultOption<bool> solverUpgradeRemoveDroppedPackages;
613 Pathname solver_checkSystemFile;
615 std::set<std::string> & multiversion() { return getMultiversion(); }
616 const std::set<std::string> & multiversion() const { return getMultiversion(); }
618 bool apply_locks_file;
620 target::rpm::RpmInstFlags rpmInstallFlags;
622 Pathname history_log_path;
623 Pathname credentials_global_dir_path;
624 Pathname credentials_global_file_path;
626 std::string userData;
628 Option<Pathname> pluginsPath;
631 std::set<std::string> & getMultiversion() const
633 if ( ! _multiversionInitialized )
635 Pathname multiversionDir( cfg_multiversion_path );
636 if ( multiversionDir.empty() )
637 multiversionDir = ( cfg_config_path.empty() ? Pathname("/etc/zypp") : cfg_config_path ) / "multiversion.d";
639 filesystem::dirForEach( multiversionDir,
640 [this]( const Pathname & dir_r, const char *const & name_r )->bool
642 MIL << "Parsing " << dir_r/name_r << endl;
643 iostr::simpleParseFile( InputStream( dir_r/name_r ),
644 [this]( int num_r, std::string line_r )->bool
646 DBG << " found " << line_r << endl;
647 _multiversion.insert( line_r );
652 _multiversionInitialized = true;
654 return _multiversion;
656 mutable std::set<std::string> _multiversion;
657 mutable DefaultIntegral<bool,false> _multiversionInitialized;
659 ///////////////////////////////////////////////////////////////////
661 // Backdoor to redirect ZConfig from within the running
662 // TEST-application. HANDLE WITH CARE!
663 void reconfigureZConfig( const Pathname & override_r )
665 // ctor puts itself unter smart pointer control.
666 new ZConfig::Impl( override_r );
669 ///////////////////////////////////////////////////////////////////
671 // METHOD NAME : ZConfig::instance
672 // METHOD TYPE : ZConfig &
674 ZConfig & ZConfig::instance()
676 static ZConfig _instance; // The singleton
680 ///////////////////////////////////////////////////////////////////
682 // METHOD NAME : ZConfig::ZConfig
683 // METHOD TYPE : Ctor
691 ///////////////////////////////////////////////////////////////////
693 // METHOD NAME : ZConfig::~ZConfig
694 // METHOD TYPE : Dtor
699 Pathname ZConfig::systemRoot() const
701 Target_Ptr target( getZYpp()->getTarget() );
702 return target ? target->root() : Pathname();
705 ///////////////////////////////////////////////////////////////////
707 // system architecture
709 ///////////////////////////////////////////////////////////////////
711 Arch ZConfig::defaultSystemArchitecture()
713 static Arch _val( _autodetectSystemArchitecture() );
717 Arch ZConfig::systemArchitecture() const
718 { return _pimpl->cfg_arch; }
720 void ZConfig::setSystemArchitecture( const Arch & arch_r )
722 if ( arch_r != _pimpl->cfg_arch )
724 WAR << "Overriding system architecture (" << _pimpl->cfg_arch << "): " << arch_r << endl;
725 _pimpl->cfg_arch = arch_r;
729 ///////////////////////////////////////////////////////////////////
733 ///////////////////////////////////////////////////////////////////
735 Locale ZConfig::defaultTextLocale()
737 static Locale _val( _autodetectTextLocale() );
741 Locale ZConfig::textLocale() const
742 { return _pimpl->cfg_textLocale; }
744 void ZConfig::setTextLocale( const Locale & locale_r )
746 if ( locale_r != _pimpl->cfg_textLocale )
748 WAR << "Overriding text locale (" << _pimpl->cfg_textLocale << "): " << locale_r << endl;
749 _pimpl->cfg_textLocale = locale_r;
750 #warning prefer signal
751 sat::Pool::instance().setTextLocale( locale_r );
755 ///////////////////////////////////////////////////////////////////
757 ///////////////////////////////////////////////////////////////////
759 bool ZConfig::hasUserData() const
760 { return !_pimpl->userData.empty(); }
762 std::string ZConfig::userData() const
763 { return _pimpl->userData; }
765 bool ZConfig::setUserData( const std::string & str_r )
767 for_( ch, str_r.begin(), str_r.end() )
769 if ( *ch < ' ' && *ch != '\t' )
771 ERR << "New user data string rejectded: char " << (int)*ch << " at position " << (ch - str_r.begin()) << endl;
775 MIL << "Set user data string to '" << str_r << "'" << endl;
776 _pimpl->userData = str_r;
780 ///////////////////////////////////////////////////////////////////
782 Pathname ZConfig::repoCachePath() const
784 return ( _pimpl->cfg_cache_path.empty()
785 ? Pathname("/var/cache/zypp") : _pimpl->cfg_cache_path );
788 Pathname ZConfig::repoMetadataPath() const
790 return ( _pimpl->cfg_metadata_path.empty()
791 ? (repoCachePath()/"raw") : _pimpl->cfg_metadata_path );
794 Pathname ZConfig::repoSolvfilesPath() const
796 return ( _pimpl->cfg_solvfiles_path.empty()
797 ? (repoCachePath()/"solv") : _pimpl->cfg_solvfiles_path );
800 Pathname ZConfig::repoPackagesPath() const
802 return ( _pimpl->cfg_packages_path.empty()
803 ? (repoCachePath()/"packages") : _pimpl->cfg_packages_path );
806 ///////////////////////////////////////////////////////////////////
808 Pathname ZConfig::configPath() const
810 return ( _pimpl->cfg_config_path.empty()
811 ? Pathname("/etc/zypp") : _pimpl->cfg_config_path );
814 Pathname ZConfig::knownReposPath() const
816 return ( _pimpl->cfg_known_repos_path.empty()
817 ? (configPath()/"repos.d") : _pimpl->cfg_known_repos_path );
820 Pathname ZConfig::knownServicesPath() const
822 return ( _pimpl->cfg_known_services_path.empty()
823 ? (configPath()/"services.d") : _pimpl->cfg_known_services_path );
826 Pathname ZConfig::vendorPath() const
828 return ( _pimpl->cfg_vendor_path.empty()
829 ? (configPath()/"vendors.d") : _pimpl->cfg_vendor_path );
832 Pathname ZConfig::locksFile() const
834 return ( _pimpl->locks_file.empty()
835 ? (configPath()/"locks") : _pimpl->locks_file );
838 ///////////////////////////////////////////////////////////////////
840 bool ZConfig::repo_add_probe() const
841 { return _pimpl->repo_add_probe; }
843 unsigned ZConfig::repo_refresh_delay() const
844 { return _pimpl->repo_refresh_delay; }
846 LocaleSet ZConfig::repoRefreshLocales() const
847 { return _pimpl->repoRefreshLocales.empty() ? Target::requestedLocales("") :_pimpl->repoRefreshLocales; }
849 bool ZConfig::repoLabelIsAlias() const
850 { return _pimpl->repoLabelIsAlias; }
852 void ZConfig::repoLabelIsAlias( bool yesno_r )
853 { _pimpl->repoLabelIsAlias = yesno_r; }
855 bool ZConfig::download_use_deltarpm() const
856 { return _pimpl->download_use_deltarpm; }
858 bool ZConfig::download_use_deltarpm_always() const
859 { return download_use_deltarpm() && _pimpl->download_use_deltarpm_always; }
861 bool ZConfig::download_media_prefer_download() const
862 { return _pimpl->download_media_prefer_download; }
864 void ZConfig::set_download_media_prefer_download( bool yesno_r )
865 { _pimpl->download_media_prefer_download.set( yesno_r ); }
867 void ZConfig::set_default_download_media_prefer_download()
868 { _pimpl->download_media_prefer_download.restoreToDefault(); }
870 long ZConfig::download_max_concurrent_connections() const
871 { return _pimpl->download_max_concurrent_connections; }
873 long ZConfig::download_min_download_speed() const
874 { return _pimpl->download_min_download_speed; }
876 long ZConfig::download_max_download_speed() const
877 { return _pimpl->download_max_download_speed; }
879 long ZConfig::download_max_silent_tries() const
880 { return _pimpl->download_max_silent_tries; }
882 long ZConfig::download_transfer_timeout() const
883 { return _pimpl->download_transfer_timeout; }
885 DownloadMode ZConfig::commit_downloadMode() const
886 { return _pimpl->commit_downloadMode; }
888 bool ZConfig::gpgCheck() const
889 { return _pimpl->gpgCheck; }
891 TriBool ZConfig::repoGpgCheck() const
892 { return _pimpl->repoGpgCheck; }
894 TriBool ZConfig::pkgGpgCheck() const
895 { return _pimpl->pkgGpgCheck; }
897 bool ZConfig::solver_onlyRequires() const
898 { return _pimpl->solver_onlyRequires; }
900 bool ZConfig::solver_allowVendorChange() const
901 { return _pimpl->solver_allowVendorChange; }
903 bool ZConfig::solver_cleandepsOnRemove() const
904 { return _pimpl->solver_cleandepsOnRemove; }
906 Pathname ZConfig::solver_checkSystemFile() const
907 { return ( _pimpl->solver_checkSystemFile.empty()
908 ? (configPath()/"systemCheck") : _pimpl->solver_checkSystemFile ); }
910 unsigned ZConfig::solver_upgradeTestcasesToKeep() const
911 { return _pimpl->solver_upgradeTestcasesToKeep; }
913 bool ZConfig::solverUpgradeRemoveDroppedPackages() const { return _pimpl->solverUpgradeRemoveDroppedPackages; }
914 void ZConfig::setSolverUpgradeRemoveDroppedPackages( bool val_r ) { _pimpl->solverUpgradeRemoveDroppedPackages.set( val_r ); }
915 void ZConfig::resetSolverUpgradeRemoveDroppedPackages() { _pimpl->solverUpgradeRemoveDroppedPackages.restoreToDefault(); }
917 const std::set<std::string> & ZConfig::multiversionSpec() const { return _pimpl->multiversion(); }
918 void ZConfig::multiversionSpec( std::set<std::string> new_r ) { _pimpl->multiversion().swap( new_r ); }
919 void ZConfig::clearMultiversionSpec() { _pimpl->multiversion().clear(); }
920 void ZConfig::addMultiversionSpec( const std::string & name_r ) { _pimpl->multiversion().insert( name_r ); }
921 void ZConfig::removeMultiversionSpec( const std::string & name_r ) { _pimpl->multiversion().erase( name_r ); }
923 bool ZConfig::apply_locks_file() const
924 { return _pimpl->apply_locks_file; }
926 Pathname ZConfig::update_dataPath() const
928 return ( _pimpl->update_data_path.empty()
929 ? Pathname("/var/adm") : _pimpl->update_data_path );
932 Pathname ZConfig::update_messagesPath() const
934 return ( _pimpl->update_messages_path.empty()
935 ? Pathname(update_dataPath()/"update-messages") : _pimpl->update_messages_path );
938 Pathname ZConfig::update_scriptsPath() const
940 return ( _pimpl->update_scripts_path.empty()
941 ? Pathname(update_dataPath()/"update-scripts") : _pimpl->update_scripts_path );
944 std::string ZConfig::updateMessagesNotify() const
945 { return _pimpl->updateMessagesNotify; }
947 void ZConfig::setUpdateMessagesNotify( const std::string & val_r )
948 { _pimpl->updateMessagesNotify.set( val_r ); }
950 void ZConfig::resetUpdateMessagesNotify()
951 { _pimpl->updateMessagesNotify.restoreToDefault(); }
953 ///////////////////////////////////////////////////////////////////
955 target::rpm::RpmInstFlags ZConfig::rpmInstallFlags() const
956 { return _pimpl->rpmInstallFlags; }
959 Pathname ZConfig::historyLogFile() const
961 return ( _pimpl->history_log_path.empty() ?
962 Pathname("/var/log/zypp/history") : _pimpl->history_log_path );
965 Pathname ZConfig::credentialsGlobalDir() const
967 return ( _pimpl->credentials_global_dir_path.empty() ?
968 Pathname("/etc/zypp/credentials.d") : _pimpl->credentials_global_dir_path );
971 Pathname ZConfig::credentialsGlobalFile() const
973 return ( _pimpl->credentials_global_file_path.empty() ?
974 Pathname("/etc/zypp/credentials.cat") : _pimpl->credentials_global_file_path );
977 ///////////////////////////////////////////////////////////////////
979 std::string ZConfig::distroverpkg() const
980 { return "redhat-release"; }
982 ///////////////////////////////////////////////////////////////////
984 Pathname ZConfig::pluginsPath() const
985 { return _pimpl->pluginsPath.get(); }
987 ///////////////////////////////////////////////////////////////////
989 std::ostream & ZConfig::about( std::ostream & str ) const
991 str << "libzypp: " << VERSION << " built " << __DATE__ << " " << __TIME__ << endl;
993 str << "libsolv: " << solv_version;
994 if ( ::strcmp( solv_version, LIBSOLV_VERSION_STRING ) )
995 str << " (built against " << LIBSOLV_VERSION_STRING << ")";
998 str << "zypp.conf: '" << _pimpl->_parsedZyppConf << "'" << endl;
999 str << "TextLocale: '" << textLocale() << "' (" << defaultTextLocale() << ")" << endl;
1000 str << "SystemArchitecture: '" << systemArchitecture() << "' (" << defaultSystemArchitecture() << ")" << endl;
1004 /////////////////////////////////////////////////////////////////
1006 ///////////////////////////////////////////////////////////////////