From 33b813ce44c7bafeb2a36b66fd004f8d94a2cbe4 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 5 Feb 2014 17:35:33 +0100 Subject: move isatty() check into InitOutput() --- apt-private/private-output.cc | 3 +++ cmdline/apt-get.cc | 4 ---- cmdline/apt.cc | 2 -- test/integration/test-apt-cli-upgrade | 6 ++---- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/apt-private/private-output.cc b/apt-private/private-output.cc index 2ae112af4..420ca14d5 100644 --- a/apt-private/private-output.cc +++ b/apt-private/private-output.cc @@ -30,6 +30,9 @@ unsigned int ScreenWidth = 80 - 1; /* - 1 for the cursor */ bool InitOutput() /*{{{*/ { + if (!isatty(STDOUT_FILENO) && _config->FindI("quiet", -1) == -1) + _config->Set("quiet","1"); + c0out.rdbuf(cout.rdbuf()); c1out.rdbuf(cout.rdbuf()); c2out.rdbuf(cout.rdbuf()); diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 6bff6e7de..1019ff325 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1736,10 +1736,6 @@ int main(int argc,const char *argv[]) /*{{{*/ // see if we are in simulate mode CheckSimulateMode(CmdL); - // Deal with stdout not being a tty - if (!isatty(STDOUT_FILENO) && _config->FindI("quiet", -1) == -1) - _config->Set("quiet","1"); - // Setup the output streams InitOutput(); diff --git a/cmdline/apt.cc b/cmdline/apt.cc index 6fe25e3f3..6ad470faa 100644 --- a/cmdline/apt.cc +++ b/cmdline/apt.cc @@ -156,8 +156,6 @@ int main(int argc, const char *argv[]) /*{{{*/ << std::endl << std::endl; } - if (!isatty(STDOUT_FILENO) && _config->FindI("quiet", -1) == -1) - _config->Set("quiet","1"); // See if the help should be shown if (_config->FindB("help") == true || diff --git a/test/integration/test-apt-cli-upgrade b/test/integration/test-apt-cli-upgrade index 163a55576..21ce69413 100755 --- a/test/integration/test-apt-cli-upgrade +++ b/test/integration/test-apt-cli-upgrade @@ -16,8 +16,7 @@ setupaptarchive APTARCHIVE=$(readlink -f ./aptarchive) # default is to allow new dependencies -testequal "Calculating upgrade... Done -The following NEW packages will be installed: +testequal "The following NEW packages will be installed: foo-new-dependency The following packages will be upgraded: foo @@ -28,7 +27,6 @@ Conf foo-new-dependency (2.0 unstable [all]) Conf foo (2.0 unstable [all])" apt upgrade -qq -s # ensure -testequal "Calculating upgrade... Done -The following packages have been kept back: +testequal "The following packages have been kept back: foo 0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded." apt upgrade -qq -s --no-new-pkgs -- cgit v1.2.3 From 8f3594c3487800edc2a97af1f3290049776dc556 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 12 Feb 2014 07:59:07 +0100 Subject: Use a APT::VersionSet instead of a VersionList Use a APT::VersionSet instead of a APT::VersionList in DoDownload() to ensure that there is only one version in the set even if the user passes multiple identical name/versions on the commandline (Bug#738103) --- cmdline/apt-get.cc | 6 +++--- test/integration/test-apt-get-download | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 1019ff325..4d609104c 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -630,8 +630,8 @@ bool DoDownload(CommandLine &CmdL) return false; APT::CacheSetHelper helper(c0out); - APT::VersionList verset = APT::VersionList::FromCommandLine(Cache, - CmdL.FileList + 1, APT::VersionList::CANDIDATE, helper); + APT::VersionSet verset = APT::VersionSet::FromCommandLine(Cache, + CmdL.FileList + 1, APT::VersionSet::CANDIDATE, helper); if (verset.empty() == true) return false; @@ -650,7 +650,7 @@ bool DoDownload(CommandLine &CmdL) std::string const cwd = SafeGetCWD(); _config->Set("Dir::Cache::Archives", cwd); int i = 0; - for (APT::VersionList::const_iterator Ver = verset.begin(); + for (APT::VersionSet::const_iterator Ver = verset.begin(); Ver != verset.end(); ++Ver, ++i) { pkgAcquire::Item *I = new pkgAcqArchive(&Fetcher, SrcList, &Recs, *Ver, storefile[i]); diff --git a/test/integration/test-apt-get-download b/test/integration/test-apt-get-download index c2a5c3d8e..0d92283f1 100755 --- a/test/integration/test-apt-get-download +++ b/test/integration/test-apt-get-download @@ -39,3 +39,8 @@ aptget download apt aptget download apt testsuccess test -s apt_2.0_all.deb rm -f apt_1.0_all.deb + +# deb:738103 - apt-get download foo foo fails +rm -f apt_*.deb +aptget download apt apt +testsuccess test -s apt_2.0_all.deb -- cgit v1.2.3