Take care target uses --root when creating solv files (bnc #363789)
authorMichael Andres <ma@suse.de>
Fri, 22 Feb 2008 13:54:07 +0000 (13:54 +0000)
committerMichael Andres <ma@suse.de>
Fri, 22 Feb 2008 13:54:07 +0000 (13:54 +0000)
devel/devel.ma/NewPool.cc
package/libzypp.changes
zypp/target/TargetImpl.cc

index 959959c..20417ce 100644 (file)
@@ -361,6 +361,8 @@ void ttt( const char * lhs, const char * rhs )
   DBG << lhs << " <=> " << rhs << " --> " << ::strcmp( lhs, rhs ) << endl;
 }
 
+namespace zypp
+{
 namespace filter
 {
   template <class _MemFun, class _Value>
@@ -383,8 +385,6 @@ namespace filter
   { return HasValue<_MemFun, _Value>( fun_r, val_r ); }
 }
 
-namespace zypp
-{
 }
 
 template <class L>
@@ -422,50 +422,21 @@ namespace zypp
 namespace sat
 { /////////////////////////////////////////////////////////////////
 
-  class ByLocaleSupport
-  {
-    private:
-      typedef bool (sat::Solvable::*LS1) (const Locale &) const;
-      typedef bool (sat::Solvable::*LS2) (const LocaleSet &) const;
-
-    public:
-      /** Solvables with locale support. */
-      ByLocaleSupport()
-      : _sel( mem_fun_ref( &sat::Solvable::supportsLocales ) )
-      {}
-
-      /** Solvables supporting \c locale_r. */
-      ByLocaleSupport( const Locale & locale_r )
-      : _sel( bind( mem_fun_ref( (LS1)&sat::Solvable::supportsLocale ), _1, locale_r ) )
-      {}
-
-      /** Solvables supporting at least one locale in \c locales_r. */
-      ByLocaleSupport( const LocaleSet & locales_r )
-      : _sel( bind( boost::mem_fun_ref( (LS2)&sat::Solvable::supportsLocale ), _1, locales_r ) )
-      {}
-
-    public:
-      bool operator()( const sat::Solvable & solv_r ) const
-      { return _sel && _sel( solv_r ); }
-
-
-      template<class _Solv>
-      bool operator()( const _Solv & solv_r ) const
-      { return operator()( solv_r.satSolvable() ); }
-
-    private:
-      function<bool(const sat::Solvable &)> _sel;
-  };
-
 
   /////////////////////////////////////////////////////////////////
 } // namespace sat
 ///////////////////////////////////////////////////////////////////
-
   /////////////////////////////////////////////////////////////////
 } // namespace zypp
 ///////////////////////////////////////////////////////////////////
 
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
 
 /******************************************************************
 **
@@ -522,7 +493,7 @@ try {
     }
   }
 
-  if ( 0 )
+  if ( 1 )
   {
     Measure x( "INIT TARGET" );
     {
@@ -532,8 +503,17 @@ try {
   }
 
   USR << "pool: " << pool << endl;
+
   ///////////////////////////////////////////////////////////////////
 
+  function<bool(const sat::Solvable &)> _sel( bind( boost::mem_fun_ref( &sat::Solvable::isSystem ), _1 ) );
+  for_( it,
+        satpool.filterBegin( _sel ),
+        satpool.filterEnd  ( _sel ) )
+  {
+    INT << *it << endl;
+  }
+
   satpool.addRequestedLocale( Locale("de") );
   satpool.addRequestedLocale( Locale("cs") );
 
@@ -544,7 +524,7 @@ try {
 
   {
     Measure x( "de" );
-    sat::ByLocaleSupport f( Locale("de") );
+    filter::ByLocaleSupport f( Locale("de") );
     for_( it, satpool.filterBegin(f), satpool.filterEnd(f) )
     {
       MIL << *it << endl;
@@ -555,6 +535,8 @@ try {
 
 
 
+
+
   //MIL << sat::WhatProvides( Capability("amarok") ) << endl;
   //MIL << sat::WhatProvides( Capability("amarok == 1.4.7-37.4") ) << endl;
 
index 5c3794a..251477f 100644 (file)
@@ -1,4 +1,10 @@
 -------------------------------------------------------------------
+Fri Feb 22 14:03:59 CET 2008 - ma@suse.de
+
+- Take care target uses --root when creating solv files (bnc #363789)
+- revision 8881
+
+-------------------------------------------------------------------
 Fri Feb 22 10:10:14 CET 2008 - schubi@suse.de
 
 - Unmaintained packages which does not fit to the updated system
index ca39307..a910280 100644 (file)
@@ -323,36 +323,36 @@ namespace zypp
 
       if ( build_rpm_solv )
       {
+        // Take care we unlink the solvfile on exception
+        ManagedFile guard( rpmsolv, filesystem::unlink );
+        ManagedFile guardcookie( rpmsolvcookie, filesystem::unlink );
+
         filesystem::TmpFile tmpsolv( Pathname::assertprefix( _root, ZConfig::instance().repoCachePath() ) /*dir*/,
-                                     sat::Pool::instance().systemRepoName() /* prefix */);
+                                     sat::Pool::instance().systemRepoName() /* prefix */ );
 
          MIL << "Executing solv converter" << endl;
 
-#warning FIXME add root to rpmdb2solv
-        // FIXME add root to rpmdb2solv
-        string cmd;
-        if ( solvexisted )
-        {
-          MIL << "Old cache found, using it to speed up (merge)" << endl;
-          cmd = str::form( "rpmdb2solv \"%s\" > \"%s\"", rpmsolv.c_str(), tmpsolv.path().c_str() );
-        }
-        else
-        {
-          cmd = str::form( "rpmdb2solv > \"%s\"", tmpsolv.path().c_str() );
-        }
+         // FIXME add root to rpmdb2solv
+         ostringstream cmd;
+         cmd << "rpmdb2solv";
 
-        ExternalProgram prog( cmd, ExternalProgram::Stderr_To_Stdout );
+         if ( ! _root.empty() )
+           cmd << " -r '" << _root << "'";
+
+         if ( solvexisted )
+           cmd << " '" << rpmsolv << "'";
+
+         cmd << "  > '" << tmpsolv.path() << "'";
+
+        ExternalProgram prog( cmd.str(), ExternalProgram::Stderr_To_Stdout );
         for ( string output( prog.receiveLine() ); output.length(); output = prog.receiveLine() ) {
           MIL << "  " << output;
         }
         int ret = prog.close();
+
         if ( ret != 0 )
           ZYPP_THROW(Exception("Failed to cache rpm database"));
 
-        // Take care we unlink the solvfile on exception
-        ManagedFile guard( rpmsolv, filesystem::unlink );
-        ManagedFile guardcookie( rpmsolvcookie, filesystem::unlink );
-
         ret = filesystem::rename( tmpsolv, rpmsolv );
 
         if ( ret != 0 )