1 |
commit: b03273772744b263ae5c06de8034ec2200245964 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Dec 21 16:10:17 2011 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Dec 21 19:29:58 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b0327377 |
7 |
|
8 |
Support checking for ignored CFLAGS using -frecord-gcc-switches. |
9 |
|
10 |
--- |
11 |
bin/misc-functions.sh | 40 ++++++++++++++++++++++++++++++++++++++++ |
12 |
cnf/make.conf | 3 +++ |
13 |
man/ebuild.5 | 9 +++++++++ |
14 |
man/make.conf.5 | 4 ++++ |
15 |
4 files changed, 56 insertions(+), 0 deletions(-) |
16 |
|
17 |
diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh |
18 |
index 3582889..b536a63 100755 |
19 |
--- a/bin/misc-functions.sh |
20 |
+++ b/bin/misc-functions.sh |
21 |
@@ -308,6 +308,46 @@ install_qa_check() { |
22 |
sleep 1 |
23 |
fi |
24 |
|
25 |
+ # Check for files built without respecting CFLAGS |
26 |
+ if [[ "${CFLAGS}" == *-frecord-gcc-switches* ]] && [[ "${PN}" != *-bin ]] ; then |
27 |
+ qa_var="QA_DT_SWITCHES_${ARCH/-/_}" |
28 |
+ eval "[[ -n \${!qa_var} ]] && QA_DT_SWITCHES=(\"\${${qa_var}[@]}\")" |
29 |
+ f=$(scanelf -qyRF '%k %p' -k \!.GCC.command.line "${ED}" | sed -e "s:\!.GCC.command.line ::") |
30 |
+ if [[ -n ${f} ]] ; then |
31 |
+ echo "${f}" > "${T}"/scanelf-ignored-CFLAGS.log |
32 |
+ if [ "${QA_STRICT_DT_SWITCHES-unset}" == unset ] ; then |
33 |
+ if [[ ${#QA_DT_SWITCHES[@]} -gt 1 ]] ; then |
34 |
+ for x in "${QA_DT_SWITCHES[@]}" ; do |
35 |
+ sed -e "s#^${x#/}\$##" -i "${T}"/scanelf-ignored-CFLAGS.log |
36 |
+ done |
37 |
+ else |
38 |
+ local shopts=$- |
39 |
+ set -o noglob |
40 |
+ for x in ${QA_DT_SWITCHES} ; do |
41 |
+ sed -e "s#^${x#/}\$##" -i "${T}"/scanelf-ignored-CFLAGS.log |
42 |
+ done |
43 |
+ set +o noglob |
44 |
+ set -${shopts} |
45 |
+ fi |
46 |
+ fi |
47 |
+ # Filter anything under /usr/lib/debug/ in order to avoid |
48 |
+ # duplicate warnings for splitdebug files. |
49 |
+ sed -e "s#^usr/lib/debug/.*##" -e "/^\$/d" -e "s#^#/#" \ |
50 |
+ -i "${T}"/scanelf-ignored-CFLAGS.log |
51 |
+ f=$(<"${T}"/scanelf-ignored-CFLAGS.log) |
52 |
+ if [[ -n ${f} ]] ; then |
53 |
+ vecho -ne '\n' |
54 |
+ eqawarn "${BAD}QA Notice: Files built without respecting CFLAGS have been detected${NORMAL}" |
55 |
+ eqawarn " Please include the following list of files in your report:" |
56 |
+ eqawarn "${f}" |
57 |
+ vecho -ne '\n' |
58 |
+ sleep 1 |
59 |
+ else |
60 |
+ rm -f "${T}"/scanelf-ignored-CFLAGS.log |
61 |
+ fi |
62 |
+ fi |
63 |
+ fi |
64 |
+ |
65 |
# Check for files built without respecting LDFLAGS |
66 |
if [[ "${LDFLAGS}" == *,--hash-style=gnu* ]] && [[ "${PN}" != *-bin ]] ; then |
67 |
qa_var="QA_DT_HASH_${ARCH/-/_}" |
68 |
|
69 |
diff --git a/cnf/make.conf b/cnf/make.conf |
70 |
index ef570bc..aecb633 100644 |
71 |
--- a/cnf/make.conf |
72 |
+++ b/cnf/make.conf |
73 |
@@ -32,6 +32,9 @@ |
74 |
# package (and in some cases the libraries it uses) at default optimizations |
75 |
# before reporting errors to developers. |
76 |
# |
77 |
+# If your gcc supports it, you can add -frecord-gcc-switches in order to enable |
78 |
+# CFLAGS ignorance checking for ebuilds. |
79 |
+# |
80 |
# Please refer to the GCC manual for a list of possible values. |
81 |
# |
82 |
#CFLAGS="-O2 -pipe" |
83 |
|
84 |
diff --git a/man/ebuild.5 b/man/ebuild.5 |
85 |
index 2d58c9e..1216ac1 100644 |
86 |
--- a/man/ebuild.5 |
87 |
+++ b/man/ebuild.5 |
88 |
@@ -602,6 +602,15 @@ This should contain a list of file paths, relative to the image directory, of |
89 |
files that contain writable and executable segments. These are rare. |
90 |
The paths may contain fnmatch patterns. |
91 |
.TP |
92 |
+\fBQA_DT_SWITCHES\fR |
93 |
+This should contain a list of file paths, relative to the image directory, of |
94 |
+files that do not contain .GCC.command.line sections. The paths may contain |
95 |
+regular expressions with escape\-quoted special characters. |
96 |
+.br |
97 |
+This variable is intended to be used on files of binary packages which ignore |
98 |
+CFLAGS variable. |
99 |
+.TP |
100 |
+.TP |
101 |
\fBQA_DT_HASH\fR |
102 |
This should contain a list of file paths, relative to the image directory, of |
103 |
files that contain .hash sections. The paths may contain regular expressions |
104 |
|
105 |
diff --git a/man/make.conf.5 b/man/make.conf.5 |
106 |
index 76adfe2..f9d69b7 100644 |
107 |
--- a/man/make.conf.5 |
108 |
+++ b/man/make.conf.5 |
109 |
@@ -814,6 +814,10 @@ settings from ebuilds. See also \fBebuild\fR(5). |
110 |
Set this to cause portage to ignore any \fIQA_TEXTREL\fR override |
111 |
settings from ebuilds. See also \fBebuild\fR(5). |
112 |
.TP |
113 |
+\fBQA_STRICT_DT_SWITCHES = \fI"set"\fR |
114 |
+Set this to cause portage to ignore any \fIQA_DT_SWITCHES\fR override |
115 |
+settings from ebuilds. See also \fBebuild\fR(5). |
116 |
+.TP |
117 |
\fBQA_STRICT_DT_HASH = \fI"set"\fR |
118 |
Set this to cause portage to ignore any \fIQA_DT_HASH\fR override |
119 |
settings from ebuilds. See also \fBebuild\fR(5). |