From 0091445d3c2bf83ad0963dd1087a849a44d20993 Mon Sep 17 00:00:00 2001 From: Michael Andres Date: Mon, 1 Dec 2008 18:42:47 +0000 Subject: [PATCH] - Fix install order computation losing some installed packages pre-requirements. (bnc #439802) --- VERSION.cmake | 4 +- devel/devel.ma/Iorder.cc | 152 +++++++++++++++++++++++++------------ package/libzypp.changes | 8 ++ zypp/sat/WhatObsoletes.h | 2 + zypp/solver/detail/InstallOrder.cc | 7 ++ 5 files changed, 124 insertions(+), 49 deletions(-) diff --git a/VERSION.cmake b/VERSION.cmake index 8892aeb..3882ed2 100644 --- a/VERSION.cmake +++ b/VERSION.cmake @@ -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) #======= diff --git a/devel/devel.ma/Iorder.cc b/devel/devel.ma/Iorder.cc index d02358b..69ed9c3 100644 --- a/devel/devel.ma/Iorder.cc +++ b/devel/devel.ma/Iorder.cc @@ -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 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 interested ) { - bool rres = solve(); - ResPool pool( test.pool() ); - for_( it, make_filter_begin(pool), - make_filter_end(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 interested ) -{ USR << "======================================================================" << endl; USR << "=== DELETE" << endl; USR << "======================================================================" << endl; @@ -331,6 +360,13 @@ void display( const pool::GetResolvablesToInsDel & collect, std::set 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 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( "SUSE_SLED" ).status().setTransact( true, ResStatus::USER ); - getPi( "kernel-pae" ).status().setTransact( true, ResStatus::USER ); - getPi( "sled-release" ).status().setTransact( true, ResStatus::USER ); - getPi( "apparmor" ).status().setTransact( true, ResStatus::USER ); - getPi( "desktop-base" ).status().setTransact( true, ResStatus::USER ); - getPi( "desktop-gnome" ).status().setTransact( true, ResStatus::USER ); - getPi( "x11" ).status().setTransact( true, ResStatus::USER ); + getPi( "SUSE_SLES", Edition("11-0"), Arch_ppc64 ).status().setTransact( true, ResStatus::USER ); + vdumpPoolStats( USR << "Transacting:"<< endl, + make_filter_begin(pool), + make_filter_end(pool) ) << endl; upgrade(); } vdumpPoolStats( USR << "Transacting:"<< endl, make_filter_begin(pool), make_filter_end(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 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; } diff --git a/package/libzypp.changes b/package/libzypp.changes index da4383c..9a96ec7 100644 --- a/package/libzypp.changes +++ b/package/libzypp.changes @@ -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 diff --git a/zypp/sat/WhatObsoletes.h b/zypp/sat/WhatObsoletes.h index 94282cf..7e2af1f 100644 --- a/zypp/sat/WhatObsoletes.h +++ b/zypp/sat/WhatObsoletes.h @@ -33,6 +33,8 @@ namespace zypp * * \code * \endcode + * + * \todo Add flag to also add any installed version to the containter. */ class WhatObsoletes : public SolvIterMixin, protected detail::PoolMember diff --git a/zypp/solver/detail/InstallOrder.cc b/zypp/solver/detail/InstallOrder.cc index 68925f2..8bae34b 100644 --- a/zypp/solver/detail/InstallOrder.cc +++ b/zypp/solver/detail/InstallOrder.cc @@ -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() ) -- 2.7.4