# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

# @ECLASS: github-snapshot.eclass
# @MAINTAINER:
# mgorny@gentoo.org
# @BLURB: support eclass for github snapshots
# @DESCRIPTION:
# This eclass provides a support src_unpack() implementation handling
# ${S} moves required by github-generated snapshots.
# @EXAMPLE:
#
# @CODE
# EAPI=4
# inherit github-snapshot
#
# SRC_URI="http://github.com/example/${PN}/tarball/${P} -> ${P}.tar.gz"
# @CODE

case ${EAPI:-0} in
	0|1) die "EAPI ${EAPI} unsupported.";;
	2|3|4) ;;
	*) die "github-snapshot.eclass API in EAPI ${EAPI} not yet established."
esac

EXPORT_FUNCTIONS src_unpack

github-snapshot_src_unpack() {
	default

	# at least username-projectname-hash
	mv *-*-[0-9a-f]*[0-9a-f]/ "${S}" || die
}