summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2016-06-29 16:10:12 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2016-06-29 16:10:12 +0200
commit309f497b7280a45e3626493318adb6d39ba5c69b (patch)
tree00f8f904cf09410c28e574a8028fb79522bf32cd /apt-pkg
parent520931867ee2fac8415a624204414d3b62550996 (diff)
write auto-bits before calling dpkg & again after if needed
Writing first means that even in the event of a power-failure the autobit is saved for future processing instead of "forgotten" so that the package is treated as manually installed. In some cases we have to re-run the writing after dpkg is done through as dpkg can let packages disappear and in such cases apt will move autobits around (or in that case non-autobits) which we need to store.
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/deb/dpkgpm.cc13
1 files changed, 10 insertions, 3 deletions
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index 5e27c2686..9854fced8 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -1216,6 +1216,11 @@ bool pkgDPkgPM::Go(APT::Progress::PackageManager *progress)
if (RunScriptsWithPkgs("DPkg::Pre-Install-Pkgs") == false)
return false;
+ auto const noopDPkgInvocation = _config->FindB("Debug::pkgDPkgPM",false);
+ // store auto-bits as they are supposed to be after dpkg is run
+ if (noopDPkgInvocation == false)
+ Cache.writeStateFile(NULL);
+
decltype(List)::const_iterator::difference_type const notconfidx =
_config->FindB("Dpkg::ExplicitLastConfigure", false) ? std::numeric_limits<decltype(notconfidx)>::max() :
std::distance(List.cbegin(), std::find_if_not(List.crbegin(), List.crend(), [](Item const &i) { return i.Op == Item::Configure; }).base());
@@ -1396,7 +1401,7 @@ bool pkgDPkgPM::Go(APT::Progress::PackageManager *progress)
J = I;
- if (_config->FindB("Debug::pkgDPkgPM",false) == true)
+ if (noopDPkgInvocation == true)
{
for (std::vector<const char *>::const_iterator a = Args.begin();
a != Args.end(); ++a)
@@ -1577,7 +1582,7 @@ bool pkgDPkgPM::Go(APT::Progress::PackageManager *progress)
if (pkgPackageManager::SigINTStop)
_error->Warning(_("Operation was interrupted before it could finish"));
- if (_config->FindB("Debug::pkgDPkgPM",false) == false)
+ if (noopDPkgInvocation == false)
{
std::string const oldpkgcache = _config->FindFile("Dir::cache::pkgcache");
if (oldpkgcache.empty() == false && RealFileExists(oldpkgcache) == true &&
@@ -1594,7 +1599,9 @@ bool pkgDPkgPM::Go(APT::Progress::PackageManager *progress)
}
}
- Cache.writeStateFile(NULL);
+ // disappearing packages can forward their auto-bit
+ if (disappearedPkgs.empty() == false)
+ Cache.writeStateFile(NULL);
d->progress->Stop();