--- vcs-snapshot.eclass.old 2012-06-04 16:10:25.000000000 +0200 +++ vcs-snapshot.eclass 2012-06-04 16:11:16.000000000 +0200 @@ -8,8 +8,10 @@ # @BLURB: support eclass for VCS (github, bitbucket, gitweb) snapshots # @DESCRIPTION: # This eclass provides a convenience src_unpack() which does support -# working with snapshots generated by various VCS-es. It unpacks those -# to ${S} rather than the original directory containing commit id. +# working with snapshots generated by various VCS-es. It unpacks all tarballs +# and zipballs according to their name into ${WORKDIR}/${name} +# rather than the original directory containing commit id. +# See example below. # # Note that this eclass handles only unpacking. You need to specify # SRC_URI yourself, and call any autoreconfiguration as necessary. @@ -26,6 +28,10 @@ # inherit autotools-utils vcs-snapshot # # SRC_URI="http://github.com/example/${PN}/tarball/v${PV} -> ${P}.tar.gz" +# +# # line above unpacks into: ${WORKDIR}/${P} +# # SRC_URI="http://github.com/example/${PN}/tarball/v${PV} -> ${P}-src.tar.gz" +# # would unpack into: ${WORKDIR}/${P}-src # @CODE case ${EAPI:-0} in @@ -37,9 +43,21 @@ EXPORT_FUNCTIONS src_unpack vcs-snapshot_src_unpack() { - default - # github, bitbucket: username-projectname-hash # gitweb: projectname-tagname-hash - mv *-*-[0-9a-f]*[0-9a-f]/ "${S}" || die + local i + local _tmpdir=${T}/_tmp + mkdir "${_tmpdir}" || die + pushd "${_tmpdir}" > /dev/null || die + for i in ${A} ; do + unpack ${i} + case ${i} in + *.tar.gz) mv "${_tmpdir}"/*/ "${WORKDIR}"/${i%.tar.gz} || die ;; + *.tar.xz) mv "${_tmpdir}"/*/ "${WORKDIR}"/${i%.tar.xz} || die ;; + *.tar.bz2) mv "${_tmpdir}"/*/ "${WORKDIR}"/${i%.tar.bz2} || die ;; + *.zip) mv "${_tmpdir}"/*/ "${WORKDIR}"/${i%.zip} || die ;; + *) mv "${_tmpdir}"/* "${WORKDIR}"/ ;; + esac + done + popd > /dev/null }