- Add zypp.conf option configdir (/etc/zypp) and arrange
authorMichael Andres <ma@suse.de>
Fri, 9 May 2008 19:39:35 +0000 (19:39 +0000)
committerMichael Andres <ma@suse.de>
Fri, 9 May 2008 19:39:35 +0000 (19:39 +0000)
  all config files and directories to follow {configdir}
  per default.
- Fix zypp-query-pool to print satisfied products and additional
  products defined in {configdir}/products.d for registration.
  (bnc #385868)

VERSION.cmake
devel/devel.ma/NewPool.cc
package/libzypp.changes
tools/registration/zypp-query-pool.cc
zypp.conf
zypp/ZConfig.cc
zypp/ZConfig.h

index f29ea63..395b143 100644 (file)
@@ -45,6 +45,6 @@
 #
 
 SET(LIBZYPP_MAJOR "4")
-SET(LIBZYPP_MINOR "20")
-SET(LIBZYPP_COMPATMINOR "18")
-SET(LIBZYPP_PATCH "1")
+SET(LIBZYPP_MINOR "21")
+SET(LIBZYPP_COMPATMINOR "21")
+SET(LIBZYPP_PATCH "0")
index 15e825f..c451c0c 100644 (file)
@@ -478,9 +478,7 @@ try {
   INT << "===[START]==========================================" << endl;
   ZConfig::instance();
 
-  //parser::ProductConfReader r( &PCDC, "test.prod" );
-  parser::ProductConfReader::scanDir( &PCDC, "." );
-
+  parser::ProductConfReader::scanDir( &PCDC, ZConfig::instance().productsPath() );
   ///////////////////////////////////////////////////////////////////
   INT << "===[END]============================================" << endl << endl;
   zypp::base::LogControl::instance().logNothing();
@@ -573,10 +571,6 @@ try {
   ///////////////////////////////////////////////////////////////////
   ///////////////////////////////////////////////////////////////////
 
-  MIL << sat::LookupAttr( sat::SolvAttr("foo") ) << endl;
-  MIL << sat::LookupAttr( sat::SolvAttr("foo") ).begin() << endl;
-  MIL << sat::LookupAttr( sat::SolvAttr("foo") ).begin().idStr() << endl;
-  MIL << sat::LookupAttr( sat::SolvAttr("foo") ).begin().idStr().id() << endl;
 
   ///////////////////////////////////////////////////////////////////
   INT << "===[END]============================================" << endl << endl;
index 5267816..d07e6a0 100644 (file)
@@ -1,4 +1,16 @@
 -------------------------------------------------------------------
+Fri May  9 21:28:42 CEST 2008 - ma@suse.de
+
+- Add zypp.conf option configdir (/etc/zypp) and arrange 
+  all config files and directories to follow {configdir}
+  per default.
+- Fix zypp-query-pool to print satisfied products and additional 
+  products defined in {configdir}/products.d for registration. 
+  (bnc #385868)
+- version 4.21.0
+- revision 10029
+
+-------------------------------------------------------------------
 Fri May  9 15:30:40 CEST 2008 - jreidinger@suse.cz
 
 - implement remove duplicate entries in lock file (bnc#385967) 
index b4776cc..3c3b437 100644 (file)
@@ -4,6 +4,7 @@
 
 #include <zypp/ZYpp.h>
 #include <zypp/zypp_detail/ZYppReadOnlyHack.h>
+#include <zypp/parser/ProductConfReader.h>
 #include <zypp/ZYppFactory.h>
 #include <zypp/RepoManager.h>
 #include <zypp/base/Logger.h>
@@ -26,7 +27,7 @@ struct ByPresent : public PoolItemFilterFunctor
 {
     bool operator()( const PoolItem & p ) const
     {
-       if ( isKind<Package>(p.resolvable()) )    
+       if ( isKind<Package>(p.resolvable()) )
            return p.status().isInstalled();
        else
            return p.status().isSatisfied();
@@ -76,6 +77,16 @@ public:
 };
 
 
+bool printAdditionalProducts( const zypp::parser::ProductConfData & d )
+{
+  cout << str::form( "i|product|%s|%s|%s|%s|%s\n",
+                        d.name().c_str(),
+                        d.edition().c_str(),
+                        d.arch().c_str(),
+                        d.distName().c_str(),
+                        d.distEdition().c_str() );
+  return true;
+}
 
 
 static void
@@ -109,10 +120,10 @@ query_pool( ZYpp::Ptr Z,
       for ( RepoInfoList::iterator it = repos.begin(); it != repos.end(); ++it )
       {
          RepoInfo & repo( *it );
-         
+
          if ( ! repo.enabled() )
              continue;
-         
+
          MIL << "Loading " << repo << endl;
          if ( ! repoManager.isCached( repo ) )
          {
@@ -133,14 +144,15 @@ query_pool( ZYpp::Ptr Z,
 // add resolvables from the system
   MIL << "Loading target..." << endl;
   Z->target()->load();
+
   MIL << "Loaded target." << endl;
-  
+
   MIL << "Pool has " << Z->pool().size() << " entries" << endl;
-  
+
 // solve to get the status satisfied available
+  getZYpp()->resolver()->setOnlyRequires( true );
   getZYpp()->resolver()->resolvePool();
-  
+
   if ( filter == FILTER_ALL)
   {
       PrintItem printitem( repository );
@@ -151,10 +163,10 @@ query_pool( ZYpp::Ptr Z,
       else
          zypp::invokeOnEach( Z->pool().begin(), Z->pool().end(),                               // all kinds
                              zypp::functor::functorRef<bool,PoolItem> (printitem) );
-      
+
   }
-else
-{
+  else
+  {
     PrintItem printitem( repository );
     if (installed_only)
        zypp::invokeOnEach( Z->pool().byKindBegin( kind ), Z->pool().byKindEnd( kind ), // filter kind
@@ -163,7 +175,18 @@ else
     else
        zypp::invokeOnEach( Z->pool().byKindBegin( kind ), Z->pool().byKindEnd( kind ), // filter kind
                            zypp::functor::functorRef<bool,PoolItem> (printitem) );
-}
+  }
+
+  if ( installed_only
+       && repository.empty()
+       && ( filter == FILTER_ALL || filter == "products" ) )
+  {
+    // write out additional products from /etc/zypp/products.d
+    // if -r is active and no repo filter is defined.
+    zypp::parser::ProductConfReader::scanDir( &printAdditionalProducts,
+                                              ZConfig::instance().productsPath() );
+  }
+
   return;
 }
 
@@ -177,7 +200,7 @@ main (int argc, char **argv)
   string repository;
   bool only_installed = false;
   int offset = 1;
-  
+
   if ( (argc>1) && ( (string(argv[offset]) == "--registrable")
                     || ( string(argv[offset]) == "-r" ) ) )
   {
@@ -188,8 +211,8 @@ main (int argc, char **argv)
   if ( argc > 1 )
   {
       filter = argv[offset];
-      --argc; ++offset; 
-      
+      --argc; ++offset;
+
       if ( argc > 1 )
       {
          repository = argv[offset];
index 0b6ffbe..81d72c8 100644 (file)
--- a/zypp.conf
+++ b/zypp.conf
 
 
 ##
+## Path where the configuration files are kept.
+##
+## Valid values: A directory
+## Default value: /etc/zypp
+##
+# configdir = /etc/zypp
+
+##
 ## Path where the known repositories .repo files are kept
 ##
 ## Valid values: A directory
-## Default value: /etc/zypp/repos.d
+## Default value: {configdir}/repos.d
 ##
 ## Changing this invalidates all known repositories
 ##
 ## Defining directory for equivalent vendors
 ##
 ## Valid values: A directory
-## Default value: /etc/zypp/vendors.d
+## Default value: {configdir}/vendors.d
 ##
 # vendordir = /etc/zypp/vendors.d
 
+
+##
+## Path where additional product information, .prod files are kept
+##
+## Valid values: A directory
+## Default value: {configdir}/products.d
+##
+## Changing this is not recommended, as the directory might
+## be populated by packages dropping files to /etc/zypp/products.d.
+##
+# productsdir = /etc/zypp/products.d
+
+
 ##
 ## Whether required packages are installed ONLY
 ## So recommended packages, language packages and packages which depend
 ## In this file is saved also UI locks.
 ##
 ## valid value: path to file or place where file can be created
-## default value: /etc/zypp/locks
+## default value: {configdir}/locks
 ##
 # locksfile.path = /etc/zypp/locks
 
index bab9174..940b1b8 100644 (file)
@@ -214,6 +214,10 @@ namespace zypp
                 {
                   cfg_packages_path = Pathname(value);
                 }
+                else if ( entry == "configdir" )
+                {
+                  cfg_config_path = Pathname(value);
+                }
                 else if ( entry == "reposdir" )
                 {
                   cfg_known_repos_path = Pathname(value);
@@ -238,6 +242,10 @@ namespace zypp
                 {
                   cfg_vendor_path = Pathname(value);
                 }
+                else if ( entry == "productsdir" )
+                {
+                  cfg_products_path = Pathname(value);
+                }
                 else if ( entry == "solver.onlyRequires" )
                 {
                   solver_onlyRequires = str::strToBool( value, solver_onlyRequires );
@@ -286,13 +294,17 @@ namespace zypp
     Arch     cfg_arch;
     Locale   cfg_textLocale;
 
+    Pathname cfg_cache_path;
     Pathname cfg_metadata_path;
     Pathname cfg_solvfiles_path;
     Pathname cfg_packages_path;
-    Pathname cfg_cache_path;
+
+    Pathname cfg_config_path;
     Pathname cfg_known_repos_path;
     Pathname cfg_vendor_path;
+    Pathname cfg_products_path;
     Pathname locks_file;
+
     Pathname update_scripts_path;
 
     bool repo_add_probe;
@@ -418,13 +430,39 @@ namespace zypp
         ? (repoCachePath()/"packages") : _pimpl->cfg_packages_path );
   }
 
+  ///////////////////////////////////////////////////////////////////
+
+  Pathname ZConfig::configPath() const
+  {
+    return ( _pimpl->cfg_config_path.empty()
+        ? Pathname("/etc/zypp") : _pimpl->cfg_config_path );
+  }
 
   Pathname ZConfig::knownReposPath() const
   {
     return ( _pimpl->cfg_known_repos_path.empty()
-        ? Pathname("/etc/zypp/repos.d") : _pimpl->cfg_known_repos_path );
+        ? (configPath()/"repos.d") : _pimpl->cfg_known_repos_path );
+  }
+  Pathname ZConfig::vendorPath() const
+  {
+    return ( _pimpl->cfg_vendor_path.empty()
+        ? (configPath()/"vendors.d") : _pimpl->cfg_vendor_path );
   }
 
+  Pathname ZConfig::productsPath() const
+  {
+    return ( _pimpl->cfg_products_path.empty()
+        ? (configPath()/"products.d") : _pimpl->cfg_products_path );
+  }
+
+  Pathname ZConfig::locksFile() const
+  {
+    return ( _pimpl->locks_file.empty()
+        ? (configPath()/"locks") : _pimpl->locks_file );
+  }
+
+  ///////////////////////////////////////////////////////////////////
+
   const std::string & ZConfig::cacheDBSplitJoinSeparator() const
   {
     static std::string s("!@$");
@@ -447,21 +485,10 @@ namespace zypp
   bool ZConfig::download_use_deltarpm() const
   { return _pimpl->download_use_deltarpm; }
 
-  Pathname ZConfig::vendorPath() const
-  {
-    return ( _pimpl->cfg_vendor_path.empty()
-        ? Pathname("/etc/zypp/vendors.d") : _pimpl->cfg_vendor_path );
-  }
 
   bool ZConfig::solver_onlyRequires() const
   { return _pimpl->solver_onlyRequires; }
 
-  Pathname ZConfig::locksFile() const
-  {
-    return ( _pimpl->locks_file.empty()
-        ? Pathname("/etc/zypp/locks") : _pimpl->locks_file );
-  }
-
   bool ZConfig::apply_locks_file() const
   {
     return _pimpl->apply_locks_file;
index a71493f..cedf71e 100644 (file)
@@ -84,28 +84,38 @@ namespace zypp
 
     public:
       /**
-       * Path where the caches are kept.
+       * Path where the caches are kept (/var/cache/zypp)
+       * \ingroup g_ZC_REPOCACHE
        */
       Pathname repoCachePath() const;
 
      /**
-       * Path where the repo metadata is downloaded and kept.
-       */
+       * Path where the repo metadata is downloaded and kept (repoCachePath()/raw).
+        * \ingroup g_ZC_REPOCACHE
+      */
       Pathname repoMetadataPath() const;
 
      /**
-       * Path where the repo solv files are created and kept.
-       */
+       * Path where the repo solv files are created and kept (repoCachePath()/solv).
+        * \ingroup g_ZC_REPOCACHE
+      */
       Pathname repoSolvfilesPath() const;
 
       /**
-       * Path where the repo packages are downloaded and kept.
-       */
+       * Path where the repo packages are downloaded and kept (repoCachePath()/packages).
+        * \ingroup g_ZC_REPOCACHE
+      */
       Pathname repoPackagesPath() const;
 
       /**
-       * Path where the known repositories
-       * .repo files are kept
+       * Path where the configfiles are kept (/etc/zypp).
+       * \ingroup g_ZC_CONFIGFILES
+       */
+      Pathname configPath() const;
+
+      /**
+       * Path where the known repositories .repo files are kept (configPath()/repos.d).
+       * \ingroup g_ZC_CONFIGFILES
        */
       Pathname knownReposPath() const;
 
@@ -138,22 +148,30 @@ namespace zypp
       bool download_use_deltarpm() const;
 
       /**
-       * Directory for equivalent vendor definitions
+       * Directory for equivalent vendor definitions  (configPath()/vendors.d)
+       * \ingroup g_ZC_CONFIGFILES
        */
       Pathname vendorPath() const;
 
       /**
+       * Directory for additional product information  (configPath()/products.d)
+       * \ingroup g_ZC_CONFIGFILES
+       */
+      Pathname productsPath() const;
+
+      /**
        * Solver regards required packages,patterns,... only
        */
       bool solver_onlyRequires() const;
 
       /**
-       * Path where zypp can find or create lock file
+       * Path where zypp can find or create lock file (configPath()/locks)
+       * \ingroup g_ZC_CONFIGFILES
        */
-      Pathname  locksFile() const;
+      Pathname locksFile() const;
 
       /**
-       * Whetever locks file should be readed and applied after start
+       * Whether locks file should be read and applied after start
        */
       bool apply_locks_file() const;