From 642ebc1a04c9c7915474c57f1143a9389ee6636a Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 24 May 2010 20:10:11 +0200 Subject: [PATCH] - show at the end of the install process a list of disappeared packages * apt-pkg/packagemanager.h: - export info about disappeared packages with GetDisappearedPackages() --- apt-pkg/deb/dpkgpm.cc | 5 +++++ apt-pkg/packagemanager.h | 16 ++++++++++++++-- cmdline/apt-get.cc | 21 +++++++++++++++++++-- debian/changelog | 3 +++ 4 files changed, 41 insertions(+), 4 deletions(-) diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index a640a0c7..8318fe37 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -468,6 +468,9 @@ void pkgDPkgPM::ProcessDpkgStatusLine(int OutStatusFd, char *line) write(OutStatusFd, status.str().c_str(), status.str().size()); if (Debug == true) std::clog << "send: '" << status.str() << "'" << endl; + + if (strncmp(action, "disappear", strlen("disappear")) == 0) + disappearedPkgs.insert(string(pkg_or_trigger)); return; } @@ -913,6 +916,8 @@ bool pkgDPkgPM::Go(int OutStatusFd) { if((*I).Pkg.end() == true) continue; + if (I->Op == Item::Configure && disappearedPkgs.find(I->Pkg.Name()) != disappearedPkgs.end()) + continue; Args[n++] = I->Pkg.Name(); Size += strlen(Args[n-1]); } diff --git a/apt-pkg/packagemanager.h b/apt-pkg/packagemanager.h index af1476b7..efd2cfac 100644 --- a/apt-pkg/packagemanager.h +++ b/apt-pkg/packagemanager.h @@ -28,6 +28,7 @@ #include #include #include +#include using std::string; @@ -47,7 +48,15 @@ class pkgPackageManager : protected pkgCache::Namespace pkgDepCache &Cache; pkgOrderList *List; bool Debug; - + + /** \brief saves packages dpkg let disappear + + This way APT can retreat from trying to configure these + packages later on and a frontend can choose to display a + notice to inform the user about these disappears. + */ + std::set disappearedPkgs; + bool DepAdd(pkgOrderList &Order,PkgIterator P,int Depth = 0); void ImmediateAdd(PkgIterator P, bool UseInstallVer, unsigned const int &Depth = 0); virtual OrderResult OrderInstall(); @@ -93,7 +102,10 @@ class pkgPackageManager : protected pkgCache::Namespace // stuff that needs to be done after the fork OrderResult DoInstallPostFork(int statusFd=-1); bool FixMissing(); - + + /** \brief returns all packages dpkg let disappear */ + inline std::set GetDisappearedPackages() { return disappearedPkgs; }; + pkgPackageManager(pkgDepCache *Cache); virtual ~pkgPackageManager(); }; diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index dd5ef174..44235e35 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1044,7 +1044,7 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true, if (Res == pkgPackageManager::Failed || _error->PendingError() == true) return false; if (Res == pkgPackageManager::Completed) - return true; + break; // Reload the fetcher object and loop again for media swapping Fetcher.Shutdown(); @@ -1052,7 +1052,24 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true, return false; _system->Lock(); - } + } + + std::set const disappearedPkgs = PM->GetDisappearedPackages(); + if (disappearedPkgs.empty() == true) + return true; + + string disappear; + for (std::set::const_iterator d = disappearedPkgs.begin(); + d != disappearedPkgs.end(); ++d) + disappear.append(*d).append(" "); + + ShowList(c1out, P_("The following package disappeared from your system as\n" + "all files have been overwritten by other packages:", + "The following packages disappeared from your system as\n" + "all files have been overwritten by other packages:", disappearedPkgs.size()), disappear, ""); + c0out << _("Note: This is done automatic and on purpose by dpkg.") << std::endl; + + return true; } /*}}}*/ // TryToInstall - Try to install a single package /*{{{*/ diff --git a/debian/changelog b/debian/changelog index c9a7f2e3..f932b48a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,7 @@ apt (0.7.26~exp5) UNRELEASED; urgency=low - rerun dpkg-source in source if --fix-broken is given (Closes: #576752) - don't suggest held packages as they are installed (Closes: #578135) - handle multiple --{tar,diff,dsc}-only options correctly + - show at the end of the install process a list of disappeared packages * cmdline/apt-cache.cc: - use GroupCount for package names in stats and add a package struct line * methods/rred.cc: @@ -37,6 +38,8 @@ apt (0.7.26~exp5) UNRELEASED; urgency=low - remove the gnome-apt reference as it is removed from unstable * apt-pkg/deb/dpkgpm.cc: - add 'disappear' to the known processing states, thanks Jonathan Nieder + * apt-pkg/packagemanager.h: + - export info about disappeared packages with GetDisappearedPackages() [ Jari Aalto ] * debian/rules: -- 2.20.1