-q is for logging and -qqq (old -qq) basically kills every output expect
errors, so there should be a way of declaring a middleground in which
the output of e.g. 'update' isn't as verbose, but still shows some
things. The test framework was actually making use of by accident as it
ignored the quiet level in output setup for apt before.
Eventually we should figure out some better quiet levels for all tools…
12 files changed:
{
if (Config.FindI("quiet",0) >= 1 || Config.FindB("quiet::NoUpdate", false) == true)
NoUpdate = true;
{
if (Config.FindI("quiet",0) >= 1 || Config.FindB("quiet::NoUpdate", false) == true)
NoUpdate = true;
- if (Config.FindI("quiet",0) >= 2)
+ if (Config.FindI("quiet",0) >= 2 || Config.FindB("quiet::NoProgress", false) == true)
NoDisplay = true;
}
/*}}}*/
NoDisplay = true;
}
/*}}}*/
// testcases use it to disable pulses without disabling other user messages
if (Quiet == 0 && _config->FindB("quiet::NoUpdate", false) == true)
this->Quiet = 1;
// testcases use it to disable pulses without disabling other user messages
if (Quiet == 0 && _config->FindB("quiet::NoUpdate", false) == true)
this->Quiet = 1;
+ if (Quiet < 2 && _config->FindB("quiet::NoProgress", false) == true)
+ this->Quiet = 2;
}
/*}}}*/
// AcqTextStatus::Start - Downloading has started /*{{{*/
}
/*}}}*/
// AcqTextStatus::Start - Downloading has started /*{{{*/
#include <apt-private/private-output.h>
#include <apt-private/private-download.h>
#include <apt-private/private-output.h>
#include <apt-private/private-download.h>
+#include <apt-private/acqprogress.h>
#include <fstream>
#include <string>
#include <fstream>
#include <string>
return AuthPrompt(UntrustedList, PromptUser);
}
return AuthPrompt(UntrustedList, PromptUser);
}
-
-bool AuthPrompt(std::vector<std::string> const &UntrustedList, bool const PromptUser)
+ /*}}}*/
+bool AuthPrompt(std::vector<std::string> const &UntrustedList, bool const PromptUser)/*{{{*/
{
ShowList(c2out,_("WARNING: The following packages cannot be authenticated!"), UntrustedList,
[](std::string const&) { return true; },
{
ShowList(c2out,_("WARNING: The following packages cannot be authenticated!"), UntrustedList,
[](std::string const&) { return true; },
+
+aptAcquireWithTextStatus::aptAcquireWithTextStatus() : pkgAcquire::pkgAcquire(),
+ Stat(std::cout, ScreenWidth, _config->FindI("quiet",0))
+{
+ SetLog(&Stat);
+}
#ifndef APT_PRIVATE_DOWNLOAD_H
#define APT_PRIVATE_DOWNLOAD_H
#ifndef APT_PRIVATE_DOWNLOAD_H
#define APT_PRIVATE_DOWNLOAD_H
+#include <apt-pkg/acquire.h>
#include <apt-pkg/macros.h>
#include <apt-pkg/macros.h>
+#include <apt-private/acqprogress.h>
+
#include <string>
#include <vector>
#include <string>
#include <vector>
// Check if all files in the fetcher are authenticated
APT_PUBLIC bool CheckAuth(pkgAcquire& Fetcher, bool const PromptUser);
// Check if all files in the fetcher are authenticated
APT_PUBLIC bool CheckAuth(pkgAcquire& Fetcher, bool const PromptUser);
APT_PUBLIC bool CheckFreeSpaceBeforeDownload(std::string const &Dir, unsigned long long FetchBytes);
APT_PUBLIC bool CheckFreeSpaceBeforeDownload(std::string const &Dir, unsigned long long FetchBytes);
+class APT_PUBLIC aptAcquireWithTextStatus : public pkgAcquire
+{
+ AcqTextStatus Stat;
+public:
+ aptAcquireWithTextStatus();
+};
+
return false;
// Create the download object
return false;
// Create the download object
- AcqTextStatus Stat(std::cout, ScreenWidth,_config->FindI("quiet",0));
- pkgAcquire Fetcher(&Stat);
+ aptAcquireWithTextStatus Fetcher;
if (_config->FindB("APT::Get::Print-URIs", false) == true)
{
// force a hashsum for compatibility reasons
if (_config->FindB("APT::Get::Print-URIs", false) == true)
{
// force a hashsum for compatibility reasons
#include <apt-private/acqprogress.h>
#include <apt-private/private-cachefile.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-update.h>
#include <apt-private/private-output.h>
#include <apt-private/private-update.h>
return false;
pkgSourceList *List = Cache.GetSourceList();
return false;
pkgSourceList *List = Cache.GetSourceList();
- // Create the progress
- AcqTextStatus Stat(std::cout, ScreenWidth,_config->FindI("quiet",0));
-
// Just print out the uris an exit if the --print-uris flag was used
if (_config->FindB("APT::Get::Print-URIs") == true)
{
// force a hashsum for compatibility reasons
_config->CndSet("Acquire::ForceHash", "md5sum");
// Just print out the uris an exit if the --print-uris flag was used
if (_config->FindB("APT::Get::Print-URIs") == true)
{
// force a hashsum for compatibility reasons
_config->CndSet("Acquire::ForceHash", "md5sum");
- // get a fetcher
- pkgAcquire Fetcher(&Stat);
-
- // Populate it with the source selection and get all Indexes
+ // Populate it with the source selection and get all Indexes
+ aptAcquireWithTextStatus Fetcher;
if (List->GetIndexes(&Fetcher,true) == false)
return false;
if (List->GetIndexes(&Fetcher,true) == false)
return false;
// do the work
if (_config->FindB("APT::Get::Download",true) == true)
// do the work
if (_config->FindB("APT::Get::Download",true) == true)
- ListUpdate(Stat, *List);
+ {
+ AcqTextStatus Stat(std::cout, ScreenWidth,_config->FindI("quiet",0));
+ ListUpdate(Stat, *List);
+ }
// Rebuild the cache.
if (_config->FindB("pkgCacheFile::Generate", true) == true)
// Rebuild the cache.
if (_config->FindB("pkgCacheFile::Generate", true) == true)
if (verset.empty() == true)
return false;
if (verset.empty() == true)
return false;
- AcqTextStatus Stat(std::cout, ScreenWidth,_config->FindI("quiet",0));
- pkgAcquire Fetcher(&Stat);
-
pkgRecords Recs(Cache);
pkgSourceList *SrcList = Cache.GetSourceList();
// reuse the usual acquire methods for deb files, but don't drop them into
// the usual directories - keep everything in the current directory
pkgRecords Recs(Cache);
pkgSourceList *SrcList = Cache.GetSourceList();
// reuse the usual acquire methods for deb files, but don't drop them into
// the usual directories - keep everything in the current directory
+ aptAcquireWithTextStatus Fetcher;
std::vector<std::string> storefile(verset.size());
std::string const cwd = SafeGetCWD();
_config->Set("Dir::Cache::Archives", cwd);
std::vector<std::string> storefile(verset.size());
std::string const cwd = SafeGetCWD();
_config->Set("Dir::Cache::Archives", cwd);
if (_error->PendingError() == true)
return false;
if (_error->PendingError() == true)
return false;
- // Create the download object
- AcqTextStatus Stat(std::cout, ScreenWidth,_config->FindI("quiet",0));
- pkgAcquire Fetcher(&Stat);
-
std::unique_ptr<DscFile[]> Dsc(new DscFile[CmdL.FileSize()]);
// insert all downloaded uris into this set to avoid downloading them
std::unique_ptr<DscFile[]> Dsc(new DscFile[CmdL.FileSize()]);
// insert all downloaded uris into this set to avoid downloading them
bool const dscOnly = _config->FindB("APT::Get::Dsc-Only", false);
// Load the requestd sources into the fetcher
bool const dscOnly = _config->FindB("APT::Get::Dsc-Only", false);
// Load the requestd sources into the fetcher
+ aptAcquireWithTextStatus Fetcher;
unsigned J = 0;
std::vector<std::string> UntrustedList;
for (const char **I = CmdL.FileList + 1; *I != 0; I++, J++)
unsigned J = 0;
std::vector<std::string> UntrustedList;
for (const char **I = CmdL.FileList + 1; *I != 0; I++, J++)
CmdL.FileList + 1, APT::CacheSetHelper::CANDIDATE, helper);
if (verset.empty() == true)
return false;
CmdL.FileList + 1, APT::CacheSetHelper::CANDIDATE, helper);
if (verset.empty() == true)
return false;
- pkgAcquire Fetcher;
- AcqTextStatus Stat(std::cout, ScreenWidth,_config->FindI("quiet",0));
- Fetcher.SetLog(&Stat);
bool const downOnly = _config->FindB("APT::Get::Download-Only", false);
bool const printOnly = _config->FindB("APT::Get::Print-URIs", false);
bool const downOnly = _config->FindB("APT::Get::Download-Only", false);
bool const printOnly = _config->FindB("APT::Get::Print-URIs", false);
+ aptAcquireWithTextStatus Fetcher;
for (APT::VersionList::const_iterator Ver = verset.begin();
Ver != verset.end();
++Ver)
for (APT::VersionList::const_iterator Ver = verset.begin();
Ver != verset.end();
++Ver)
if (CmdL.FileSize() <= 2)
return _error->Error(_("Must specify at least one pair url/filename"));
if (CmdL.FileSize() <= 2)
return _error->Error(_("Must specify at least one pair url/filename"));
- AcqTextStatus Stat(std::cout, ScreenWidth,_config->FindI("quiet",0));
- pkgAcquire Fetcher(&Stat);
-
+ aptAcquireWithTextStatus Fetcher;
size_t fileind = 0;
std::vector<std::string> targetfiles;
while (fileind + 2 <= CmdL.FileSize())
size_t fileind = 0;
std::vector<std::string> targetfiles;
while (fileind + 2 <= CmdL.FileSize())
static bool ShowHelp(CommandLine &, CommandLine::DispatchWithHelp const * Cmds)
{
static bool ShowHelp(CommandLine &, CommandLine::DispatchWithHelp const * Cmds)
{
- ioprintf(c1out, "%s %s (%s)\n", PACKAGE, PACKAGE_VERSION, COMMON_ARCH);
+ ioprintf(std::cout, "%s %s (%s)\n", PACKAGE, PACKAGE_VERSION, COMMON_ARCH);
// FIXME: generate from CommandLine
// FIXME: generate from CommandLine
_("Usage: apt [options] command\n"
"\n"
"CLI for apt.\n")
_("Usage: apt [options] command\n"
"\n"
"CLI for apt.\n")
{nullptr, nullptr, nullptr}
};
{nullptr, nullptr, nullptr}
};
- // FIXME: Those ignore commandline configuration like -q
- InitSignals();
- InitOutput();
-
CommandLine CmdL;
ParseCommandLine(CmdL, Cmds, "apt", &_config, &_system, argc, argv, ShowHelp);
CommandLine CmdL;
ParseCommandLine(CmdL, Cmds, "apt", &_config, &_system, argc, argv, ShowHelp);
+ int const quiet = _config->FindI("quiet", 0);
+ if (quiet == 2)
+ {
+ _config->CndSet("quiet::NoProgress", true);
+ _config->Set("quiet", 1);
+ }
+
+ InitSignals();
+ InitOutput();
+
CheckIfCalledByScript(argc, argv);
CheckIfSimulateMode(CmdL);
CheckIfCalledByScript(argc, argv);
CheckIfSimulateMode(CmdL);
testfailuremsg 'E: The update command takes no arguments' apt update arguments
testfailuremsg 'E: The update command takes no arguments' apt update arguments
-testsuccessequal "1 package can be upgraded. Run 'apt list --upgradable' to see it." apt update -q
+testsuccessequal "1 package can be upgraded. Run 'apt list --upgradable' to see it." apt update -qq
cp dpkg.status rootdir/var/lib/dpkg/status
insertinstalledpackage 'foo' 'all' '2.0'
cp dpkg.status rootdir/var/lib/dpkg/status
insertinstalledpackage 'foo' 'all' '2.0'
-testsuccessequal 'All packages are up to date.' apt update -q
+testsuccessequal 'All packages are up to date.' apt update -qq
assert_repo_is_intact()
{
assert_repo_is_intact()
{
- testsuccessequal "foo/unstable 2.0 all" apt list -q
+ testsuccessequal "foo/unstable 2.0 all" apt list -qq
testsuccess aptget install -y -s foo
testfailure aptget install -y evil
testsuccess aptget source foo --print-uris
testsuccess aptget install -y -s foo
testfailure aptget install -y evil
testsuccess aptget source foo --print-uris
create_fresh_archive
testsuccess aptget update
listcurrentlistsdirectory > lists.before
create_fresh_archive
testsuccess aptget update
listcurrentlistsdirectory > lists.before
- testsuccessequal 'old/unstable 1.0 all' apt list -q
+ testsuccessequal 'old/unstable 1.0 all' apt list -qq
}
test_inrelease_to_new_inrelease() {
}
test_inrelease_to_new_inrelease() {
add_new_package '+1hour'
testsuccess aptget update -o Debug::Acquire::Transaction=1
testsuccessequal 'new/unstable 1.0 all
add_new_package '+1hour'
testsuccess aptget update -o Debug::Acquire::Transaction=1
testsuccessequal 'new/unstable 1.0 all
-old/unstable 1.0 all' apt list -q
+old/unstable 1.0 all' apt list -qq
}
test_inrelease_to_broken_hash_reverts_all() {
}
test_inrelease_to_broken_hash_reverts_all() {