1 |
Add support for absolute paths in unpack(). Allow subdirectory-level |
2 |
relative paths not to start with './'. |
3 |
--- |
4 |
bin/eapi.sh | 4 ++++ |
5 |
bin/phase-helpers.sh | 25 ++++++++++++++++++------- |
6 |
2 files changed, 22 insertions(+), 7 deletions(-) |
7 |
|
8 |
diff --git a/bin/eapi.sh b/bin/eapi.sh |
9 |
index 878f8e7..6716b1c 100644 |
10 |
--- a/bin/eapi.sh |
11 |
+++ b/bin/eapi.sh |
12 |
@@ -162,6 +162,10 @@ ___eapi_unpack_is_case_sensitive() { |
13 |
[[ ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend)$ ]] |
14 |
} |
15 |
|
16 |
+___eapi_unpack_supports_absolute_paths() { |
17 |
+ [[ ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend)$ ]] |
18 |
+} |
19 |
+ |
20 |
# OTHERS |
21 |
|
22 |
___eapi_enables_failglob_in_global_scope() { |
23 |
diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh |
24 |
index 0be79fd..60f7a39 100644 |
25 |
--- a/bin/phase-helpers.sh |
26 |
+++ b/bin/phase-helpers.sh |
27 |
@@ -276,14 +276,25 @@ unpack() { |
28 |
y=${y##*.} |
29 |
y_insensitive=$(LC_ALL=C tr "[:upper:]" "[:lower:]" <<< "${y}") |
30 |
|
31 |
- if [[ ${x} == "./"* ]] ; then |
32 |
- srcdir="" |
33 |
- elif [[ ${x} == ${DISTDIR%/}/* ]] ; then |
34 |
- die "Arguments to unpack() cannot begin with \${DISTDIR}." |
35 |
- elif [[ ${x} == "/"* ]] ; then |
36 |
- die "Arguments to unpack() cannot be absolute" |
37 |
+ # wrt PMS 11.3.3.13 Misc Commands |
38 |
+ if [[ ${x} != */* ]]; then |
39 |
+ # filename without path of any kind |
40 |
+ srcdir=${DISTDIR}/ |
41 |
+ elif [[ ${x} == ./* ]]; then |
42 |
+ # relative path starting with './' |
43 |
+ srcdir= |
44 |
else |
45 |
- srcdir="${DISTDIR}/" |
46 |
+ # non-'./' filename with path of some kind |
47 |
+ if ___eapi_unpack_supports_absolute_paths; then |
48 |
+ # EAPI 6 allows absolute and deep relative paths |
49 |
+ srcdir= |
50 |
+ elif [[ ${x} == ${DISTDIR%/}/* ]]; then |
51 |
+ die "Arguments to unpack() cannot begin with \${DISTDIR} in EAPI ${EAPI}" |
52 |
+ elif [[ ${x} == /* ]] ; then |
53 |
+ die "Arguments to unpack() cannot be absolute in EAPI ${EAPI}" |
54 |
+ else |
55 |
+ die "Relative paths to unpack() must be prefixed with './' in EAPI ${EAPI}" |
56 |
+ fi |
57 |
fi |
58 |
[[ ! -s ${srcdir}${x} ]] && die "${x} does not exist" |
59 |
|
60 |
-- |
61 |
2.0.4 |