summaryrefslogtreecommitdiffstats
path: root/apt-pkg/contrib
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-23 04:10:52 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-23 04:10:52 +0000
commit85f9a2650850b181208492de61822cf840ee62e5 (patch)
treef2ba509bc1f23e871c5e0e9d569fb82c68280e50 /apt-pkg/contrib
parentReleasing progress-linux version 2.9.1-0.0~progress7.99u1. (diff)
downloadapt-85f9a2650850b181208492de61822cf840ee62e5.tar.xz
apt-85f9a2650850b181208492de61822cf840ee62e5.zip
Merging upstream version 2.9.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'apt-pkg/contrib')
-rw-r--r--apt-pkg/contrib/error.cc28
-rw-r--r--apt-pkg/contrib/error.h23
-rw-r--r--apt-pkg/contrib/progress.cc10
3 files changed, 50 insertions, 11 deletions
diff --git a/apt-pkg/contrib/error.cc b/apt-pkg/contrib/error.cc
index c9bb622..83e90a0 100644
--- a/apt-pkg/contrib/error.cc
+++ b/apt-pkg/contrib/error.cc
@@ -34,6 +34,7 @@
#include <string>
#include <unistd.h>
+#include <apti18n.h>
/*}}}*/
// Global Error Object /*{{{*/
@@ -64,6 +65,7 @@ GEMessage(FatalE, FATAL)
GEMessage(Errno, ERROR)
GEMessage(WarningE, WARNING)
GEMessage(NoticeE, NOTICE)
+GEMessage(AuditE, AUDIT)
GEMessage(DebugE, DEBUG)
#undef GEMessage
/*}}}*/
@@ -121,6 +123,7 @@ GEMessage(Fatal, FATAL)
GEMessage(Error, ERROR)
GEMessage(Warning, WARNING)
GEMessage(Notice, NOTICE)
+GEMessage(Audit, AUDIT)
GEMessage(Debug, DEBUG)
#undef GEMessage
/*}}}*/
@@ -252,11 +255,13 @@ void GlobalError::MergeWithStack() {
APT_HIDDEN std::ostream &operator<<(std::ostream &out, GlobalError::Item i)
{
static constexpr auto COLOR_RESET = "\033[0m";
- static constexpr auto COLOR_NOTICE = "\033[33m"; // normal yellow
+ static constexpr auto COLOR_BOLD = "\033[1m"; // bold neutral
+ static constexpr auto COLOR_NOTICE = "\033[1m"; // bold neutral
static constexpr auto COLOR_WARN = "\033[1;33m"; // bold yellow
static constexpr auto COLOR_ERROR = "\033[1;31m"; // bold red
bool use_color = _config->FindB("APT::Color", false);
+ auto out_ver = _config->FindI("APT::Output-Version");
if (use_color)
{
@@ -270,6 +275,7 @@ APT_HIDDEN std::ostream &operator<<(std::ostream &out, GlobalError::Item i)
out << COLOR_WARN;
break;
case GlobalError::NOTICE:
+ case GlobalError::AUDIT:
out << COLOR_NOTICE;
break;
default:
@@ -281,19 +287,26 @@ APT_HIDDEN std::ostream &operator<<(std::ostream &out, GlobalError::Item i)
{
case GlobalError::FATAL:
case GlobalError::ERROR:
- out << 'E';
+ // TRANSLATOR: This is a warning level displayed before the message
+ out << (out_ver < 30 ? "E:" : _("Error:"));
break;
case GlobalError::WARNING:
- out << 'W';
+ // TRANSLATOR: This is a warning level displayed before the message
+ out << (out_ver < 30 ? "W:" : _("Warning:"));
break;
case GlobalError::NOTICE:
- out << 'N';
+ // TRANSLATOR: This is a warning level displayed before the message
+ out << (out_ver < 30 ? "N:" : _("Notice:"));
+ break;
+ case GlobalError::AUDIT:
+ out << (out_ver < 30 ? "A:" : _("Audit:"));
break;
case GlobalError::DEBUG:
- out << 'D';
+ // TRANSLATOR: This is a warning level displayed before the message
+ out << _("Debug:");
break;
}
- out << ": ";
+ out << " ";
if (use_color)
{
@@ -303,7 +316,10 @@ APT_HIDDEN std::ostream &operator<<(std::ostream &out, GlobalError::Item i)
case GlobalError::ERROR:
case GlobalError::WARNING:
case GlobalError::NOTICE:
+ case GlobalError::AUDIT:
out << COLOR_RESET;
+ if (out_ver >= 30)
+ out << COLOR_BOLD;
break;
default:
break;
diff --git a/apt-pkg/contrib/error.h b/apt-pkg/contrib/error.h
index 35e39ee..7922320 100644
--- a/apt-pkg/contrib/error.h
+++ b/apt-pkg/contrib/error.h
@@ -66,6 +66,8 @@ public: /*{{{*/
WARNING = 20,
/** \brief deprecation warnings, old fallback behavior, … */
NOTICE = 10,
+ /** \brief future deprecation warnings, divergence from best practices */
+ AUDIT = 5,
/** \brief for developers only in areas it is hard to print something directly */
DEBUG = 0
};
@@ -109,6 +111,15 @@ public: /*{{{*/
*/
bool NoticeE(const char *Function,const char *Description,...) APT_PRINTF(3) APT_COLD;
+ /** \brief add an audit message with errno to the list
+ *
+ * \param Function name of the function generating the error
+ * \param Description format string for the error message
+ *
+ * \return \b false
+ */
+ bool AuditE(const char *Function,const char *Description,...) APT_PRINTF(3) APT_COLD;
+
/** \brief add a debug message with errno to the list
*
* \param Function name of the function generating the error
@@ -193,6 +204,18 @@ public: /*{{{*/
*/
bool Notice(const char *Description,...) APT_PRINTF(2) APT_COLD;
+ /** \brief add an audit message to the list
+ *
+ * An audit message highlights divergences from best practices and
+ * future deprecations. It my for example include additional messages
+ * targeted at repository owners.
+ *
+ * \param Description Format string for the message
+ *
+ * \return \b false
+ */
+ bool Audit(const char *Description,...) APT_PRINTF(2) APT_COLD;
+
/** \brief add a debug message to the list
*
* \param Description Format string for the message
diff --git a/apt-pkg/contrib/progress.cc b/apt-pkg/contrib/progress.cc
index df068e4..5f440a7 100644
--- a/apt-pkg/contrib/progress.cc
+++ b/apt-pkg/contrib/progress.cc
@@ -156,12 +156,12 @@ void OpTextProgress::Done()
char S[300] = {};
if (_error->PendingError() == true)
snprintf(S,sizeof(S),_("%c%s... Error!"),'\r',OldOp.c_str());
- else if (not _config->FindB("APT::Internal::OpProgress::EraseLines", true))
+ else if (not _config->FindB("APT::Internal::OpProgress::EraseLines", _config->FindI("APT::Output-Version") >= 30))
snprintf(S,sizeof(S),_("%c%s... Done"),'\r',OldOp.c_str());
Write(S);
// FIXME: apt-cdrom relies on this end of line being printed
- if (_error->PendingError() || not _config->FindB("APT::Internal::OpProgress::EraseLines", true))
- cout << endl;
+ if (_error->PendingError() || not _config->FindB("APT::Internal::OpProgress::EraseLines", _config->FindI("APT::Output-Version") >= 30))
+ cout << endl;
OldOp = string();
}
@@ -202,8 +202,8 @@ void OpTextProgress::Update()
{
snprintf(S,sizeof(S),"\r%s",OldOp.c_str());
Write(S);
- if (_config->FindB("APT::Internal::OpProgress::EraseLines", true))
- cout << endl;
+ if (_config->FindB("APT::Internal::OpProgress::EraseLines", _config->FindI("APT::Output-Version") >= 30))
+ cout << endl;
}
// Print the spinner. Absolute progress shows us a time progress.