1 |
From: Michał Górny <mgorny@g.o> |
2 |
|
3 |
--- |
4 |
bin/estrip | 70 +++++++++++++++++++++++++++++++++++++++++++-------- |
5 |
bin/misc-functions.sh | 3 ++- |
6 |
2 files changed, 61 insertions(+), 12 deletions(-) |
7 |
|
8 |
diff --git a/bin/estrip b/bin/estrip |
9 |
index 431624498..309a2962e 100755 |
10 |
--- a/bin/estrip |
11 |
+++ b/bin/estrip |
12 |
@@ -30,6 +30,59 @@ if ${RESTRICT_strip} || ${FEATURES_nostrip} ; then |
13 |
${FEATURES_installsources} || exit 0 |
14 |
fi |
15 |
|
16 |
+while [[ $# -gt 0 ]] ; do |
17 |
+ case $1 in |
18 |
+ --ignore) |
19 |
+ shift |
20 |
+ |
21 |
+ skip_dirs=() |
22 |
+ for skip; do |
23 |
+ if [[ -d ${ED%/}/${skip#/} ]]; then |
24 |
+ skip_dirs+=( "${ED%/}/${skip#/}" ) |
25 |
+ else |
26 |
+ rm -f "${ED%/}/${skip#/}.estrip" || die |
27 |
+ fi |
28 |
+ done |
29 |
+ |
30 |
+ if [[ ${skip_dirs[@]} ]]; then |
31 |
+ find "${skip_dirs[@]}" -name '*.estrip' -delete || die |
32 |
+ fi |
33 |
+ |
34 |
+ exit 0 |
35 |
+ ;; |
36 |
+ --queue) |
37 |
+ shift |
38 |
+ |
39 |
+ find_paths=() |
40 |
+ for path; do |
41 |
+ if [[ -e ${ED%/}/${path#/} ]]; then |
42 |
+ find_paths+=( "${ED%/}/${path#/}" ) |
43 |
+ fi |
44 |
+ done |
45 |
+ |
46 |
+ if [[ ${find_paths[@]} ]]; then |
47 |
+ while IFS= read -r path; do |
48 |
+ >> "${path}.estrip" || die |
49 |
+ done < <( |
50 |
+ scanelf -yqRBF '#k%F' -k '.symtab' "${find_paths[@]}" |
51 |
+ find "${find_paths[@]}" -type f ! -type l -name '*.a' |
52 |
+ ) |
53 |
+ fi |
54 |
+ |
55 |
+ exit 0 |
56 |
+ ;; |
57 |
+ --dequeue) |
58 |
+ [[ -n ${2} ]] && die "${0##*/}: --dequeue takes no additional arguments" |
59 |
+ break |
60 |
+ ;; |
61 |
+ *) |
62 |
+ die "${0##*/}: unknown arguments '$*'" |
63 |
+ exit 1 |
64 |
+ ;; |
65 |
+ esac |
66 |
+ shift |
67 |
+done |
68 |
+ |
69 |
PRESERVE_XATTR=false |
70 |
if [[ ${KERNEL} == linux ]] && ${FEATURES_xattr} ; then |
71 |
PRESERVE_XATTR=true |
72 |
@@ -253,7 +306,7 @@ if ! ${RESTRICT_binchecks} && ! ${RESTRICT_strip} ; then |
73 |
# and start stripping the files ourselves. The log parsing can be done in |
74 |
# parallel though. |
75 |
log=${tmpdir}/scanelf-already-stripped.log |
76 |
- scanelf -yqRBF '#k%F' -k '!.symtab' "$@" | sed -e "s#^${ED%/}/##" > "${log}" |
77 |
+ scanelf -yqRBF '#k%F' -k '!.symtab' "${ED}" | sed -e "s#^${ED%/}/##" > "${log}" |
78 |
qa_var="QA_PRESTRIPPED_${ARCH/-/_}" |
79 |
[[ -n ${!qa_var} ]] && QA_PRESTRIPPED="${!qa_var}" |
80 |
if [[ -n ${QA_PRESTRIPPED} && -s ${log} && \ |
81 |
@@ -286,16 +339,11 @@ else |
82 |
get_inode_number() { stat -c '%i' "$1"; } |
83 |
fi |
84 |
cd "${tmpdir}/inodes" || die "cd failed unexpectedly" |
85 |
-while read -r x ; do |
86 |
- inode_link=$(get_inode_number "${x}") || die "stat failed unexpectedly" |
87 |
- echo "${x}" >> "${inode_link}" || die "echo failed unexpectedly" |
88 |
-done < <( |
89 |
- # Use sort -u to eliminate duplicates for bug #445336. |
90 |
- ( |
91 |
- scanelf -yqRBF '#k%F' -k '.symtab' "$@" |
92 |
- find "$@" -type f ! -type l -name '*.a' |
93 |
- ) | LC_ALL=C sort -u |
94 |
-) |
95 |
+while IFS= read -d '' -r x ; do |
96 |
+ rm -f "${x}" || die |
97 |
+ inode_link=$(get_inode_number "${x%.estrip}") || die "stat failed unexpectedly" |
98 |
+ echo "${x%.estrip}" >> "${inode_link}" || die "echo failed unexpectedly" |
99 |
+done < <(find "${ED}" -name '*.estrip' -print0) |
100 |
|
101 |
# Now we look for unstripped binaries. |
102 |
for inode_link in $(shopt -s nullglob; echo *) ; do |
103 |
diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh |
104 |
index 199e09fe9..a7af3ec73 100755 |
105 |
--- a/bin/misc-functions.sh |
106 |
+++ b/bin/misc-functions.sh |
107 |
@@ -224,7 +224,8 @@ install_qa_check() { |
108 |
ecompressdir --dequeue |
109 |
ecompress --dequeue |
110 |
|
111 |
- "${PORTAGE_BIN_PATH}"/estrip "${ED}" |
112 |
+ "${PORTAGE_BIN_PATH}"/estrip --queue / |
113 |
+ "${PORTAGE_BIN_PATH}"/estrip --dequeue |
114 |
|
115 |
# Create NEEDED.ELF.2 regardless of RESTRICT=binchecks, since this info is |
116 |
# too useful not to have (it's required for things like preserve-libs), and |
117 |
-- |
118 |
2.13.6 |