diff options
author | Michał Górny <mgorny@gentoo.org> | 2012-03-19 08:38:45 +0000 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2012-03-19 08:38:45 +0000 |
commit | a77f61e85a9f93a2113462f35218dc75507df5cd (patch) | |
tree | 4bb2cc399c4356197c0b4d95448ef4bc4ede9033 /eclass | |
parent | Cleaned old (diff) | |
download | gentoo-2-a77f61e85a9f93a2113462f35218dc75507df5cd.tar.gz gentoo-2-a77f61e85a9f93a2113462f35218dc75507df5cd.tar.bz2 gentoo-2-a77f61e85a9f93a2113462f35218dc75507df5cd.zip |
Introduce vcs-snapshot eclass to simplify workin with github, bitbucket and similar snapshots.
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/ChangeLog | 6 | ||||
-rw-r--r-- | eclass/vcs-snapshot.eclass | 45 |
2 files changed, 50 insertions, 1 deletions
diff --git a/eclass/ChangeLog b/eclass/ChangeLog index f553fe6313db..c494ba55f4ea 100644 --- a/eclass/ChangeLog +++ b/eclass/ChangeLog @@ -1,6 +1,10 @@ # ChangeLog for eclass directory # Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.171 2012/03/18 23:33:49 hd_brummy Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.172 2012/03/19 08:38:45 mgorny Exp $ + + 19 Mar 2012; Michał Górny <mgorny@gentoo.org> +vcs-snapshot.eclass: + Introduce vcs-snapshot eclass to simplify working with github, bitbucket + and similar snapshots. 18 Mar 2012; Joerg Bornkessel <hd_brummy@gentoo.org> vdr-plugin.eclass: move eerror to ewarn, make the gettext warning less importend diff --git a/eclass/vcs-snapshot.eclass b/eclass/vcs-snapshot.eclass new file mode 100644 index 000000000000..2bc459bea408 --- /dev/null +++ b/eclass/vcs-snapshot.eclass @@ -0,0 +1,45 @@ +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/vcs-snapshot.eclass,v 1.1 2012/03/19 08:38:45 mgorny Exp $ + +# @ECLASS: vcs-snapshot.eclass +# @MAINTAINER: +# mgorny@gentoo.org +# @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. +# +# Note that this eclass handles only unpacking. You need to specify +# SRC_URI yourself, and call any autoreconfiguration as necessary. +# The example does that using autotools-utils eclass. +# +# Right now, the eclass was tested with github, bitbucket and gitweb +# snapshots. Feel free to report snapshotting services which aren't +# working. +# @EXAMPLE: +# +# @CODE +# EAPI=4 +# AUTOTOOLS_AUTORECONF=1 +# inherit autotools-utils vcs-snapshot +# +# SRC_URI="http://github.com/example/${PN}/tarball/v${PV} -> ${P}.tar.gz" +# @CODE + +case ${EAPI:-0} in + 0|1) die "EAPI ${EAPI} unsupported.";; # default(), SRC_URI arrows + 2|3|4) ;; + *) die "github-snapshot.eclass API in EAPI ${EAPI} not yet established." +esac + +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 +} |