From b03273772744b263ae5c06de8034ec2200245964 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Wed, 21 Dec 2011 17:10:17 +0100 Subject: Support checking for ignored CFLAGS using -frecord-gcc-switches. --- bin/misc-functions.sh | 40 ++++++++++++++++++++++++++++++++++++++++ cnf/make.conf | 3 +++ man/ebuild.5 | 9 +++++++++ man/make.conf.5 | 4 ++++ 4 files changed, 56 insertions(+) diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh index 358288932..b536a63e9 100755 --- a/bin/misc-functions.sh +++ b/bin/misc-functions.sh @@ -308,6 +308,46 @@ install_qa_check() { sleep 1 fi + # Check for files built without respecting CFLAGS + if [[ "${CFLAGS}" == *-frecord-gcc-switches* ]] && [[ "${PN}" != *-bin ]] ; then + qa_var="QA_DT_SWITCHES_${ARCH/-/_}" + eval "[[ -n \${!qa_var} ]] && QA_DT_SWITCHES=(\"\${${qa_var}[@]}\")" + f=$(scanelf -qyRF '%k %p' -k \!.GCC.command.line "${ED}" | sed -e "s:\!.GCC.command.line ::") + if [[ -n ${f} ]] ; then + echo "${f}" > "${T}"/scanelf-ignored-CFLAGS.log + if [ "${QA_STRICT_DT_SWITCHES-unset}" == unset ] ; then + if [[ ${#QA_DT_SWITCHES[@]} -gt 1 ]] ; then + for x in "${QA_DT_SWITCHES[@]}" ; do + sed -e "s#^${x#/}\$##" -i "${T}"/scanelf-ignored-CFLAGS.log + done + else + local shopts=$- + set -o noglob + for x in ${QA_DT_SWITCHES} ; do + sed -e "s#^${x#/}\$##" -i "${T}"/scanelf-ignored-CFLAGS.log + done + set +o noglob + set -${shopts} + fi + fi + # Filter anything under /usr/lib/debug/ in order to avoid + # duplicate warnings for splitdebug files. + sed -e "s#^usr/lib/debug/.*##" -e "/^\$/d" -e "s#^#/#" \ + -i "${T}"/scanelf-ignored-CFLAGS.log + f=$(<"${T}"/scanelf-ignored-CFLAGS.log) + if [[ -n ${f} ]] ; then + vecho -ne '\n' + eqawarn "${BAD}QA Notice: Files built without respecting CFLAGS have been detected${NORMAL}" + eqawarn " Please include the following list of files in your report:" + eqawarn "${f}" + vecho -ne '\n' + sleep 1 + else + rm -f "${T}"/scanelf-ignored-CFLAGS.log + fi + fi + fi + # Check for files built without respecting LDFLAGS if [[ "${LDFLAGS}" == *,--hash-style=gnu* ]] && [[ "${PN}" != *-bin ]] ; then qa_var="QA_DT_HASH_${ARCH/-/_}" diff --git a/cnf/make.conf b/cnf/make.conf index ef570bcb4..aecb6336f 100644 --- a/cnf/make.conf +++ b/cnf/make.conf @@ -32,6 +32,9 @@ # package (and in some cases the libraries it uses) at default optimizations # before reporting errors to developers. # +# If your gcc supports it, you can add -frecord-gcc-switches in order to enable +# CFLAGS ignorance checking for ebuilds. +# # Please refer to the GCC manual for a list of possible values. # #CFLAGS="-O2 -pipe" diff --git a/man/ebuild.5 b/man/ebuild.5 index 2d58c9e61..1216ac171 100644 --- a/man/ebuild.5 +++ b/man/ebuild.5 @@ -602,6 +602,15 @@ This should contain a list of file paths, relative to the image directory, of files that contain writable and executable segments. These are rare. The paths may contain fnmatch patterns. .TP +\fBQA_DT_SWITCHES\fR +This should contain a list of file paths, relative to the image directory, of +files that do not contain .GCC.command.line sections. The paths may contain +regular expressions with escape\-quoted special characters. +.br +This variable is intended to be used on files of binary packages which ignore +CFLAGS variable. +.TP +.TP \fBQA_DT_HASH\fR This should contain a list of file paths, relative to the image directory, of files that contain .hash sections. The paths may contain regular expressions diff --git a/man/make.conf.5 b/man/make.conf.5 index 76adfe2ce..f9d69b71b 100644 --- a/man/make.conf.5 +++ b/man/make.conf.5 @@ -814,6 +814,10 @@ settings from ebuilds. See also \fBebuild\fR(5). Set this to cause portage to ignore any \fIQA_TEXTREL\fR override settings from ebuilds. See also \fBebuild\fR(5). .TP +\fBQA_STRICT_DT_SWITCHES = \fI"set"\fR +Set this to cause portage to ignore any \fIQA_DT_SWITCHES\fR override +settings from ebuilds. See also \fBebuild\fR(5). +.TP \fBQA_STRICT_DT_HASH = \fI"set"\fR Set this to cause portage to ignore any \fIQA_DT_HASH\fR override settings from ebuilds. See also \fBebuild\fR(5). -- cgit v1.2.3-1-g7c22