summaryrefslogtreecommitdiff
path: root/apt-private/private-install.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2013-10-03 14:45:41 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2013-10-03 14:45:41 +0200
commit866893a619e00966ae6b1549c4bfce92d6c17db1 (patch)
tree6f80b022d9216fa3601ba55b1190778a882932dc /apt-private/private-install.cc
parent3c8030a4977536e9d3a1954adc68082ae1c6d5a2 (diff)
put fetch errors in 'source' on our errorstack
refactor the fetching process so that it looks more like the others we have in the hope that we can reuse code in the future. This is a soft interface change as 'source' previously printed errors directly on stderr, while it will now push it onto our usual error stack.
Diffstat (limited to 'apt-private/private-install.cc')
-rw-r--r--apt-private/private-install.cc72
1 files changed, 5 insertions, 67 deletions
diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc
index c07d060f3..9adad45af 100644
--- a/apt-private/private-install.cc
+++ b/apt-private/private-install.cc
@@ -42,6 +42,7 @@
#include <sstream>
#include "private-install.h"
+#include "private-download.h"
#include "private-cachefile.h"
#include "private-output.h"
#include "private-cacheset.h"
@@ -50,50 +51,6 @@
#include <apti18n.h>
/*}}}*/
-// CheckAuth - check if each download comes form a trusted source /*{{{*/
-// ---------------------------------------------------------------------
-/* */
-static bool CheckAuth(pkgAcquire& Fetcher)
-{
- std::string UntrustedList;
- for (pkgAcquire::ItemIterator I = Fetcher.ItemsBegin(); I < Fetcher.ItemsEnd(); ++I)
- {
- if (!(*I)->IsTrusted())
- {
- UntrustedList += std::string((*I)->ShortDesc()) + " ";
- }
- }
-
- if (UntrustedList == "")
- {
- return true;
- }
-
- ShowList(c2out,_("WARNING: The following packages cannot be authenticated!"),UntrustedList,"");
-
- if (_config->FindB("APT::Get::AllowUnauthenticated",false) == true)
- {
- c2out << _("Authentication warning overridden.\n");
- return true;
- }
-
- if (_config->FindI("quiet",0) < 2
- && _config->FindB("APT::Get::Assume-Yes",false) == false)
- {
- c2out << _("Install these packages without verification?") << std::flush;
- if (!YnPrompt(false))
- return _error->Error(_("Some packages could not be authenticated"));
-
- return true;
- }
- else if (_config->FindB("APT::Get::Force-Yes",false) == true)
- {
- return true;
- }
-
- return _error->Error(_("There are problems and -y was used without --force-yes"));
-}
- /*}}}*/
// InstallPackages - Actually download and install the packages /*{{{*/
// ---------------------------------------------------------------------
/* This displays the informative messages describing what is going to
@@ -304,7 +261,7 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask, bool Safety)
return true;
}
- if (!CheckAuth(Fetcher))
+ if (!CheckAuth(Fetcher, true))
return false;
/* Unlock the dpkg lock if we are not going to be doing an install
@@ -336,29 +293,10 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask, bool Safety)
I = Fetcher.ItemsBegin();
}
}
-
- if (Fetcher.Run() == pkgAcquire::Failed)
- return false;
-
- // Print out errors
- bool Failed = false;
- for (pkgAcquire::ItemIterator I = Fetcher.ItemsBegin(); I != Fetcher.ItemsEnd(); ++I)
- {
- if ((*I)->Status == pkgAcquire::Item::StatDone &&
- (*I)->Complete == true)
- continue;
-
- if ((*I)->Status == pkgAcquire::Item::StatIdle)
- {
- Transient = true;
- // Failed = true;
- continue;
- }
- fprintf(stderr,_("Failed to fetch %s %s\n"),(*I)->DescURI().c_str(),
- (*I)->ErrorText.c_str());
- Failed = true;
- }
+ bool Failed = false;
+ if (AcquireRun(Fetcher, 0, &Failed, &Transient) == false)
+ return false;
/* If we are in no download mode and missing files and there were
'failures' then the user must specify -m. Furthermore, there