- Fix install order computation losing some installed packages
authorMichael Andres <ma@suse.de>
Mon, 1 Dec 2008 18:42:47 +0000 (18:42 +0000)
committerMichael Andres <ma@suse.de>
Mon, 1 Dec 2008 18:42:47 +0000 (18:42 +0000)
  pre-requirements. (bnc #439802)

VERSION.cmake
devel/devel.ma/Iorder.cc
package/libzypp.changes
zypp/sat/WhatObsoletes.h
zypp/solver/detail/InstallOrder.cc

index 8892aeb..3882ed2 100644 (file)
@@ -61,8 +61,8 @@
 SET(LIBZYPP_MAJOR "5")
 SET(LIBZYPP_COMPATMINOR "23")
 SET(LIBZYPP_MINOR "24")
-SET(LIBZYPP_PATCH "4")
+SET(LIBZYPP_PATCH "5")
 #
-# LAST RELEASED: 5.24.4 (23)
+# LAST RELEASED: 5.24.5 (23)
 # (The number in parenthesis is LIBZYPP_COMPATMINOR)
 #=======
index d02358b..69ed9c3 100644 (file)
@@ -5,12 +5,50 @@
 
 #include "zypp/pool/GetResolvablesToInsDel.h"
 
-Pathname mroot( "/tmp/Bb" );
-TestSetup test( mroot, Arch_ppc64 );
+void Dbg( ui::Selectable::Ptr s )
+{
+  SEC << dump(s) << endl;
+  if ( s->installedObj() )
+  {
+    PoolItem pi( s->installedObj() );
+    DBG << pi.satSolvable().obsoletes() << endl;
+    sat::WhatObsoletes obs( pi );
+    INT << "WhatObsoletes " <<  pi << " " << obs << endl;
+  }
+  if ( s->candidateObj() )
+  {
+    PoolItem pi( s->candidateObj() );
+    DBG << pi.satSolvable().obsoletes() << endl;
+    sat::WhatObsoletes obs( pi );
+    INT << "WhatObsoletes " <<  pi << " " << obs << endl;
+  }
+
+}
+
+///////////////////////////////////////////////////////////////////
+
+static std::string appname( "ToolIorder" );
+
+void message( const std::string & msg_r )
+{
+  cerr << "*** " << msg_r << endl;
+}
+
+int usage( const std::string & msg_r = std::string(), int exit_r = 100 )
+{
+  if ( ! msg_r.empty() )
+  {
+    cerr << endl;
+    message( msg_r );
+    cerr << endl;
+  }
+  cerr << "Usage: " << appname << "[OPTIONS] TESTCASE" << endl;
+  cerr << "  Load testcase and analyze install order." << endl;
+  return exit_r;
+}
+
+///////////////////////////////////////////////////////////////////
 
-#define LCStack   "IOrder::Stack"
-#define LCCache   "IOrder::Cache"
-#define LCVerbose "IOrder::Verbose"
 
 bool progressReceiver( const ProgressData & v )
 {
@@ -18,6 +56,12 @@ bool progressReceiver( const ProgressData & v )
   return true;
 }
 
+///////////////////////////////////////////////////////////////////
+
+#define LCStack   "IOrder::Stack"
+#define LCCache   "IOrder::Cache"
+#define LCVerbose "IOrder::Verbose"
+
 struct RunnableCache
 {
   typedef std::tr1::unordered_map<sat::Solvable,TriBool> CacheType;
@@ -177,7 +221,7 @@ struct RunnableCache
       if ( _stack.back() == solv_r )
       {
         _stack.pop_back();
-        _ltag = str::form( "[%0l4u]", _stack.size() );
+        _ltag = str::form( "[%04lu]", _stack.size() );
         return true;
       }
       // stack corrupted?
@@ -226,7 +270,7 @@ bool solve()
   USR << "Solve " << run++ << endl;
   bool rres = false;
   {
-    //zypp::base::LogControl::TmpLineWriter shutUp;
+    zypp::base::LogControl::TmpLineWriter shutUp;
     rres = getZYpp()->resolver()->resolvePool();
   }
   if ( ! rres )
@@ -239,34 +283,19 @@ bool solve()
   return true;
 }
 
-bool verify()
+void display( const pool::GetResolvablesToInsDel & collect, std::set<IdString> interested )
 {
-  bool rres = solve();
-  ResPool pool( test.pool() );
-  for_( it, make_filter_begin<resfilter::ByTransact>(pool),
-        make_filter_end<resfilter::ByTransact>(pool) )
+  if ( ! interested.empty() )
   {
-    if ( it->status().transacts() &&
-         it->status().isBySolver() )
+    USR << "======================================================================" << endl;
+    USR << "=== INTERESTED" << endl;
+    USR << "======================================================================" << endl;
+    for_( it, interested.begin(), interested.end() )
     {
-      WAR << "MISSING " << *it << endl;
+      MIL << dump(ui::Selectable::get( *it )) << endl;
     }
   }
-  return rres;
-}
-
-inline void save()
-{
-  test.poolProxy().saveState();
-}
-
-inline void restore()
-{
-  test.poolProxy().restoreState();
-}
 
-void display( const pool::GetResolvablesToInsDel & collect, std::set<IdString> interested )
-{
   USR << "======================================================================" << endl;
   USR << "=== DELETE" << endl;
   USR << "======================================================================" << endl;
@@ -331,6 +360,13 @@ void display( const pool::GetResolvablesToInsDel & collect, std::set<IdString> i
 
       rcache.clear();
 
+      for_( it, p->installedBegin(), p->installedEnd() )
+      {
+        if ( ! rcache.isInstallable( *it ) )
+        {
+          USR << "FAILED OLD " << *it << endl;
+        }
+      }
       sat::WhatObsoletes obs( *it );
       for_( it, obs.begin(), obs.end() )
       {
@@ -340,6 +376,7 @@ void display( const pool::GetResolvablesToInsDel & collect, std::set<IdString> i
         }
       }
 
+
       if ( ! rcache.isInstallable( *it ) )
       {
         USR << "FAILED INS " << *it << endl;
@@ -371,48 +408,69 @@ void display( const pool::GetResolvablesToInsDel & collect )
 int main( int argc, char * argv[] )
 {
   INT << "===[START]==========================================" << endl;
+  appname = Pathname::basename( argv[0] );
+  --argc;
+  ++argv;
+
+  if ( ! argc )
+  {
+    return usage();
+  }
+
+  ///////////////////////////////////////////////////////////////////
+
+  Pathname mtest( "/suse/ma/BUGS/439802/bug439802/YaST2/solverTestcase" );
+  Arch     march( Arch_ppc64 );
+
+  while ( argc )
+  {
+    --argc;
+    ++argv;
+  }
+
+  if ( mtest.empty() )
+  {
+    return usage( "Missing Testcase", 102 );
+  }
 
-  Pathname mroot( "/tmp/Bb" );
-  TestSetup test( mroot, Arch_i686 ); // <<< arch
+  ///////////////////////////////////////////////////////////////////
 
-  ResPool pool( test.pool() );
+  TestSetup test( march );
+  ResPool   pool( test.pool() );
   sat::Pool satpool( test.satpool() );
 
   {
     zypp::base::LogControl::TmpLineWriter shutUp;
     test.loadTarget();
-    test.loadTestcaseRepos( "/suse/ma/BUGS/153548/YaST2/solverTestcase" ); // <<< repos
+    test.loadTestcaseRepos( mtest ); // <<< repos
   }
-  save();
-
+  test.poolProxy().saveState();
 
   { // <<< transaction
     zypp::base::LogControl::TmpLineWriter shutUp;
-    getPi<Product>( "SUSE_SLED" ).status().setTransact( true, ResStatus::USER );
-    getPi<Package>( "kernel-pae" ).status().setTransact( true, ResStatus::USER );
-    getPi<Package>( "sled-release" ).status().setTransact( true, ResStatus::USER );
-    getPi<Pattern>( "apparmor" ).status().setTransact( true, ResStatus::USER );
-    getPi<Pattern>( "desktop-base" ).status().setTransact( true, ResStatus::USER );
-    getPi<Pattern>( "desktop-gnome" ).status().setTransact( true, ResStatus::USER );
-    getPi<Pattern>( "x11" ).status().setTransact( true, ResStatus::USER );
+    getPi<Product>( "SUSE_SLES", Edition("11-0"), Arch_ppc64 ).status().setTransact( true, ResStatus::USER );
+    vdumpPoolStats( USR << "Transacting:"<< endl,
+                  make_filter_begin<resfilter::ByTransact>(pool),
+                  make_filter_end<resfilter::ByTransact>(pool) ) << endl;
     upgrade();
   }
   vdumpPoolStats( USR << "Transacting:"<< endl,
                   make_filter_begin<resfilter::ByTransact>(pool),
                   make_filter_end<resfilter::ByTransact>(pool) ) << endl;
+
   pool::GetResolvablesToInsDel collect( pool, pool::GetResolvablesToInsDel::ORDER_BY_MEDIANR );
 
-  USR << ui::Selectable::get( "libtiff" ) << endl;
 
-  restore();
+
+  test.poolProxy().restoreState();
   {
-    //base::LogControl::TmpLineWriter shutUp( new log::FileLineWriter( "iorder.log" ) );
+    base::LogControl::TmpLineWriter shutUp( new log::FileLineWriter( "iorder.log" ) );
     std::set<IdString> interested;
-    interested.insert( IdString("libtiff") );
+    //interested.insert( IdString("fillup") );
     display( collect, interested );
   }
 
- INT << "===[END]============================================" << endl << endl;
 INT << "===[END]============================================" << endl << endl;
   zypp::base::LogControl::TmpLineWriter shutUp;
   return 0;
 }
index da4383c..9a96ec7 100644 (file)
@@ -1,4 +1,12 @@
 -------------------------------------------------------------------
+Mon Dec  1 19:38:24 CET 2008 - ma@suse.de
+
+- Fix install order computation losing some installed packages
+  pre-requirements. (bnc #439802)
+- revision 11845
+- version 5.24.5 (23)
+
+-------------------------------------------------------------------
 Fri Nov 28 16:33:56 CET 2008 - ma@suse.de
 
 - Prune soft locks to prevent installation but not update of 
index 94282cf..7e2af1f 100644 (file)
@@ -33,6 +33,8 @@ namespace zypp
      *
      * \code
      * \endcode
+     *
+     * \todo Add flag to also add any installed version to the containter.
      */
     class WhatObsoletes : public SolvIterMixin<WhatObsoletes,detail::WhatProvidesIterator>,
                           protected detail::PoolMember
index 68925f2..8bae34b 100644 (file)
@@ -197,6 +197,13 @@ InstallOrder::rdfsvisit (const PoolItem item)
 
     // items prereq
     CapabilitySet prq( item->dep(Dep::PREREQUIRES).begin(), item->dep(Dep::PREREQUIRES).end() );
+    // an installed items prereq (in case they are reqired for uninstall scripts)
+    ui::Selectable::Ptr sel( ui::Selectable::get( item ) );
+    for_( it, sel->installedBegin(), sel->installedEnd() )
+    {
+      Capabilities p( it->satSolvable().prerequires() );
+      prq.insert( p.begin(), p.end() );
+    }
     // any obsoleted items prereq (in case they are reqired for uninstall scripts)
     sat::WhatObsoletes obs( item );
     for_( it, obs.begin(), obs.end() )