From 3c4d07ff1802d6834fbe36583438b98e1ad420ee Mon Sep 17 00:00:00 2001 From: Lyndon Brown Date: Tue, 24 Mar 2020 19:35:20 +0000 Subject: [PATCH] apt: use its new colour support apt v2.0.1 introduced support for coloured E:/W:/N: labels. this adds support to control it based upon our own colour control. note that with utilities like dpkg we do not do this, but apt only uses its new colour support automatically when `apt` is used directly, it is not automatically enabled (per isatty()) for `apt-get`/`aptitude` (the `apt` developer responsible for adding colour support in response to my request for it told me that it was deliberately done like this per being customary to not change behaviour of those tools for compatibility reasons). colour errors/warnings are useful, so we want to turn it on for our use of these tools where we can. Gbp-Dch: Short --- functions/defaults.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/functions/defaults.sh b/functions/defaults.sh index 2b7a1e27b..daeb7ca78 100755 --- a/functions/defaults.sh +++ b/functions/defaults.sh @@ -219,6 +219,15 @@ Set_config_defaults () _QUIET="${_QUIET:-false}" _VERBOSE="${_VERBOSE:-false}" + # Apt v2.0.1 introduced color support, but it needs to be explicitly enabled + if [ "${_COLOR_OUT}" = "true" ] && [ "${_COLOR_ERR}" = "true" ]; then + APT_OPTIONS="${APT_OPTIONS} -o APT::Color=true" + APTITUDE_OPTIONS="${APTITUDE_OPTIONS} -o APT::Color=true" + else + APT_OPTIONS="${APT_OPTIONS} -o APT::Color=false" + APTITUDE_OPTIONS="${APTITUDE_OPTIONS} -o APT::Color=false" + fi + ## config/bootstrap # Setting mirrors