From 47c2b42af60ceefd8ed52b32a3a365facf0e05b8 Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex.kanavin@gmail.com>
Date: Thu, 21 May 2020 20:13:25 +0000
Subject: [PATCH] Revert "always run 'dpkg --configure -a' at the end of our
 dpkg callings"

This reverts commit a2a75ff4516f7609f4c55b42270abb8d08943c60, which
always run 'dpkg --configure -a' at the end of our dpkg callings,
but it does not work for cross-compile, since the rootfs dir can not
be passed into dpkg, and lead to the below similar error:
   -------
   |mkdir: cannot create directory '/usr/lib/opkg': Permission denied
   -------

Upstream-Status: Inappropriate [embedded specific]
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>

---
 apt-pkg/deb/dpkgpm.cc | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index 93effa9..4375781 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -1199,12 +1199,6 @@ void pkgDPkgPM::BuildPackagesProgressMap()
 	 }
       }
    }
-   /* one extra: We don't want the progress bar to reach 100%, especially not
-      if we call dpkg --configure --pending and process a bunch of triggers
-      while showing 100%. Also, spindown takes a while, so never reaching 100%
-      is way more correct than reaching 100% while still doing stuff even if
-      doing it this way is slightly bending the rules */
-   ++PackagesTotal;
 }
                                                                         /*}}}*/
 void pkgDPkgPM::StartPtyMagic()						/*{{{*/
@@ -1741,7 +1735,8 @@ bool pkgDPkgPM::Go(APT::Progress::PackageManager *progress)
 
       // support subpressing of triggers processing for special
       // cases like d-i that runs the triggers handling manually
-      if (_config->FindB("DPkg::ConfigurePending", true))
+      bool const SmartConf = (_config->Find("PackageManager::Configure", "all") != "all");
+      if (0)
 	 List.emplace_back(Item::ConfigurePending, pkgCache::PkgIterator());
    }
    bool const TriggersPending = _config->FindB("DPkg::TriggersPending", false);
