1 |
commit: b91754cb94e3f3d2db50768ec7cad47314d806ce |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Dec 24 09:07:39 2011 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Dec 24 09:07:39 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b91754cb |
7 |
|
8 |
Do CFLAGS check before strip for bug #395877. |
9 |
|
10 |
--- |
11 |
bin/misc-functions.sh | 144 +++++++++++++++++++++++++------------------------ |
12 |
1 files changed, 73 insertions(+), 71 deletions(-) |
13 |
|
14 |
diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh |
15 |
index dcfdceb..9d8244d 100755 |
16 |
--- a/bin/misc-functions.sh |
17 |
+++ b/bin/misc-functions.sh |
18 |
@@ -148,12 +148,83 @@ prepcompress() { |
19 |
} |
20 |
|
21 |
install_qa_check() { |
22 |
- local f i x |
23 |
+ local f i qa_var x |
24 |
[[ " ${FEATURES} " == *" force-prefix "* ]] || \ |
25 |
case "$EAPI" in 0|1|2) local ED=${D} ;; esac |
26 |
|
27 |
cd "${ED}" || die "cd failed" |
28 |
|
29 |
+ # Merge QA_FLAGS_IGNORED and QA_DT_HASH into a single array, since |
30 |
+ # QA_DT_HASH is deprecated. |
31 |
+ qa_var="QA_FLAGS_IGNORED_${ARCH/-/_}" |
32 |
+ eval "[[ -n \${!qa_var} ]] && QA_FLAGS_IGNORED=(\"\${${qa_var}[@]}\")" |
33 |
+ if [[ ${#QA_FLAGS_IGNORED[@]} -eq 1 ]] ; then |
34 |
+ local shopts=$- |
35 |
+ set -o noglob |
36 |
+ QA_FLAGS_IGNORED=(${QA_FLAGS_IGNORED}) |
37 |
+ set +o noglob |
38 |
+ set -${shopts} |
39 |
+ fi |
40 |
+ |
41 |
+ qa_var="QA_DT_HASH_${ARCH/-/_}" |
42 |
+ eval "[[ -n \${!qa_var} ]] && QA_DT_HASH=(\"\${${qa_var}[@]}\")" |
43 |
+ if [[ ${#QA_DT_HASH[@]} -eq 1 ]] ; then |
44 |
+ local shopts=$- |
45 |
+ set -o noglob |
46 |
+ QA_DT_HASH=(${QA_DT_HASH}) |
47 |
+ set +o noglob |
48 |
+ set -${shopts} |
49 |
+ fi |
50 |
+ |
51 |
+ if [[ -n ${QA_DT_HASH} ]] ; then |
52 |
+ QA_FLAGS_IGNORED=("${QA_FLAGS_IGNORED[@]}" "${QA_DT_HASH[@]}") |
53 |
+ unset QA_DT_HASH |
54 |
+ fi |
55 |
+ |
56 |
+ # Merge QA_STRICT_FLAGS_IGNORED and QA_STRICT_DT_HASH, since |
57 |
+ # QA_STRICT_DT_HASH is deprecated |
58 |
+ if [ "${QA_STRICT_FLAGS_IGNORED-unset}" = unset ] && \ |
59 |
+ [ "${QA_STRICT_DT_HASH-unset}" != unset ] ; then |
60 |
+ QA_STRICT_FLAGS_IGNORED=1 |
61 |
+ unset QA_STRICT_DT_HASH |
62 |
+ fi |
63 |
+ |
64 |
+ # Check for files built without respecting *FLAGS. Note that |
65 |
+ # -frecord-gcc-switches must be in all *FLAGS variables, in |
66 |
+ # order to avoid false positive results here. |
67 |
+ # NOTE: This check must execute before prepall/prepstrip, since |
68 |
+ # prepstrip strips the .GCC.command.line sections. |
69 |
+ if type -P scanelf > /dev/null && ! has binchecks ${RESTRICT} && \ |
70 |
+ [[ "${CFLAGS}" == *-frecord-gcc-switches* ]] && \ |
71 |
+ [[ "${CXXFLAGS}" == *-frecord-gcc-switches* ]] && \ |
72 |
+ [[ "${FFLAGS}" == *-frecord-gcc-switches* ]] && \ |
73 |
+ [[ "${FCFLAGS}" == *-frecord-gcc-switches* ]] ; then |
74 |
+ f=$(scanelf -qyRF '%k %p' -k \!.GCC.command.line "${ED}" | sed -e "s:\!.GCC.command.line ::") |
75 |
+ if [[ -n ${f} ]] ; then |
76 |
+ echo "${f}" > "${T}"/scanelf-ignored-CFLAGS.log |
77 |
+ if [ "${QA_STRICT_FLAGS_IGNORED-unset}" = unset ] ; then |
78 |
+ for x in "${QA_FLAGS_IGNORED[@]}" ; do |
79 |
+ sed -e "s#^${x#/}\$##" -i "${T}"/scanelf-ignored-CFLAGS.log |
80 |
+ done |
81 |
+ fi |
82 |
+ # Filter anything under /usr/lib/debug/ in order to avoid |
83 |
+ # duplicate warnings for splitdebug files. |
84 |
+ sed -e "s#^usr/lib/debug/.*##" -e "/^\$/d" -e "s#^#/#" \ |
85 |
+ -i "${T}"/scanelf-ignored-CFLAGS.log |
86 |
+ f=$(<"${T}"/scanelf-ignored-CFLAGS.log) |
87 |
+ if [[ -n ${f} ]] ; then |
88 |
+ vecho -ne '\n' |
89 |
+ eqawarn "${BAD}QA Notice: Files built without respecting CFLAGS have been detected${NORMAL}" |
90 |
+ eqawarn " Please include the following list of files in your report:" |
91 |
+ eqawarn "${f}" |
92 |
+ vecho -ne '\n' |
93 |
+ sleep 1 |
94 |
+ else |
95 |
+ rm -f "${T}"/scanelf-ignored-CFLAGS.log |
96 |
+ fi |
97 |
+ fi |
98 |
+ fi |
99 |
+ |
100 |
export STRIP_MASK |
101 |
prepall |
102 |
has "${EAPI}" 0 1 2 3 || prepcompress |
103 |
@@ -185,7 +256,7 @@ install_qa_check() { |
104 |
fi |
105 |
|
106 |
if type -P scanelf > /dev/null && ! has binchecks ${RESTRICT}; then |
107 |
- local qa_var insecure_rpath=0 tmp_quiet=${PORTAGE_QUIET} |
108 |
+ local insecure_rpath=0 tmp_quiet=${PORTAGE_QUIET} |
109 |
local x |
110 |
|
111 |
# display warnings when using stricter because we die afterwards |
112 |
@@ -308,75 +379,6 @@ install_qa_check() { |
113 |
sleep 1 |
114 |
fi |
115 |
|
116 |
- # Merge QA_FLAGS_IGNORED and QA_DT_HASH into a single array, since |
117 |
- # QA_DT_HASH is deprecated. |
118 |
- qa_var="QA_FLAGS_IGNORED_${ARCH/-/_}" |
119 |
- eval "[[ -n \${!qa_var} ]] && QA_FLAGS_IGNORED=(\"\${${qa_var}[@]}\")" |
120 |
- if [[ ${#QA_FLAGS_IGNORED[@]} -eq 1 ]] ; then |
121 |
- local shopts=$- |
122 |
- set -o noglob |
123 |
- QA_FLAGS_IGNORED=(${QA_FLAGS_IGNORED}) |
124 |
- set +o noglob |
125 |
- set -${shopts} |
126 |
- fi |
127 |
- |
128 |
- qa_var="QA_DT_HASH_${ARCH/-/_}" |
129 |
- eval "[[ -n \${!qa_var} ]] && QA_DT_HASH=(\"\${${qa_var}[@]}\")" |
130 |
- if [[ ${#QA_DT_HASH[@]} -eq 1 ]] ; then |
131 |
- local shopts=$- |
132 |
- set -o noglob |
133 |
- QA_DT_HASH=(${QA_DT_HASH}) |
134 |
- set +o noglob |
135 |
- set -${shopts} |
136 |
- fi |
137 |
- |
138 |
- if [[ -n ${QA_DT_HASH} ]] ; then |
139 |
- QA_FLAGS_IGNORED=("${QA_FLAGS_IGNORED[@]}" "${QA_DT_HASH[@]}") |
140 |
- unset QA_DT_HASH |
141 |
- fi |
142 |
- |
143 |
- # Merge QA_STRICT_FLAGS_IGNORED and QA_STRICT_DT_HASH, since |
144 |
- # QA_STRICT_DT_HASH is deprecated |
145 |
- if [ "${QA_STRICT_FLAGS_IGNORED-unset}" = unset ] && \ |
146 |
- [ "${QA_STRICT_DT_HASH-unset}" != unset ] ; then |
147 |
- QA_STRICT_FLAGS_IGNORED=1 |
148 |
- unset QA_STRICT_DT_HASH |
149 |
- fi |
150 |
- |
151 |
- # Check for files built without respecting *FLAGS. Note that |
152 |
- # -frecord-gcc-switches must be in all *FLAGS variables, in |
153 |
- # order to avoid false positive results here. |
154 |
- if [[ "${CFLAGS}" == *-frecord-gcc-switches* ]] && \ |
155 |
- [[ "${CXXFLAGS}" == *-frecord-gcc-switches* ]] && \ |
156 |
- [[ "${FFLAGS}" == *-frecord-gcc-switches* ]] && \ |
157 |
- [[ "${FCFLAGS}" == *-frecord-gcc-switches* ]] && \ |
158 |
- ! has binchecks ${RESTRICT} ; then |
159 |
- f=$(scanelf -qyRF '%k %p' -k \!.GCC.command.line "${ED}" | sed -e "s:\!.GCC.command.line ::") |
160 |
- if [[ -n ${f} ]] ; then |
161 |
- echo "${f}" > "${T}"/scanelf-ignored-CFLAGS.log |
162 |
- if [ "${QA_STRICT_FLAGS_IGNORED-unset}" = unset ] ; then |
163 |
- for x in "${QA_FLAGS_IGNORED[@]}" ; do |
164 |
- sed -e "s#^${x#/}\$##" -i "${T}"/scanelf-ignored-CFLAGS.log |
165 |
- done |
166 |
- fi |
167 |
- # Filter anything under /usr/lib/debug/ in order to avoid |
168 |
- # duplicate warnings for splitdebug files. |
169 |
- sed -e "s#^usr/lib/debug/.*##" -e "/^\$/d" -e "s#^#/#" \ |
170 |
- -i "${T}"/scanelf-ignored-CFLAGS.log |
171 |
- f=$(<"${T}"/scanelf-ignored-CFLAGS.log) |
172 |
- if [[ -n ${f} ]] ; then |
173 |
- vecho -ne '\n' |
174 |
- eqawarn "${BAD}QA Notice: Files built without respecting CFLAGS have been detected${NORMAL}" |
175 |
- eqawarn " Please include the following list of files in your report:" |
176 |
- eqawarn "${f}" |
177 |
- vecho -ne '\n' |
178 |
- sleep 1 |
179 |
- else |
180 |
- rm -f "${T}"/scanelf-ignored-CFLAGS.log |
181 |
- fi |
182 |
- fi |
183 |
- fi |
184 |
- |
185 |
# Check for files built without respecting LDFLAGS |
186 |
if [[ "${LDFLAGS}" == *,--hash-style=gnu* ]] && \ |
187 |
! has binchecks ${RESTRICT} ; then |