net-fs/torus: add package
authorZac Medico <zmedico@gentoo.org>
Mon, 7 Nov 2016 03:43:57 +0000 (19:43 -0800)
committerZac Medico <zmedico@gentoo.org>
Mon, 7 Nov 2016 04:09:23 +0000 (20:09 -0800)
Package-Manager: portage-2.3.2

net-fs/torus/Manifest [new file with mode: 0644]
net-fs/torus/metadata.xml [new file with mode: 0644]
net-fs/torus/torus-0.1.2.ebuild [new file with mode: 0644]

diff --git a/net-fs/torus/Manifest b/net-fs/torus/Manifest
new file mode 100644 (file)
index 0000000..bce1aad
--- /dev/null
@@ -0,0 +1,3 @@
+DIST glide-0.10.2.tar.gz 204775 SHA256 f0153d88f12fb36419cb616d9922ae95b274ac7c9ed9b043701f187da5834eac SHA512 5e8ecf20de7ce53236d16e52e98acf46f4611d84b742665009d4aea44efe9ba09344f9fe5a6d3f6d6b67ba168ac0f825f620ea419a24ddd826a3ecd83aeea320 WHIRLPOOL 5ea7e59e06cb88c080fcd11af090188a1df8c1dfc8503c0a7c70cc57522b8cedcddc9f1a8fba5ad0c1236f3635d4a8038121f038674f840e44e22d3fe8bbccb2
+DIST gogo-protobuf-0.3.tar.gz 2116795 SHA256 82222a5ad3bdc53fb60851df05acc16e7578932984c78e32abd05cb610127308 SHA512 57e1b1715d4811800da8cf9f2c72d202deae622d89715d7eff2ff0c406a0ea3778c187443abb17b072ae6fe57382844807f103837032759dab5420c860b99fb8 WHIRLPOOL 2c900a93d698d946949e8ef830c9940ea43c8faaf667eec7ec99ad58f46e5de9e59e43182d675f419196caacb08af2a49e63146998c5ccbef379c3920997511f
+DIST torus-0.1.2.tar.gz 8319943 SHA256 1639ff6dc739daa44259bf8fe7573301702fae86d136a89e00401122d37f9018 SHA512 46d56f560d92cf0b0c357d57d5249584f9a8444dc6bb0c3e00db3a288eea496fbc19c73be87ac9d534a4707ed74769e91354c95bac4b354fc62104a006239912 WHIRLPOOL c12151246943d25304e3074baa4616d478626ff9a0a092dbbf31ba35e2ca265257f2ef6438d64c4e65535b61d32b7b9c5a65b41209c0683f2e8f95aef50b0258
diff --git a/net-fs/torus/metadata.xml b/net-fs/torus/metadata.xml
new file mode 100644 (file)
index 0000000..d39e23b
--- /dev/null
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+       <maintainer type="person">
+               <email>zmedico@gentoo.org</email>
+               <name>Zac Medico</name>
+       </maintainer>
+       <upstream>
+               <remote-id type="github">coreos/torus</remote-id>
+       </upstream>
+</pkgmetadata>
diff --git a/net-fs/torus/torus-0.1.2.ebuild b/net-fs/torus/torus-0.1.2.ebuild
new file mode 100644 (file)
index 0000000..2c7e774
--- /dev/null
@@ -0,0 +1,83 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+
+EGO_PN="github.com/coreos/${PN}/..."
+SRC_URI="https://${EGO_PN}/releases/download/v${PV}/${PN}_v${PV}_src.tar.gz -> ${P}.tar.gz
+       https://github.com/Masterminds/glide/archive/0.10.2.tar.gz -> glide-0.10.2.tar.gz
+       test? ( https://github.com/gogo/protobuf/archive/v0.3.tar.gz -> gogo-protobuf-0.3.tar.gz )"
+
+DESCRIPTION="A distributed storage system coordinated through etcd"
+HOMEPAGE="https://${EGO_PN%/*}"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE="doc test"
+
+DEPEND=">=dev-lang/go-1.6:="
+RDEPEND=""
+
+get_archive_go_package() {
+       local archive=${1} uri x
+       for x in ${SRC_URI}; do
+               if [[ ${x} == http* ]]; then
+                       uri=${x}
+               elif [[ ${x} == ${archive} ]]; then
+                       break
+               fi
+       done
+       uri=${uri#https://}
+       uri=${uri%/archive/*}
+       case ${uri} in
+               ${EGO_PN%/*}*)
+                       echo "${EGO_PN%/*}|${PN}_*"
+                       ;;
+               *)
+                       echo "${uri}|${uri##*/}-*"
+                       ;;
+       esac
+}
+
+unpack_go_packages() {
+       local go_package x
+       # Unpack packages to appropriate locations for GOPATH
+       for x in ${A}; do
+               unpack ${x}
+               if [[ ${x} == *.tar.gz ]]; then
+                       go_package=$(get_archive_go_package ${x})
+                       x=${go_package#*|}
+                       go_package=${go_package%|*}
+                       mkdir -p src/${go_package%/*}
+                       mv ${x} src/${go_package} || die
+               fi
+       done
+}
+
+src_unpack() {
+       mkdir "${S}" || die
+       cd "${S}" || die
+       unpack_go_packages
+}
+
+src_compile() {
+       GOPATH="${S}" go install -v -work -x github.com/Masterminds/glide/... || die
+       mkdir -p "${S}/src/${EGO_PN%/*}/tools" || die
+       mv "${S}/bin/glide" "${S}/src/${EGO_PN%/*}/tools/glide" || die
+       GOPATH="${S}" \
+               emake -C "${S}/src/${EGO_PN%/*}" VERSION=v${PV} build
+}
+
+src_test() {
+       GOPATH="${S}" \
+               emake -C "${S}/src/${EGO_PN%/*}" VERSION=v${PV} test
+}
+
+src_install() {
+       cd "${S}/src/${EGO_PN%/*}"|| die
+       dobin bin/${PN}*
+       dodoc README.md
+       use doc && dodoc -r Documentation
+}