aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2014-09-12 13:38:07 +0200
committerBrian Dolbec <dolsen@gentoo.org>2014-09-25 18:22:13 -0700
commit0f245b5f6d32c6bb10f59071e8bff8193a08b85a (patch)
tree17f332551d80b26af3b1366b17a189c645660ea8
parentUpdate gcc warning checks to work with colored output (diff)
downloadportage-0f245b5f6d32c6bb10f59071e8bff8193a08b85a.tar.gz
portage-0f245b5f6d32c6bb10f59071e8bff8193a08b85a.tar.bz2
portage-0f245b5f6d32c6bb10f59071e8bff8193a08b85a.zip
Use a single grep call for gcc warning checksv2.2.14_rc1
Use a single grep call with all gcc warning checks combined rather than calling grep separately for each message being checked. Aside to being faster, this also avoids outputting warnings in separate blocks.
-rw-r--r--bin/install-qa-check.d/90gcc-warnings62
1 files changed, 33 insertions, 29 deletions
diff --git a/bin/install-qa-check.d/90gcc-warnings b/bin/install-qa-check.d/90gcc-warnings
index 48c11e4af..9703c39de 100644
--- a/bin/install-qa-check.d/90gcc-warnings
+++ b/bin/install-qa-check.d/90gcc-warnings
@@ -71,39 +71,43 @@ gcc_warn_check() {
#': warning: missing sentinel in function call'
#': warning: not enough variable arguments to fit a sentinel'
)
+
+ # join all messages into one grep-expression
+ local joined_msgs
+ printf -v joined_msgs '%s|' "${msgs[@]}"
+ joined_msgs=${joined_msgs%|}
+
local abort="no"
- local i=0
local grep_cmd=grep
[[ $PORTAGE_LOG_FILE = *.gz ]] && grep_cmd=zgrep
- while [[ -n ${msgs[${i}]} ]] ; do
- m=${msgs[$((i++))]}
- # force C locale to work around slow unicode locales #160234
- f=$(LC_ALL=C $grep_cmd "${m}" "${PORTAGE_LOG_FILE}")
- if [[ -n ${f} ]] ; then
- abort="yes"
- # for now, don't make this fatal (see bug #337031)
- #case "$m" in
- # ": warning: call to .* will always overflow destination buffer") always_overflow=yes ;;
- #esac
- if [[ $always_overflow = yes ]] ; then
- eerror
- eerror "QA Notice: Package triggers severe warnings which indicate that it"
- eerror " may exhibit random runtime failures."
- eerror
- eerror "${f}"
- eerror
- eerror " Please file a bug about this at http://bugs.gentoo.org/"
- eerror " with the maintaining herd of the package."
- eerror
- else
- __vecho -ne '\n'
- eqawarn "QA Notice: Package triggers severe warnings which indicate that it"
- eqawarn " may exhibit random runtime failures."
- eqawarn "${f}"
- __vecho -ne '\n'
- fi
+
+ # force C locale to work around slow unicode locales #160234
+ f=$(LC_CTYPE=C LC_COLLATE=C "${grep_cmd}" -E "${joined_msgs}" "${PORTAGE_LOG_FILE}")
+ if [[ -n ${f} ]] ; then
+ abort="yes"
+ # for now, don't make this fatal (see bug #337031)
+ #if [[ ${f} == *'will always overflow destination buffer'* ]]; then
+ # always_overflow=yes
+ #fi
+ if [[ $always_overflow = yes ]] ; then
+ eerror
+ eerror "QA Notice: Package triggers severe warnings which indicate that it"
+ eerror " may exhibit random runtime failures."
+ eerror
+ eerror "${f}"
+ eerror
+ eerror " Please file a bug about this at http://bugs.gentoo.org/"
+ eerror " with the maintaining herd of the package."
+ eerror
+ else
+ __vecho -ne '\n'
+ eqawarn "QA Notice: Package triggers severe warnings which indicate that it"
+ eqawarn " may exhibit random runtime failures."
+ eqawarn "${f}"
+ __vecho -ne '\n'
fi
- done
+ fi
+
local cat_cmd=cat
[[ $PORTAGE_LOG_FILE = *.gz ]] && cat_cmd=zcat
[[ $reset_debug = 1 ]] && set -x