All, I'm finding in working on Go ebuilds, that we are propegating a src_unpack function that is very similar to the one in vcs-snapshot.
This patch adds an EXTRACT_PATH variable to the vcs-snapshot eclass which, if set, puts the extracted archives in the specified directory under ${S}. If it is not set, nothing should happen. This could be used by other types of ebuilds later, but for now it would be used by Go ebuilds. Thoughts? William
Index: vcs-snapshot.eclass =================================================================== RCS file: /var/cvsroot/gentoo-x86/eclass/vcs-snapshot.eclass,v retrieving revision 1.7 diff -u -B -r1.7 vcs-snapshot.eclass --- vcs-snapshot.eclass 25 Jul 2013 07:51:16 -0000 1.7 +++ vcs-snapshot.eclass 30 Jul 2015 15:44:55 -0000 @@ -40,6 +40,13 @@ *) die "vcs-snapshot.eclass API in EAPI ${EAPI} not yet established." esac +# @ECLASS-VARIABLE: EXTRACT_PATH +# @DESCRIPTION: +# This is a special purpose variable, mainly used by Go ebuilds, which +# creates a sub directory under ${S} and stores the extracted archive +# there. By default, this is empty, and please do not set it in your +# ebuild unless you know exactly what you are doing. + EXPORT_FUNCTIONS src_unpack # @FUNCTION: vcs-snapshot_src_unpack @@ -57,13 +64,19 @@ do case "${f}" in *.tar|*.tar.gz|*.tar.bz2|*.tar.xz) - local destdir=${WORKDIR}/${f%.tar*} + [[ -n $EXTRACT_PATH ]] && + local destdir=${WORKDIR}/${P}/${EXTRACT_PATH} || + local destdir=${WORKDIR}/${f%.tar*} debug-print "${FUNCNAME}: unpacking ${f} to ${destdir}" # XXX: check whether the directory structure inside is # fine? i.e. if the tarball has actually a parent dir. - mkdir "${destdir}" || die + if [[ -n ${EXTRACT_PATH} ]]; then + mkdir -p "${destdir}" || die + else + mkdir "${destdir}" || die + fi tar -C "${destdir}" -x --strip-components 1 \ -f "${DISTDIR}/${f}" || die ;;
signature.asc
Description: Digital signature