00001
00002
00003
00004
00005
00006
00007
00008
00012 extern "C"
00013 {
00014 #include <sys/utsname.h>
00015 #include <unistd.h>
00016 #include <satsolver/satversion.h>
00017 }
00018 #include <iostream>
00019 #include <fstream>
00020 #include "zypp/base/Logger.h"
00021 #include "zypp/base/IOStream.h"
00022 #include "zypp/base/InputStream.h"
00023 #include "zypp/base/String.h"
00024
00025 #include "zypp/ZConfig.h"
00026 #include "zypp/ZYppFactory.h"
00027 #include "zypp/PathInfo.h"
00028 #include "zypp/parser/IniDict.h"
00029
00030 #include "zypp/sat/Pool.h"
00031
00032 using namespace std;
00033 using namespace zypp::filesystem;
00034 using namespace zypp::parser;
00035
00036 #undef ZYPP_BASE_LOGGER_LOGGROUP
00037 #define ZYPP_BASE_LOGGER_LOGGROUP "zconfig"
00038
00040 namespace zypp
00041 {
00042
00044 namespace
00045 {
00046
00049 Arch _autodetectSystemArchitecture()
00050 {
00051 struct ::utsname buf;
00052 if ( ::uname( &buf ) < 0 )
00053 {
00054 ERR << "Can't determine system architecture" << endl;
00055 return Arch_noarch;
00056 }
00057
00058 Arch architecture( buf.machine );
00059 MIL << "Uname architecture is '" << buf.machine << "'" << endl;
00060
00061
00062
00063
00064 if ( architecture == Arch_i686 )
00065 {
00066 std::ifstream cpuinfo( "/proc/cpuinfo" );
00067 if ( cpuinfo )
00068 {
00069 for( iostr::EachLine in( cpuinfo ); in; in.next() )
00070 {
00071 if ( str::hasPrefix( *in, "flags" ) )
00072 {
00073 if ( in->find( "cx8" ) == std::string::npos
00074 || in->find( "cmov" ) == std::string::npos )
00075 {
00076 architecture = Arch_i586;
00077 WAR << "CPU lacks 'cx8' or 'cmov': architecture downgraded to '" << architecture << "'" << endl;
00078 }
00079 break;
00080 }
00081 }
00082 }
00083 else
00084 {
00085 ERR << "Cant open " << PathInfo("/proc/cpuinfo") << endl;
00086 }
00087 }
00088 return architecture;
00089 }
00090
00108 Locale _autodetectTextLocale()
00109 {
00110 Locale ret( "en" );
00111 const char * envlist[] = { "LC_ALL", "LC_MESSAGES", "LANG", NULL };
00112 for ( const char ** envvar = envlist; *envvar; ++envvar )
00113 {
00114 const char * envlang = getenv( *envvar );
00115 if ( envlang )
00116 {
00117 std::string envstr( envlang );
00118 if ( envstr != "POSIX" && envstr != "C" )
00119 {
00120 Locale lang( envstr );
00121 if ( ! lang.code().empty() )
00122 {
00123 MIL << "Found " << *envvar << "=" << envstr << endl;
00124 ret = lang;
00125 break;
00126 }
00127 }
00128 }
00129 }
00130 MIL << "Default text locale is '" << ret << "'" << endl;
00131 #warning HACK AROUND BOOST_TEST_CATCH_SYSTEM_ERRORS
00132 setenv( "BOOST_TEST_CATCH_SYSTEM_ERRORS", "no", 1 );
00133 return ret;
00134 }
00135
00137 }
00139
00141 template<class _Tp>
00142 struct Option
00143 {
00144 typedef _Tp value_type;
00145
00147 Option( const value_type & initial_r )
00148 : _val( initial_r )
00149 {}
00150
00152 const value_type & get() const
00153 { return _val; }
00154
00156 operator const value_type &() const
00157 { return _val; }
00158
00160 void set( const value_type & newval_r )
00161 { _val = newval_r; }
00162
00164 value_type & ref()
00165 { return _val; }
00166
00167 private:
00168 value_type _val;
00169 };
00170
00172 template<class _Tp>
00173 struct DefaultOption : public Option<_Tp>
00174 {
00175 typedef _Tp value_type;
00176 typedef Option<_Tp> option_type;
00177
00178 DefaultOption( const value_type & initial_r )
00179 : Option<_Tp>( initial_r ), _default( initial_r )
00180 {}
00181
00183 void restoreToDefault()
00184 { this->set( _default.get() ); }
00185
00187 void restoreToDefault( const value_type & newval_r )
00188 { setDefault( newval_r ); restoreToDefault(); }
00189
00191 const value_type & getDefault() const
00192 { return _default.get(); }
00193
00195 void setDefault( const value_type & newval_r )
00196 { _default.set( newval_r ); }
00197
00198 private:
00199 option_type _default;
00200 };
00201
00203
00204
00205
00211 class ZConfig::Impl
00212 {
00213 public:
00214 Impl( const Pathname & override_r = Pathname() )
00215 : _parsedZyppConf ( override_r )
00216 , cfg_arch ( defaultSystemArchitecture() )
00217 , cfg_textLocale ( defaultTextLocale() )
00218 , updateMessagesNotify ( "single | /usr/lib/zypp/notify-message -p %p" )
00219 , repo_add_probe ( false )
00220 , repo_refresh_delay ( 10 )
00221 , repoLabelIsAlias ( false )
00222 , download_use_deltarpm ( true )
00223 , download_use_deltarpm_always ( false )
00224 , download_media_prefer_download( true )
00225 , download_max_concurrent_connections( 2 )
00226 , download_min_download_speed ( 0 )
00227 , download_max_download_speed ( 0 )
00228 , download_max_silent_tries ( 5 )
00229 , download_transfer_timeout ( 180 )
00230 , commit_downloadMode ( DownloadDefault )
00231 , solver_onlyRequires ( false )
00232 , solver_allowVendorChange ( false )
00233 , solver_upgradeTestcasesToKeep ( 2 )
00234 , solverUpgradeRemoveDroppedPackages( true )
00235 , apply_locks_file ( true )
00236 , pluginsPath ( "/usr/lib/zypp/plugins" )
00237 {
00238 MIL << "libzypp: " << VERSION << " built " << __DATE__ << " " << __TIME__ << endl;
00239
00240
00241 if ( _parsedZyppConf.empty() )
00242 {
00243 const char *env_confpath = getenv( "ZYPP_CONF" );
00244 _parsedZyppConf = env_confpath ? env_confpath : "/etc/zypp/zypp.conf";
00245 }
00246 else
00247 {
00248
00249
00250 INT << "Reconfigure to " << _parsedZyppConf << endl;
00251 ZConfig::instance()._pimpl.reset( this );
00252 }
00253 if ( PathInfo(_parsedZyppConf).isExist() )
00254 {
00255 parser::IniDict dict( _parsedZyppConf );
00256 for ( IniDict::section_const_iterator sit = dict.sectionsBegin();
00257 sit != dict.sectionsEnd();
00258 ++sit )
00259 {
00260 string section(*sit);
00261
00262 for ( IniDict::entry_const_iterator it = dict.entriesBegin(*sit);
00263 it != dict.entriesEnd(*sit);
00264 ++it )
00265 {
00266 string entry(it->first);
00267 string value(it->second);
00268
00269 if ( section == "main" )
00270 {
00271 if ( entry == "arch" )
00272 {
00273 Arch carch( value );
00274 if ( carch != cfg_arch )
00275 {
00276 WAR << "Overriding system architecture (" << cfg_arch << "): " << carch << endl;
00277 cfg_arch = carch;
00278 }
00279 }
00280 else if ( entry == "cachedir" )
00281 {
00282 cfg_cache_path = Pathname(value);
00283 }
00284 else if ( entry == "metadatadir" )
00285 {
00286 cfg_metadata_path = Pathname(value);
00287 }
00288 else if ( entry == "solvfilesdir" )
00289 {
00290 cfg_solvfiles_path = Pathname(value);
00291 }
00292 else if ( entry == "packagesdir" )
00293 {
00294 cfg_packages_path = Pathname(value);
00295 }
00296 else if ( entry == "configdir" )
00297 {
00298 cfg_config_path = Pathname(value);
00299 }
00300 else if ( entry == "reposdir" )
00301 {
00302 cfg_known_repos_path = Pathname(value);
00303 }
00304 else if ( entry == "servicesdir" )
00305 {
00306 cfg_known_services_path = Pathname(value);
00307 }
00308 else if ( entry == "repo.add.probe" )
00309 {
00310 repo_add_probe = str::strToBool( value, repo_add_probe );
00311 }
00312 else if ( entry == "repo.refresh.delay" )
00313 {
00314 str::strtonum(value, repo_refresh_delay);
00315 }
00316 else if ( entry == "download.use_deltarpm" )
00317 {
00318 download_use_deltarpm = str::strToBool( value, download_use_deltarpm );
00319 }
00320 else if ( entry == "download.use_deltarpm.always" )
00321 {
00322 download_use_deltarpm_always = str::strToBool( value, download_use_deltarpm_always );
00323 }
00324 else if ( entry == "download.media_preference" )
00325 {
00326 download_media_prefer_download.restoreToDefault( str::compareCI( value, "volatile" ) != 0 );
00327 }
00328 else if ( entry == "download.max_concurrent_connections" )
00329 {
00330 str::strtonum(value, download_max_concurrent_connections);
00331 }
00332 else if ( entry == "download.min_download_speed" )
00333 {
00334 str::strtonum(value, download_min_download_speed);
00335 }
00336 else if ( entry == "download.max_download_speed" )
00337 {
00338 str::strtonum(value, download_max_download_speed);
00339 }
00340 else if ( entry == "download.max_silent_tries" )
00341 {
00342 str::strtonum(value, download_max_silent_tries);
00343 }
00344 else if ( entry == "download.transfer_timeout" )
00345 {
00346 str::strtonum(value, download_transfer_timeout);
00347 if ( download_transfer_timeout < 0 ) download_transfer_timeout = 0;
00348 else if ( download_transfer_timeout > 3600 ) download_transfer_timeout = 3600;
00349 }
00350 else if ( entry == "commit.downloadMode" )
00351 {
00352 commit_downloadMode.set( deserializeDownloadMode( value ) );
00353 }
00354 else if ( entry == "vendordir" )
00355 {
00356 cfg_vendor_path = Pathname(value);
00357 }
00358 else if ( entry == "solver.onlyRequires" )
00359 {
00360 solver_onlyRequires.set( str::strToBool( value, solver_onlyRequires ) );
00361 }
00362 else if ( entry == "solver.allowVendorChange" )
00363 {
00364 solver_allowVendorChange.set( str::strToBool( value, solver_allowVendorChange ) );
00365 }
00366 else if ( entry == "solver.upgradeTestcasesToKeep" )
00367 {
00368 solver_upgradeTestcasesToKeep.set( str::strtonum<unsigned>( value ) );
00369 }
00370 else if ( entry == "solver.upgradeRemoveDroppedPackages" )
00371 {
00372 solverUpgradeRemoveDroppedPackages.restoreToDefault( str::strToBool( value, solverUpgradeRemoveDroppedPackages.getDefault() ) );
00373 }
00374 else if ( entry == "solver.checkSystemFile" )
00375 {
00376 solver_checkSystemFile = Pathname(value);
00377 }
00378 else if ( entry == "multiversion" )
00379 {
00380 str::split( value, inserter( multiversion, multiversion.end() ), ", \t" );
00381 }
00382 else if ( entry == "locksfile.path" )
00383 {
00384 locks_file = Pathname(value);
00385 }
00386 else if ( entry == "locksfile.apply" )
00387 {
00388 apply_locks_file = str::strToBool( value, apply_locks_file );
00389 }
00390 else if ( entry == "update.datadir" )
00391 {
00392 update_data_path = Pathname(value);
00393 }
00394 else if ( entry == "update.scriptsdir" )
00395 {
00396 update_scripts_path = Pathname(value);
00397 }
00398 else if ( entry == "update.messagessdir" )
00399 {
00400 update_messages_path = Pathname(value);
00401 }
00402 else if ( entry == "update.messages.notify" )
00403 {
00404 updateMessagesNotify.set( value );
00405 }
00406 else if ( entry == "rpm.install.excludedocs" )
00407 {
00408 rpmInstallFlags.setFlag( target::rpm::RPMINST_EXCLUDEDOCS,
00409 str::strToBool( value, false ) );
00410 }
00411 else if ( entry == "history.logfile" )
00412 {
00413 history_log_path = Pathname(value);
00414 }
00415 else if ( entry == "credentials.global.dir" )
00416 {
00417 credentials_global_dir_path = Pathname(value);
00418 }
00419 else if ( entry == "credentials.global.file" )
00420 {
00421 credentials_global_file_path = Pathname(value);
00422 }
00423 }
00424 }
00425 }
00426 }
00427 else
00428 {
00429 MIL << _parsedZyppConf << " not found, using defaults instead." << endl;
00430 _parsedZyppConf = _parsedZyppConf.extend( " (NOT FOUND)" );
00431 }
00432
00433
00434 if ( getenv( "ZYPP_TESTSUITE_FAKE_ARCH" ) )
00435 {
00436 Arch carch( getenv( "ZYPP_TESTSUITE_FAKE_ARCH" ) );
00437 if ( carch != cfg_arch )
00438 {
00439 WAR << "ZYPP_TESTSUITE_FAKE_ARCH: Overriding system architecture (" << cfg_arch << "): " << carch << endl;
00440 cfg_arch = carch;
00441 }
00442 }
00443 MIL << "ZConfig singleton created." << endl;
00444 }
00445
00446 ~Impl()
00447 {}
00448
00449 public:
00451 Pathname _parsedZyppConf;
00452
00453 Arch cfg_arch;
00454 Locale cfg_textLocale;
00455
00456 Pathname cfg_cache_path;
00457 Pathname cfg_metadata_path;
00458 Pathname cfg_solvfiles_path;
00459 Pathname cfg_packages_path;
00460
00461 Pathname cfg_config_path;
00462 Pathname cfg_known_repos_path;
00463 Pathname cfg_known_services_path;
00464 Pathname cfg_vendor_path;
00465 Pathname locks_file;
00466
00467 Pathname update_data_path;
00468 Pathname update_scripts_path;
00469 Pathname update_messages_path;
00470 DefaultOption<std::string> updateMessagesNotify;
00471
00472 bool repo_add_probe;
00473 unsigned repo_refresh_delay;
00474 bool repoLabelIsAlias;
00475
00476 bool download_use_deltarpm;
00477 bool download_use_deltarpm_always;
00478 DefaultOption<bool> download_media_prefer_download;
00479
00480 int download_max_concurrent_connections;
00481 int download_min_download_speed;
00482 int download_max_download_speed;
00483 int download_max_silent_tries;
00484 int download_transfer_timeout;
00485
00486 Option<DownloadMode> commit_downloadMode;
00487
00488 Option<bool> solver_onlyRequires;
00489 Option<bool> solver_allowVendorChange;
00490 Option<unsigned> solver_upgradeTestcasesToKeep;
00491 DefaultOption<bool> solverUpgradeRemoveDroppedPackages;
00492
00493 Pathname solver_checkSystemFile;
00494
00495 std::set<std::string> multiversion;
00496
00497 bool apply_locks_file;
00498
00499 target::rpm::RpmInstFlags rpmInstallFlags;
00500
00501 Pathname history_log_path;
00502 Pathname credentials_global_dir_path;
00503 Pathname credentials_global_file_path;
00504
00505 Option<Pathname> pluginsPath;
00506 };
00508
00509
00510
00511 void reconfigureZConfig( const Pathname & override_r )
00512 {
00513
00514 new ZConfig::Impl( override_r );
00515 }
00516
00518
00519
00520
00521
00522 ZConfig & ZConfig::instance()
00523 {
00524 static ZConfig _instance;
00525 return _instance;
00526 }
00527
00529
00530
00531
00532
00533 ZConfig::ZConfig()
00534 : _pimpl( new Impl )
00535 {
00536 about( MIL );
00537 }
00538
00540
00541
00542
00543
00544 ZConfig::~ZConfig( )
00545 {}
00546
00547 Pathname ZConfig::systemRoot() const
00548 {
00549 Target_Ptr target( getZYpp()->getTarget() );
00550 return target ? target->root() : Pathname();
00551 }
00552
00554
00555
00556
00558
00559 Arch ZConfig::defaultSystemArchitecture()
00560 {
00561 static Arch _val( _autodetectSystemArchitecture() );
00562 return _val;
00563 }
00564
00565 Arch ZConfig::systemArchitecture() const
00566 { return _pimpl->cfg_arch; }
00567
00568 void ZConfig::setSystemArchitecture( const Arch & arch_r )
00569 {
00570 if ( arch_r != _pimpl->cfg_arch )
00571 {
00572 WAR << "Overriding system architecture (" << _pimpl->cfg_arch << "): " << arch_r << endl;
00573 _pimpl->cfg_arch = arch_r;
00574 }
00575 }
00576
00578
00579
00580
00582
00583 Locale ZConfig::defaultTextLocale()
00584 {
00585 static Locale _val( _autodetectTextLocale() );
00586 return _val;
00587 }
00588
00589 Locale ZConfig::textLocale() const
00590 { return _pimpl->cfg_textLocale; }
00591
00592 void ZConfig::setTextLocale( const Locale & locale_r )
00593 {
00594 if ( locale_r != _pimpl->cfg_textLocale )
00595 {
00596 WAR << "Overriding text locale (" << _pimpl->cfg_textLocale << "): " << locale_r << endl;
00597 _pimpl->cfg_textLocale = locale_r;
00598 #warning prefer signal
00599 sat::Pool::instance().setTextLocale( locale_r );
00600 }
00601 }
00602
00604
00605 Pathname ZConfig::repoCachePath() const
00606 {
00607 return ( _pimpl->cfg_cache_path.empty()
00608 ? Pathname("/var/cache/zypp") : _pimpl->cfg_cache_path );
00609 }
00610
00611 Pathname ZConfig::repoMetadataPath() const
00612 {
00613 return ( _pimpl->cfg_metadata_path.empty()
00614 ? (repoCachePath()/"raw") : _pimpl->cfg_metadata_path );
00615 }
00616
00617 Pathname ZConfig::repoSolvfilesPath() const
00618 {
00619 return ( _pimpl->cfg_solvfiles_path.empty()
00620 ? (repoCachePath()/"solv") : _pimpl->cfg_solvfiles_path );
00621 }
00622
00623 Pathname ZConfig::repoPackagesPath() const
00624 {
00625 return ( _pimpl->cfg_packages_path.empty()
00626 ? (repoCachePath()/"packages") : _pimpl->cfg_packages_path );
00627 }
00628
00630
00631 Pathname ZConfig::configPath() const
00632 {
00633 return ( _pimpl->cfg_config_path.empty()
00634 ? Pathname("/etc/zypp") : _pimpl->cfg_config_path );
00635 }
00636
00637 Pathname ZConfig::knownReposPath() const
00638 {
00639 return ( _pimpl->cfg_known_repos_path.empty()
00640 ? (configPath()/"repos.d") : _pimpl->cfg_known_repos_path );
00641 }
00642
00643 Pathname ZConfig::knownServicesPath() const
00644 {
00645 return ( _pimpl->cfg_known_services_path.empty()
00646 ? (configPath()/"services.d") : _pimpl->cfg_known_repos_path );
00647 }
00648
00649 Pathname ZConfig::vendorPath() const
00650 {
00651 return ( _pimpl->cfg_vendor_path.empty()
00652 ? (configPath()/"vendors.d") : _pimpl->cfg_vendor_path );
00653 }
00654
00655 Pathname ZConfig::locksFile() const
00656 {
00657 return ( _pimpl->locks_file.empty()
00658 ? (configPath()/"locks") : _pimpl->locks_file );
00659 }
00660
00662
00663 bool ZConfig::repo_add_probe() const
00664 {
00665 return _pimpl->repo_add_probe;
00666 }
00667
00668 unsigned ZConfig::repo_refresh_delay() const
00669 {
00670 return _pimpl->repo_refresh_delay;
00671 }
00672
00673 bool ZConfig::repoLabelIsAlias() const
00674 { return _pimpl->repoLabelIsAlias; }
00675
00676 void ZConfig::repoLabelIsAlias( bool yesno_r )
00677 { _pimpl->repoLabelIsAlias = yesno_r; }
00678
00679 bool ZConfig::download_use_deltarpm() const
00680 { return _pimpl->download_use_deltarpm; }
00681
00682 bool ZConfig::download_use_deltarpm_always() const
00683 { return download_use_deltarpm() && _pimpl->download_use_deltarpm_always; }
00684
00685 bool ZConfig::download_media_prefer_download() const
00686 { return _pimpl->download_media_prefer_download; }
00687
00688 void ZConfig::set_download_media_prefer_download( bool yesno_r )
00689 { _pimpl->download_media_prefer_download.set( yesno_r ); }
00690
00691 void ZConfig::set_default_download_media_prefer_download()
00692 { _pimpl->download_media_prefer_download.restoreToDefault(); }
00693
00694 long ZConfig::download_max_concurrent_connections() const
00695 { return _pimpl->download_max_concurrent_connections; }
00696
00697 long ZConfig::download_min_download_speed() const
00698 { return _pimpl->download_min_download_speed; }
00699
00700 long ZConfig::download_max_download_speed() const
00701 { return _pimpl->download_max_download_speed; }
00702
00703 long ZConfig::download_max_silent_tries() const
00704 { return _pimpl->download_max_silent_tries; }
00705
00706 long ZConfig::download_transfer_timeout() const
00707 { return _pimpl->download_transfer_timeout; }
00708
00709 DownloadMode ZConfig::commit_downloadMode() const
00710 { return _pimpl->commit_downloadMode; }
00711
00712 bool ZConfig::solver_onlyRequires() const
00713 { return _pimpl->solver_onlyRequires; }
00714
00715 bool ZConfig::solver_allowVendorChange() const
00716 { return _pimpl->solver_allowVendorChange; }
00717
00718 Pathname ZConfig::solver_checkSystemFile() const
00719 { return ( _pimpl->solver_checkSystemFile.empty()
00720 ? (configPath()/"systemCheck") : _pimpl->solver_checkSystemFile ); }
00721
00722 unsigned ZConfig::solver_upgradeTestcasesToKeep() const
00723 { return _pimpl->solver_upgradeTestcasesToKeep; }
00724
00725 bool ZConfig::solverUpgradeRemoveDroppedPackages() const { return _pimpl->solverUpgradeRemoveDroppedPackages; }
00726 void ZConfig::setSolverUpgradeRemoveDroppedPackages( bool val_r ) { _pimpl->solverUpgradeRemoveDroppedPackages.set( val_r ); }
00727 void ZConfig::resetSolverUpgradeRemoveDroppedPackages() { _pimpl->solverUpgradeRemoveDroppedPackages.restoreToDefault(); }
00728
00729 const std::set<std::string> & ZConfig::multiversionSpec() const { return _pimpl->multiversion; }
00730 void ZConfig::addMultiversionSpec( const std::string & name_r ) { _pimpl->multiversion.insert( name_r ); }
00731 void ZConfig::removeMultiversionSpec( const std::string & name_r ) { _pimpl->multiversion.erase( name_r ); }
00732
00733 bool ZConfig::apply_locks_file() const
00734 { return _pimpl->apply_locks_file; }
00735
00736 Pathname ZConfig::update_dataPath() const
00737 {
00738 return ( _pimpl->update_data_path.empty()
00739 ? Pathname("/var/adm") : _pimpl->update_data_path );
00740 }
00741
00742 Pathname ZConfig::update_messagesPath() const
00743 {
00744 return ( _pimpl->update_messages_path.empty()
00745 ? Pathname(update_dataPath()/"update-messages") : _pimpl->update_messages_path );
00746 }
00747
00748 Pathname ZConfig::update_scriptsPath() const
00749 {
00750 return ( _pimpl->update_scripts_path.empty()
00751 ? Pathname(update_dataPath()/"update-scripts") : _pimpl->update_scripts_path );
00752 }
00753
00754 std::string ZConfig::updateMessagesNotify() const
00755 { return _pimpl->updateMessagesNotify; }
00756
00757 void ZConfig::setUpdateMessagesNotify( const std::string & val_r )
00758 { _pimpl->updateMessagesNotify.set( val_r ); }
00759
00760 void ZConfig::resetUpdateMessagesNotify()
00761 { _pimpl->updateMessagesNotify.restoreToDefault(); }
00762
00764
00765 target::rpm::RpmInstFlags ZConfig::rpmInstallFlags() const
00766 { return _pimpl->rpmInstallFlags; }
00767
00768
00769 Pathname ZConfig::historyLogFile() const
00770 {
00771 return ( _pimpl->history_log_path.empty() ?
00772 Pathname("/var/log/zypp/history") : _pimpl->history_log_path );
00773 }
00774
00775
00776 Pathname ZConfig::credentialsGlobalDir() const
00777 {
00778 return ( _pimpl->credentials_global_dir_path.empty() ?
00779 Pathname("/etc/zypp/credentials.d") : _pimpl->credentials_global_dir_path );
00780 }
00781
00782 Pathname ZConfig::credentialsGlobalFile() const
00783 {
00784 return ( _pimpl->credentials_global_file_path.empty() ?
00785 Pathname("/etc/zypp/credentials.cat") : _pimpl->credentials_global_file_path );
00786 }
00787
00789
00790 std::string ZConfig::distroverpkg() const
00791 { return "redhat-release"; }
00792
00794
00795 Pathname ZConfig::pluginsPath() const
00796 { return _pimpl->pluginsPath.get(); }
00797
00799
00800 std::ostream & ZConfig::about( std::ostream & str ) const
00801 {
00802 str << "libzypp: " << VERSION << " built " << __DATE__ << " " << __TIME__ << endl;
00803
00804 str << "satsolver: " << sat_version;
00805 if ( ::strcmp( sat_version, SATSOLVER_VERSION_STRING ) )
00806 str << " (built against " << SATSOLVER_VERSION_STRING << ")";
00807 str << endl;
00808
00809 str << "zypp.conf: '" << _pimpl->_parsedZyppConf << "'" << endl;
00810 str << "TextLocale: '" << textLocale() << "' (" << defaultTextLocale() << ")" << endl;
00811 str << "SystemArchitecture: '" << systemArchitecture() << "' (" << defaultSystemArchitecture() << ")" << endl;
00812 return str;
00813 }
00814
00816 }