Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: bin/
Date: Sun, 01 Sep 2013 19:04:17
Message-Id: 1378062177.71e22fb4dbccc41c93f4b05dc193a557769ba6bc.zmedico@gentoo
1 commit: 71e22fb4dbccc41c93f4b05dc193a557769ba6bc
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 19:02:57 2013 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=71e22fb4
7
8 unpack: warn for unofficial sufffix, bug #476738
9
10 ---
11 bin/eapi.sh | 4 +++
12 bin/phase-helpers.sh | 92 ++++++++++++++++++++++++++++++++++++++++++++++++----
13 2 files changed, 90 insertions(+), 6 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..d03a4d7 100644
33 --- a/bin/phase-helpers.sh
34 +++ b/bin/phase-helpers.sh
35 @@ -260,8 +260,8 @@ use_enable() {
36 unpack() {
37 local srcdir
38 local x
39 - local y
40 - local suffix
41 + local y y_insensitive
42 + local suffix suffix_insensitive
43 local myfail
44 local eapi=${EAPI:-0}
45 [ -z "$*" ] && die "Nothing passed to the 'unpack' command"
46 @@ -269,10 +269,10 @@ unpack() {
47 for x in "$@"; do
48 __vecho ">>> Unpacking ${x} to ${PWD}"
49 suffix=${x##*.}
50 - suffix=$(LC_ALL=C tr "[:upper:]" "[:lower:]" <<< "${suffix}")
51 + suffix_insensitive=$(LC_ALL=C tr "[:upper:]" "[:lower:]" <<< "${suffix}")
52 y=${x%.*}
53 y=${y##*.}
54 - y=$(LC_ALL=C tr "[:upper:]" "[:lower:]" <<< "${y}")
55 + y_insensitive=$(LC_ALL=C tr "[:upper:]" "[:lower:]" <<< "${y}")
56
57 if [[ ${x} == "./"* ]] ; then
58 srcdir=""
59 @@ -286,7 +286,13 @@ unpack() {
60 [[ ! -s ${srcdir}${x} ]] && die "${x} does not exist"
61
62 __unpack_tar() {
63 - if [ "${y}" == "tar" ]; then
64 + if [[ ${y_insensitive} == tar ]] ; then
65 + if ___eapi_unpack_is_case_sensitive && \
66 + [[ tar != ${y} ]] ; then
67 + eqawarn "QA Notice: unpack called with" \
68 + "secondary suffix '${y}' which is unofficially" \
69 + "supported with EAPI '${EAPI}'. Instead use 'tar'."
70 + fi
71 $1 -c -- "$srcdir$x" | tar xof -
72 __assert_sigpipe_ok "$myfail"
73 else
74 @@ -297,27 +303,64 @@ unpack() {
75 }
76
77 myfail="failure unpacking ${x}"
78 - case "${suffix}" in
79 + case "${suffix_insensitive}" in
80 tar)
81 + if ___eapi_unpack_is_case_sensitive && \
82 + [[ tar != ${suffix} ]] ; then
83 + eqawarn "QA Notice: unpack called with" \
84 + "suffix '${suffix}' which is unofficially supported" \
85 + "with EAPI '${EAPI}'. Instead use 'tar'."
86 + fi
87 tar xof "$srcdir$x" || die "$myfail"
88 ;;
89 tgz)
90 + if ___eapi_unpack_is_case_sensitive && \
91 + [[ tgz != ${suffix} ]] ; then
92 + eqawarn "QA Notice: unpack called with" \
93 + "suffix '${suffix}' which is unofficially supported" \
94 + "with EAPI '${EAPI}'. Instead use 'tgz'."
95 + fi
96 tar xozf "$srcdir$x" || die "$myfail"
97 ;;
98 tbz|tbz2)
99 + if ___eapi_unpack_is_case_sensitive && \
100 + [[ " tbz tbz2 " != *" ${suffix} "* ]] ; then
101 + eqawarn "QA Notice: unpack called with" \
102 + "suffix '${suffix}' which is unofficially supported" \
103 + "with EAPI '${EAPI}'. Instead use 'tbz' or 'tbz2'."
104 + fi
105 ${PORTAGE_BUNZIP2_COMMAND:-${PORTAGE_BZIP2_COMMAND} -d} -c -- "$srcdir$x" | tar xof -
106 __assert_sigpipe_ok "$myfail"
107 ;;
108 zip|jar)
109 + if ___eapi_unpack_is_case_sensitive && \
110 + [[ " ZIP zip jar " != *" ${suffix} "* ]] ; then
111 + eqawarn "QA Notice: unpack called with" \
112 + "suffix '${suffix}' which is unofficially supported" \
113 + "with EAPI '${EAPI}'." \
114 + "Instead use 'ZIP', 'zip', or 'jar'."
115 + fi
116 # unzip will interactively prompt under some error conditions,
117 # as reported in bug #336285
118 ( set +x ; while true ; do echo n || break ; done ) | \
119 unzip -qo "${srcdir}${x}" || die "$myfail"
120 ;;
121 gz|z)
122 + if ___eapi_unpack_is_case_sensitive && \
123 + [[ " gz z Z " != *" ${suffix} "* ]] ; then
124 + eqawarn "QA Notice: unpack called with" \
125 + "suffix '${suffix}' which is unofficially supported" \
126 + "with EAPI '${EAPI}'. Instead use 'gz', 'z', or 'Z'."
127 + fi
128 __unpack_tar "gzip -d"
129 ;;
130 bz2|bz)
131 + if ___eapi_unpack_is_case_sensitive && \
132 + [[ " bz bz2 " != *" ${suffix} "* ]] ; then
133 + eqawarn "QA Notice: unpack called with" \
134 + "suffix '${suffix}' which is unofficially supported" \
135 + "with EAPI '${EAPI}'. Instead use 'bz' or 'bz2'."
136 + fi
137 __unpack_tar "${PORTAGE_BUNZIP2_COMMAND:-${PORTAGE_BZIP2_COMMAND} -d}"
138 ;;
139 7z)
140 @@ -329,15 +372,40 @@ unpack() {
141 fi
142 ;;
143 rar)
144 + if ___eapi_unpack_is_case_sensitive && \
145 + [[ " rar RAR " != *" ${suffix} "* ]] ; then
146 + eqawarn "QA Notice: unpack called with" \
147 + "suffix '${suffix}' which is unofficially supported" \
148 + "with EAPI '${EAPI}'. Instead use 'rar' or 'RAR'."
149 + fi
150 unrar x -idq -o+ "${srcdir}${x}" || die "$myfail"
151 ;;
152 lha|lzh)
153 + if ___eapi_unpack_is_case_sensitive && \
154 + [[ " LHA LHa lha lzh " != *" ${suffix} "* ]] ; then
155 + eqawarn "QA Notice: unpack called with" \
156 + "suffix '${suffix}' which is unofficially supported" \
157 + "with EAPI '${EAPI}'." \
158 + "Instead use 'LHA', 'LHa', 'lha', or 'lzh'."
159 + fi
160 lha xfq "${srcdir}${x}" || die "$myfail"
161 ;;
162 a)
163 + if ___eapi_unpack_is_case_sensitive && \
164 + [[ " a " != *" ${suffix} "* ]] ; then
165 + eqawarn "QA Notice: unpack called with" \
166 + "suffix '${suffix}' which is unofficially supported" \
167 + "with EAPI '${EAPI}'. Instead use 'a'."
168 + fi
169 ar x "${srcdir}${x}" || die "$myfail"
170 ;;
171 deb)
172 + if ___eapi_unpack_is_case_sensitive && \
173 + [[ " deb " != *" ${suffix} "* ]] ; then
174 + eqawarn "QA Notice: unpack called with" \
175 + "suffix '${suffix}' which is unofficially supported" \
176 + "with EAPI '${EAPI}'. Instead use 'deb'."
177 + fi
178 # Unpacking .deb archives can not always be done with
179 # `ar`. For instance on AIX this doesn't work out. If
180 # we have `deb2targz` installed, prefer it over `ar` for
181 @@ -365,9 +433,21 @@ unpack() {
182 fi
183 ;;
184 lzma)
185 + if ___eapi_unpack_is_case_sensitive && \
186 + [[ " lzma " != *" ${suffix} "* ]] ; then
187 + eqawarn "QA Notice: unpack called with" \
188 + "suffix '${suffix}' which is unofficially supported" \
189 + "with EAPI '${EAPI}'. Instead use 'lzma'."
190 + fi
191 __unpack_tar "lzma -d"
192 ;;
193 xz)
194 + if ___eapi_unpack_is_case_sensitive && \
195 + [[ " xz " != *" ${suffix} "* ]] ; then
196 + eqawarn "QA Notice: unpack called with" \
197 + "suffix '${suffix}' which is unofficially supported" \
198 + "with EAPI '${EAPI}'. Instead use 'xz'."
199 + fi
200 if ___eapi_unpack_supports_xz; then
201 __unpack_tar "xz -d"
202 else