1 |
commit: 9c4f16193cd07e1b11761592b4c79225bce32cee |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Sep 1 18:16:07 2013 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Sep 1 18:45:19 2013 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9c4f1619 |
7 |
|
8 |
unpack: warn for unofficial sufffix, bug #476738 |
9 |
|
10 |
--- |
11 |
bin/eapi.sh | 4 +++ |
12 |
bin/phase-helpers.sh | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++-- |
13 |
2 files changed, 81 insertions(+), 2 deletions(-) |
14 |
|
15 |
diff --git a/bin/eapi.sh b/bin/eapi.sh |
16 |
index e63f145..5d5b36d 100644 |
17 |
--- a/bin/eapi.sh |
18 |
+++ b/bin/eapi.sh |
19 |
@@ -134,6 +134,10 @@ ___eapi_disallows_helpers_in_global_scope() { |
20 |
[[ ${1-${EAPI}} =~ ^(4-python|5-progress)$ ]] |
21 |
} |
22 |
|
23 |
+___eapi_unpack_is_case_sensitive() { |
24 |
+ true |
25 |
+} |
26 |
+ |
27 |
# OTHERS |
28 |
|
29 |
___eapi_enables_globstar() { |
30 |
|
31 |
diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh |
32 |
index 91762bf..ffb87aa 100644 |
33 |
--- a/bin/phase-helpers.sh |
34 |
+++ b/bin/phase-helpers.sh |
35 |
@@ -262,6 +262,7 @@ unpack() { |
36 |
local x |
37 |
local y |
38 |
local suffix |
39 |
+ local insensitive_suffix |
40 |
local myfail |
41 |
local eapi=${EAPI:-0} |
42 |
[ -z "$*" ] && die "Nothing passed to the 'unpack' command" |
43 |
@@ -269,7 +270,7 @@ unpack() { |
44 |
for x in "$@"; do |
45 |
__vecho ">>> Unpacking ${x} to ${PWD}" |
46 |
suffix=${x##*.} |
47 |
- suffix=$(LC_ALL=C tr "[:upper:]" "[:lower:]" <<< "${suffix}") |
48 |
+ insensitive_suffix=$(LC_ALL=C tr "[:upper:]" "[:lower:]" <<< "${suffix}") |
49 |
y=${x%.*} |
50 |
y=${y##*.} |
51 |
y=$(LC_ALL=C tr "[:upper:]" "[:lower:]" <<< "${y}") |
52 |
@@ -297,27 +298,64 @@ unpack() { |
53 |
} |
54 |
|
55 |
myfail="failure unpacking ${x}" |
56 |
- case "${suffix}" in |
57 |
+ case "${insensitive_suffix}" in |
58 |
tar) |
59 |
+ if ___eapi_unpack_is_case_sensitive && \ |
60 |
+ [[ tar != ${suffix} ]] ; then |
61 |
+ eqawarn "QA Notice: unpack called with" \ |
62 |
+ "suffix '${suffix}' which is unofficially supported" \ |
63 |
+ "with EAPI '${EAPI}'. Instead use 'tar'." |
64 |
+ fi |
65 |
tar xof "$srcdir$x" || die "$myfail" |
66 |
;; |
67 |
tgz) |
68 |
+ if ___eapi_unpack_is_case_sensitive && \ |
69 |
+ [[ tgz != ${suffix} ]] ; then |
70 |
+ eqawarn "QA Notice: unpack called with" \ |
71 |
+ "suffix '${suffix}' which is unofficially supported" \ |
72 |
+ "with EAPI '${EAPI}'. Instead use 'tgz'." |
73 |
+ fi |
74 |
tar xozf "$srcdir$x" || die "$myfail" |
75 |
;; |
76 |
tbz|tbz2) |
77 |
+ if ___eapi_unpack_is_case_sensitive && \ |
78 |
+ [[ " tbz tbz2 " != *" ${suffix} "* ]] ; then |
79 |
+ eqawarn "QA Notice: unpack called with" \ |
80 |
+ "suffix '${suffix}' which is unofficially supported" \ |
81 |
+ "with EAPI '${EAPI}'. Instead use 'tbz' or 'tbz2'." |
82 |
+ fi |
83 |
${PORTAGE_BUNZIP2_COMMAND:-${PORTAGE_BZIP2_COMMAND} -d} -c -- "$srcdir$x" | tar xof - |
84 |
__assert_sigpipe_ok "$myfail" |
85 |
;; |
86 |
zip|jar) |
87 |
+ if ___eapi_unpack_is_case_sensitive && \ |
88 |
+ [[ " ZIP zip jar " != *" ${suffix} "* ]] ; then |
89 |
+ eqawarn "QA Notice: unpack called with" \ |
90 |
+ "suffix '${suffix}' which is unofficially supported" \ |
91 |
+ "with EAPI '${EAPI}'." \ |
92 |
+ "Instead use 'ZIP', 'zip', or 'jar'." |
93 |
+ fi |
94 |
# unzip will interactively prompt under some error conditions, |
95 |
# as reported in bug #336285 |
96 |
( set +x ; while true ; do echo n || break ; done ) | \ |
97 |
unzip -qo "${srcdir}${x}" || die "$myfail" |
98 |
;; |
99 |
gz|z) |
100 |
+ if ___eapi_unpack_is_case_sensitive && \ |
101 |
+ [[ " gz z Z " != *" ${suffix} "* ]] ; then |
102 |
+ eqawarn "QA Notice: unpack called with" \ |
103 |
+ "suffix '${suffix}' which is unofficially supported" \ |
104 |
+ "with EAPI '${EAPI}'. Instead use 'gz', 'z', or 'Z'." |
105 |
+ fi |
106 |
__unpack_tar "gzip -d" |
107 |
;; |
108 |
bz2|bz) |
109 |
+ if ___eapi_unpack_is_case_sensitive && \ |
110 |
+ [[ " bz bz2 " != *" ${suffix} "* ]] ; then |
111 |
+ eqawarn "QA Notice: unpack called with" \ |
112 |
+ "suffix '${suffix}' which is unofficially supported" \ |
113 |
+ "with EAPI '${EAPI}'. Instead use 'bz' or 'bz2'." |
114 |
+ fi |
115 |
__unpack_tar "${PORTAGE_BUNZIP2_COMMAND:-${PORTAGE_BZIP2_COMMAND} -d}" |
116 |
;; |
117 |
7z) |
118 |
@@ -329,15 +367,40 @@ unpack() { |
119 |
fi |
120 |
;; |
121 |
rar) |
122 |
+ if ___eapi_unpack_is_case_sensitive && \ |
123 |
+ [[ " rar RAR " != *" ${suffix} "* ]] ; then |
124 |
+ eqawarn "QA Notice: unpack called with" \ |
125 |
+ "suffix '${suffix}' which is unofficially supported" \ |
126 |
+ "with EAPI '${EAPI}'. Instead use 'rar' or 'RAR'." |
127 |
+ fi |
128 |
unrar x -idq -o+ "${srcdir}${x}" || die "$myfail" |
129 |
;; |
130 |
lha|lzh) |
131 |
+ if ___eapi_unpack_is_case_sensitive && \ |
132 |
+ [[ " LHA LHa lha lzh " != *" ${suffix} "* ]] ; then |
133 |
+ eqawarn "QA Notice: unpack called with" \ |
134 |
+ "suffix '${suffix}' which is unofficially supported" \ |
135 |
+ "with EAPI '${EAPI}'." \ |
136 |
+ "Instead use 'LHA', 'LHa', 'lha', or 'lzh'." |
137 |
+ fi |
138 |
lha xfq "${srcdir}${x}" || die "$myfail" |
139 |
;; |
140 |
a) |
141 |
+ if ___eapi_unpack_is_case_sensitive && \ |
142 |
+ [[ " a " != *" ${suffix} "* ]] ; then |
143 |
+ eqawarn "QA Notice: unpack called with" \ |
144 |
+ "suffix '${suffix}' which is unofficially supported" \ |
145 |
+ "with EAPI '${EAPI}'. Instead use 'a'." |
146 |
+ fi |
147 |
ar x "${srcdir}${x}" || die "$myfail" |
148 |
;; |
149 |
deb) |
150 |
+ if ___eapi_unpack_is_case_sensitive && \ |
151 |
+ [[ " deb " != *" ${suffix} "* ]] ; then |
152 |
+ eqawarn "QA Notice: unpack called with" \ |
153 |
+ "suffix '${suffix}' which is unofficially supported" \ |
154 |
+ "with EAPI '${EAPI}'. Instead use 'deb'." |
155 |
+ fi |
156 |
# Unpacking .deb archives can not always be done with |
157 |
# `ar`. For instance on AIX this doesn't work out. If |
158 |
# we have `deb2targz` installed, prefer it over `ar` for |
159 |
@@ -365,9 +428,21 @@ unpack() { |
160 |
fi |
161 |
;; |
162 |
lzma) |
163 |
+ if ___eapi_unpack_is_case_sensitive && \ |
164 |
+ [[ " lzma " != *" ${suffix} "* ]] ; then |
165 |
+ eqawarn "QA Notice: unpack called with" \ |
166 |
+ "suffix '${suffix}' which is unofficially supported" \ |
167 |
+ "with EAPI '${EAPI}'. Instead use 'lzma'." |
168 |
+ fi |
169 |
__unpack_tar "lzma -d" |
170 |
;; |
171 |
xz) |
172 |
+ if ___eapi_unpack_is_case_sensitive && \ |
173 |
+ [[ " xz " != *" ${suffix} "* ]] ; then |
174 |
+ eqawarn "QA Notice: unpack called with" \ |
175 |
+ "suffix '${suffix}' which is unofficially supported" \ |
176 |
+ "with EAPI '${EAPI}'. Instead use 'xz'." |
177 |
+ fi |
178 |
if ___eapi_unpack_supports_xz; then |
179 |
__unpack_tar "xz -d" |
180 |
else |