prepare default options for package install (e.g. excludedocs)
authorMichael Andres <ma@suse.de>
Fri, 8 Aug 2008 16:13:28 +0000 (16:13 +0000)
committerMichael Andres <ma@suse.de>
Fri, 8 Aug 2008 16:13:28 +0000 (16:13 +0000)
zypp.conf
zypp/ZConfig.cc
zypp/ZConfig.h
zypp/target/TargetImpl.cc

index b75bb51..33a075f 100644 (file)
--- a/zypp.conf
+++ b/zypp.conf
 ## vendors = nvidia,suse,opensuse
 ##
 ## ------------------------- file contains end -----------------------
-## Libzypp makes an string comparision (like strncmp, case-insensitive) 
-## whereas the beginning of the strings are compared only. 
+## Libzypp makes an string comparision (like strncmp, case-insensitive)
+## whereas the beginning of the strings are compared only.
 ## e.G. vendor "opensuse11.0" is compatible to "openSuSE".
 ##
 ## Valid values: A directory
 # solver.onlyRequires = false
 
 ##
-## This file contains requirements/conflicts which fulfill the 
+## This file contains requirements/conflicts which fulfill the
 ## needs of a running system.
 ## For example the system would be broken if not glibc or kernel is
-## installed. 
+## installed.
 ## So the user will be informed if these packages will be deleted.
-## 
+##
 ## format: Each line represents one dependency:
 ## e.g.
 ## requires:kernel
 # solver.checkSystemFile = /etc/zypp/systemCheck
 
 ##
-## Packages which are parallel installable with 
+## Packages which are parallel installable with
 ## diffent versions
 ##
 # multiversion = kernel-default,kernel-smp
 ##
 # update.scriptsdir = /var/adm/update-scripts
 
-
+##
+## Options for package installation: excludedocs
+##
+## Don't install any files which are marked as documentation.
+##
+## Valid values:  boolean
+## Default value: no
+##
+# rpm.install.excludedocs = no
index b3f05a5..63aacc0 100644 (file)
@@ -251,13 +251,13 @@ namespace zypp
                 }
                 else if ( entry == "multiversion" )
                 {
-                 std::list<std::string> multi;  
+                 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));  
+                     multiversion.insert (IdString(*it));
                  }
-                }              
+                }
                 else if ( entry == "locksfile.path" )
                 {
                   locks_file = Pathname(value);
@@ -278,7 +278,10 @@ namespace zypp
                 {
                   update_messages_path = Pathname(value);
                 }
-
+                else if ( entry == "rpm.install.excludedocs" )
+                {
+                  rpmInstallExcludedocs = true;
+                }
               }
             }
           }
@@ -334,11 +337,13 @@ namespace zypp
 
     bool solver_onlyRequires;
     Pathname solver_checkSystemFile;
-      
-    std::set<IdString> multiversion;  
+
+    std::set<IdString> multiversion;
 
     bool apply_locks_file;
 
+    DefaultIntegral<bool,false> rpmInstallExcludedocs;
+
   };
   ///////////////////////////////////////////////////////////////////
 
@@ -524,9 +529,9 @@ namespace zypp
 
   void ZConfig::addMultiversion(std::string &name)
   { _pimpl->multiversion.insert(IdString(name)); }
-    
+
   bool ZConfig::removeMultiversion(std::string &name)
-  { return _pimpl->multiversion.erase(IdString(name)); }      
+  { return _pimpl->multiversion.erase(IdString(name)); }
 
   bool ZConfig::apply_locks_file() const
   {
@@ -552,6 +557,11 @@ namespace zypp
              ? Pathname(update_dataPath()/"update-scripts") : _pimpl->update_scripts_path );
   }
 
+  ///////////////////////////////////////////////////////////////////
+
+  bool ZConfig::rpmInstallExcludedocs() const
+  { return _pimpl->rpmInstallExcludedocs; }
+
   /////////////////////////////////////////////////////////////////
 } // namespace zypp
 ///////////////////////////////////////////////////////////////////
index c639093..0ae1fdc 100644 (file)
@@ -186,10 +186,10 @@ namespace zypp
       /**
        * Packages which can be installed parallel with different versions
        * Returning a set of package names (IdString)
-       */      
+       */
       std::set<IdString> multiversion() const;
       void addMultiversion(std::string &name);
-      bool removeMultiversion(std::string &name);      
+      bool removeMultiversion(std::string &name);
 
       /**
        * Path where zypp can find or create lock file (configPath()/locks)
@@ -198,7 +198,7 @@ namespace zypp
       Pathname locksFile() const;
 
       /**
-       * Whether locks file should be read and applied after start
+       * Whether locks file should be read and applied after start (true)
        */
       bool apply_locks_file() const;
 
@@ -220,6 +220,13 @@ namespace zypp
       Pathname update_messagesPath() const;
 
     public:
+      /** \name Options for package installation */
+      //@{
+      /** Don't install any files which are marked as documentation (false). */
+      bool rpmInstallExcludedocs() const;
+      //@}
+
+    public:
       class Impl;
       /** Dtor */
       ~ZConfig();
index a078593..571f7af 100644 (file)
@@ -291,11 +291,11 @@ namespace zypp
       // create the anonymous unique id
       // this value is used for statistics
       Pathname idpath( home() / "AnonymousUniqueId");
-      
+
       if ( ! PathInfo( idpath ).isExist() )
       {
           MIL << "creating anonymous unique id" << endl;
-          
+
           // if the file does not exist we need to generate the uuid file
           const char* argv[] =
           {
@@ -321,7 +321,7 @@ namespace zypp
                   line = prog.receiveLine() )
               {
                   MIL << line << endl;
-                  
+
                   idfile << line;
               }
               prog.close();
@@ -730,6 +730,7 @@ namespace zypp
             //
             if (p->installOnly()) flags |= rpm::RpmDb::RPMINST_NOUPGRADE;
             if (policy_r.dryRun()) flags |= rpm::RpmDb::RPMINST_TEST;
+            if (policy_r.rpmExcludeDocs()) flags |= rpm::RpmDb::RPMINST_NODOCS;
             if (policy_r.rpmNoSignature()) flags |= rpm::RpmDb::RPMINST_NOSIGNATURE;
 
             try