GoogleGit

blob: aafe170ddc6a45e4a82fb254f54e03ad17c4ee45 [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. dev-libs/protobuf
  22. sys-apps/rootdev
  23. "
  24. DEPEND="
  25. ${RDEPEND}
  26. chromeos-base/vboot_reference
  27. test? ( dev-cpp/gmock )
  28. dev-cpp/gtest
  29. "
  30. src_unpack() {
  31. platform_src_unpack
  32. EGIT_SOURCEDIR="${S}/components/metrics"
  33. EGIT_REPO_URI="${CROS_GIT_HOST_URL}/chromium/src/components/metrics.git" \
  34. EGIT_PROJECT="metrics" \
  35. EGIT_COMMIT="9f8d4f96900b543e191234c04f182c6de5f9869d" \
  36. git-2_src_unpack
  37. }
  38. src_install() {
  39. dobin "${OUT}"/metrics_client syslog_parser.sh
  40. if use passive_metrics; then
  41. dobin "${OUT}"/metrics_daemon
  42. insinto /etc/init
  43. doins init/metrics_library.conf init/metrics_daemon.conf
  44. if use metrics_uploader; then
  45. sed -i '/DAEMON_FLAGS=/s:=.*:="-uploader":' \
  46. "${D}"/etc/init/metrics_daemon.conf || die
  47. fi
  48. fi
  49. insinto /usr/$(get_libdir)/pkgconfig
  50. for v in "${LIBCHROME_VERS[@]}"; do
  51. ./platform2_preinstall.sh "${OUT}" "${v}"
  52. dolib.so "${OUT}/lib/libmetrics-${v}.so"
  53. doins "${OUT}/lib/libmetrics-${v}.pc"
  54. done
  55. insinto /usr/include/metrics
  56. doins c_metrics_library.h \
  57. metrics_library{,_mock}.h \
  58. timer{,_mock}.h
  59. # Install the protobuf so that autotests can have access to it.
  60. insinto /usr/include/metrics/proto
  61. doins components/metrics/proto/*.proto
  62. }
  63. platform_pkg_test() {
  64. local tests=(
  65. metrics_library_test
  66. $(usex passive_metrics 'metrics_daemon_test' '')
  67. persistent_integer_test
  68. timer_test
  69. upload_service_test
  70. )
  71. local test_bin
  72. for test_bin in "${tests[@]}"; do
  73. platform_test "run" "${OUT}/${test_bin}"
  74. done
  75. }