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 if ( architecture == Arch_i686 )
00062 {
00063
00064
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 else if ( architecture == Arch_sparc || architecture == Arch_sparc64 )
00089 {
00090
00091 std::ifstream cpuinfo( "/proc/cpuinfo" );
00092 if ( cpuinfo )
00093 {
00094 for( iostr::EachLine in( cpuinfo ); in; in.next() )
00095 {
00096 if ( str::hasPrefix( *in, "type" ) )
00097 {
00098 if ( in->find( "sun4v" ) != std::string::npos )
00099 {
00100 architecture = ( architecture == Arch_sparc64 ? Arch_sparc64v : Arch_sparcv9v );
00101 WAR << "CPU has 'sun4v': architecture upgraded to '" << architecture << "'" << endl;
00102 }
00103 else if ( in->find( "sun4u" ) != std::string::npos )
00104 {
00105 architecture = ( architecture == Arch_sparc64 ? Arch_sparc64 : Arch_sparcv9 );
00106 WAR << "CPU has 'sun4u': architecture upgraded to '" << architecture << "'" << endl;
00107 }
00108 else if ( in->find( "sun4m" ) != std::string::npos )
00109 {
00110 architecture = Arch_sparcv8;
00111 WAR << "CPU has 'sun4m': architecture upgraded to '" << architecture << "'" << endl;
00112 }
00113 break;
00114 }
00115 }
00116 }
00117 else
00118 {
00119 ERR << "Cant open " << PathInfo("/proc/cpuinfo") << endl;
00120 }
00121 }
00122 return architecture;
00123 }
00124
00142 Locale _autodetectTextLocale()
00143 {
00144 Locale ret( "en" );
00145 const char * envlist[] = { "LC_ALL", "LC_MESSAGES", "LANG", NULL };
00146 for ( const char ** envvar = envlist; *envvar; ++envvar )
00147 {
00148 const char * envlang = getenv( *envvar );
00149 if ( envlang )
00150 {
00151 std::string envstr( envlang );
00152 if ( envstr != "POSIX" && envstr != "C" )
00153 {
00154 Locale lang( envstr );
00155 if ( ! lang.code().empty() )
00156 {
00157 MIL << "Found " << *envvar << "=" << envstr << endl;
00158 ret = lang;
00159 break;
00160 }
00161 }
00162 }
00163 }
00164 MIL << "Default text locale is '" << ret << "'" << endl;
00165 #warning HACK AROUND BOOST_TEST_CATCH_SYSTEM_ERRORS
00166 setenv( "BOOST_TEST_CATCH_SYSTEM_ERRORS", "no", 1 );
00167 return ret;
00168 }
00169
00171 }
00173
00175 template<class _Tp>
00176 struct Option
00177 {
00178 typedef _Tp value_type;
00179
00181 Option( const value_type & initial_r )
00182 : _val( initial_r )
00183 {}
00184
00186 const value_type & get() const
00187 { return _val; }
00188
00190 operator const value_type &() const
00191 { return _val; }
00192
00194 void set( const value_type & newval_r )
00195 { _val = newval_r; }
00196
00198 value_type & ref()
00199 { return _val; }
00200
00201 private:
00202 value_type _val;
00203 };
00204
00206 template<class _Tp>
00207 struct DefaultOption : public Option<_Tp>
00208 {
00209 typedef _Tp value_type;
00210 typedef Option<_Tp> option_type;
00211
00212 DefaultOption( const value_type & initial_r )
00213 : Option<_Tp>( initial_r ), _default( initial_r )
00214 {}
00215
00217 void restoreToDefault()
00218 { this->set( _default.get() ); }
00219
00221 void restoreToDefault( const value_type & newval_r )
00222 { setDefault( newval_r ); restoreToDefault(); }
00223
00225 const value_type & getDefault() const
00226 { return _default.get(); }
00227
00229 void setDefault( const value_type & newval_r )
00230 { _default.set( newval_r ); }
00231
00232 private:
00233 option_type _default;
00234 };
00235
00237
00238
00239
00245 class ZConfig::Impl
00246 {
00247 public:
00248 Impl( const Pathname & override_r = Pathname() )
00249 : _parsedZyppConf ( override_r )
00250 , cfg_arch ( defaultSystemArchitecture() )
00251 , cfg_textLocale ( defaultTextLocale() )
00252 , updateMessagesNotify ( "single | /usr/lib/zypp/notify-message -p %p" )
00253 , repo_add_probe ( false )
00254 , repo_refresh_delay ( 10 )
00255 , repoLabelIsAlias ( false )
00256 , download_use_deltarpm ( true )
00257 , download_use_deltarpm_always ( false )
00258 , download_media_prefer_download( true )
00259 , download_max_concurrent_connections( 2 )
00260 , download_min_download_speed ( 0 )
00261 , download_max_download_speed ( 0 )
00262 , download_max_silent_tries ( 5 )
00263 , commit_downloadMode ( DownloadDefault )
00264 , solver_onlyRequires ( false )
00265 , solver_allowVendorChange ( false )
00266 , solver_cleandepsOnRemove ( false )
00267 , solver_upgradeTestcasesToKeep ( 2 )
00268 , solverUpgradeRemoveDroppedPackages( true )
00269 , apply_locks_file ( true )
00270
00271 {
00272 MIL << "libzypp: " << VERSION << " built " << __DATE__ << " " << __TIME__ << endl;
00273
00274
00275 if ( _parsedZyppConf.empty() )
00276 {
00277 const char *env_confpath = getenv( "ZYPP_CONF" );
00278 _parsedZyppConf = env_confpath ? env_confpath : "/etc/zypp/zypp.conf";
00279 }
00280 else
00281 {
00282
00283
00284 INT << "Reconfigure to " << _parsedZyppConf << endl;
00285 ZConfig::instance()._pimpl.reset( this );
00286 }
00287 if ( PathInfo(_parsedZyppConf).isExist() )
00288 {
00289 parser::IniDict dict( _parsedZyppConf );
00290 for ( IniDict::section_const_iterator sit = dict.sectionsBegin();
00291 sit != dict.sectionsEnd();
00292 ++sit )
00293 {
00294 string section(*sit);
00295
00296 for ( IniDict::entry_const_iterator it = dict.entriesBegin(*sit);
00297 it != dict.entriesEnd(*sit);
00298 ++it )
00299 {
00300 string entry(it->first);
00301 string value(it->second);
00302
00303 if ( section == "main" )
00304 {
00305 if ( entry == "arch" )
00306 {
00307 Arch carch( value );
00308 if ( carch != cfg_arch )
00309 {
00310 WAR << "Overriding system architecture (" << cfg_arch << "): " << carch << endl;
00311 cfg_arch = carch;
00312 }
00313 }
00314 else if ( entry == "cachedir" )
00315 {
00316 cfg_cache_path = Pathname(value);
00317 }
00318 else if ( entry == "metadatadir" )
00319 {
00320 cfg_metadata_path = Pathname(value);
00321 }
00322 else if ( entry == "solvfilesdir" )
00323 {
00324 cfg_solvfiles_path = Pathname(value);
00325 }
00326 else if ( entry == "packagesdir" )
00327 {
00328 cfg_packages_path = Pathname(value);
00329 }
00330 else if ( entry == "configdir" )
00331 {
00332 cfg_config_path = Pathname(value);
00333 }
00334 else if ( entry == "reposdir" )
00335 {
00336 cfg_known_repos_path = Pathname(value);
00337 }
00338 else if ( entry == "servicesdir" )
00339 {
00340 cfg_known_services_path = Pathname(value);
00341 }
00342 else if ( entry == "repo.add.probe" )
00343 {
00344 repo_add_probe = str::strToBool( value, repo_add_probe );
00345 }
00346 else if ( entry == "repo.refresh.delay" )
00347 {
00348 str::strtonum(value, repo_refresh_delay);
00349 }
00350 else if ( entry == "download.use_deltarpm" )
00351 {
00352 download_use_deltarpm = str::strToBool( value, download_use_deltarpm );
00353 }
00354 else if ( entry == "download.use_deltarpm.always" )
00355 {
00356 download_use_deltarpm_always = str::strToBool( value, download_use_deltarpm_always );
00357 }
00358 else if ( entry == "download.media_preference" )
00359 {
00360 download_media_prefer_download.restoreToDefault( str::compareCI( value, "volatile" ) != 0 );
00361 }
00362 else if ( entry == "download.max_concurrent_connections" )
00363 {
00364 str::strtonum(value, download_max_concurrent_connections);
00365 }
00366 else if ( entry == "download.min_download_speed" )
00367 {
00368 str::strtonum(value, download_min_download_speed);
00369 }
00370 else if ( entry == "download.max_download_speed" )
00371 {
00372 str::strtonum(value, download_max_download_speed);
00373 }
00374 else if ( entry == "download.max_silent_tries" )
00375 {
00376 str::strtonum(value, download_max_silent_tries);
00377 }
00378 else if ( entry == "commit.downloadMode" )
00379 {
00380 commit_downloadMode.set( deserializeDownloadMode( value ) );
00381 }
00382 else if ( entry == "vendordir" )
00383 {
00384 cfg_vendor_path = Pathname(value);
00385 }
00386 else if ( entry == "solver.onlyRequires" )
00387 {
00388 solver_onlyRequires.set( str::strToBool( value, solver_onlyRequires ) );
00389 }
00390 else if ( entry == "solver.allowVendorChange" )
00391 {
00392 solver_allowVendorChange.set( str::strToBool( value, solver_allowVendorChange ) );
00393 }
00394 else if ( entry == "solver.cleandepsOnRemove" )
00395 {
00396 solver_cleandepsOnRemove.set( str::strToBool( value, solver_cleandepsOnRemove ) );
00397 }
00398 else if ( entry == "solver.upgradeTestcasesToKeep" )
00399 {
00400 solver_upgradeTestcasesToKeep.set( str::strtonum<unsigned>( value ) );
00401 }
00402 else if ( entry == "solver.upgradeRemoveDroppedPackages" )
00403 {
00404 solverUpgradeRemoveDroppedPackages.restoreToDefault( str::strToBool( value, solverUpgradeRemoveDroppedPackages.getDefault() ) );
00405 }
00406 else if ( entry == "solver.checkSystemFile" )
00407 {
00408 solver_checkSystemFile = Pathname(value);
00409 }
00410 else if ( entry == "multiversion" )
00411 {
00412 str::split( value, inserter( multiversion, multiversion.end() ), ", \t" );
00413 }
00414 else if ( entry == "locksfile.path" )
00415 {
00416 locks_file = Pathname(value);
00417 }
00418 else if ( entry == "locksfile.apply" )
00419 {
00420 apply_locks_file = str::strToBool( value, apply_locks_file );
00421 }
00422 else if ( entry == "update.datadir" )
00423 {
00424 update_data_path = Pathname(value);
00425 }
00426 else if ( entry == "update.scriptsdir" )
00427 {
00428 update_scripts_path = Pathname(value);
00429 }
00430 else if ( entry == "update.messagessdir" )
00431 {
00432 update_messages_path = Pathname(value);
00433 }
00434 else if ( entry == "update.messages.notify" )
00435 {
00436 updateMessagesNotify.set( value );
00437 }
00438 else if ( entry == "rpm.install.excludedocs" )
00439 {
00440 rpmInstallFlags.setFlag( target::rpm::RPMINST_EXCLUDEDOCS,
00441 str::strToBool( value, false ) );
00442 }
00443 else if ( entry == "history.logfile" )
00444 {
00445 history_log_path = Pathname(value);
00446 }
00447 else if ( entry == "credentials.global.dir" )
00448 {
00449 credentials_global_dir_path = Pathname(value);
00450 }
00451 else if ( entry == "credentials.global.file" )
00452 {
00453 credentials_global_file_path = Pathname(value);
00454 }
00455 }
00456 }
00457 }
00458 }
00459 else
00460 {
00461 MIL << _parsedZyppConf << " not found, using defaults instead." << endl;
00462 _parsedZyppConf = _parsedZyppConf.extend( " (NOT FOUND)" );
00463 }
00464
00465
00466 if ( getenv( "ZYPP_TESTSUITE_FAKE_ARCH" ) )
00467 {
00468 Arch carch( getenv( "ZYPP_TESTSUITE_FAKE_ARCH" ) );
00469 if ( carch != cfg_arch )
00470 {
00471 WAR << "ZYPP_TESTSUITE_FAKE_ARCH: Overriding system architecture (" << cfg_arch << "): " << carch << endl;
00472 cfg_arch = carch;
00473 }
00474 }
00475 MIL << "ZConfig singleton created." << endl;
00476 }
00477
00478 ~Impl()
00479 {}
00480
00481 public:
00483 Pathname _parsedZyppConf;
00484
00485 Arch cfg_arch;
00486 Locale cfg_textLocale;
00487
00488 Pathname cfg_cache_path;
00489 Pathname cfg_metadata_path;
00490 Pathname cfg_solvfiles_path;
00491 Pathname cfg_packages_path;
00492
00493 Pathname cfg_config_path;
00494 Pathname cfg_known_repos_path;
00495 Pathname cfg_known_services_path;
00496 Pathname cfg_vendor_path;
00497 Pathname locks_file;
00498
00499 Pathname update_data_path;
00500 Pathname update_scripts_path;
00501 Pathname update_messages_path;
00502 DefaultOption<std::string> updateMessagesNotify;
00503
00504 bool repo_add_probe;
00505 unsigned repo_refresh_delay;
00506 bool repoLabelIsAlias;
00507
00508 bool download_use_deltarpm;
00509 bool download_use_deltarpm_always;
00510 DefaultOption<bool> download_media_prefer_download;
00511
00512 int download_max_concurrent_connections;
00513 int download_min_download_speed;
00514 int download_max_download_speed;
00515 int download_max_silent_tries;
00516
00517 Option<DownloadMode> commit_downloadMode;
00518
00519 Option<bool> solver_onlyRequires;
00520 Option<bool> solver_allowVendorChange;
00521 Option<bool> solver_cleandepsOnRemove;
00522 Option<unsigned> solver_upgradeTestcasesToKeep;
00523 DefaultOption<bool> solverUpgradeRemoveDroppedPackages;
00524
00525 Pathname solver_checkSystemFile;
00526
00527 std::set<std::string> multiversion;
00528
00529 bool apply_locks_file;
00530
00531 target::rpm::RpmInstFlags rpmInstallFlags;
00532
00533 Pathname history_log_path;
00534 Pathname credentials_global_dir_path;
00535 Pathname credentials_global_file_path;
00536 };
00538
00539
00540
00541 void reconfigureZConfig( const Pathname & override_r )
00542 {
00543
00544 new ZConfig::Impl( override_r );
00545 }
00546
00548
00549
00550
00551
00552 ZConfig & ZConfig::instance()
00553 {
00554 static ZConfig _instance;
00555 return _instance;
00556 }
00557
00559
00560
00561
00562
00563 ZConfig::ZConfig()
00564 : _pimpl( new Impl )
00565 {
00566 about( MIL );
00567 }
00568
00570
00571
00572
00573
00574 ZConfig::~ZConfig( )
00575 {}
00576
00577 Pathname ZConfig::systemRoot() const
00578 {
00579 Target_Ptr target( getZYpp()->getTarget() );
00580 return target ? target->root() : Pathname();
00581 }
00582
00584
00585
00586
00588
00589 Arch ZConfig::defaultSystemArchitecture()
00590 {
00591 static Arch _val( _autodetectSystemArchitecture() );
00592 return _val;
00593 }
00594
00595 Arch ZConfig::systemArchitecture() const
00596 { return _pimpl->cfg_arch; }
00597
00598 void ZConfig::setSystemArchitecture( const Arch & arch_r )
00599 {
00600 if ( arch_r != _pimpl->cfg_arch )
00601 {
00602 WAR << "Overriding system architecture (" << _pimpl->cfg_arch << "): " << arch_r << endl;
00603 _pimpl->cfg_arch = arch_r;
00604 }
00605 }
00606
00608
00609
00610
00612
00613 Locale ZConfig::defaultTextLocale()
00614 {
00615 static Locale _val( _autodetectTextLocale() );
00616 return _val;
00617 }
00618
00619 Locale ZConfig::textLocale() const
00620 { return _pimpl->cfg_textLocale; }
00621
00622 void ZConfig::setTextLocale( const Locale & locale_r )
00623 {
00624 if ( locale_r != _pimpl->cfg_textLocale )
00625 {
00626 WAR << "Overriding text locale (" << _pimpl->cfg_textLocale << "): " << locale_r << endl;
00627 _pimpl->cfg_textLocale = locale_r;
00628 #warning prefer signal
00629 sat::Pool::instance().setTextLocale( locale_r );
00630 }
00631 }
00632
00634
00635 Pathname ZConfig::repoCachePath() const
00636 {
00637 return ( _pimpl->cfg_cache_path.empty()
00638 ? Pathname("/var/cache/zypp") : _pimpl->cfg_cache_path );
00639 }
00640
00641 Pathname ZConfig::repoMetadataPath() const
00642 {
00643 return ( _pimpl->cfg_metadata_path.empty()
00644 ? (repoCachePath()/"raw") : _pimpl->cfg_metadata_path );
00645 }
00646
00647 Pathname ZConfig::repoSolvfilesPath() const
00648 {
00649 return ( _pimpl->cfg_solvfiles_path.empty()
00650 ? (repoCachePath()/"solv") : _pimpl->cfg_solvfiles_path );
00651 }
00652
00653 Pathname ZConfig::repoPackagesPath() const
00654 {
00655 return ( _pimpl->cfg_packages_path.empty()
00656 ? (repoCachePath()/"packages") : _pimpl->cfg_packages_path );
00657 }
00658
00660
00661 Pathname ZConfig::configPath() const
00662 {
00663 return ( _pimpl->cfg_config_path.empty()
00664 ? Pathname("/etc/zypp") : _pimpl->cfg_config_path );
00665 }
00666
00667 Pathname ZConfig::knownReposPath() const
00668 {
00669 return ( _pimpl->cfg_known_repos_path.empty()
00670 ? (configPath()/"repos.d") : _pimpl->cfg_known_repos_path );
00671 }
00672
00673 Pathname ZConfig::knownServicesPath() const
00674 {
00675 return ( _pimpl->cfg_known_services_path.empty()
00676 ? (configPath()/"services.d") : _pimpl->cfg_known_repos_path );
00677 }
00678
00679 Pathname ZConfig::vendorPath() const
00680 {
00681 return ( _pimpl->cfg_vendor_path.empty()
00682 ? (configPath()/"vendors.d") : _pimpl->cfg_vendor_path );
00683 }
00684
00685 Pathname ZConfig::locksFile() const
00686 {
00687 return ( _pimpl->locks_file.empty()
00688 ? (configPath()/"locks") : _pimpl->locks_file );
00689 }
00690
00692
00693 bool ZConfig::repo_add_probe() const
00694 {
00695 return _pimpl->repo_add_probe;
00696 }
00697
00698 unsigned ZConfig::repo_refresh_delay() const
00699 {
00700 return _pimpl->repo_refresh_delay;
00701 }
00702
00703 bool ZConfig::repoLabelIsAlias() const
00704 { return _pimpl->repoLabelIsAlias; }
00705
00706 void ZConfig::repoLabelIsAlias( bool yesno_r )
00707 { _pimpl->repoLabelIsAlias = yesno_r; }
00708
00709 bool ZConfig::download_use_deltarpm() const
00710 { return _pimpl->download_use_deltarpm; }
00711
00712 bool ZConfig::download_use_deltarpm_always() const
00713 { return download_use_deltarpm() && _pimpl->download_use_deltarpm_always; }
00714
00715 bool ZConfig::download_media_prefer_download() const
00716 { return _pimpl->download_media_prefer_download; }
00717
00718 void ZConfig::set_download_media_prefer_download( bool yesno_r )
00719 { _pimpl->download_media_prefer_download.set( yesno_r ); }
00720
00721 void ZConfig::set_default_download_media_prefer_download()
00722 { _pimpl->download_media_prefer_download.restoreToDefault(); }
00723
00724 long ZConfig::download_max_concurrent_connections() const
00725 { return _pimpl->download_max_concurrent_connections; }
00726
00727 long ZConfig::download_min_download_speed() const
00728 { return _pimpl->download_min_download_speed; }
00729
00730 long ZConfig::download_max_download_speed() const
00731 { return _pimpl->download_max_download_speed; }
00732
00733 long ZConfig::download_max_silent_tries() const
00734 { return _pimpl->download_max_silent_tries; }
00735
00736 DownloadMode ZConfig::commit_downloadMode() const
00737 { return _pimpl->commit_downloadMode; }
00738
00739 bool ZConfig::solver_onlyRequires() const
00740 { return _pimpl->solver_onlyRequires; }
00741
00742 bool ZConfig::solver_allowVendorChange() const
00743 { return _pimpl->solver_allowVendorChange; }
00744
00745 bool ZConfig::solver_cleandepsOnRemove() const
00746 { return _pimpl->solver_cleandepsOnRemove; }
00747
00748 Pathname ZConfig::solver_checkSystemFile() const
00749 { return ( _pimpl->solver_checkSystemFile.empty()
00750 ? (configPath()/"systemCheck") : _pimpl->solver_checkSystemFile ); }
00751
00752 unsigned ZConfig::solver_upgradeTestcasesToKeep() const
00753 { return _pimpl->solver_upgradeTestcasesToKeep; }
00754
00755 bool ZConfig::solverUpgradeRemoveDroppedPackages() const { return _pimpl->solverUpgradeRemoveDroppedPackages; }
00756 void ZConfig::setSolverUpgradeRemoveDroppedPackages( bool val_r ) { _pimpl->solverUpgradeRemoveDroppedPackages.set( val_r ); }
00757 void ZConfig::resetSolverUpgradeRemoveDroppedPackages() { _pimpl->solverUpgradeRemoveDroppedPackages.restoreToDefault(); }
00758
00759 const std::set<std::string> & ZConfig::multiversionSpec() const { return _pimpl->multiversion; }
00760 void ZConfig::addMultiversionSpec( const std::string & name_r ) { _pimpl->multiversion.insert( name_r ); }
00761 void ZConfig::removeMultiversionSpec( const std::string & name_r ) { _pimpl->multiversion.erase( name_r ); }
00762
00763 bool ZConfig::apply_locks_file() const
00764 { return _pimpl->apply_locks_file; }
00765
00766 Pathname ZConfig::update_dataPath() const
00767 {
00768 return ( _pimpl->update_data_path.empty()
00769 ? Pathname("/var/adm") : _pimpl->update_data_path );
00770 }
00771
00772 Pathname ZConfig::update_messagesPath() const
00773 {
00774 return ( _pimpl->update_messages_path.empty()
00775 ? Pathname(update_dataPath()/"update-messages") : _pimpl->update_messages_path );
00776 }
00777
00778 Pathname ZConfig::update_scriptsPath() const
00779 {
00780 return ( _pimpl->update_scripts_path.empty()
00781 ? Pathname(update_dataPath()/"update-scripts") : _pimpl->update_scripts_path );
00782 }
00783
00784 std::string ZConfig::updateMessagesNotify() const
00785 { return _pimpl->updateMessagesNotify; }
00786
00787 void ZConfig::setUpdateMessagesNotify( const std::string & val_r )
00788 { _pimpl->updateMessagesNotify.set( val_r ); }
00789
00790 void ZConfig::resetUpdateMessagesNotify()
00791 { _pimpl->updateMessagesNotify.restoreToDefault(); }
00792
00794
00795 target::rpm::RpmInstFlags ZConfig::rpmInstallFlags() const
00796 { return _pimpl->rpmInstallFlags; }
00797
00798
00799 Pathname ZConfig::historyLogFile() const
00800 {
00801 return ( _pimpl->history_log_path.empty() ?
00802 Pathname("/var/log/zypp/history") : _pimpl->history_log_path );
00803 }
00804
00805
00806 Pathname ZConfig::credentialsGlobalDir() const
00807 {
00808 return ( _pimpl->credentials_global_dir_path.empty() ?
00809 Pathname("/etc/zypp/credentials.d") : _pimpl->credentials_global_dir_path );
00810 }
00811
00812 Pathname ZConfig::credentialsGlobalFile() const
00813 {
00814 return ( _pimpl->credentials_global_file_path.empty() ?
00815 Pathname("/etc/zypp/credentials.cat") : _pimpl->credentials_global_file_path );
00816 }
00817
00819
00820 std::string ZConfig::distroverpkg() const
00821 { return "redhat-release"; }
00822
00824
00825 std::ostream & ZConfig::about( std::ostream & str ) const
00826 {
00827 str << "libzypp: " << VERSION << " built " << __DATE__ << " " << __TIME__ << endl;
00828
00829 str << "satsolver: " << sat_version;
00830 if ( ::strcmp( sat_version, SATSOLVER_VERSION_STRING ) )
00831 str << " (built against " << SATSOLVER_VERSION_STRING << ")";
00832 str << endl;
00833
00834 str << "zypp.conf: '" << _pimpl->_parsedZyppConf << "'" << endl;
00835 str << "TextLocale: '" << textLocale() << "' (" << defaultTextLocale() << ")" << endl;
00836 str << "SystemArchitecture: '" << systemArchitecture() << "' (" << defaultSystemArchitecture() << ")" << endl;
00837 return str;
00838 }
00839
00841 }