From: Klaus Kaempf Date: Thu, 2 Feb 2006 17:53:13 +0000 (+0000) Subject: sort uninstall correctly X-Git-Tag: 6.6.0~5397 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c616f79a6158b1d5b56e6933ff47d308acc5d6fc;p=platform%2Fupstream%2Flibzypp.git sort uninstall correctly --- diff --git a/zypp/target/TargetImpl.cc b/zypp/target/TargetImpl.cc index a4ae17cb4..ddd0b0055 100644 --- a/zypp/target/TargetImpl.cc +++ b/zypp/target/TargetImpl.cc @@ -92,18 +92,34 @@ namespace zypp { to_install.push_back(*it); } - else if (it->status().isToBeUninstalled()) + else if (it->status().isToBeUninstalled() + && !it->status().isToBeUninstalledDueToObsolete()) // leave out obsoletes { to_uninstall.push_back(*it); } - else if (it->status().isInstalled()) + else if (it->status().staysInstalled()) { installed.push_back(*it); } } - // first uninstall what is to be uninstalled -#warning FIXME this orderding doesn't honor the dependencies for removals - commit(to_uninstall); + + if (to_uninstall.size() > 0 ) { + + // sort delete list... + + InstallOrder order(pool_r, to_uninstall, installed); + order.init(); + const PoolItemList & uninstallorder(order.getTopSorted()); + + to_uninstall.clear(); + for (PoolItemList::const_reverse_iterator it = uninstallorder.rbegin(); it != uninstallorder.rend(); ++it ) { + to_uninstall.push_back (*it); + } + + // first uninstall what is to be uninstalled + commit(to_uninstall); + } + // now install what is to be installed InstallOrder order(pool_r, to_install, installed); order.init(); @@ -182,6 +198,17 @@ namespace zypp bool TargetImpl::providesFile (const std::string & name_str, const std::string & path_str) const { return _rpm.hasFile(path_str); } + + +void +TargetImpl::getResolvablesToInsDel ( ResPool pool_r, + PoolItemList & dellist_r, + PoolItemList & instlist_r, + PoolItemList & srclist_r ) +{ +} + + ///////////////////////////////////////////////////////////////// } // namespace target /////////////////////////////////////////////////////////////////// diff --git a/zypp/target/TargetImpl.h b/zypp/target/TargetImpl.h index 847f5f5cd..d212e2168 100644 --- a/zypp/target/TargetImpl.h +++ b/zypp/target/TargetImpl.h @@ -61,7 +61,13 @@ namespace zypp /** All resolvables in the target. */ const ResStore & resolvables(); - /** Comomit changes in the pool */ + /** Sort according to prereqs and media numbers */ + void getResolvablesToInsDel ( ResPool pool_r, + PoolItemList & dellist_r, + PoolItemList & instlist_r, + PoolItemList & srclist_r ); + + /** Commit changes in the pool */ #warning Add support for multiple medias - eg. limit only to CD1 void commit(ResPool pool_r);