GoogleGit

blob: 38a903d94fc8ce1971a6eb36335ab7c26ff18a1d [file] [log] [blame]
  1. # Copyright 2014 The Chromium OS Authors. All rights reserved.
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=4
  4. CROS_WORKON_INCREMENTAL_BUILD=1
  5. CROS_WORKON_USE_VCSID=1
  6. CROS_WORKON_LOCALNAME="platform2"
  7. CROS_WORKON_PROJECT="chromiumos/platform2"
  8. CROS_WORKON_DESTDIR="${S}/platform2"
  9. PLATFORM_SUBDIR="metrics"
  10. inherit cros-constants cros-workon git-2 platform
  11. DESCRIPTION="Metrics aggregation service for Chromium OS"
  12. HOMEPAGE="http://www.chromium.org/"
  13. LICENSE="BSD-Google"
  14. SLOT="0"
  15. KEYWORDS="~*"
  16. IUSE="metrics_uploader +passive_metrics"
  17. RDEPEND="
  18. chromeos-base/libchromeos
  19. chromeos-base/system_api
  20. dev-libs/dbus-glib
  21. sys-apps/rootdev
  22. "
  23. DEPEND="
  24. ${RDEPEND}
  25. chromeos-base/vboot_reference
  26. test? ( dev-cpp/gmock )
  27. dev-cpp/gtest
  28. "
  29. src_unpack() {
  30. platform_src_unpack
  31. EGIT_SOURCEDIR="${S}/components/metrics"
  32. EGIT_REPO_URI="${CROS_GIT_HOST_URL}/chromium/src/components/metrics.git" \
  33. EGIT_PROJECT="metrics" \
  34. EGIT_COMMIT="9f8d4f96900b543e191234c04f182c6de5f9869d" \
  35. git-2_src_unpack
  36. }
  37. src_install() {
  38. dobin "${OUT}"/metrics_client syslog_parser.sh
  39. if use passive_metrics; then
  40. dobin "${OUT}"/metrics_daemon
  41. insinto /etc/init
  42. doins init/metrics_library.conf init/metrics_daemon.conf
  43. if use metrics_uploader; then
  44. sed -i '/DAEMON_FLAGS=/s:=.*:="-uploader":' \
  45. "${D}"/etc/init/metrics_daemon.conf || die
  46. fi
  47. fi
  48. insinto /usr/$(get_libdir)/pkgconfig
  49. for v in "${LIBCHROME_VERS[@]}"; do
  50. ./platform2_preinstall.sh "${OUT}" "${v}"
  51. dolib.so "${OUT}/lib/libmetrics-${v}.so"
  52. doins "${OUT}/lib/libmetrics-${v}.pc"
  53. done
  54. insinto /usr/include/metrics
  55. doins c_metrics_library.h \
  56. metrics_library{,_mock}.h \
  57. timer{,_mock}.h
  58. # Install the protobuf so that autotests can have access to it.
  59. insinto /usr/include/metrics/proto
  60. doins components/metrics/proto/*.proto
  61. }
  62. platform_pkg_test() {
  63. local tests=(
  64. metrics_library_test
  65. $(usex passive_metrics 'metrics_daemon_test' '')
  66. persistent_integer_test
  67. timer_test
  68. upload_service_test
  69. )
  70. local test_bin
  71. for test_bin in "${tests[@]}"; do
  72. platform_test "run" "${OUT}/${test_bin}"
  73. done
  74. }