Просмотр исходного кода

- show at the end of the install process a list of disappeared packages
* apt-pkg/packagemanager.h:
- export info about disappeared packages with GetDisappearedPackages()

David Kalnischkies лет назад: 16
Родитель
Сommit
642ebc1a04
4 измененных файлов с 41 добавлено и 4 удалено
  1. 5 0
      apt-pkg/deb/dpkgpm.cc
  2. 14 2
      apt-pkg/packagemanager.h
  3. 19 2
      cmdline/apt-get.cc
  4. 3 0
      debian/changelog

+ 5 - 0
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]);
 	 }	 

+ 14 - 2
apt-pkg/packagemanager.h

@@ -28,6 +28,7 @@
 #include <iostream>
 #include <apt-pkg/pkgcache.h>
 #include <apt-pkg/depcache.h>
+#include <set>
 
 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<std::string> 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<std::string> GetDisappearedPackages() { return disappearedPkgs; };
+
    pkgPackageManager(pkgDepCache *Cache);
    virtual ~pkgPackageManager();
 };

+ 19 - 2
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<std::string> const disappearedPkgs = PM->GetDisappearedPackages();
+   if (disappearedPkgs.empty() == true)
+      return true;
+
+   string disappear;
+   for (std::set<std::string>::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			/*{{{*/

+ 3 - 0
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: