Use libsolv includes and adjust documentation
[platform/upstream/libzypp.git] / zypp / ZConfig.cc
index 442c27d..b68039d 100644 (file)
@@ -13,7 +13,7 @@ extern "C"
 {
 #include <sys/utsname.h>
 #include <unistd.h>
-#include <satsolver/satversion.h>
+#include <solv/satversion.h>
 }
 #include <iostream>
 #include <fstream>
@@ -27,6 +27,8 @@ extern "C"
 #include "zypp/PathInfo.h"
 #include "zypp/parser/IniDict.h"
 
+#include "zypp/sat/Pool.h"
+
 using namespace std;
 using namespace zypp::filesystem;
 using namespace zypp::parser;
@@ -56,11 +58,11 @@ namespace zypp
       Arch architecture( buf.machine );
       MIL << "Uname architecture is '" << buf.machine << "'" << endl;
 
-      // some CPUs report i686 but dont implement cx8 and cmov
-      // check for both flags in /proc/cpuinfo and downgrade
-      // to i586 if either is missing (cf bug #18885)
       if ( architecture == Arch_i686 )
       {
+       // some CPUs report i686 but dont implement cx8 and cmov
+       // check for both flags in /proc/cpuinfo and downgrade
+       // to i586 if either is missing (cf bug #18885)
         std::ifstream cpuinfo( "/proc/cpuinfo" );
         if ( cpuinfo )
         {
@@ -83,6 +85,40 @@ namespace zypp
           ERR << "Cant open " << PathInfo("/proc/cpuinfo") << endl;
         }
       }
+      else if ( architecture == Arch_sparc || architecture == Arch_sparc64 )
+      {
+       // Check for sun4[vum] to get the real arch. (bug #566291)
+       std::ifstream cpuinfo( "/proc/cpuinfo" );
+        if ( cpuinfo )
+        {
+          for( iostr::EachLine in( cpuinfo ); in; in.next() )
+          {
+            if ( str::hasPrefix( *in, "type" ) )
+            {
+              if ( in->find( "sun4v" ) != std::string::npos )
+              {
+                architecture = ( architecture == Arch_sparc64 ? Arch_sparc64v : Arch_sparcv9v );
+                WAR << "CPU has 'sun4v': architecture upgraded to '" << architecture << "'" << endl;
+              }
+              else if ( in->find( "sun4u" ) != std::string::npos )
+              {
+                architecture = ( architecture == Arch_sparc64 ? Arch_sparc64 : Arch_sparcv9 );
+                WAR << "CPU has 'sun4u': architecture upgraded to '" << architecture << "'" << endl;
+              }
+              else if ( in->find( "sun4m" ) != std::string::npos )
+              {
+                architecture = Arch_sparcv8;
+                WAR << "CPU has 'sun4m': architecture upgraded to '" << architecture << "'" << endl;
+              }
+              break;
+            }
+          }
+        }
+        else
+        {
+          ERR << "Cant open " << PathInfo("/proc/cpuinfo") << endl;
+        }
+      }
       return architecture;
     }
 
@@ -216,20 +252,22 @@ namespace zypp
         , updateMessagesNotify         ( "single | /usr/lib/zypp/notify-message -p %p" )
         , repo_add_probe               ( false )
         , repo_refresh_delay           ( 10 )
+        , repoLabelIsAlias              ( false )
         , download_use_deltarpm        ( true )
         , download_use_deltarpm_always  ( false )
         , download_media_prefer_download( true )
-        , download_max_concurrent_connections( 2 )
+        , download_max_concurrent_connections( 5 )
         , download_min_download_speed  ( 0 )
         , download_max_download_speed  ( 0 )
         , download_max_silent_tries    ( 5 )
         , commit_downloadMode          ( DownloadDefault )
         , solver_onlyRequires          ( false )
         , solver_allowVendorChange     ( false )
+        , solver_cleandepsOnRemove     ( false )
         , solver_upgradeTestcasesToKeep        ( 2 )
         , solverUpgradeRemoveDroppedPackages( true )
         , apply_locks_file             ( true )
-
+        , pluginsPath                  ( "/usr/lib/zypp/plugins" )
       {
         MIL << "libzypp: " << VERSION << " built " << __DATE__ << " " <<  __TIME__ << endl;
         // override_r has higest prio
@@ -353,6 +391,10 @@ namespace zypp
                 {
                   solver_allowVendorChange.set( str::strToBool( value, solver_allowVendorChange ) );
                 }
+                else if ( entry == "solver.cleandepsOnRemove" )
+                {
+                  solver_cleandepsOnRemove.set( str::strToBool( value, solver_cleandepsOnRemove ) );
+                }
                 else if ( entry == "solver.upgradeTestcasesToKeep" )
                 {
                   solver_upgradeTestcasesToKeep.set( str::strtonum<unsigned>( value ) );
@@ -367,12 +409,7 @@ namespace zypp
                 }
                 else if ( entry == "multiversion" )
                 {
-                 std::list<std::string> multi;
-                  str::split( value, back_inserter(multi), ", \t" );
-                 for ( std::list<string>::const_iterator it = multi.begin();
-                       it != multi.end(); it++) {
-                     multiversion.insert (IdString(*it));
-                 }
+                  str::split( value, inserter( multiversion, multiversion.end() ), ", \t" );
                 }
                 else if ( entry == "locksfile.path" )
                 {
@@ -456,6 +493,7 @@ namespace zypp
     Pathname cfg_config_path;
     Pathname cfg_known_repos_path;
     Pathname cfg_known_services_path;
+
     Pathname cfg_vendor_path;
     Pathname locks_file;
 
@@ -466,6 +504,7 @@ namespace zypp
 
     bool repo_add_probe;
     unsigned repo_refresh_delay;
+    bool repoLabelIsAlias;
 
     bool download_use_deltarpm;
     bool download_use_deltarpm_always;
@@ -480,12 +519,13 @@ namespace zypp
 
     Option<bool>       solver_onlyRequires;
     Option<bool>       solver_allowVendorChange;
+    Option<bool>       solver_cleandepsOnRemove;
     Option<unsigned>   solver_upgradeTestcasesToKeep;
     DefaultOption<bool> solverUpgradeRemoveDroppedPackages;
 
     Pathname solver_checkSystemFile;
 
-    std::set<IdString> multiversion;
+    std::set<std::string> multiversion;
 
     bool apply_locks_file;
 
@@ -494,6 +534,8 @@ namespace zypp
     Pathname history_log_path;
     Pathname credentials_global_dir_path;
     Pathname credentials_global_file_path;
+
+    Option<Pathname> pluginsPath;
   };
   ///////////////////////////////////////////////////////////////////
 
@@ -586,6 +628,8 @@ namespace zypp
     {
       WAR << "Overriding text locale (" << _pimpl->cfg_textLocale << "): " << locale_r << endl;
       _pimpl->cfg_textLocale = locale_r;
+#warning prefer signal
+      sat::Pool::instance().setTextLocale( locale_r );
     }
   }
 
@@ -659,6 +703,12 @@ namespace zypp
     return _pimpl->repo_refresh_delay;
   }
 
+  bool ZConfig::repoLabelIsAlias() const
+  { return _pimpl->repoLabelIsAlias; }
+
+  void ZConfig::repoLabelIsAlias( bool yesno_r )
+  { _pimpl->repoLabelIsAlias = yesno_r; }
+
   bool ZConfig::download_use_deltarpm() const
   { return _pimpl->download_use_deltarpm; }
 
@@ -695,6 +745,9 @@ namespace zypp
   bool ZConfig::solver_allowVendorChange() const
   { return _pimpl->solver_allowVendorChange; }
 
+  bool ZConfig::solver_cleandepsOnRemove() const
+  { return _pimpl->solver_cleandepsOnRemove; }
+
   Pathname ZConfig::solver_checkSystemFile() const
   { return ( _pimpl->solver_checkSystemFile.empty()
       ? (configPath()/"systemCheck") : _pimpl->solver_checkSystemFile ); }
@@ -706,14 +759,9 @@ namespace zypp
   void ZConfig::setSolverUpgradeRemoveDroppedPackages( bool val_r )    { _pimpl->solverUpgradeRemoveDroppedPackages.set( val_r ); }
   void ZConfig::resetSolverUpgradeRemoveDroppedPackages()              { _pimpl->solverUpgradeRemoveDroppedPackages.restoreToDefault(); }
 
-  std::set<IdString> ZConfig::multiversion() const
-  { return _pimpl->multiversion; }
-
-  void ZConfig::addMultiversion(std::string &name)
-  { _pimpl->multiversion.insert(IdString(name)); }
-
-  bool ZConfig::removeMultiversion(std::string &name)
-  { return _pimpl->multiversion.erase(IdString(name)); }
+  const std::set<std::string> & ZConfig::multiversionSpec() const      { return _pimpl->multiversion; }
+  void ZConfig::addMultiversionSpec( const std::string & name_r )      { _pimpl->multiversion.insert( name_r ); }
+  void ZConfig::removeMultiversionSpec( const std::string & name_r )   { _pimpl->multiversion.erase( name_r ); }
 
   bool ZConfig::apply_locks_file() const
   { return _pimpl->apply_locks_file; }
@@ -777,13 +825,18 @@ namespace zypp
 
   ///////////////////////////////////////////////////////////////////
 
+  Pathname ZConfig::pluginsPath() const
+  { return _pimpl->pluginsPath.get(); }
+
+  ///////////////////////////////////////////////////////////////////
+
   std::ostream & ZConfig::about( std::ostream & str ) const
   {
     str << "libzypp: " << VERSION << " built " << __DATE__ << " " <<  __TIME__ << endl;
 
-    str << "satsolver: " << sat_version;
-    if ( ::strcmp( sat_version, SATSOLVER_VERSION_STRING ) )
-      str << " (built against " << SATSOLVER_VERSION_STRING << ")";
+    str << "libsolv: " << sat_version;
+    if ( ::strcmp( sat_version, LIBSOLV_VERSION_STRING ) )
+      str << " (built against " << LIBSOLV_VERSION_STRING << ")";
     str << endl;
 
     str << "zypp.conf: '" << _pimpl->_parsedZyppConf << "'" << endl;