summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /eclass/golang-vcs-snapshot.eclass
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'eclass/golang-vcs-snapshot.eclass')
-rw-r--r--eclass/golang-vcs-snapshot.eclass56
1 files changed, 56 insertions, 0 deletions
diff --git a/eclass/golang-vcs-snapshot.eclass b/eclass/golang-vcs-snapshot.eclass
new file mode 100644
index 000000000000..1cf5a56e7160
--- /dev/null
+++ b/eclass/golang-vcs-snapshot.eclass
@@ -0,0 +1,56 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# @ECLASS: golang-vcs-snapshot.eclass
+# @MAINTAINER:
+# William Hubbs <williamh@gentoo.org>
+# @BLURB: support eclass for unpacking VCS snapshot tarballs for
+# software written in the Go programming language
+# @DESCRIPTION:
+# This eclass provides a convenience src_unpack() which unpacks the
+# first tarball mentioned in SRC_URI to its appropriate location in
+# ${WORKDIR}/${P}, treating ${WORKDIR}/${P} as a go workspace.
+#
+# The location where the tarball is extracted is defined as
+# ${WORKDIR}/${P}/src/${EGO_PN}.
+#
+# The typical use case is VCS snapshots coming from github, bitbucket
+# and similar services.
+#
+# Please note that this eclass currently handles only tarballs
+# (.tar.gz), but support for more formats may be added in the future.
+#
+# @EXAMPLE:
+#
+# @CODE
+# EGO_PN=github.com/user/package
+# inherit golang-vcs-snapshot
+#
+# SRC_URI="http://github.com/example/${PN}/tarball/v${PV} -> ${P}.tar.gz"
+# @CODE
+#
+# The above example will extract the tarball to
+# ${WORKDIR}/${P}/src/github.com/user/package
+
+inherit golang-base
+
+case ${EAPI:-0} in
+ 5) ;;
+ *) die "${ECLASS} API in EAPI ${EAPI} not yet established."
+esac
+
+EXPORT_FUNCTIONS src_unpack
+
+# @FUNCTION: golang-vcs-snapshot_src_unpack
+# @DESCRIPTION:
+# Extract the first archive from ${A} to the appropriate location for GOPATH.
+golang-vcs-snapshot_src_unpack() {
+ local x
+ ego_pn_check
+ set -- ${A}
+ x="$1"
+ mkdir -p "${WORKDIR}/${P}/src/${EGO_PN%/*}" || die
+ tar -C "${WORKDIR}/${P}/src/${EGO_PN%/*}" -x --strip-components 1 \
+ -f "${DISTDIR}/${x}" || die
+}