From 215b184d6a5774df10cabe12bde7d6b0fa3aff85 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 23 Jan 2024 18:43:13 +0100 Subject: Add an --audit option to switch on audit logging This option is recommended to be used by repository operators for testing. --- apt-private/private-cmndline.cc | 5 ++++- apt-private/private-output.cc | 4 +++- doc/apt.ent | 7 +++++++ doc/examples/configure-index | 1 + 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/apt-private/private-cmndline.cc b/apt-private/private-cmndline.cc index a37af6b58..b05ec8945 100644 --- a/apt-private/private-cmndline.cc +++ b/apt-private/private-cmndline.cc @@ -409,6 +409,7 @@ std::vector getCommandArgs(APT_CMD const Program, char const // general options addArg(0, "color", "APT::Color", 0); addArg('q', "quiet", "quiet", CommandLine::IntLevel); + addArg(0, "audit", "APT::Audit", 0); addArg('q', "silent", "quiet", CommandLine::IntLevel); addArg('c', "config-file", 0, CommandLine::ConfigFile); addArg('o', "option", 0, CommandLine::ArbItem); @@ -601,7 +602,9 @@ unsigned short DispatchCommandLine(CommandLine &CmdL, std::vectorPendingError(); - if (_config->FindI("quiet",0) > 0) + if (_config->FindB("APT::Audit")) + _error->DumpErrors(GlobalError::AUDIT); + else if (_config->FindI("quiet",0) > 0) _error->DumpErrors(); else _error->DumpErrors(GlobalError::NOTICE); diff --git a/apt-private/private-output.cc b/apt-private/private-output.cc index 179078e80..35fe9cdca 100644 --- a/apt-private/private-output.cc +++ b/apt-private/private-output.cc @@ -799,7 +799,9 @@ bool YnPrompt(char const * const Question, bool const Default, bool const ShowGl // if we ask interactively, show warnings/notices before the question if (ShowGlobalErrors == true && AssumeYes == false && AssumeNo == false) { - if (_config->FindI("quiet",0) > 0) + if (_config->FindB("APT::Audit")) + _error->DumpErrors(c2o, GlobalError::AUDIT); + else if (_config->FindI("quiet",0) > 0) _error->DumpErrors(c2o); else _error->DumpErrors(c2o, GlobalError::NOTICE); diff --git a/doc/apt.ent b/doc/apt.ent index 386abd493..b502073a9 100644 --- a/doc/apt.ent +++ b/doc/apt.ent @@ -48,6 +48,13 @@ + + + Show audit (and notice) messages. This overrides the quiet option, but only for notice messages, not progress ones. + + + + diff --git a/doc/examples/configure-index b/doc/examples/configure-index index 72e907507..3f6140038 100644 --- a/doc/examples/configure-index +++ b/doc/examples/configure-index @@ -47,6 +47,7 @@ quiet "" { // Options for APT in general APT { + Audit ""; // display audit messages Architecture ""; // debian architecture like amd64, i386, powerpc, armhf, mips, … Architectures ""; // a list of (foreign) debian architectures, defaults to: dpkg --print-foreign-architectures BarbarianArchitectures ""; // a list of architectures considered too foreign to satisfy M-A:foreign -- cgit v1.2.3-70-g09d2