1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/ZConfig.cc
14 #include <sys/utsname.h>
16 #include <solv/solvversion.h>
20 #include "zypp/base/Logger.h"
21 #include "zypp/base/IOStream.h"
22 #include "zypp/base/InputStream.h"
23 #include "zypp/base/String.h"
25 #include "zypp/ZConfig.h"
26 #include "zypp/ZYppFactory.h"
27 #include "zypp/PathInfo.h"
28 #include "zypp/parser/IniDict.h"
30 #include "zypp/sat/Pool.h"
33 using namespace zypp::filesystem;
34 using namespace zypp::parser;
36 #undef ZYPP_BASE_LOGGER_LOGGROUP
37 #define ZYPP_BASE_LOGGER_LOGGROUP "zconfig"
39 ///////////////////////////////////////////////////////////////////
41 { /////////////////////////////////////////////////////////////////
42 /** \addtogroup ZyppConfig Zypp Configuration Options
44 * The global \c zypp.conf configuration file is per default located in \c /etc/zypp/.
45 * An alternate config file can be set using the environment varaible \c ZYPP_CONF=<PATH>
46 * (see \ref zypp-envars).
48 * \section ZyppConfig_ZyppConfSample Sample zypp.conf
49 * \include ../zypp.conf
51 ///////////////////////////////////////////////////////////////////
53 { /////////////////////////////////////////////////////////////////
55 /** Determine system architecture evaluating \c uname and \c /proc/cpuinfo.
57 Arch _autodetectSystemArchitecture()
60 if ( ::uname( &buf ) < 0 )
62 ERR << "Can't determine system architecture" << endl;
66 Arch architecture( buf.machine );
67 MIL << "Uname architecture is '" << buf.machine << "'" << endl;
69 if ( architecture == Arch_i686 )
71 // some CPUs report i686 but dont implement cx8 and cmov
72 // check for both flags in /proc/cpuinfo and downgrade
73 // to i586 if either is missing (cf bug #18885)
74 std::ifstream cpuinfo( "/proc/cpuinfo" );
77 for( iostr::EachLine in( cpuinfo ); in; in.next() )
79 if ( str::hasPrefix( *in, "flags" ) )
81 if ( in->find( "cx8" ) == std::string::npos
82 || in->find( "cmov" ) == std::string::npos )
84 architecture = Arch_i586;
85 WAR << "CPU lacks 'cx8' or 'cmov': architecture downgraded to '" << architecture << "'" << endl;
93 ERR << "Cant open " << PathInfo("/proc/cpuinfo") << endl;
96 else if ( architecture == Arch_sparc || architecture == Arch_sparc64 )
98 // Check for sun4[vum] to get the real arch. (bug #566291)
99 std::ifstream cpuinfo( "/proc/cpuinfo" );
102 for( iostr::EachLine in( cpuinfo ); in; in.next() )
104 if ( str::hasPrefix( *in, "type" ) )
106 if ( in->find( "sun4v" ) != std::string::npos )
108 architecture = ( architecture == Arch_sparc64 ? Arch_sparc64v : Arch_sparcv9v );
109 WAR << "CPU has 'sun4v': architecture upgraded to '" << architecture << "'" << endl;
111 else if ( in->find( "sun4u" ) != std::string::npos )
113 architecture = ( architecture == Arch_sparc64 ? Arch_sparc64 : Arch_sparcv9 );
114 WAR << "CPU has 'sun4u': architecture upgraded to '" << architecture << "'" << endl;
116 else if ( in->find( "sun4m" ) != std::string::npos )
118 architecture = Arch_sparcv8;
119 WAR << "CPU has 'sun4m': architecture upgraded to '" << architecture << "'" << endl;
127 ERR << "Cant open " << PathInfo("/proc/cpuinfo") << endl;
133 /** The locale to be used for texts and messages.
135 * For the encoding to be used the preference is
137 * LC_ALL, LC_CTYPE, LANG
139 * For the language of the messages to be used, the preference is
141 * LANGUAGE, LC_ALL, LC_MESSAGES, LANG
143 * Note that LANGUAGE can contain more than one locale name, it can be
144 * a list of locale names like for example
146 * LANGUAGE=ja_JP.UTF-8:de_DE.UTF-8:fr_FR.UTF-8
148 * \todo Support dynamic fallbacklists defined by LANGUAGE
150 Locale _autodetectTextLocale()
153 const char * envlist[] = { "LC_ALL", "LC_MESSAGES", "LANG", NULL };
154 for ( const char ** envvar = envlist; *envvar; ++envvar )
156 const char * envlang = getenv( *envvar );
159 std::string envstr( envlang );
160 if ( envstr != "POSIX" && envstr != "C" )
162 Locale lang( envstr );
163 if ( ! lang.code().empty() )
165 MIL << "Found " << *envvar << "=" << envstr << endl;
172 MIL << "Default text locale is '" << ret << "'" << endl;
173 #warning HACK AROUND BOOST_TEST_CATCH_SYSTEM_ERRORS
174 setenv( "BOOST_TEST_CATCH_SYSTEM_ERRORS", "no", 1 );
178 /////////////////////////////////////////////////////////////////
180 ///////////////////////////////////////////////////////////////////
182 /** Mutable option. */
186 typedef _Tp value_type;
188 /** No default ctor, explicit initialisation! */
189 Option( const value_type & initial_r )
193 /** Get the value. */
194 const value_type & get() const
197 /** Autoconversion to value_type. */
198 operator const value_type &() const
201 /** Set a new value. */
202 void set( const value_type & newval_r )
205 /** Non-const reference to set a new value. */
213 /** Mutable option with initial value also remembering a config value. */
215 struct DefaultOption : public Option<_Tp>
217 typedef _Tp value_type;
218 typedef Option<_Tp> option_type;
220 DefaultOption( const value_type & initial_r )
221 : Option<_Tp>( initial_r ), _default( initial_r )
224 /** Reset value to the current default. */
225 void restoreToDefault()
226 { this->set( _default.get() ); }
228 /** Reset value to a new default. */
229 void restoreToDefault( const value_type & newval_r )
230 { setDefault( newval_r ); restoreToDefault(); }
232 /** Get the current default value. */
233 const value_type & getDefault() const
234 { return _default.get(); }
236 /** Set a new default value. */
237 void setDefault( const value_type & newval_r )
238 { _default.set( newval_r ); }
241 option_type _default;
244 ///////////////////////////////////////////////////////////////////
246 // CLASS NAME : ZConfig::Impl
248 /** ZConfig implementation.
249 * \todo Enrich section and entry definition by some comment
250 * (including the default setting and provide some method to
251 * write this into a sample zypp.conf.
256 Impl( const Pathname & override_r = Pathname() )
257 : _parsedZyppConf ( override_r )
258 , cfg_arch ( defaultSystemArchitecture() )
259 , cfg_textLocale ( defaultTextLocale() )
260 , updateMessagesNotify ( "single | /usr/lib/zypp/notify-message -p %p" )
261 , repo_add_probe ( false )
262 , repo_refresh_delay ( 10 )
263 , repoLabelIsAlias ( false )
264 , download_use_deltarpm ( true )
265 , download_use_deltarpm_always ( false )
266 , download_media_prefer_download( true )
267 , download_max_concurrent_connections( 5 )
268 , download_min_download_speed ( 0 )
269 , download_max_download_speed ( 0 )
270 , download_max_silent_tries ( 5 )
271 , commit_downloadMode ( DownloadDefault )
272 , solver_onlyRequires ( false )
273 , solver_allowVendorChange ( false )
274 , solver_cleandepsOnRemove ( false )
275 , solver_upgradeTestcasesToKeep ( 2 )
276 , solverUpgradeRemoveDroppedPackages( true )
277 , apply_locks_file ( true )
278 , pluginsPath ( "/usr/lib/zypp/plugins" )
280 MIL << "libzypp: " << VERSION << " built " << __DATE__ << " " << __TIME__ << endl;
281 // override_r has higest prio
282 // ZYPP_CONF might override /etc/zypp/zypp.conf
283 if ( _parsedZyppConf.empty() )
285 const char *env_confpath = getenv( "ZYPP_CONF" );
286 _parsedZyppConf = env_confpath ? env_confpath : "/etc/zypp/zypp.conf";
290 // Inject this into ZConfig. Be shure this is
291 // allocated via new. See: reconfigureZConfig
292 INT << "Reconfigure to " << _parsedZyppConf << endl;
293 ZConfig::instance()._pimpl.reset( this );
295 if ( PathInfo(_parsedZyppConf).isExist() )
297 parser::IniDict dict( _parsedZyppConf );
298 for ( IniDict::section_const_iterator sit = dict.sectionsBegin();
299 sit != dict.sectionsEnd();
302 string section(*sit);
303 //MIL << section << endl;
304 for ( IniDict::entry_const_iterator it = dict.entriesBegin(*sit);
305 it != dict.entriesEnd(*sit);
308 string entry(it->first);
309 string value(it->second);
310 //DBG << (*it).first << "=" << (*it).second << endl;
311 if ( section == "main" )
313 if ( entry == "arch" )
316 if ( carch != cfg_arch )
318 WAR << "Overriding system architecture (" << cfg_arch << "): " << carch << endl;
322 else if ( entry == "cachedir" )
324 cfg_cache_path = Pathname(value);
326 else if ( entry == "metadatadir" )
328 cfg_metadata_path = Pathname(value);
330 else if ( entry == "solvfilesdir" )
332 cfg_solvfiles_path = Pathname(value);
334 else if ( entry == "packagesdir" )
336 cfg_packages_path = Pathname(value);
338 else if ( entry == "configdir" )
340 cfg_config_path = Pathname(value);
342 else if ( entry == "reposdir" )
344 cfg_known_repos_path = Pathname(value);
346 else if ( entry == "servicesdir" )
348 cfg_known_services_path = Pathname(value);
350 else if ( entry == "repo.add.probe" )
352 repo_add_probe = str::strToBool( value, repo_add_probe );
354 else if ( entry == "repo.refresh.delay" )
356 str::strtonum(value, repo_refresh_delay);
358 else if ( entry == "repo.refresh.locales" )
360 std::vector<std::string> tmp;
361 str::split( value, back_inserter( tmp ), ", \t" );
363 boost::function<Locale(const std::string &)> transform(
364 [](const std::string & str_r)->Locale{ return Locale(str_r); }
366 repoRefreshLocales.insert( make_transform_iterator( tmp.begin(), transform ),
367 make_transform_iterator( tmp.end(), transform ) );
369 else if ( entry == "download.use_deltarpm" )
371 download_use_deltarpm = str::strToBool( value, download_use_deltarpm );
373 else if ( entry == "download.use_deltarpm.always" )
375 download_use_deltarpm_always = str::strToBool( value, download_use_deltarpm_always );
377 else if ( entry == "download.media_preference" )
379 download_media_prefer_download.restoreToDefault( str::compareCI( value, "volatile" ) != 0 );
381 else if ( entry == "download.max_concurrent_connections" )
383 str::strtonum(value, download_max_concurrent_connections);
385 else if ( entry == "download.min_download_speed" )
387 str::strtonum(value, download_min_download_speed);
389 else if ( entry == "download.max_download_speed" )
391 str::strtonum(value, download_max_download_speed);
393 else if ( entry == "download.max_silent_tries" )
395 str::strtonum(value, download_max_silent_tries);
397 else if ( entry == "commit.downloadMode" )
399 commit_downloadMode.set( deserializeDownloadMode( value ) );
401 else if ( entry == "vendordir" )
403 cfg_vendor_path = Pathname(value);
405 else if ( entry == "solver.onlyRequires" )
407 solver_onlyRequires.set( str::strToBool( value, solver_onlyRequires ) );
409 else if ( entry == "solver.allowVendorChange" )
411 solver_allowVendorChange.set( str::strToBool( value, solver_allowVendorChange ) );
413 else if ( entry == "solver.cleandepsOnRemove" )
415 solver_cleandepsOnRemove.set( str::strToBool( value, solver_cleandepsOnRemove ) );
417 else if ( entry == "solver.upgradeTestcasesToKeep" )
419 solver_upgradeTestcasesToKeep.set( str::strtonum<unsigned>( value ) );
421 else if ( entry == "solver.upgradeRemoveDroppedPackages" )
423 solverUpgradeRemoveDroppedPackages.restoreToDefault( str::strToBool( value, solverUpgradeRemoveDroppedPackages.getDefault() ) );
425 else if ( entry == "solver.checkSystemFile" )
427 solver_checkSystemFile = Pathname(value);
429 else if ( entry == "multiversion" )
431 str::split( value, inserter( multiversion, multiversion.end() ), ", \t" );
433 else if ( entry == "locksfile.path" )
435 locks_file = Pathname(value);
437 else if ( entry == "locksfile.apply" )
439 apply_locks_file = str::strToBool( value, apply_locks_file );
441 else if ( entry == "update.datadir" )
443 update_data_path = Pathname(value);
445 else if ( entry == "update.scriptsdir" )
447 update_scripts_path = Pathname(value);
449 else if ( entry == "update.messagessdir" )
451 update_messages_path = Pathname(value);
453 else if ( entry == "update.messages.notify" )
455 updateMessagesNotify.set( value );
457 else if ( entry == "rpm.install.excludedocs" )
459 rpmInstallFlags.setFlag( target::rpm::RPMINST_EXCLUDEDOCS,
460 str::strToBool( value, false ) );
462 else if ( entry == "history.logfile" )
464 history_log_path = Pathname(value);
466 else if ( entry == "credentials.global.dir" )
468 credentials_global_dir_path = Pathname(value);
470 else if ( entry == "credentials.global.file" )
472 credentials_global_file_path = Pathname(value);
480 MIL << _parsedZyppConf << " not found, using defaults instead." << endl;
481 _parsedZyppConf = _parsedZyppConf.extend( " (NOT FOUND)" );
485 if ( getenv( "ZYPP_TESTSUITE_FAKE_ARCH" ) )
487 Arch carch( getenv( "ZYPP_TESTSUITE_FAKE_ARCH" ) );
488 if ( carch != cfg_arch )
490 WAR << "ZYPP_TESTSUITE_FAKE_ARCH: Overriding system architecture (" << cfg_arch << "): " << carch << endl;
494 MIL << "ZConfig singleton created." << endl;
501 /** Remember any parsed zypp.conf. */
502 Pathname _parsedZyppConf;
505 Locale cfg_textLocale;
507 Pathname cfg_cache_path;
508 Pathname cfg_metadata_path;
509 Pathname cfg_solvfiles_path;
510 Pathname cfg_packages_path;
512 Pathname cfg_config_path;
513 Pathname cfg_known_repos_path;
514 Pathname cfg_known_services_path;
516 Pathname cfg_vendor_path;
519 Pathname update_data_path;
520 Pathname update_scripts_path;
521 Pathname update_messages_path;
522 DefaultOption<std::string> updateMessagesNotify;
525 unsigned repo_refresh_delay;
526 LocaleSet repoRefreshLocales;
527 bool repoLabelIsAlias;
529 bool download_use_deltarpm;
530 bool download_use_deltarpm_always;
531 DefaultOption<bool> download_media_prefer_download;
533 int download_max_concurrent_connections;
534 int download_min_download_speed;
535 int download_max_download_speed;
536 int download_max_silent_tries;
538 Option<DownloadMode> commit_downloadMode;
540 Option<bool> solver_onlyRequires;
541 Option<bool> solver_allowVendorChange;
542 Option<bool> solver_cleandepsOnRemove;
543 Option<unsigned> solver_upgradeTestcasesToKeep;
544 DefaultOption<bool> solverUpgradeRemoveDroppedPackages;
546 Pathname solver_checkSystemFile;
548 std::set<std::string> multiversion;
550 bool apply_locks_file;
552 target::rpm::RpmInstFlags rpmInstallFlags;
554 Pathname history_log_path;
555 Pathname credentials_global_dir_path;
556 Pathname credentials_global_file_path;
558 Option<Pathname> pluginsPath;
560 ///////////////////////////////////////////////////////////////////
562 // Backdoor to redirect ZConfig from within the running
563 // TEST-application. HANDLE WITH CARE!
564 void reconfigureZConfig( const Pathname & override_r )
566 // ctor puts itself unter smart pointer control.
567 new ZConfig::Impl( override_r );
570 ///////////////////////////////////////////////////////////////////
572 // METHOD NAME : ZConfig::instance
573 // METHOD TYPE : ZConfig &
575 ZConfig & ZConfig::instance()
577 static ZConfig _instance; // The singleton
581 ///////////////////////////////////////////////////////////////////
583 // METHOD NAME : ZConfig::ZConfig
584 // METHOD TYPE : Ctor
592 ///////////////////////////////////////////////////////////////////
594 // METHOD NAME : ZConfig::~ZConfig
595 // METHOD TYPE : Dtor
600 Pathname ZConfig::systemRoot() const
602 Target_Ptr target( getZYpp()->getTarget() );
603 return target ? target->root() : Pathname();
606 ///////////////////////////////////////////////////////////////////
608 // system architecture
610 ///////////////////////////////////////////////////////////////////
612 Arch ZConfig::defaultSystemArchitecture()
614 static Arch _val( _autodetectSystemArchitecture() );
618 Arch ZConfig::systemArchitecture() const
619 { return _pimpl->cfg_arch; }
621 void ZConfig::setSystemArchitecture( const Arch & arch_r )
623 if ( arch_r != _pimpl->cfg_arch )
625 WAR << "Overriding system architecture (" << _pimpl->cfg_arch << "): " << arch_r << endl;
626 _pimpl->cfg_arch = arch_r;
630 ///////////////////////////////////////////////////////////////////
634 ///////////////////////////////////////////////////////////////////
636 Locale ZConfig::defaultTextLocale()
638 static Locale _val( _autodetectTextLocale() );
642 Locale ZConfig::textLocale() const
643 { return _pimpl->cfg_textLocale; }
645 void ZConfig::setTextLocale( const Locale & locale_r )
647 if ( locale_r != _pimpl->cfg_textLocale )
649 WAR << "Overriding text locale (" << _pimpl->cfg_textLocale << "): " << locale_r << endl;
650 _pimpl->cfg_textLocale = locale_r;
651 #warning prefer signal
652 sat::Pool::instance().setTextLocale( locale_r );
656 ///////////////////////////////////////////////////////////////////
658 Pathname ZConfig::repoCachePath() const
660 return ( _pimpl->cfg_cache_path.empty()
661 ? Pathname("/var/cache/zypp") : _pimpl->cfg_cache_path );
664 Pathname ZConfig::repoMetadataPath() const
666 return ( _pimpl->cfg_metadata_path.empty()
667 ? (repoCachePath()/"raw") : _pimpl->cfg_metadata_path );
670 Pathname ZConfig::repoSolvfilesPath() const
672 return ( _pimpl->cfg_solvfiles_path.empty()
673 ? (repoCachePath()/"solv") : _pimpl->cfg_solvfiles_path );
676 Pathname ZConfig::repoPackagesPath() const
678 return ( _pimpl->cfg_packages_path.empty()
679 ? (repoCachePath()/"packages") : _pimpl->cfg_packages_path );
682 ///////////////////////////////////////////////////////////////////
684 Pathname ZConfig::configPath() const
686 return ( _pimpl->cfg_config_path.empty()
687 ? Pathname("/etc/zypp") : _pimpl->cfg_config_path );
690 Pathname ZConfig::knownReposPath() const
692 return ( _pimpl->cfg_known_repos_path.empty()
693 ? (configPath()/"repos.d") : _pimpl->cfg_known_repos_path );
696 Pathname ZConfig::knownServicesPath() const
698 return ( _pimpl->cfg_known_services_path.empty()
699 ? (configPath()/"services.d") : _pimpl->cfg_known_repos_path );
702 Pathname ZConfig::vendorPath() const
704 return ( _pimpl->cfg_vendor_path.empty()
705 ? (configPath()/"vendors.d") : _pimpl->cfg_vendor_path );
708 Pathname ZConfig::locksFile() const
710 return ( _pimpl->locks_file.empty()
711 ? (configPath()/"locks") : _pimpl->locks_file );
714 ///////////////////////////////////////////////////////////////////
716 bool ZConfig::repo_add_probe() const
717 { return _pimpl->repo_add_probe; }
719 unsigned ZConfig::repo_refresh_delay() const
720 { return _pimpl->repo_refresh_delay; }
722 LocaleSet ZConfig::repoRefreshLocales() const
723 { return _pimpl->repoRefreshLocales.empty() ? Target::requestedLocales("") :_pimpl->repoRefreshLocales; }
725 bool ZConfig::repoLabelIsAlias() const
726 { return _pimpl->repoLabelIsAlias; }
728 void ZConfig::repoLabelIsAlias( bool yesno_r )
729 { _pimpl->repoLabelIsAlias = yesno_r; }
731 bool ZConfig::download_use_deltarpm() const
732 { return _pimpl->download_use_deltarpm; }
734 bool ZConfig::download_use_deltarpm_always() const
735 { return download_use_deltarpm() && _pimpl->download_use_deltarpm_always; }
737 bool ZConfig::download_media_prefer_download() const
738 { return _pimpl->download_media_prefer_download; }
740 void ZConfig::set_download_media_prefer_download( bool yesno_r )
741 { _pimpl->download_media_prefer_download.set( yesno_r ); }
743 void ZConfig::set_default_download_media_prefer_download()
744 { _pimpl->download_media_prefer_download.restoreToDefault(); }
746 long ZConfig::download_max_concurrent_connections() const
747 { return _pimpl->download_max_concurrent_connections; }
749 long ZConfig::download_min_download_speed() const
750 { return _pimpl->download_min_download_speed; }
752 long ZConfig::download_max_download_speed() const
753 { return _pimpl->download_max_download_speed; }
755 long ZConfig::download_max_silent_tries() const
756 { return _pimpl->download_max_silent_tries; }
758 DownloadMode ZConfig::commit_downloadMode() const
759 { return _pimpl->commit_downloadMode; }
761 bool ZConfig::solver_onlyRequires() const
762 { return _pimpl->solver_onlyRequires; }
764 bool ZConfig::solver_allowVendorChange() const
765 { return _pimpl->solver_allowVendorChange; }
767 bool ZConfig::solver_cleandepsOnRemove() const
768 { return _pimpl->solver_cleandepsOnRemove; }
770 Pathname ZConfig::solver_checkSystemFile() const
771 { return ( _pimpl->solver_checkSystemFile.empty()
772 ? (configPath()/"systemCheck") : _pimpl->solver_checkSystemFile ); }
774 unsigned ZConfig::solver_upgradeTestcasesToKeep() const
775 { return _pimpl->solver_upgradeTestcasesToKeep; }
777 bool ZConfig::solverUpgradeRemoveDroppedPackages() const { return _pimpl->solverUpgradeRemoveDroppedPackages; }
778 void ZConfig::setSolverUpgradeRemoveDroppedPackages( bool val_r ) { _pimpl->solverUpgradeRemoveDroppedPackages.set( val_r ); }
779 void ZConfig::resetSolverUpgradeRemoveDroppedPackages() { _pimpl->solverUpgradeRemoveDroppedPackages.restoreToDefault(); }
781 const std::set<std::string> & ZConfig::multiversionSpec() const { return _pimpl->multiversion; }
782 void ZConfig::addMultiversionSpec( const std::string & name_r ) { _pimpl->multiversion.insert( name_r ); }
783 void ZConfig::removeMultiversionSpec( const std::string & name_r ) { _pimpl->multiversion.erase( name_r ); }
785 bool ZConfig::apply_locks_file() const
786 { return _pimpl->apply_locks_file; }
788 Pathname ZConfig::update_dataPath() const
790 return ( _pimpl->update_data_path.empty()
791 ? Pathname("/var/adm") : _pimpl->update_data_path );
794 Pathname ZConfig::update_messagesPath() const
796 return ( _pimpl->update_messages_path.empty()
797 ? Pathname(update_dataPath()/"update-messages") : _pimpl->update_messages_path );
800 Pathname ZConfig::update_scriptsPath() const
802 return ( _pimpl->update_scripts_path.empty()
803 ? Pathname(update_dataPath()/"update-scripts") : _pimpl->update_scripts_path );
806 std::string ZConfig::updateMessagesNotify() const
807 { return _pimpl->updateMessagesNotify; }
809 void ZConfig::setUpdateMessagesNotify( const std::string & val_r )
810 { _pimpl->updateMessagesNotify.set( val_r ); }
812 void ZConfig::resetUpdateMessagesNotify()
813 { _pimpl->updateMessagesNotify.restoreToDefault(); }
815 ///////////////////////////////////////////////////////////////////
817 target::rpm::RpmInstFlags ZConfig::rpmInstallFlags() const
818 { return _pimpl->rpmInstallFlags; }
821 Pathname ZConfig::historyLogFile() const
823 return ( _pimpl->history_log_path.empty() ?
824 Pathname("/var/log/zypp/history") : _pimpl->history_log_path );
828 Pathname ZConfig::credentialsGlobalDir() const
830 return ( _pimpl->credentials_global_dir_path.empty() ?
831 Pathname("/etc/zypp/credentials.d") : _pimpl->credentials_global_dir_path );
834 Pathname ZConfig::credentialsGlobalFile() const
836 return ( _pimpl->credentials_global_file_path.empty() ?
837 Pathname("/etc/zypp/credentials.cat") : _pimpl->credentials_global_file_path );
840 ///////////////////////////////////////////////////////////////////
842 std::string ZConfig::distroverpkg() const
843 { return "redhat-release"; }
845 ///////////////////////////////////////////////////////////////////
847 Pathname ZConfig::pluginsPath() const
848 { return _pimpl->pluginsPath.get(); }
850 ///////////////////////////////////////////////////////////////////
852 std::ostream & ZConfig::about( std::ostream & str ) const
854 str << "libzypp: " << VERSION << " built " << __DATE__ << " " << __TIME__ << endl;
856 str << "libsolv: " << solv_version;
857 if ( ::strcmp( solv_version, LIBSOLV_VERSION_STRING ) )
858 str << " (built against " << LIBSOLV_VERSION_STRING << ")";
861 str << "zypp.conf: '" << _pimpl->_parsedZyppConf << "'" << endl;
862 str << "TextLocale: '" << textLocale() << "' (" << defaultTextLocale() << ")" << endl;
863 str << "SystemArchitecture: '" << systemArchitecture() << "' (" << defaultSystemArchitecture() << ")" << endl;
867 /////////////////////////////////////////////////////////////////
869 ///////////////////////////////////////////////////////////////////