Bladeren bron

ensure all configures are reported to hook scripts

A planner might not explicitly configure all packages, but we need to
know all packages which will be configured for progress reporting and to
tell the hook scripts about them as they rely on this for their own
functionality.
David Kalnischkies 10 jaren geleden
bovenliggende
commit
9ffbac99e5
1 gewijzigde bestanden met toevoegingen van 17 en 0 verwijderingen
  1. 17 0
      apt-pkg/deb/dpkgpm.cc

+ 17 - 0
apt-pkg/deb/dpkgpm.cc

@@ -53,6 +53,7 @@
 #include <string>
 #include <string>
 #include <type_traits>
 #include <type_traits>
 #include <utility>
 #include <utility>
+#include <unordered_set>
 #include <vector>
 #include <vector>
 #include <sstream>
 #include <sstream>
 #include <numeric>
 #include <numeric>
@@ -1283,6 +1284,22 @@ bool pkgDPkgPM::Go(APT::Progress::PackageManager *progress)
 	       std::find_if_not(List.crbegin(), List.crend(), [](Item const &i) { return i.Op == Item::Configure; }),
 	       std::find_if_not(List.crbegin(), List.crend(), [](Item const &i) { return i.Op == Item::Configure; }),
 	       List.crend(), [](Item const &i) { return i.Op == Item::Remove || i.Op == Item::Purge; }).base());
 	       List.crend(), [](Item const &i) { return i.Op == Item::Remove || i.Op == Item::Purge; }).base());
 
 
+   // explicitely configure everything for hookscripts and progress building
+   {
+      std::unordered_set<decltype(pkgCache::Package::ID)> alreadyConfigured;
+      for (auto && I : List)
+	 if (I.Op == Item::Configure)
+	    alreadyConfigured.insert(I.Pkg->ID);
+      decltype(List) AppendList;
+      for (auto && I : List)
+	 if (I.Op == Item::Install && alreadyConfigured.insert(I.Pkg->ID).second == true)
+	    AppendList.emplace_back(Item::Configure, I.Pkg);
+      for (auto Pkg = Cache.PkgBegin(); Pkg.end() == false; ++Pkg)
+	 if (Pkg.State() == pkgCache::PkgIterator::NeedsConfigure && alreadyConfigured.insert(Pkg->ID).second == true)
+	    AppendList.emplace_back(Item::Configure, Pkg);
+      std::move(AppendList.begin(), AppendList.end(), std::back_inserter(List));
+   }
+
    auto const ItemIsEssential = [](pkgDPkgPM::Item const &I) {
    auto const ItemIsEssential = [](pkgDPkgPM::Item const &I) {
       static auto const cachegen = _config->Find("pkgCacheGen::Essential");
       static auto const cachegen = _config->Find("pkgCacheGen::Essential");
       if (cachegen == "none" || cachegen == "native")
       if (cachegen == "none" || cachegen == "native")