From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 4249B13877A for ; Mon, 18 Aug 2014 17:56:53 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D9B02E0BCF; Mon, 18 Aug 2014 17:56:17 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 5C438E0BCE for ; Mon, 18 Aug 2014 17:56:17 +0000 (UTC) Received: from pomiot.lan (77-253-136-53.adsl.inetia.pl [77.253.136.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mgorny) by smtp.gentoo.org (Postfix) with ESMTPSA id CA9C934015A; Mon, 18 Aug 2014 17:56:15 +0000 (UTC) From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= To: gentoo-portage-dev@lists.gentoo.org Cc: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Subject: [gentoo-portage-dev] [PATCH 10/13] Add tentative EAPI6 absolute path support to unpack() Date: Mon, 18 Aug 2014 19:56:49 +0200 Message-Id: <1408384612-14713-11-git-send-email-mgorny@gentoo.org> X-Mailer: git-send-email 2.0.4 In-Reply-To: <1408384612-14713-1-git-send-email-mgorny@gentoo.org> References: <1408384612-14713-1-git-send-email-mgorny@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-portage-dev@lists.gentoo.org Reply-to: gentoo-portage-dev@lists.gentoo.org X-Archives-Salt: e024cfa0-2f27-454b-9a54-25740709e160 X-Archives-Hash: 8054b3feb133ae6608637629a5b35143 Add support for absolute paths in unpack(). Allow subdirectory-level relative paths not to start with './'. --- bin/eapi.sh | 4 ++++ bin/phase-helpers.sh | 25 ++++++++++++++++++------- 2 files changed, 22 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 0be79fd..60f7a39 100644 --- a/bin/phase-helpers.sh +++ b/bin/phase-helpers.sh @@ -276,14 +276,25 @@ 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= + 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 [[ ! -s ${srcdir}${x} ]] && die "${x} does not exist" -- 2.0.4