On 29 December 2011 04:57, Daniel Hartwig <mand...@gmail.com> wrote: > tags 451137 + patch > thanks > > > Attached patch pulls in error reporting from ListUpdate [1] for > cmdline and curses interface. > > > [1] apt-pkg/algorithms.cc
Attached.
From 71a3720e11cd99a62b85141ca2bd32f1ec8fa240 Mon Sep 17 00:00:00 2001 From: Daniel Hartwig <mand...@gmail.com> Date: Thu, 29 Dec 2011 04:06:14 +0800 Subject: [PATCH 1/2] Report update errors. --- src/generic/apt/download_update_manager.cc | 18 +++++++++++++++++- 1 files changed, 17 insertions(+), 1 deletions(-) diff --git a/src/generic/apt/download_update_manager.cc b/src/generic/apt/download_update_manager.cc index c27fbbf..b6b49ea 100644 --- a/src/generic/apt/download_update_manager.cc +++ b/src/generic/apt/download_update_manager.cc @@ -27,6 +27,7 @@ #include <apt-pkg/cachefile.h> #include <apt-pkg/clean.h> #include <apt-pkg/error.h> +#include <apt-pkg/strutl.h> #include <cwidget/generic/util/exception.h> #include <cwidget/generic/util/ssprintf.h> @@ -300,13 +301,19 @@ void download_update_manager::finish(pkgAcquire::RunResult res, (*it)->Finished(); + ::URI uri((*it)->DescURI()); + uri.User.clear(); + uri.Password.clear(); + string descUri = string(uri); + _error->Warning(_("Failed to fetch %s %s\n"), descUri.c_str(), + (*it)->ErrorText.c_str()); + if((*it)->Status == pkgAcquire::Item::StatTransientNetworkError) { transientNetworkFailure = true; continue; } - // Q: should I display an error message for this source? rval = failure; } @@ -323,6 +330,15 @@ void download_update_manager::finish(pkgAcquire::RunResult res, return; } + if(transientNetworkFailure == true) + _error->Warning(_("Some index files failed to download. They have been ignored, or old ones used instead.")); + else if(rval == failure) + { + _error->Error(_("Some index files failed to download. They have been ignored, or old ones used instead.")); + k(failure); + return; + } + // Rebuild the apt caches as done in apt-get. cachefile is scoped // so it dies before we possibly-reload the cache. This will do a // little redundant work in visual mode, but avoids lots of -- 1.7.5.4