consul-replicate-0.2.0.ebuild 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. inherit golang-base
  5. KEYWORDS="~amd64"
  6. DESCRIPTION="Consul cross-DC KV replication daemon"
  7. EGO_PN="github.com/hashicorp/${PN}/..."
  8. HOMEPAGE="http://${EGO_PN%/*}"
  9. LICENSE="MPL-2.0"
  10. SLOT="0"
  11. IUSE="test"
  12. DEPEND=">=dev-lang/go-1.4:="
  13. RDEPEND=""
  14. SRC_URI="https://${EGO_PN%/*}/archive/v${PV}.tar.gz -> ${P}.tar.gz
  15. https://github.com/hashicorp/consul-template/archive/v0.8.0.tar.gz -> consul-template-0.8.0.tar.gz
  16. https://github.com/fatih/structs/archive/a924a2250d1033753512e95dce41dca3fd793ad9.tar.gz -> structs-a924a2250d1033753512e95dce41dca3fd793ad9.tar.gz
  17. https://github.com/hashicorp/consul/archive/v0.6.3.tar.gz -> consul-0.6.3.tar.gz
  18. https://github.com/hashicorp/errwrap/archive/7554cd9344cec97297fa6649b055a8c98c2a1e55.tar.gz -> errwrap-7554cd9344cec97297fa6649b055a8c98c2a1e55.tar.gz
  19. https://github.com/hashicorp/go-cleanhttp/archive/ce617e79981a8fff618bb643d155133a8f38db96.tar.gz -> go-cleanhttp-ce617e79981a8fff618bb643d155133a8f38db96.tar.gz
  20. https://github.com/hashicorp/go-multierror/archive/d30f09973e19c1dfcd120b2d9c4f168e68d6b5d5.tar.gz -> go-multierror-d30f09973e19c1dfcd120b2d9c4f168e68d6b5d5.tar.gz
  21. https://github.com/hashicorp/go-syslog/archive/42a2b573b664dbf281bd48c3cc12c086b17a39ba.tar.gz -> go-syslog-42a2b573b664dbf281bd48c3cc12c086b17a39ba.tar.gz
  22. https://github.com/hashicorp/hcl/archive/578dd9746824a54637686b51a41bad457a56bcef.tar.gz -> hcl-578dd9746824a54637686b51a41bad457a56bcef.tar.gz
  23. https://github.com/hashicorp/logutils/archive/0dc08b1671f34c4250ce212759ebd880f743d883.tar.gz -> logutils-0dc08b1671f34c4250ce212759ebd880f743d883.tar.gz
  24. https://github.com/hashicorp/serf/archive/64d10e9428bd70dbcd831ad087573b66731c014b.tar.gz -> serf-64d10e9428bd70dbcd831ad087573b66731c014b.tar.gz
  25. https://github.com/mitchellh/mapstructure/archive/281073eb9eb092240d33ef253c404f1cca550309.tar.gz -> mapstructure-281073eb9eb092240d33ef253c404f1cca550309.tar.gz"
  26. STRIP_MASK="*.a"
  27. S="${WORKDIR}/src/${EGO_PN%/*}"
  28. get_archive_go_package() {
  29. local archive=${1} uri x
  30. for x in ${SRC_URI}; do
  31. if [[ ${x} == http* ]]; then
  32. uri=${x}
  33. elif [[ ${x} == ${archive} ]]; then
  34. break
  35. fi
  36. done
  37. uri=${uri#https://}
  38. echo ${uri%/archive/*}
  39. }
  40. unpack_go_packages() {
  41. local go_package x
  42. # Unpack packages to appropriate locations for GOPATH
  43. for x in ${A}; do
  44. unpack ${x}
  45. go_package=$(get_archive_go_package ${x})
  46. mkdir -p src/${go_package%/*}
  47. mv ${go_package##*/}-* src/${go_package} || die
  48. done
  49. }
  50. src_unpack() {
  51. unpack_go_packages
  52. export GOPATH=${WORKDIR}:$(get_golibdir_gopath)
  53. }
  54. src_prepare() {
  55. # Create a writable GOROOT in order to avoid sandbox violations.
  56. export GOROOT="${WORKDIR}/goroot"
  57. cp -sR "${EPREFIX}"/usr/lib/go "${GOROOT}" || die
  58. rm -rf "${GOROOT}"/{src,pkg/$(go env GOOS)_$(go env GOARCH)}/"${EGO_PN%/*}" || die
  59. # Prune conflicting libraries from GOROOT
  60. while read -r -d '' x; do
  61. x=${x#${WORKDIR}/src}
  62. rm -rf "${GOROOT}/src/${x}" "${GOROOT}/pkg/$(go env GOOS)_$(go env GOARCH)/${x}"{,.a} || die
  63. done < <(find "${WORKDIR}/src" -maxdepth 3 -mindepth 3 -type d -print0)
  64. sed -e 's:TestParseConfig_parseFileError(:_\0:' -i config_test.go || die
  65. }
  66. src_compile() {
  67. go build -v -work -x ${EGO_BUILD_FLAGS} "${EGO_PN}" || die
  68. go install -v -work -x ${EGO_BUILD_FLAGS} "${EGO_PN}" || die
  69. }
  70. src_install() {
  71. dobin "${WORKDIR}/bin/${PN}"
  72. dodoc CHANGELOG.md README.md
  73. }