summaryrefslogtreecommitdiff
path: root/apt-private
diff options
context:
space:
mode:
Diffstat (limited to 'apt-private')
-rw-r--r--apt-private/acqprogress.cc34
-rw-r--r--apt-private/acqprogress.h5
-rw-r--r--apt-private/private-cachefile.cc14
-rw-r--r--apt-private/private-cachefile.h6
-rw-r--r--apt-private/private-cacheset.cc9
-rw-r--r--apt-private/private-cacheset.h2
-rw-r--r--apt-private/private-cmndline.cc24
-rw-r--r--apt-private/private-depends.cc5
-rw-r--r--apt-private/private-download.cc22
-rw-r--r--apt-private/private-install.cc72
-rw-r--r--apt-private/private-install.h5
-rw-r--r--apt-private/private-list.cc9
-rw-r--r--apt-private/private-main.cc3
-rw-r--r--apt-private/private-moo.cc10
-rw-r--r--apt-private/private-output.cc49
-rw-r--r--apt-private/private-output.h7
-rw-r--r--apt-private/private-search.cc11
-rw-r--r--apt-private/private-search.h2
-rw-r--r--apt-private/private-show.cc15
-rw-r--r--apt-private/private-show.h2
-rw-r--r--apt-private/private-source.cc5
-rw-r--r--apt-private/private-sources.cc18
-rw-r--r--apt-private/private-unmet.cc2
-rw-r--r--apt-private/private-update.cc6
-rw-r--r--apt-private/private-upgrade.cc6
25 files changed, 184 insertions, 159 deletions
diff --git a/apt-private/acqprogress.cc b/apt-private/acqprogress.cc
index e4bfbd4e5..a788ec98b 100644
--- a/apt-private/acqprogress.cc
+++ b/apt-private/acqprogress.cc
@@ -7,22 +7,23 @@
##################################################################### */
/*}}}*/
// Include files /*{{{*/
-#include<config.h>
+#include <config.h>
-#include <apt-pkg/acquire.h>
#include <apt-pkg/acquire-item.h>
#include <apt-pkg/acquire-worker.h>
+#include <apt-pkg/acquire.h>
#include <apt-pkg/configuration.h>
-#include <apt-pkg/strutl.h>
#include <apt-pkg/error.h>
+#include <apt-pkg/strutl.h>
#include <apt-private/acqprogress.h>
+#include <apt-private/private-output.h>
-#include <string.h>
-#include <stdio.h>
-#include <signal.h>
#include <iostream>
#include <sstream>
+#include <signal.h>
+#include <stdio.h>
+#include <string.h>
#include <unistd.h>
#include <apti18n.h>
@@ -32,7 +33,7 @@
// ---------------------------------------------------------------------
/* */
AcqTextStatus::AcqTextStatus(std::ostream &out, unsigned int &ScreenWidth,unsigned int const Quiet) :
- pkgAcquireStatus(), out(out), ScreenWidth(ScreenWidth), LastLineLength(0), ID(0), Quiet(Quiet)
+ pkgAcquireStatus2(), out(out), ScreenWidth(ScreenWidth), LastLineLength(0), ID(0), Quiet(Quiet)
{
// testcases use it to disable pulses without disabling other user messages
if (Quiet == 0 && _config->FindB("quiet::NoUpdate", false) == true)
@@ -330,6 +331,25 @@ bool AcqTextStatus::MediaChange(std::string Media, std::string Drive)
return bStatus;
}
/*}}}*/
+bool AcqTextStatus::ReleaseInfoChanges(metaIndex const * const L, metaIndex const * const N, std::vector<ReleaseInfoChange> &&Changes)/*{{{*/
+{
+ if (Quiet >= 2 || isatty(STDOUT_FILENO) != 1 || isatty(STDIN_FILENO) != 1 ||
+ _config->FindB("APT::Get::Update::InteractiveReleaseInfoChanges", false) == false)
+ return pkgAcquireStatus2::ReleaseInfoChanges(nullptr, nullptr, std::move(Changes));
+
+ _error->PushToStack();
+ auto const confirmed = pkgAcquireStatus2::ReleaseInfoChanges(L, N, std::move(Changes));
+ if (confirmed == true)
+ {
+ _error->MergeWithStack();
+ return true;
+ }
+ clearLastLine();
+ _error->DumpErrors(out, GlobalError::NOTICE, false);
+ _error->RevertToStack();
+ return YnPrompt(_("Do you want to accept these changes and continue updating from this repository?"), false, false, out, out);
+}
+ /*}}}*/
void AcqTextStatus::clearLastLine() { /*{{{*/
if (Quiet > 0 || LastLineLength == 0)
return;
diff --git a/apt-private/acqprogress.h b/apt-private/acqprogress.h
index 6b6d555b1..c8c211689 100644
--- a/apt-private/acqprogress.h
+++ b/apt-private/acqprogress.h
@@ -12,10 +12,10 @@
#include <apt-pkg/acquire.h>
#include <apt-pkg/macros.h>
-#include <string>
#include <iostream>
+#include <string>
-class APT_PUBLIC AcqTextStatus : public pkgAcquireStatus
+class APT_PUBLIC AcqTextStatus : public pkgAcquireStatus2
{
std::ostream &out;
unsigned int &ScreenWidth;
@@ -28,6 +28,7 @@ class APT_PUBLIC AcqTextStatus : public pkgAcquireStatus
public:
+ virtual bool ReleaseInfoChanges(metaIndex const * const LastRelease, metaIndex const * const CurrentRelease, std::vector<ReleaseInfoChange> &&Changes) APT_OVERRIDE;
virtual bool MediaChange(std::string Media,std::string Drive) APT_OVERRIDE;
virtual void IMSHit(pkgAcquire::ItemDesc &Itm) APT_OVERRIDE;
virtual void Fetch(pkgAcquire::ItemDesc &Itm) APT_OVERRIDE;
diff --git a/apt-private/private-cachefile.cc b/apt-private/private-cachefile.cc
index 77090f8eb..ab25338ff 100644
--- a/apt-private/private-cachefile.cc
+++ b/apt-private/private-cachefile.cc
@@ -1,20 +1,20 @@
// Include files /*{{{*/
-#include<config.h>
+#include <config.h>
#include <apt-pkg/algorithms.h>
-#include <apt-pkg/upgrade.h>
-#include <apt-pkg/error.h>
+#include <apt-pkg/cacheset.h>
#include <apt-pkg/configuration.h>
#include <apt-pkg/depcache.h>
+#include <apt-pkg/error.h>
#include <apt-pkg/pkgcache.h>
-#include <apt-pkg/cacheset.h>
+#include <apt-pkg/upgrade.h>
-#include <apt-private/private-output.h>
#include <apt-private/private-cachefile.h>
+#include <apt-private/private-output.h>
-#include <string.h>
-#include <ostream>
#include <cstdlib>
+#include <ostream>
+#include <string.h>
#include <apti18n.h>
/*}}}*/
diff --git a/apt-private/private-cachefile.h b/apt-private/private-cachefile.h
index 77e8b61d9..5086ceaeb 100644
--- a/apt-private/private-cachefile.h
+++ b/apt-private/private-cachefile.h
@@ -2,12 +2,12 @@
#define APT_PRIVATE_CACHEFILE_H
#include <apt-pkg/cachefile.h>
-#include <apt-pkg/progress.h>
+#include <apt-pkg/cacheset.h>
#include <apt-pkg/configuration.h>
-#include <apt-pkg/pkgcache.h>
#include <apt-pkg/macros.h>
+#include <apt-pkg/pkgcache.h>
+#include <apt-pkg/progress.h>
#include <apt-pkg/sourcelist.h>
-#include <apt-pkg/cacheset.h>
// class CacheFile - Cover class for some dependency cache functions /*{{{*/
class APT_PUBLIC CacheFile : public pkgCacheFile
diff --git a/apt-private/private-cacheset.cc b/apt-private/private-cacheset.cc
index 52cd22d2a..3d1a2b91c 100644
--- a/apt-private/private-cacheset.cc
+++ b/apt-private/private-cacheset.cc
@@ -1,14 +1,13 @@
#include <config.h>
+#include <apt-pkg/aptconfiguration.h>
#include <apt-pkg/cachefile.h>
-#include <apt-pkg/pkgcache.h>
-#include <apt-pkg/depcache.h>
-#include <apt-pkg/cacheiterators.h>
#include <apt-pkg/cachefilter.h>
-#include <apt-pkg/aptconfiguration.h>
#include <apt-pkg/configuration.h>
-#include <apt-pkg/progress.h>
+#include <apt-pkg/depcache.h>
+#include <apt-pkg/pkgcache.h>
#include <apt-pkg/policy.h>
+#include <apt-pkg/progress.h>
#include <apt-pkg/strutl.h>
#include <apt-private/private-cacheset.h>
diff --git a/apt-private/private-cacheset.h b/apt-private/private-cacheset.h
index 37c921081..7bf486b9e 100644
--- a/apt-private/private-cacheset.h
+++ b/apt-private/private-cacheset.h
@@ -6,10 +6,10 @@
#include <apt-private/private-output.h>
-#include <vector>
#include <list>
#include <set>
#include <string>
+#include <vector>
class OpProgress;
diff --git a/apt-private/private-cmndline.cc b/apt-private/private-cmndline.cc
index de3992a00..2ecc47ba4 100644
--- a/apt-private/private-cmndline.cc
+++ b/apt-private/private-cmndline.cc
@@ -3,21 +3,21 @@
#include <apt-pkg/cmndline.h>
#include <apt-pkg/configuration.h>
+#include <apt-pkg/error.h>
#include <apt-pkg/fileutl.h>
-#include <apt-pkg/pkgsystem.h>
#include <apt-pkg/init.h>
-#include <apt-pkg/error.h>
+#include <apt-pkg/pkgsystem.h>
#include <apt-pkg/strutl.h>
#include <apt-private/private-cmndline.h>
#include <apt-private/private-main.h>
#include <stdarg.h>
-#include <string.h>
#include <stdlib.h>
+#include <string.h>
-#include <vector>
#include <iomanip>
+#include <vector>
#include <apti18n.h>
/*}}}*/
@@ -203,6 +203,15 @@ static bool addArgumentsAPTGet(std::vector<CommandLine::Args> &Args, char const
else if (CmdMatches("update"))
{
addArg(0, "list-cleanup", "APT::Get::List-Cleanup", 0);
+ addArg(0, "allow-insecure-repositories", "Acquire::AllowInsecureRepositories", 0);
+ addArg(0, "allow-weak-repositories", "Acquire::AllowWeakRepositories", 0);
+ addArg(0, "allow-releaseinfo-change", "Acquire::AllowReleaseInfoChange", 0);
+ addArg(0, "allow-releaseinfo-change-origin", "Acquire::AllowReleaseInfoChange::Origin", 0);
+ addArg(0, "allow-releaseinfo-change-label", "Acquire::AllowReleaseInfoChange::Label", 0);
+ addArg(0, "allow-releaseinfo-change-version", "Acquire::AllowReleaseInfoChange::Version", 0);
+ addArg(0, "allow-releaseinfo-change-codename", "Acquire::AllowReleaseInfoChange::Codename", 0);
+ addArg(0, "allow-releaseinfo-change-suite", "Acquire::AllowReleaseInfoChange::Suite", 0);
+ addArg(0, "allow-releaseinfo-change-defaultpin", "Acquire::AllowReleaseInfoChange::DefaultPin", 0);
}
else if (CmdMatches("source"))
{
@@ -273,8 +282,6 @@ static bool addArgumentsAPTGet(std::vector<CommandLine::Args> &Args, char const
addArg(0,"remove","APT::Get::Remove",0);
addArg(0,"only-source","APT::Get::Only-Source",0);
addArg(0,"allow-unauthenticated","APT::Get::AllowUnauthenticated",0);
- addArg(0,"allow-insecure-repositories","Acquire::AllowInsecureRepositories",0);
- addArg(0,"allow-weak-repositories","Acquire::AllowWeakRepositories",0);
addArg(0,"install-recommends","APT::Install-Recommends",CommandLine::Boolean);
addArg(0,"install-suggests","APT::Install-Suggests",CommandLine::Boolean);
addArg(0,"fix-policy","APT::Get::Fix-Policy-Broken",0);
@@ -462,9 +469,8 @@ static void BinarySpecificConfiguration(char const * const Binary) /*{{{*/
_config->CndSet("Binary::apt::APT::Cmd::Show-Update-Stats", true);
_config->CndSet("Binary::apt::DPkg::Progress-Fancy", true);
_config->CndSet("Binary::apt::APT::Keep-Downloaded-Packages", false);
+ _config->CndSet("Binary::apt::APT::Get::Update::InteractiveReleaseInfoChanges", true);
}
- if (binary == "apt-config")
- _config->CndSet("Binary::apt-get::Acquire::AllowInsecureRepositories", true);
_config->Set("Binary", binary);
}
@@ -472,8 +478,6 @@ static void BinarySpecificConfiguration(char const * const Binary) /*{{{*/
static void BinaryCommandSpecificConfiguration(char const * const Binary, char const * const Cmd)/*{{{*/
{
std::string const binary = flNotDir(Binary);
- if (binary == "apt-get" && CmdMatches("update"))
- _config->CndSet("Binary::apt-get::Acquire::AllowInsecureRepositories", true);
if ((binary == "apt" || binary == "apt-get") && CmdMatches("upgrade", "dist-upgrade", "full-upgrade"))
{
//FIXME: the option is documented to apply only for install/remove, so
diff --git a/apt-private/private-depends.cc b/apt-private/private-depends.cc
index 3a3a2737a..79d66b72a 100644
--- a/apt-private/private-depends.cc
+++ b/apt-private/private-depends.cc
@@ -1,12 +1,11 @@
// Include Files /*{{{*/
-#include<config.h>
+#include <config.h>
#include <apt-pkg/algorithms.h>
#include <apt-pkg/cachefile.h>
-#include <apt-pkg/cacheiterators.h>
#include <apt-pkg/cacheset.h>
-#include <apt-pkg/configuration.h>
#include <apt-pkg/cmndline.h>
+#include <apt-pkg/configuration.h>
#include <apt-pkg/error.h>
#include <apt-pkg/pkgcache.h>
diff --git a/apt-private/private-download.cc b/apt-private/private-download.cc
index ee477f4cb..25dee318e 100644
--- a/apt-private/private-download.cc
+++ b/apt-private/private-download.cc
@@ -1,30 +1,30 @@
// Include Files /*{{{*/
#include <config.h>
-#include <apt-pkg/acquire.h>
#include <apt-pkg/acquire-item.h>
+#include <apt-pkg/acquire.h>
#include <apt-pkg/cacheset.h>
-#include <apt-pkg/cmndline.h>
#include <apt-pkg/clean.h>
+#include <apt-pkg/cmndline.h>
#include <apt-pkg/configuration.h>
#include <apt-pkg/error.h>
#include <apt-pkg/fileutl.h>
#include <apt-pkg/strutl.h>
+#include <apt-private/acqprogress.h>
#include <apt-private/private-cachefile.h>
#include <apt-private/private-download.h>
#include <apt-private/private-output.h>
#include <apt-private/private-utils.h>
-#include <apt-private/acqprogress.h>
#include <fstream>
#include <string>
#include <vector>
-#include <unistd.h>
-#include <sys/types.h>
-#include <pwd.h>
#include <fcntl.h>
+#include <pwd.h>
+#include <sys/types.h>
+#include <unistd.h>
#ifdef HAVE_VFS_H
#include <sys/vfs.h>
#else
@@ -33,9 +33,9 @@
#endif
#include <sys/mount.h>
#endif
-#include <sys/statvfs.h>
-#include <sys/stat.h>
#include <errno.h>
+#include <sys/stat.h>
+#include <sys/statvfs.h>
#include <apti18n.h>
/*}}}*/
@@ -339,15 +339,15 @@ bool DoClean(CommandLine &)
// ---------------------------------------------------------------------
/* This is similar to clean but it only purges things that cannot be
downloaded, that is old versions of cached packages. */
- class LogCleaner : public pkgArchiveCleaner
+ class LogCleaner : public pkgArchiveCleaner2
{
protected:
- virtual void Erase(const char *File, std::string Pkg, std::string Ver,struct stat &St) APT_OVERRIDE
+ virtual void Erase(int const dirfd, char const * const File, std::string const &Pkg, std::string const &Ver,struct stat const &St) APT_OVERRIDE
{
c1out << "Del " << Pkg << " " << Ver << " [" << SizeToStr(St.st_size) << "B]" << std::endl;
if (_config->FindB("APT::Get::Simulate") == false)
- RemoveFile("Cleaner::Erase", File);
+ RemoveFileAt("Cleaner::Erase", dirfd, File);
};
};
bool DoAutoClean(CommandLine &)
diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc
index 73a03a828..aafe5542d 100644
--- a/apt-private/private-install.cc
+++ b/apt-private/private-install.cc
@@ -1,41 +1,40 @@
// Include Files /*{{{*/
#include <config.h>
-#include <apt-pkg/acquire.h>
#include <apt-pkg/acquire-item.h>
+#include <apt-pkg/acquire.h>
#include <apt-pkg/algorithms.h>
#include <apt-pkg/cachefile.h>
#include <apt-pkg/cacheset.h>
#include <apt-pkg/cmndline.h>
+#include <apt-pkg/configuration.h>
#include <apt-pkg/depcache.h>
#include <apt-pkg/error.h>
#include <apt-pkg/fileutl.h>
+#include <apt-pkg/install-progress.h>
+#include <apt-pkg/macros.h>
+#include <apt-pkg/packagemanager.h>
+#include <apt-pkg/pkgcache.h>
#include <apt-pkg/pkgrecords.h>
#include <apt-pkg/pkgsystem.h>
+#include <apt-pkg/prettyprinters.h>
#include <apt-pkg/sptr.h>
#include <apt-pkg/strutl.h>
-#include <apt-pkg/cacheiterators.h>
-#include <apt-pkg/configuration.h>
-#include <apt-pkg/macros.h>
-#include <apt-pkg/packagemanager.h>
-#include <apt-pkg/pkgcache.h>
#include <apt-pkg/upgrade.h>
-#include <apt-pkg/install-progress.h>
-#include <apt-pkg/prettyprinters.h>
-#include <stdlib.h>
-#include <string.h>
#include <algorithm>
#include <iostream>
+#include <map>
#include <set>
#include <vector>
-#include <map>
+#include <stdlib.h>
+#include <string.h>
#include <apt-private/acqprogress.h>
-#include <apt-private/private-install.h>
#include <apt-private/private-cachefile.h>
#include <apt-private/private-cacheset.h>
#include <apt-private/private-download.h>
+#include <apt-private/private-install.h>
#include <apt-private/private-output.h>
#include <apti18n.h>
@@ -109,6 +108,7 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask, bool Safety)
Cache->MarkDelete(I,true);
// Create the download object
+ auto const DownloadAllowed = _config->FindB("APT::Get::Download",true);
aptAcquireWithTextStatus Fetcher;
if (_config->FindB("APT::Get::Print-URIs", false) == true)
{
@@ -136,7 +136,7 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask, bool Safety)
_error->PendingError() == true)
return false;
- if (_config->FindB("APT::Get::Download",true) == false)
+ if (DownloadAllowed == false)
{
bool Missing = false;
RemoveDownloadNeedingItemsFromFetcher(Fetcher, Missing);
@@ -218,27 +218,30 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask, bool Safety)
return true;
}
- // Display statistics
- auto const FetchBytes = Fetcher.FetchNeeded();
- auto const FetchPBytes = Fetcher.PartialPresent();
- auto const DebBytes = Fetcher.TotalNeeded();
- if (DebBytes != Cache->DebSize())
+ auto const FetchBytes = DownloadAllowed ? Fetcher.FetchNeeded() : 0;
+ auto const FetchPBytes = DownloadAllowed ? Fetcher.PartialPresent() : 0;
+ if (DownloadAllowed)
{
- c0out << DebBytes << ',' << Cache->DebSize() << std::endl;
- c0out << _("How odd... The sizes didn't match, email apt@packages.debian.org") << std::endl;
- }
-
- // Number of bytes
- if (DebBytes != FetchBytes)
- //TRANSLATOR: The required space between number and unit is already included
- // in the replacement strings, so %sB will be correctly translate in e.g. 1,5 MB
- ioprintf(c1out,_("Need to get %sB/%sB of archives.\n"),
+ // Display statistics
+ auto const DebBytes = Fetcher.TotalNeeded();
+ if (DebBytes != Cache->DebSize())
+ {
+ c0out << "E: " << DebBytes << ',' << Cache->DebSize() << std::endl;
+ c0out << "E: " << _("How odd... The sizes didn't match, email apt@packages.debian.org") << std::endl;
+ }
+
+ // Number of bytes
+ if (DebBytes != FetchBytes)
+ //TRANSLATOR: The required space between number and unit is already included
+ // in the replacement strings, so %sB will be correctly translate in e.g. 1,5 MB
+ ioprintf(c1out,_("Need to get %sB/%sB of archives.\n"),
SizeToStr(FetchBytes).c_str(),SizeToStr(DebBytes).c_str());
- else if (DebBytes != 0)
- //TRANSLATOR: The required space between number and unit is already included
- // in the replacement string, so %sB will be correctly translate in e.g. 1,5 MB
- ioprintf(c1out,_("Need to get %sB of archives.\n"),
+ else if (DebBytes != 0)
+ //TRANSLATOR: The required space between number and unit is already included
+ // in the replacement string, so %sB will be correctly translate in e.g. 1,5 MB
+ ioprintf(c1out,_("Need to get %sB of archives.\n"),
SizeToStr(DebBytes).c_str());
+ }
// Size delta
if (Cache->UsrSize() >= 0)
@@ -252,8 +255,9 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask, bool Safety)
ioprintf(c1out,_("After this operation, %sB disk space will be freed.\n"),
SizeToStr(-1*Cache->UsrSize()).c_str());
- if (CheckFreeSpaceBeforeDownload(_config->FindDir("Dir::Cache::Archives"), (FetchBytes - FetchPBytes)) == false)
- return false;
+ if (DownloadAllowed)
+ if (CheckFreeSpaceBeforeDownload(_config->FindDir("Dir::Cache::Archives"), (FetchBytes - FetchPBytes)) == false)
+ return false;
if (_error->PendingError() == true)
return false;
@@ -362,7 +366,7 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask, bool Safety)
return false;
Failed = false;
- if (_config->FindB("APT::Get::Download",true) == false)
+ if (DownloadAllowed == false)
RemoveDownloadNeedingItemsFromFetcher(Fetcher, Failed);
}
diff --git a/apt-private/private-install.h b/apt-private/private-install.h
index d2a9bed3f..c8b065331 100644
--- a/apt-private/private-install.h
+++ b/apt-private/private-install.h
@@ -2,11 +2,10 @@
#define APT_PRIVATE_INSTALL_H
#include <apt-pkg/cachefile.h>
-#include <apt-pkg/configuration.h>
-#include <apt-pkg/pkgcache.h>
-#include <apt-pkg/cacheiterators.h>
#include <apt-pkg/cacheset.h>
+#include <apt-pkg/configuration.h>
#include <apt-pkg/macros.h>
+#include <apt-pkg/pkgcache.h>
#include <list>
#include <string>
diff --git a/apt-private/private-list.cc b/apt-private/private-list.cc
index 32c8eeaa2..2c9b349a3 100644
--- a/apt-private/private-list.cc
+++ b/apt-private/private-list.cc
@@ -5,21 +5,20 @@
#include <apt-pkg/cachefilter.h>
#include <apt-pkg/cacheset.h>
#include <apt-pkg/cmndline.h>
-#include <apt-pkg/pkgrecords.h>
-#include <apt-pkg/progress.h>
-#include <apt-pkg/strutl.h>
#include <apt-pkg/configuration.h>
#include <apt-pkg/macros.h>
#include <apt-pkg/pkgcache.h>
-#include <apt-pkg/cacheiterators.h>
+#include <apt-pkg/pkgrecords.h>
+#include <apt-pkg/progress.h>
+#include <apt-pkg/strutl.h>
#include <apt-private/private-cacheset.h>
#include <apt-private/private-list.h>
#include <apt-private/private-output.h>
#include <iostream>
-#include <sstream>
#include <map>
+#include <sstream>
#include <string>
#include <utility>
#include <vector>
diff --git a/apt-private/private-main.cc b/apt-private/private-main.cc
index 52f35cfdc..47b1a0921 100644
--- a/apt-private/private-main.cc
+++ b/apt-private/private-main.cc
@@ -10,13 +10,12 @@
#include <iostream>
#include <locale>
+#include <signal.h>
#include <string.h>
#include <unistd.h>
-#include <signal.h>
#include <apti18n.h>
-
void InitLocale(APT_CMD const binary) /*{{{*/
{
try {
diff --git a/apt-private/private-moo.cc b/apt-private/private-moo.cc
index b8ed6efbd..ca456ed96 100644
--- a/apt-private/private-moo.cc
+++ b/apt-private/private-moo.cc
@@ -7,22 +7,22 @@
##################################################################### */
/*}}}*/
// Include Files /*{{{*/
-#include<config.h>
+#include <config.h>
-#include <apt-pkg/configuration.h>
#include <apt-pkg/cmndline.h>
+#include <apt-pkg/configuration.h>
#include <apt-pkg/strutl.h>
#include <apt-private/private-moo.h>
#include <apt-private/private-output.h>
#include <apt-private/private-utils.h>
-#include <stddef.h>
-#include <string.h>
-#include <time.h>
#include <iostream>
#include <sstream>
#include <string>
+#include <stddef.h>
+#include <string.h>
+#include <time.h>
#include <apti18n.h>
/*}}}*/
diff --git a/apt-private/private-output.cc b/apt-private/private-output.cc
index 9c25cda6d..6bc18516d 100644
--- a/apt-private/private-output.cc
+++ b/apt-private/private-output.cc
@@ -1,29 +1,28 @@
// Include files /*{{{*/
-#include<config.h>
+#include <config.h>
+#include <apt-pkg/cachefile.h>
#include <apt-pkg/configuration.h>
-#include <apt-pkg/strutl.h>
+#include <apt-pkg/depcache.h>
#include <apt-pkg/error.h>
-#include <apt-pkg/cachefile.h>
+#include <apt-pkg/pkgcache.h>
#include <apt-pkg/pkgrecords.h>
#include <apt-pkg/policy.h>
-#include <apt-pkg/depcache.h>
-#include <apt-pkg/pkgcache.h>
-#include <apt-pkg/cacheiterators.h>
+#include <apt-pkg/strutl.h>
-#include <apt-private/private-output.h>
#include <apt-private/private-cachefile.h>
+#include <apt-private/private-output.h>
-#include <regex.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#include <iomanip>
#include <iostream>
#include <langinfo.h>
-#include <unistd.h>
+#include <regex.h>
#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#include <sys/ioctl.h>
+#include <unistd.h>
#include <sstream>
@@ -650,20 +649,20 @@ void Stats(ostream &out,pkgDepCache &Dep)
// YnPrompt - Yes No Prompt. /*{{{*/
// ---------------------------------------------------------------------
/* Returns true on a Yes.*/
-bool YnPrompt(char const * const Question, bool Default)
+bool YnPrompt(char const * const Question, bool const Default, bool const ShowGlobalErrors, std::ostream &c1o, std::ostream &c2o)
{
auto const AssumeYes = _config->FindB("APT::Get::Assume-Yes",false);
auto const AssumeNo = _config->FindB("APT::Get::Assume-No",false);
// if we ask interactively, show warnings/notices before the question
- if (AssumeYes == false && AssumeNo == false)
+ if (ShowGlobalErrors == true && AssumeYes == false && AssumeNo == false)
{
if (_config->FindI("quiet",0) > 0)
- _error->DumpErrors(c2out);
+ _error->DumpErrors(c2o);
else
- _error->DumpErrors(c2out, GlobalError::DEBUG);
+ _error->DumpErrors(c2o, GlobalError::DEBUG);
}
- c2out << Question << std::flush;
+ c2o << Question << std::flush;
/* nl_langinfo does not support LANGUAGE setting, so we unset it here
to have the help-message (hopefully) match the expected characters */
@@ -678,13 +677,13 @@ bool YnPrompt(char const * const Question, bool Default)
// e.g. "Do you want to continue? [Y/n] "
// The user has to answer with an input matching the
// YESEXPR/NOEXPR defined in your l10n.
- c2out << " " << _("[Y/n]") << " " << std::flush;
+ c2o << " " << _("[Y/n]") << " " << std::flush;
else
// TRANSLATOR: Yes/No question help-text: defaulting to N[o]
// e.g. "Should this file be removed? [y/N] "
// The user has to answer with an input matching the
// YESEXPR/NOEXPR defined in your l10n.
- c2out << " " << _("[y/N]") << " " << std::flush;
+ c2o << " " << _("[y/N]") << " " << std::flush;
if (language != NULL)
{
@@ -695,13 +694,13 @@ bool YnPrompt(char const * const Question, bool Default)
if (AssumeYes)
{
// TRANSLATOR: "Yes" answer printed for a yes/no question if --assume-yes is set
- c1out << _("Y") << std::endl;
+ c1o << _("Y") << std::endl;
return true;
}
else if (AssumeNo)
{
// TRANSLATOR: "No" answer printed for a yes/no question if --assume-no is set
- c1out << _("N") << std::endl;
+ c1o << _("N") << std::endl;
return false;
}
@@ -721,16 +720,20 @@ bool YnPrompt(char const * const Question, bool Default)
REG_EXTENDED|REG_ICASE|REG_NOSUB);
if (Res != 0) {
- char Error[300];
+ char Error[300];
regerror(Res,&Pattern,Error,sizeof(Error));
return _error->Error(_("Regex compilation error - %s"),Error);
}
-
+
Res = regexec(&Pattern, response, 0, NULL, 0);
if (Res == 0)
return true;
return false;
}
+bool YnPrompt(char const * const Question, bool const Default)
+{
+ return YnPrompt(Question, Default, true, c1out, c2out);
+}
/*}}}*/
// AnalPrompt - Annoying Yes No Prompt. /*{{{*/
// ---------------------------------------------------------------------
diff --git a/apt-private/private-output.h b/apt-private/private-output.h
index bb9428d7f..1ac861328 100644
--- a/apt-private/private-output.h
+++ b/apt-private/private-output.h
@@ -2,13 +2,13 @@
#define APT_PRIVATE_OUTPUT_H
#include <apt-pkg/configuration.h>
-#include <apt-pkg/pkgcache.h>
#include <apt-pkg/macros.h>
+#include <apt-pkg/pkgcache.h>
-#include <functional>
#include <fstream>
-#include <string>
+#include <functional>
#include <iostream>
+#include <string>
// forward declaration
class pkgCacheFile;
@@ -102,6 +102,7 @@ void Stats(std::ostream &out, pkgDepCache &Dep);
// prompting
bool YnPrompt(char const * const Question, bool Default=true);
+bool YnPrompt(char const * const Question, bool const Default, bool const ShowGlobalErrors, std::ostream &c1o, std::ostream &c2o);
bool AnalPrompt(std::string const &Question, const char *Text);
std::string PrettyFullName(pkgCache::PkgIterator const &Pkg);
diff --git a/apt-private/private-search.cc b/apt-private/private-search.cc
index bae04173d..b850339f9 100644
--- a/apt-private/private-search.cc
+++ b/apt-private/private-search.cc
@@ -4,26 +4,25 @@
#include <apt-pkg/cachefile.h>
#include <apt-pkg/cacheset.h>
#include <apt-pkg/cmndline.h>
-#include <apt-pkg/pkgrecords.h>
-#include <apt-pkg/policy.h>
-#include <apt-pkg/progress.h>
-#include <apt-pkg/cacheiterators.h>
#include <apt-pkg/configuration.h>
#include <apt-pkg/depcache.h>
#include <apt-pkg/macros.h>
#include <apt-pkg/pkgcache.h>
+#include <apt-pkg/pkgrecords.h>
+#include <apt-pkg/policy.h>
+#include <apt-pkg/progress.h>
#include <apt-private/private-cacheset.h>
#include <apt-private/private-output.h>
#include <apt-private/private-search.h>
#include <apt-private/private-show.h>
-#include <string.h>
#include <iostream>
-#include <sstream>
#include <map>
+#include <sstream>
#include <string>
#include <utility>
+#include <string.h>
#include <apti18n.h>
/*}}}*/
diff --git a/apt-private/private-search.h b/apt-private/private-search.h
index 8ae1f38f3..518f297ca 100644
--- a/apt-private/private-search.h
+++ b/apt-private/private-search.h
@@ -1,8 +1,8 @@
#ifndef APT_PRIVATE_SEARCH_H
#define APT_PRIVATE_SEARCH_H
-#include <apt-pkg/pkgcache.h>
#include <apt-pkg/macros.h>
+#include <apt-pkg/pkgcache.h>
class CommandLine;
diff --git a/apt-private/private-show.cc b/apt-private/private-show.cc
index 27338a08c..3cc6a5b87 100644
--- a/apt-private/private-show.cc
+++ b/apt-private/private-show.cc
@@ -4,29 +4,28 @@
#include <apt-pkg/cachefile.h>
#include <apt-pkg/cacheset.h>
#include <apt-pkg/cmndline.h>
+#include <apt-pkg/configuration.h>
+#include <apt-pkg/depcache.h>
#include <apt-pkg/error.h>
#include <apt-pkg/fileutl.h>
#include <apt-pkg/indexfile.h>
+#include <apt-pkg/macros.h>
+#include <apt-pkg/pkgcache.h>
#include <apt-pkg/pkgrecords.h>
#include <apt-pkg/pkgsystem.h>
+#include <apt-pkg/policy.h>
#include <apt-pkg/sourcelist.h>
#include <apt-pkg/strutl.h>
#include <apt-pkg/tagfile.h>
-#include <apt-pkg/cacheiterators.h>
-#include <apt-pkg/configuration.h>
-#include <apt-pkg/depcache.h>
-#include <apt-pkg/macros.h>
-#include <apt-pkg/pkgcache.h>
-#include <apt-pkg/policy.h>
#include <apt-private/private-cacheset.h>
#include <apt-private/private-output.h>
#include <apt-private/private-show.h>
-#include <stdio.h>
-#include <unistd.h>
#include <ostream>
#include <string>
+#include <stdio.h>
+#include <unistd.h>
#include <apti18n.h>
/*}}}*/
diff --git a/apt-private/private-show.h b/apt-private/private-show.h
index 80871b817..e48979c2c 100644
--- a/apt-private/private-show.h
+++ b/apt-private/private-show.h
@@ -1,8 +1,8 @@
#ifndef APT_PRIVATE_SHOW_H
#define APT_PRIVATE_SHOW_H
-#include <apt-pkg/pkgcache.h>
#include <apt-pkg/macros.h>
+#include <apt-pkg/pkgcache.h>
#include <iostream>
diff --git a/apt-private/private-source.cc b/apt-private/private-source.cc
index e9ec7c6cf..47610cd80 100644
--- a/apt-private/private-source.cc
+++ b/apt-private/private-source.cc
@@ -6,7 +6,6 @@
#include <apt-pkg/algorithms.h>
#include <apt-pkg/aptconfiguration.h>
#include <apt-pkg/cachefile.h>
-#include <apt-pkg/cacheiterators.h>
#include <apt-pkg/cacheset.h>
#include <apt-pkg/cmndline.h>
#include <apt-pkg/configuration.h>
@@ -17,11 +16,11 @@
#include <apt-pkg/indexfile.h>
#include <apt-pkg/metaindex.h>
#include <apt-pkg/pkgcache.h>
+#include <apt-pkg/policy.h>
#include <apt-pkg/sourcelist.h>
#include <apt-pkg/srcrecords.h>
#include <apt-pkg/strutl.h>
#include <apt-pkg/version.h>
-#include <apt-pkg/policy.h>
#include <apt-private/private-cachefile.h>
#include <apt-private/private-cacheset.h>
@@ -39,8 +38,8 @@
#include <unistd.h>
#include <iostream>
-#include <sstream>
#include <set>
+#include <sstream>
#include <string>
#include <vector>
diff --git a/apt-private/private-sources.cc b/apt-private/private-sources.cc
index 587571760..1d27d0ff1 100644
--- a/apt-private/private-sources.cc
+++ b/apt-private/private-sources.cc
@@ -1,24 +1,24 @@
#include <config.h>
-#include <apt-pkg/hashes.h>
-#include <apt-pkg/strutl.h>
-#include <apt-pkg/configuration.h>
-#include <apt-pkg/sourcelist.h>
+#include <apt-pkg/cachefile.h>
#include <apt-pkg/cmndline.h>
+#include <apt-pkg/configuration.h>
#include <apt-pkg/error.h>
#include <apt-pkg/fileutl.h>
-#include <apt-pkg/cachefile.h>
+#include <apt-pkg/hashes.h>
+#include <apt-pkg/sourcelist.h>
+#include <apt-pkg/strutl.h>
#include <apt-private/private-output.h>
#include <apt-private/private-sources.h>
#include <apt-private/private-utils.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stddef.h>
-#include <unistd.h>
#include <iostream>
#include <string>
+#include <stddef.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
#include <apti18n.h>
diff --git a/apt-private/private-unmet.cc b/apt-private/private-unmet.cc
index 51ace3f47..f5161fcc3 100644
--- a/apt-private/private-unmet.cc
+++ b/apt-private/private-unmet.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Include Files /*{{{*/
-#include<config.h>
+#include <config.h>
#include <apt-pkg/cachefile.h>
#include <apt-pkg/cmndline.h>
diff --git a/apt-private/private-update.cc b/apt-private/private-update.cc
index a886c830f..8949dab30 100644
--- a/apt-private/private-update.cc
+++ b/apt-private/private-update.cc
@@ -1,15 +1,15 @@
// Include files /*{{{*/
-#include<config.h>
+#include <config.h>
#include <apt-pkg/acquire-item.h>
+#include <apt-pkg/acquire.h>
#include <apt-pkg/cachefile.h>
#include <apt-pkg/cmndline.h>
+#include <apt-pkg/configuration.h>
#include <apt-pkg/error.h>
#include <apt-pkg/fileutl.h>
#include <apt-pkg/sourcelist.h>
#include <apt-pkg/update.h>
-#include <apt-pkg/acquire.h>
-#include <apt-pkg/configuration.h>
#include <apt-private/acqprogress.h>
#include <apt-private/private-cachefile.h>
diff --git a/apt-private/private-upgrade.cc b/apt-private/private-upgrade.cc
index 679140bfd..989f6b0c1 100644
--- a/apt-private/private-upgrade.cc
+++ b/apt-private/private-upgrade.cc
@@ -1,14 +1,14 @@
// Includes /*{{{*/
#include <config.h>
-#include <apt-pkg/upgrade.h>
#include <apt-pkg/configuration.h>
#include <apt-pkg/error.h>
+#include <apt-pkg/upgrade.h>
-#include <apt-private/private-install.h>
#include <apt-private/private-cachefile.h>
-#include <apt-private/private-upgrade.h>
+#include <apt-private/private-install.h>
#include <apt-private/private-output.h>
+#include <apt-private/private-upgrade.h>
#include <iostream>