commit: 2e845dabd4b6f21381b4022ca57e064e2361ebf9
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 18 08:32:57 2014 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Dec 4 14:01:35 2014 +0000
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=2e845dab
Add tentative EAPI6 absolute path support to unpack()
Add support for absolute paths in unpack(). Allow subdirectory-level
relative paths not to start with './'.
---
bin/eapi.sh | 4 ++++
bin/phase-helpers.sh | 29 ++++++++++++++++++++++-------
2 files changed, 26 insertions(+), 7 deletions(-)
diff --git a/bin/eapi.sh b/bin/eapi.sh
index 878f8e7..6716b1c 100644
--- a/bin/eapi.sh
+++ b/bin/eapi.sh
@@ -162,6 +162,10 @@ ___eapi_unpack_is_case_sensitive() {
[[ ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend)$ ]]
}
+___eapi_unpack_supports_absolute_paths() {
+ [[ ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend)$ ]]
+}
+
# OTHERS
___eapi_enables_failglob_in_global_scope() {
diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 182a872..a6e1cdb 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -276,14 +276,29 @@ unpack() {
y=${y##*.}
y_insensitive=$(LC_ALL=C tr "[:upper:]" "[:lower:]" <<< "${y}")
- if [[ ${x} == "./"* ]] ; then
- srcdir=""
- elif [[ ${x} == ${DISTDIR%/}/* ]] ; then
- die "Arguments to unpack() cannot begin with
\${DISTDIR}."
- elif [[ ${x} == "/"* ]] ; then
- die "Arguments to unpack() cannot be absolute"
+ # wrt PMS 11.3.3.13 Misc Commands
+ if [[ ${x} != */* ]]; then
+ # filename without path of any kind
+ srcdir=${DISTDIR}/
+ elif [[ ${x} == ./* ]]; then
+ # relative path starting with './'
+ srcdir=
else
- srcdir="${DISTDIR}/"
+ # non-'./' filename with path of some kind
+ if ___eapi_unpack_supports_absolute_paths; then
+ # EAPI 6 allows absolute and deep relative paths
+ srcdir=
+
+ if [[ ${x} == ${DISTDIR%/}/* ]]; then
+ eqawarn "QA Notice: unpack called with
redundant \${DISTDIR} in path"
+ fi
+ elif [[ ${x} == ${DISTDIR%/}/* ]]; then
+ die "Arguments to unpack() cannot begin with
\${DISTDIR} in EAPI ${EAPI}"
+ elif [[ ${x} == /* ]] ; then
+ die "Arguments to unpack() cannot be absolute
in EAPI ${EAPI}"
+ else
+ die "Relative paths to unpack() must be
prefixed with './' in EAPI ${EAPI}"
+ fi
fi
if [[ ! -s ${srcdir}${x} ]]; then
__helpers_die "unpack: ${x} does not exist"