diff options
author | Tim Harder <radhermit@gmail.com> | 2014-10-19 21:51:55 -0400 |
---|---|---|
committer | Tim Harder <radhermit@gmail.com> | 2016-05-01 18:44:22 -0400 |
commit | c73297fbb32aae22d5161037f564bd8ee0f63a07 (patch) | |
tree | 0d8d4c51782321f7b19c376c6b18494d80114509 | |
parent | eapi6: unpack() *.txz support (diff) | |
download | pkgcore-c73297fbb32aae22d5161037f564bd8ee0f63a07.tar.gz pkgcore-c73297fbb32aae22d5161037f564bd8ee0f63a07.tar.bz2 pkgcore-c73297fbb32aae22d5161037f564bd8ee0f63a07.zip |
eapi6: unpack() absolute path support
X-Gentoo-Url: https://bugs.gentoo.org/show_bug.cgi?id=483244
-rw-r--r-- | ebd/eapi/common.lib | 26 | ||||
-rw-r--r-- | pkgcore/ebuild/eapi.py | 7 |
2 files changed, 26 insertions, 7 deletions
diff --git a/ebd/eapi/common.lib b/ebd/eapi/common.lib index 97029861f..ae87575e7 100644 --- a/ebd/eapi/common.lib +++ b/ebd/eapi/common.lib @@ -406,18 +406,32 @@ unpack() { for file in "$@"; do echo ">>> Unpacking ${file} to ${PWD}" myfail="failure unpacking ${file}" - if [[ ${file} == "./"* ]]; then + + if [[ ${file} != */* ]]; then + # regular filename get prefixed with ${DISTDIR}/ + srcdir=${DISTDIR}/ + elif [[ ${file} == "./"* ]]; then + # relative paths get passed through srcdir="" else - srcdir=${DISTDIR} + srcdir=${DISTDIR}/ + + if ${PKGCORE_UNPACK_ABSOLUTE_PATHS}; then + # EAPI 6 and up allows absolute paths + srcdir="" + [[ ${file} == ${DISTDIR%%/}/* ]] && \ + eqawarn "QA Notice: unpack() argument contains redundant \${DISTDIR}: ${file}" + elif [[ ${file} == ${DISTDIR%%/}/* ]]; then + die "Arguments to unpack() must not begin with \${DISTDIR}." + elif [[ ${file} == /* ]]; then + die "Arguments to unpack() must not be absolute paths." + else + die "Relative paths to unpack() must be prefixed with './' in EAPI ${EAPI}" + fi fi [[ ! -e ${srcdir}${file} ]] && die "${myfail}: file doesn't exist" [[ ! -s ${srcdir}${file} ]] && die "${myfail}: empty file" - [[ ${file} == ${DISTDIR%%/}/* ]] && \ - die "Arguments to unpack() must not begin with \${DISTDIR}." - [[ ${file} == /* ]] && - die "Arguments to unpack() must not be absolute paths." filename=${file##*/} diff --git a/pkgcore/ebuild/eapi.py b/pkgcore/ebuild/eapi.py index 805c40d44..feac049f8 100644 --- a/pkgcore/ebuild/eapi.py +++ b/pkgcore/ebuild/eapi.py @@ -103,6 +103,9 @@ eapi_optionals = mappings.ImmutableDict({ # If the EAPI didn't mandate this var, then we can do our inference, but generally will # invoke the phase in the absense of that metadata var since we have no other choice. "trust_defined_phases_cache": True, + + # Controls whether unpack supports absolute paths; see PMS. + "unpack_absolute_paths": False, }) @@ -268,7 +271,8 @@ common_env_optionals = mappings.ImmutableDict(dict.fromkeys( "doman_language_detect", "doman_language_override", "ebuild_phase_func", "econf_disable_dependency_tracking", "econf_disable_silent_rules", "econf_docdir_and_htmldir", "global_failglob", - "new_reads_stdin", "nonfatal", "nonfatal_die", "profile_iuse_injection",), + "new_reads_stdin", "nonfatal", "nonfatal_die", "profile_iuse_injection", + "unpack_absolute_paths",), lambda s: str(s).lower())) @@ -391,6 +395,7 @@ eapi6 = EAPI.register( global_failglob=True, nonfatal_die=True, is_supported=False, + unpack_absolute_paths=True, )), ebd_env_options=eapi5.ebd_env_options, ) |