summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2016-05-10 19:15:17 +0200
committerJulian Andres Klode <jak@debian.org>2016-05-10 20:53:44 +0200
commit31cc85c5f6392fd85ff19f90714e41726f917a30 (patch)
tree24f630bb1dc86e691ff49c0e01f1e9dcd2d5ba08 /apt-pkg
parenta39467f5d9fc51c9bf32d0f0e42e36041ece6bd5 (diff)
update: Run Post-Invoke-Success if not all sources failed
Failures can happen and APT regardless will do a partial cache update anyway. Because APT ensures that the list directory is in a sane state, it makes sense to also call success hooks if success was only partial - otherwise it loses sync with APT. Most importantly, this causes the appstream cache to be empty, see launchpad bug #1562733. This is somewhat overly optimistic though: As soon as any repository has nonexisting optional files, the missing optional files are also treated as success, which means a single broken repository without an InRelease file still runs Success hooks, even though it really should not. (cherry picked from commit 35664152e47a1d4d712fd52e0f0a2dc8ed359d32)
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/update.cc15
1 files changed, 10 insertions, 5 deletions
diff --git a/apt-pkg/update.cc b/apt-pkg/update.cc
index ca87c6976..0d901eab1 100644
--- a/apt-pkg/update.cc
+++ b/apt-pkg/update.cc
@@ -61,11 +61,14 @@ bool AcquireUpdate(pkgAcquire &Fetcher, int const PulseInterval,
bool Failed = false;
bool TransientNetworkFailure = false;
+ bool AllFailed = true;
for (pkgAcquire::ItemIterator I = Fetcher.ItemsBegin();
I != Fetcher.ItemsEnd(); ++I)
{
- if ((*I)->Status == pkgAcquire::Item::StatDone)
+ if ((*I)->Status == pkgAcquire::Item::StatDone) {
+ AllFailed = false;
continue;
+ }
(*I)->Finished();
@@ -101,22 +104,24 @@ bool AcquireUpdate(pkgAcquire &Fetcher, int const PulseInterval,
// something went wrong with the clean
return false;
}
+
+ bool Res = true;
if (TransientNetworkFailure == true)
- _error->Warning(_("Some index files failed to download. They have been ignored, or old ones used instead."));
+ Res = _error->Warning(_("Some index files failed to download. They have been ignored, or old ones used instead."));
else if (Failed == true)
- return _error->Error(_("Some index files failed to download. They have been ignored, or old ones used instead."));
+ Res = _error->Error(_("Some index files failed to download. They have been ignored, or old ones used instead."));
// Run the success scripts if all was fine
if (RunUpdateScripts == true)
{
- if(!TransientNetworkFailure && !Failed)
+ if(AllFailed == false)
RunScripts("APT::Update::Post-Invoke-Success");
// Run the other scripts
RunScripts("APT::Update::Post-Invoke");
}
- return true;
+ return Res;
}
/*}}}*/