mtail-0_pre20161108.ebuild 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=6
  4. KEYWORDS="~amd64"
  5. EGO_PN=github.com/google/mtail
  6. EGIT_COMMIT=a780a6342bd70a8fb8ffe187ef988d5417d43a96
  7. SRC_URI="https://${EGO_PN}/archive/${EGIT_COMMIT}.tar.gz -> ${P}.tar.gz
  8. https://github.com/spf13/afero/archive/06b7e5f50606ecd49148a01a6008942d9b669217.tar.gz -> afero-06b7e5f50606ecd49148a01a6008942d9b669217.tar.gz
  9. https://github.com/golang/glog/archive/23def4e6c14b4da8ac2ed8007337bc5eb5007998.tar.gz -> go-glog-23def4e6c14b4da8ac2ed8007337bc5eb5007998.tar.gz
  10. https://github.com/fsnotify/fsnotify/archive/v1.4.2.tar.gz -> go-fsnotify-1.4.2.tar.gz
  11. https://github.com/golang/tools/archive/76b6c242fbd3fa734fbfe26a653f14fd495cb03a.tar.gz -> go-tools-76b6c242fbd3fa734fbfe26a653f14fd495cb03a.tar.gz
  12. https://github.com/golang/sys/archive/30237cf4eefd639b184d1f2cb77a581ea0be8947.tar.gz -> go-sys-30237cf4eefd639b184d1f2cb77a581ea0be8947.tar.gz
  13. https://github.com/golang/text/archive/b01949dc0793a9af5e4cb3fce4d42999e76e8ca1.tar.gz -> go-text-b01949dc0793a9af5e4cb3fce4d42999e76e8ca1.tar.gz
  14. test? (
  15. https://github.com/kylelemons/godebug/archive/d99083b96f422f8fd5a93bc02040acec769e178f.tar.gz -> godebug-d99083b96f422f8fd5a93bc02040acec769e178f.tar.gz
  16. )"
  17. DESCRIPTION="A tool for extracting metrics from application logs"
  18. HOMEPAGE="https://${EGO_PN}/"
  19. LICENSE="Apache-2.0"
  20. SLOT="0"
  21. IUSE="test"
  22. DEPEND=">=dev-lang/go-1.6:="
  23. RDEPEND="!app-misc/mtail"
  24. get_archive_go_package() {
  25. local archive=${1} uri x
  26. for x in ${SRC_URI}; do
  27. if [[ ${x} == http* ]]; then
  28. uri=${x}
  29. elif [[ ${x} == ${archive} ]]; then
  30. break
  31. fi
  32. done
  33. uri=${uri#https://}
  34. uri=${uri%/archive/*}
  35. case ${uri} in
  36. github.com/fsnotify/fsnotify)
  37. echo "gopkg.in/fsnotify.v1|fsnotify-*"
  38. ;;
  39. github.com/golang/glog)
  40. echo "${uri}|${uri##*/}-*"
  41. ;;
  42. github.com/golang/*)
  43. echo "golang.org/x/${uri##*/}|${uri##*/}-*"
  44. ;;
  45. *)
  46. echo "${uri}|${uri##*/}-*"
  47. ;;
  48. esac
  49. }
  50. unpack_go_packages() {
  51. local go_package x
  52. # Unpack packages to appropriate locations for GOPATH
  53. for x in ${A}; do
  54. unpack ${x}
  55. if [[ ${x} == *.tar.gz ]]; then
  56. go_package=$(get_archive_go_package ${x})
  57. x=${go_package#*|}
  58. go_package=${go_package%|*}
  59. mkdir -p src/${go_package%/*}
  60. mv ${x} src/${go_package} || die
  61. fi
  62. done
  63. }
  64. src_unpack() {
  65. mkdir "${S}" || die
  66. cd "${S}" || die
  67. unpack_go_packages
  68. }
  69. src_prepare() {
  70. default
  71. sed '/^[[:space:]]*go get .*/d' -i "${S}/src/${EGO_PN}/Makefile" || die
  72. }
  73. src_compile() {
  74. export GOPATH="${S}"
  75. go install -v -work -x ${EGO_BUILD_FLAGS} "golang.org/x/tools/cmd/goyacc" || die
  76. PATH=${S}/bin:${PATH} emake -C "${S}/src/${EGO_PN}"
  77. }
  78. src_test() {
  79. cd "${S}/src/${EGO_PN}" || die
  80. default
  81. }
  82. src_install() {
  83. dobin bin/mtail
  84. dodoc "${S}/src/${EGO_PN}/"{CONTRIBUTING.md,README.md,TODO}
  85. }