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( 5 )
00260 , download_min_download_speed ( 0 )
00261 , download_max_download_speed ( 0 )
00262 , download_max_silent_tries ( 5 )
00263 , download_transfer_timeout ( 180 )
00264 , commit_downloadMode ( DownloadDefault )
00265 , solver_onlyRequires ( false )
00266 , solver_allowVendorChange ( false )
00267 , solver_cleandepsOnRemove ( false )
00268 , solver_upgradeTestcasesToKeep ( 2 )
00269 , solverUpgradeRemoveDroppedPackages( true )
00270 , apply_locks_file ( true )
00271 , pluginsPath ( "/usr/lib/zypp/plugins" )
00272 {
00273 MIL << "libzypp: " << VERSION << " built " << __DATE__ << " " << __TIME__ << endl;
00274
00275
00276 if ( _parsedZyppConf.empty() )
00277 {
00278 const char *env_confpath = getenv( "ZYPP_CONF" );
00279 _parsedZyppConf = env_confpath ? env_confpath : "/etc/zypp/zypp.conf";
00280 }
00281 else
00282 {
00283
00284
00285 INT << "Reconfigure to " << _parsedZyppConf << endl;
00286 ZConfig::instance()._pimpl.reset( this );
00287 }
00288 if ( PathInfo(_parsedZyppConf).isExist() )
00289 {
00290 parser::IniDict dict( _parsedZyppConf );
00291 for ( IniDict::section_const_iterator sit = dict.sectionsBegin();
00292 sit != dict.sectionsEnd();
00293 ++sit )
00294 {
00295 string section(*sit);
00296
00297 for ( IniDict::entry_const_iterator it = dict.entriesBegin(*sit);
00298 it != dict.entriesEnd(*sit);
00299 ++it )
00300 {
00301 string entry(it->first);
00302 string value(it->second);
00303
00304 if ( section == "main" )
00305 {
00306 if ( entry == "arch" )
00307 {
00308 Arch carch( value );
00309 if ( carch != cfg_arch )
00310 {
00311 WAR << "Overriding system architecture (" << cfg_arch << "): " << carch << endl;
00312 cfg_arch = carch;
00313 }
00314 }
00315 else if ( entry == "cachedir" )
00316 {
00317 cfg_cache_path = Pathname(value);
00318 }
00319 else if ( entry == "metadatadir" )
00320 {
00321 cfg_metadata_path = Pathname(value);
00322 }
00323 else if ( entry == "solvfilesdir" )
00324 {
00325 cfg_solvfiles_path = Pathname(value);
00326 }
00327 else if ( entry == "packagesdir" )
00328 {
00329 cfg_packages_path = Pathname(value);
00330 }
00331 else if ( entry == "configdir" )
00332 {
00333 cfg_config_path = Pathname(value);
00334 }
00335 else if ( entry == "reposdir" )
00336 {
00337 cfg_known_repos_path = Pathname(value);
00338 }
00339 else if ( entry == "servicesdir" )
00340 {
00341 cfg_known_services_path = Pathname(value);
00342 }
00343 else if ( entry == "repo.add.probe" )
00344 {
00345 repo_add_probe = str::strToBool( value, repo_add_probe );
00346 }
00347 else if ( entry == "repo.refresh.delay" )
00348 {
00349 str::strtonum(value, repo_refresh_delay);
00350 }
00351 else if ( entry == "download.use_deltarpm" )
00352 {
00353 download_use_deltarpm = str::strToBool( value, download_use_deltarpm );
00354 }
00355 else if ( entry == "download.use_deltarpm.always" )
00356 {
00357 download_use_deltarpm_always = str::strToBool( value, download_use_deltarpm_always );
00358 }
00359 else if ( entry == "download.media_preference" )
00360 {
00361 download_media_prefer_download.restoreToDefault( str::compareCI( value, "volatile" ) != 0 );
00362 }
00363 else if ( entry == "download.max_concurrent_connections" )
00364 {
00365 str::strtonum(value, download_max_concurrent_connections);
00366 }
00367 else if ( entry == "download.min_download_speed" )
00368 {
00369 str::strtonum(value, download_min_download_speed);
00370 }
00371 else if ( entry == "download.max_download_speed" )
00372 {
00373 str::strtonum(value, download_max_download_speed);
00374 }
00375 else if ( entry == "download.max_silent_tries" )
00376 {
00377 str::strtonum(value, download_max_silent_tries);
00378 }
00379 else if ( entry == "download.transfer_timeout" )
00380 {
00381 str::strtonum(value, download_transfer_timeout);
00382 if ( download_transfer_timeout < 0 ) download_transfer_timeout = 0;
00383 else if ( download_transfer_timeout > 3600 ) download_transfer_timeout = 3600;
00384 }
00385 else if ( entry == "commit.downloadMode" )
00386 {
00387 commit_downloadMode.set( deserializeDownloadMode( value ) );
00388 }
00389 else if ( entry == "vendordir" )
00390 {
00391 cfg_vendor_path = Pathname(value);
00392 }
00393 else if ( entry == "solver.onlyRequires" )
00394 {
00395 solver_onlyRequires.set( str::strToBool( value, solver_onlyRequires ) );
00396 }
00397 else if ( entry == "solver.allowVendorChange" )
00398 {
00399 solver_allowVendorChange.set( str::strToBool( value, solver_allowVendorChange ) );
00400 }
00401 else if ( entry == "solver.cleandepsOnRemove" )
00402 {
00403 solver_cleandepsOnRemove.set( str::strToBool( value, solver_cleandepsOnRemove ) );
00404 }
00405 else if ( entry == "solver.upgradeTestcasesToKeep" )
00406 {
00407 solver_upgradeTestcasesToKeep.set( str::strtonum<unsigned>( value ) );
00408 }
00409 else if ( entry == "solver.upgradeRemoveDroppedPackages" )
00410 {
00411 solverUpgradeRemoveDroppedPackages.restoreToDefault( str::strToBool( value, solverUpgradeRemoveDroppedPackages.getDefault() ) );
00412 }
00413 else if ( entry == "solver.checkSystemFile" )
00414 {
00415 solver_checkSystemFile = Pathname(value);
00416 }
00417 else if ( entry == "multiversion" )
00418 {
00419 str::split( value, inserter( multiversion, multiversion.end() ), ", \t" );
00420 }
00421 else if ( entry == "locksfile.path" )
00422 {
00423 locks_file = Pathname(value);
00424 }
00425 else if ( entry == "locksfile.apply" )
00426 {
00427 apply_locks_file = str::strToBool( value, apply_locks_file );
00428 }
00429 else if ( entry == "update.datadir" )
00430 {
00431 update_data_path = Pathname(value);
00432 }
00433 else if ( entry == "update.scriptsdir" )
00434 {
00435 update_scripts_path = Pathname(value);
00436 }
00437 else if ( entry == "update.messagessdir" )
00438 {
00439 update_messages_path = Pathname(value);
00440 }
00441 else if ( entry == "update.messages.notify" )
00442 {
00443 updateMessagesNotify.set( value );
00444 }
00445 else if ( entry == "rpm.install.excludedocs" )
00446 {
00447 rpmInstallFlags.setFlag( target::rpm::RPMINST_EXCLUDEDOCS,
00448 str::strToBool( value, false ) );
00449 }
00450 else if ( entry == "history.logfile" )
00451 {
00452 history_log_path = Pathname(value);
00453 }
00454 else if ( entry == "credentials.global.dir" )
00455 {
00456 credentials_global_dir_path = Pathname(value);
00457 }
00458 else if ( entry == "credentials.global.file" )
00459 {
00460 credentials_global_file_path = Pathname(value);
00461 }
00462 }
00463 }
00464 }
00465 }
00466 else
00467 {
00468 MIL << _parsedZyppConf << " not found, using defaults instead." << endl;
00469 _parsedZyppConf = _parsedZyppConf.extend( " (NOT FOUND)" );
00470 }
00471
00472
00473 if ( getenv( "ZYPP_TESTSUITE_FAKE_ARCH" ) )
00474 {
00475 Arch carch( getenv( "ZYPP_TESTSUITE_FAKE_ARCH" ) );
00476 if ( carch != cfg_arch )
00477 {
00478 WAR << "ZYPP_TESTSUITE_FAKE_ARCH: Overriding system architecture (" << cfg_arch << "): " << carch << endl;
00479 cfg_arch = carch;
00480 }
00481 }
00482 MIL << "ZConfig singleton created." << endl;
00483 }
00484
00485 ~Impl()
00486 {}
00487
00488 public:
00490 Pathname _parsedZyppConf;
00491
00492 Arch cfg_arch;
00493 Locale cfg_textLocale;
00494
00495 Pathname cfg_cache_path;
00496 Pathname cfg_metadata_path;
00497 Pathname cfg_solvfiles_path;
00498 Pathname cfg_packages_path;
00499
00500 Pathname cfg_config_path;
00501 Pathname cfg_known_repos_path;
00502 Pathname cfg_known_services_path;
00503
00504 Pathname cfg_vendor_path;
00505 Pathname locks_file;
00506
00507 Pathname update_data_path;
00508 Pathname update_scripts_path;
00509 Pathname update_messages_path;
00510 DefaultOption<std::string> updateMessagesNotify;
00511
00512 bool repo_add_probe;
00513 unsigned repo_refresh_delay;
00514 bool repoLabelIsAlias;
00515
00516 bool download_use_deltarpm;
00517 bool download_use_deltarpm_always;
00518 DefaultOption<bool> download_media_prefer_download;
00519
00520 int download_max_concurrent_connections;
00521 int download_min_download_speed;
00522 int download_max_download_speed;
00523 int download_max_silent_tries;
00524 int download_transfer_timeout;
00525
00526 Option<DownloadMode> commit_downloadMode;
00527
00528 Option<bool> solver_onlyRequires;
00529 Option<bool> solver_allowVendorChange;
00530 Option<bool> solver_cleandepsOnRemove;
00531 Option<unsigned> solver_upgradeTestcasesToKeep;
00532 DefaultOption<bool> solverUpgradeRemoveDroppedPackages;
00533
00534 Pathname solver_checkSystemFile;
00535
00536 std::set<std::string> multiversion;
00537
00538 bool apply_locks_file;
00539
00540 target::rpm::RpmInstFlags rpmInstallFlags;
00541
00542 Pathname history_log_path;
00543 Pathname credentials_global_dir_path;
00544 Pathname credentials_global_file_path;
00545
00546 Option<Pathname> pluginsPath;
00547 };
00549
00550
00551
00552 void reconfigureZConfig( const Pathname & override_r )
00553 {
00554
00555 new ZConfig::Impl( override_r );
00556 }
00557
00559
00560
00561
00562
00563 ZConfig & ZConfig::instance()
00564 {
00565 static ZConfig _instance;
00566 return _instance;
00567 }
00568
00570
00571
00572
00573
00574 ZConfig::ZConfig()
00575 : _pimpl( new Impl )
00576 {
00577 about( MIL );
00578 }
00579
00581
00582
00583
00584
00585 ZConfig::~ZConfig( )
00586 {}
00587
00588 Pathname ZConfig::systemRoot() const
00589 {
00590 Target_Ptr target( getZYpp()->getTarget() );
00591 return target ? target->root() : Pathname();
00592 }
00593
00595
00596
00597
00599
00600 Arch ZConfig::defaultSystemArchitecture()
00601 {
00602 static Arch _val( _autodetectSystemArchitecture() );
00603 return _val;
00604 }
00605
00606 Arch ZConfig::systemArchitecture() const
00607 { return _pimpl->cfg_arch; }
00608
00609 void ZConfig::setSystemArchitecture( const Arch & arch_r )
00610 {
00611 if ( arch_r != _pimpl->cfg_arch )
00612 {
00613 WAR << "Overriding system architecture (" << _pimpl->cfg_arch << "): " << arch_r << endl;
00614 _pimpl->cfg_arch = arch_r;
00615 }
00616 }
00617
00619
00620
00621
00623
00624 Locale ZConfig::defaultTextLocale()
00625 {
00626 static Locale _val( _autodetectTextLocale() );
00627 return _val;
00628 }
00629
00630 Locale ZConfig::textLocale() const
00631 { return _pimpl->cfg_textLocale; }
00632
00633 void ZConfig::setTextLocale( const Locale & locale_r )
00634 {
00635 if ( locale_r != _pimpl->cfg_textLocale )
00636 {
00637 WAR << "Overriding text locale (" << _pimpl->cfg_textLocale << "): " << locale_r << endl;
00638 _pimpl->cfg_textLocale = locale_r;
00639 #warning prefer signal
00640 sat::Pool::instance().setTextLocale( locale_r );
00641 }
00642 }
00643
00645
00646 Pathname ZConfig::repoCachePath() const
00647 {
00648 return ( _pimpl->cfg_cache_path.empty()
00649 ? Pathname("/var/cache/zypp") : _pimpl->cfg_cache_path );
00650 }
00651
00652 Pathname ZConfig::repoMetadataPath() const
00653 {
00654 return ( _pimpl->cfg_metadata_path.empty()
00655 ? (repoCachePath()/"raw") : _pimpl->cfg_metadata_path );
00656 }
00657
00658 Pathname ZConfig::repoSolvfilesPath() const
00659 {
00660 return ( _pimpl->cfg_solvfiles_path.empty()
00661 ? (repoCachePath()/"solv") : _pimpl->cfg_solvfiles_path );
00662 }
00663
00664 Pathname ZConfig::repoPackagesPath() const
00665 {
00666 return ( _pimpl->cfg_packages_path.empty()
00667 ? (repoCachePath()/"packages") : _pimpl->cfg_packages_path );
00668 }
00669
00671
00672 Pathname ZConfig::configPath() const
00673 {
00674 return ( _pimpl->cfg_config_path.empty()
00675 ? Pathname("/etc/zypp") : _pimpl->cfg_config_path );
00676 }
00677
00678 Pathname ZConfig::knownReposPath() const
00679 {
00680 return ( _pimpl->cfg_known_repos_path.empty()
00681 ? (configPath()/"repos.d") : _pimpl->cfg_known_repos_path );
00682 }
00683
00684 Pathname ZConfig::knownServicesPath() const
00685 {
00686 return ( _pimpl->cfg_known_services_path.empty()
00687 ? (configPath()/"services.d") : _pimpl->cfg_known_repos_path );
00688 }
00689
00690 Pathname ZConfig::vendorPath() const
00691 {
00692 return ( _pimpl->cfg_vendor_path.empty()
00693 ? (configPath()/"vendors.d") : _pimpl->cfg_vendor_path );
00694 }
00695
00696 Pathname ZConfig::locksFile() const
00697 {
00698 return ( _pimpl->locks_file.empty()
00699 ? (configPath()/"locks") : _pimpl->locks_file );
00700 }
00701
00703
00704 bool ZConfig::repo_add_probe() const
00705 {
00706 return _pimpl->repo_add_probe;
00707 }
00708
00709 unsigned ZConfig::repo_refresh_delay() const
00710 {
00711 return _pimpl->repo_refresh_delay;
00712 }
00713
00714 bool ZConfig::repoLabelIsAlias() const
00715 { return _pimpl->repoLabelIsAlias; }
00716
00717 void ZConfig::repoLabelIsAlias( bool yesno_r )
00718 { _pimpl->repoLabelIsAlias = yesno_r; }
00719
00720 bool ZConfig::download_use_deltarpm() const
00721 { return _pimpl->download_use_deltarpm; }
00722
00723 bool ZConfig::download_use_deltarpm_always() const
00724 { return download_use_deltarpm() && _pimpl->download_use_deltarpm_always; }
00725
00726 bool ZConfig::download_media_prefer_download() const
00727 { return _pimpl->download_media_prefer_download; }
00728
00729 void ZConfig::set_download_media_prefer_download( bool yesno_r )
00730 { _pimpl->download_media_prefer_download.set( yesno_r ); }
00731
00732 void ZConfig::set_default_download_media_prefer_download()
00733 { _pimpl->download_media_prefer_download.restoreToDefault(); }
00734
00735 long ZConfig::download_max_concurrent_connections() const
00736 { return _pimpl->download_max_concurrent_connections; }
00737
00738 long ZConfig::download_min_download_speed() const
00739 { return _pimpl->download_min_download_speed; }
00740
00741 long ZConfig::download_max_download_speed() const
00742 { return _pimpl->download_max_download_speed; }
00743
00744 long ZConfig::download_max_silent_tries() const
00745 { return _pimpl->download_max_silent_tries; }
00746
00747 long ZConfig::download_transfer_timeout() const
00748 { return _pimpl->download_transfer_timeout; }
00749
00750 DownloadMode ZConfig::commit_downloadMode() const
00751 { return _pimpl->commit_downloadMode; }
00752
00753 bool ZConfig::solver_onlyRequires() const
00754 { return _pimpl->solver_onlyRequires; }
00755
00756 bool ZConfig::solver_allowVendorChange() const
00757 { return _pimpl->solver_allowVendorChange; }
00758
00759 bool ZConfig::solver_cleandepsOnRemove() const
00760 { return _pimpl->solver_cleandepsOnRemove; }
00761
00762 Pathname ZConfig::solver_checkSystemFile() const
00763 { return ( _pimpl->solver_checkSystemFile.empty()
00764 ? (configPath()/"systemCheck") : _pimpl->solver_checkSystemFile ); }
00765
00766 unsigned ZConfig::solver_upgradeTestcasesToKeep() const
00767 { return _pimpl->solver_upgradeTestcasesToKeep; }
00768
00769 bool ZConfig::solverUpgradeRemoveDroppedPackages() const { return _pimpl->solverUpgradeRemoveDroppedPackages; }
00770 void ZConfig::setSolverUpgradeRemoveDroppedPackages( bool val_r ) { _pimpl->solverUpgradeRemoveDroppedPackages.set( val_r ); }
00771 void ZConfig::resetSolverUpgradeRemoveDroppedPackages() { _pimpl->solverUpgradeRemoveDroppedPackages.restoreToDefault(); }
00772
00773 const std::set<std::string> & ZConfig::multiversionSpec() const { return _pimpl->multiversion; }
00774 void ZConfig::addMultiversionSpec( const std::string & name_r ) { _pimpl->multiversion.insert( name_r ); }
00775 void ZConfig::removeMultiversionSpec( const std::string & name_r ) { _pimpl->multiversion.erase( name_r ); }
00776
00777 bool ZConfig::apply_locks_file() const
00778 { return _pimpl->apply_locks_file; }
00779
00780 Pathname ZConfig::update_dataPath() const
00781 {
00782 return ( _pimpl->update_data_path.empty()
00783 ? Pathname("/var/adm") : _pimpl->update_data_path );
00784 }
00785
00786 Pathname ZConfig::update_messagesPath() const
00787 {
00788 return ( _pimpl->update_messages_path.empty()
00789 ? Pathname(update_dataPath()/"update-messages") : _pimpl->update_messages_path );
00790 }
00791
00792 Pathname ZConfig::update_scriptsPath() const
00793 {
00794 return ( _pimpl->update_scripts_path.empty()
00795 ? Pathname(update_dataPath()/"update-scripts") : _pimpl->update_scripts_path );
00796 }
00797
00798 std::string ZConfig::updateMessagesNotify() const
00799 { return _pimpl->updateMessagesNotify; }
00800
00801 void ZConfig::setUpdateMessagesNotify( const std::string & val_r )
00802 { _pimpl->updateMessagesNotify.set( val_r ); }
00803
00804 void ZConfig::resetUpdateMessagesNotify()
00805 { _pimpl->updateMessagesNotify.restoreToDefault(); }
00806
00808
00809 target::rpm::RpmInstFlags ZConfig::rpmInstallFlags() const
00810 { return _pimpl->rpmInstallFlags; }
00811
00812
00813 Pathname ZConfig::historyLogFile() const
00814 {
00815 return ( _pimpl->history_log_path.empty() ?
00816 Pathname("/var/log/zypp/history") : _pimpl->history_log_path );
00817 }
00818
00819
00820 Pathname ZConfig::credentialsGlobalDir() const
00821 {
00822 return ( _pimpl->credentials_global_dir_path.empty() ?
00823 Pathname("/etc/zypp/credentials.d") : _pimpl->credentials_global_dir_path );
00824 }
00825
00826 Pathname ZConfig::credentialsGlobalFile() const
00827 {
00828 return ( _pimpl->credentials_global_file_path.empty() ?
00829 Pathname("/etc/zypp/credentials.cat") : _pimpl->credentials_global_file_path );
00830 }
00831
00833
00834 std::string ZConfig::distroverpkg() const
00835 { return "redhat-release"; }
00836
00838
00839 Pathname ZConfig::pluginsPath() const
00840 { return _pimpl->pluginsPath.get(); }
00841
00843
00844 std::ostream & ZConfig::about( std::ostream & str ) const
00845 {
00846 str << "libzypp: " << VERSION << " built " << __DATE__ << " " << __TIME__ << endl;
00847
00848 str << "satsolver: " << sat_version;
00849 if ( ::strcmp( sat_version, SATSOLVER_VERSION_STRING ) )
00850 str << " (built against " << SATSOLVER_VERSION_STRING << ")";
00851 str << endl;
00852
00853 str << "zypp.conf: '" << _pimpl->_parsedZyppConf << "'" << endl;
00854 str << "TextLocale: '" << textLocale() << "' (" << defaultTextLocale() << ")" << endl;
00855 str << "SystemArchitecture: '" << systemArchitecture() << "' (" << defaultSystemArchitecture() << ")" << endl;
00856 return str;
00857 }
00858
00860 }