libzypp 8.13.6

ZConfig.cc

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                          ____ _   __ __ ___                          |
00003 |                         |__  / \ / / . \ . \                         |
00004 |                           / / \ V /|  _/  _/                         |
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         // some CPUs report i686 but dont implement cx8 and cmov
00064         // check for both flags in /proc/cpuinfo and downgrade
00065         // to i586 if either is missing (cf bug #18885)
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         // Check for sun4[vum] to get the real arch. (bug #566291)
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   } // namespace zypp
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   //    CLASS NAME : ZConfig::Impl
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         , 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         , pluginsPath                   ( "/usr/lib/zypp/plugins" )
00271       {
00272         MIL << "libzypp: " << VERSION << " built " << __DATE__ << " " <<  __TIME__ << endl;
00273         // override_r has higest prio
00274         // ZYPP_CONF might override /etc/zypp/zypp.conf
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           // Inject this into ZConfig. Be shure this is
00283           // allocated via new. See: reconfigureZConfig
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             //MIL << section << endl;
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               //DBG << (*it).first << "=" << (*it).second << endl;
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         // legacy:
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 
00497     Pathname cfg_vendor_path;
00498     Pathname locks_file;
00499 
00500     Pathname update_data_path;
00501     Pathname update_scripts_path;
00502     Pathname update_messages_path;
00503     DefaultOption<std::string> updateMessagesNotify;
00504 
00505     bool repo_add_probe;
00506     unsigned repo_refresh_delay;
00507     bool repoLabelIsAlias;
00508 
00509     bool download_use_deltarpm;
00510     bool download_use_deltarpm_always;
00511     DefaultOption<bool> download_media_prefer_download;
00512 
00513     int download_max_concurrent_connections;
00514     int download_min_download_speed;
00515     int download_max_download_speed;
00516     int download_max_silent_tries;
00517 
00518     Option<DownloadMode> commit_downloadMode;
00519 
00520     Option<bool>        solver_onlyRequires;
00521     Option<bool>        solver_allowVendorChange;
00522     Option<bool>        solver_cleandepsOnRemove;
00523     Option<unsigned>    solver_upgradeTestcasesToKeep;
00524     DefaultOption<bool> solverUpgradeRemoveDroppedPackages;
00525 
00526     Pathname solver_checkSystemFile;
00527 
00528     std::set<std::string> multiversion;
00529 
00530     bool apply_locks_file;
00531 
00532     target::rpm::RpmInstFlags rpmInstallFlags;
00533 
00534     Pathname history_log_path;
00535     Pathname credentials_global_dir_path;
00536     Pathname credentials_global_file_path;
00537 
00538     Option<Pathname> pluginsPath;
00539   };
00541 
00542   // Backdoor to redirect ZConfig from within the running
00543   // TEST-application. HANDLE WITH CARE!
00544   void reconfigureZConfig( const Pathname & override_r )
00545   {
00546     // ctor puts itself unter smart pointer control.
00547     new ZConfig::Impl( override_r );
00548   }
00549 
00551   //
00552   //    METHOD NAME : ZConfig::instance
00553   //    METHOD TYPE : ZConfig &
00554   //
00555   ZConfig & ZConfig::instance()
00556   {
00557     static ZConfig _instance; // The singleton
00558     return _instance;
00559   }
00560 
00562   //
00563   //    METHOD NAME : ZConfig::ZConfig
00564   //    METHOD TYPE : Ctor
00565   //
00566   ZConfig::ZConfig()
00567   : _pimpl( new Impl )
00568   {
00569     about( MIL );
00570   }
00571 
00573   //
00574   //    METHOD NAME : ZConfig::~ZConfig
00575   //    METHOD TYPE : Dtor
00576   //
00577   ZConfig::~ZConfig( )
00578   {}
00579 
00580   Pathname ZConfig::systemRoot() const
00581   {
00582     Target_Ptr target( getZYpp()->getTarget() );
00583     return target ? target->root() : Pathname();
00584   }
00585 
00587   //
00588   // system architecture
00589   //
00591 
00592   Arch ZConfig::defaultSystemArchitecture()
00593   {
00594     static Arch _val( _autodetectSystemArchitecture() );
00595     return _val;
00596   }
00597 
00598   Arch ZConfig::systemArchitecture() const
00599   { return _pimpl->cfg_arch; }
00600 
00601   void ZConfig::setSystemArchitecture( const Arch & arch_r )
00602   {
00603     if ( arch_r != _pimpl->cfg_arch )
00604     {
00605       WAR << "Overriding system architecture (" << _pimpl->cfg_arch << "): " << arch_r << endl;
00606       _pimpl->cfg_arch = arch_r;
00607     }
00608   }
00609 
00611   //
00612   // text locale
00613   //
00615 
00616   Locale ZConfig::defaultTextLocale()
00617   {
00618     static Locale _val( _autodetectTextLocale() );
00619     return _val;
00620   }
00621 
00622   Locale ZConfig::textLocale() const
00623   { return _pimpl->cfg_textLocale; }
00624 
00625   void ZConfig::setTextLocale( const Locale & locale_r )
00626   {
00627     if ( locale_r != _pimpl->cfg_textLocale )
00628     {
00629       WAR << "Overriding text locale (" << _pimpl->cfg_textLocale << "): " << locale_r << endl;
00630       _pimpl->cfg_textLocale = locale_r;
00631 #warning prefer signal
00632       sat::Pool::instance().setTextLocale( locale_r );
00633     }
00634   }
00635 
00637 
00638   Pathname ZConfig::repoCachePath() const
00639   {
00640     return ( _pimpl->cfg_cache_path.empty()
00641         ? Pathname("/var/cache/zypp") : _pimpl->cfg_cache_path );
00642   }
00643 
00644   Pathname ZConfig::repoMetadataPath() const
00645   {
00646     return ( _pimpl->cfg_metadata_path.empty()
00647         ? (repoCachePath()/"raw") : _pimpl->cfg_metadata_path );
00648   }
00649 
00650   Pathname ZConfig::repoSolvfilesPath() const
00651   {
00652     return ( _pimpl->cfg_solvfiles_path.empty()
00653         ? (repoCachePath()/"solv") : _pimpl->cfg_solvfiles_path );
00654   }
00655 
00656   Pathname ZConfig::repoPackagesPath() const
00657   {
00658     return ( _pimpl->cfg_packages_path.empty()
00659         ? (repoCachePath()/"packages") : _pimpl->cfg_packages_path );
00660   }
00661 
00663 
00664   Pathname ZConfig::configPath() const
00665   {
00666     return ( _pimpl->cfg_config_path.empty()
00667         ? Pathname("/etc/zypp") : _pimpl->cfg_config_path );
00668   }
00669 
00670   Pathname ZConfig::knownReposPath() const
00671   {
00672     return ( _pimpl->cfg_known_repos_path.empty()
00673         ? (configPath()/"repos.d") : _pimpl->cfg_known_repos_path );
00674   }
00675 
00676   Pathname ZConfig::knownServicesPath() const
00677   {
00678     return ( _pimpl->cfg_known_services_path.empty()
00679         ? (configPath()/"services.d") : _pimpl->cfg_known_repos_path );
00680   }
00681 
00682   Pathname ZConfig::vendorPath() const
00683   {
00684     return ( _pimpl->cfg_vendor_path.empty()
00685         ? (configPath()/"vendors.d") : _pimpl->cfg_vendor_path );
00686   }
00687 
00688   Pathname ZConfig::locksFile() const
00689   {
00690     return ( _pimpl->locks_file.empty()
00691         ? (configPath()/"locks") : _pimpl->locks_file );
00692   }
00693 
00695 
00696   bool ZConfig::repo_add_probe() const
00697   {
00698     return _pimpl->repo_add_probe;
00699   }
00700 
00701   unsigned ZConfig::repo_refresh_delay() const
00702   {
00703     return _pimpl->repo_refresh_delay;
00704   }
00705 
00706   bool ZConfig::repoLabelIsAlias() const
00707   { return _pimpl->repoLabelIsAlias; }
00708 
00709   void ZConfig::repoLabelIsAlias( bool yesno_r )
00710   { _pimpl->repoLabelIsAlias = yesno_r; }
00711 
00712   bool ZConfig::download_use_deltarpm() const
00713   { return _pimpl->download_use_deltarpm; }
00714 
00715   bool ZConfig::download_use_deltarpm_always() const
00716   { return download_use_deltarpm() && _pimpl->download_use_deltarpm_always; }
00717 
00718   bool ZConfig::download_media_prefer_download() const
00719   { return _pimpl->download_media_prefer_download; }
00720 
00721   void ZConfig::set_download_media_prefer_download( bool yesno_r )
00722   { _pimpl->download_media_prefer_download.set( yesno_r ); }
00723 
00724   void ZConfig::set_default_download_media_prefer_download()
00725   { _pimpl->download_media_prefer_download.restoreToDefault(); }
00726 
00727   long ZConfig::download_max_concurrent_connections() const
00728   { return _pimpl->download_max_concurrent_connections; }
00729 
00730   long ZConfig::download_min_download_speed() const
00731   { return _pimpl->download_min_download_speed; }
00732 
00733   long ZConfig::download_max_download_speed() const
00734   { return _pimpl->download_max_download_speed; }
00735 
00736   long ZConfig::download_max_silent_tries() const
00737   { return _pimpl->download_max_silent_tries; }
00738 
00739   DownloadMode ZConfig::commit_downloadMode() const
00740   { return _pimpl->commit_downloadMode; }
00741 
00742   bool ZConfig::solver_onlyRequires() const
00743   { return _pimpl->solver_onlyRequires; }
00744 
00745   bool ZConfig::solver_allowVendorChange() const
00746   { return _pimpl->solver_allowVendorChange; }
00747 
00748   bool ZConfig::solver_cleandepsOnRemove() const
00749   { return _pimpl->solver_cleandepsOnRemove; }
00750 
00751   Pathname ZConfig::solver_checkSystemFile() const
00752   { return ( _pimpl->solver_checkSystemFile.empty()
00753       ? (configPath()/"systemCheck") : _pimpl->solver_checkSystemFile ); }
00754 
00755   unsigned ZConfig::solver_upgradeTestcasesToKeep() const
00756   { return _pimpl->solver_upgradeTestcasesToKeep; }
00757 
00758   bool ZConfig::solverUpgradeRemoveDroppedPackages() const              { return _pimpl->solverUpgradeRemoveDroppedPackages; }
00759   void ZConfig::setSolverUpgradeRemoveDroppedPackages( bool val_r )     { _pimpl->solverUpgradeRemoveDroppedPackages.set( val_r ); }
00760   void ZConfig::resetSolverUpgradeRemoveDroppedPackages()               { _pimpl->solverUpgradeRemoveDroppedPackages.restoreToDefault(); }
00761 
00762   const std::set<std::string> & ZConfig::multiversionSpec() const       { return _pimpl->multiversion; }
00763   void ZConfig::addMultiversionSpec( const std::string & name_r )       { _pimpl->multiversion.insert( name_r ); }
00764   void ZConfig::removeMultiversionSpec( const std::string & name_r )    { _pimpl->multiversion.erase( name_r ); }
00765 
00766   bool ZConfig::apply_locks_file() const
00767   { return _pimpl->apply_locks_file; }
00768 
00769   Pathname ZConfig::update_dataPath() const
00770   {
00771     return ( _pimpl->update_data_path.empty()
00772         ? Pathname("/var/adm") : _pimpl->update_data_path );
00773   }
00774 
00775   Pathname ZConfig::update_messagesPath() const
00776   {
00777     return ( _pimpl->update_messages_path.empty()
00778              ? Pathname(update_dataPath()/"update-messages") : _pimpl->update_messages_path );
00779   }
00780 
00781   Pathname ZConfig::update_scriptsPath() const
00782   {
00783     return ( _pimpl->update_scripts_path.empty()
00784              ? Pathname(update_dataPath()/"update-scripts") : _pimpl->update_scripts_path );
00785   }
00786 
00787   std::string ZConfig::updateMessagesNotify() const
00788   { return _pimpl->updateMessagesNotify; }
00789 
00790   void ZConfig::setUpdateMessagesNotify( const std::string & val_r )
00791   { _pimpl->updateMessagesNotify.set( val_r ); }
00792 
00793   void ZConfig::resetUpdateMessagesNotify()
00794   { _pimpl->updateMessagesNotify.restoreToDefault(); }
00795 
00797 
00798   target::rpm::RpmInstFlags ZConfig::rpmInstallFlags() const
00799   { return _pimpl->rpmInstallFlags; }
00800 
00801 
00802   Pathname ZConfig::historyLogFile() const
00803   {
00804     return ( _pimpl->history_log_path.empty() ?
00805         Pathname("/var/log/zypp/history") : _pimpl->history_log_path );
00806   }
00807 
00808 
00809   Pathname ZConfig::credentialsGlobalDir() const
00810   {
00811     return ( _pimpl->credentials_global_dir_path.empty() ?
00812         Pathname("/etc/zypp/credentials.d") : _pimpl->credentials_global_dir_path );
00813   }
00814 
00815   Pathname ZConfig::credentialsGlobalFile() const
00816   {
00817     return ( _pimpl->credentials_global_file_path.empty() ?
00818         Pathname("/etc/zypp/credentials.cat") : _pimpl->credentials_global_file_path );
00819   }
00820 
00822 
00823   std::string ZConfig::distroverpkg() const
00824   { return "redhat-release"; }
00825 
00827 
00828   Pathname ZConfig::pluginsPath() const
00829   { return _pimpl->pluginsPath.get(); }
00830 
00832 
00833   std::ostream & ZConfig::about( std::ostream & str ) const
00834   {
00835     str << "libzypp: " << VERSION << " built " << __DATE__ << " " <<  __TIME__ << endl;
00836 
00837     str << "satsolver: " << sat_version;
00838     if ( ::strcmp( sat_version, SATSOLVER_VERSION_STRING ) )
00839       str << " (built against " << SATSOLVER_VERSION_STRING << ")";
00840     str << endl;
00841 
00842     str << "zypp.conf: '" << _pimpl->_parsedZyppConf << "'" << endl;
00843     str << "TextLocale: '" << textLocale() << "' (" << defaultTextLocale() << ")" << endl;
00844     str << "SystemArchitecture: '" << systemArchitecture() << "' (" << defaultSystemArchitecture() << ")" << endl;
00845     return str;
00846   }
00847 
00849 } // namespace zypp