summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAri Hausman-Cohen <arihc@google.com>2015-10-26 23:34:03 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-10-26 23:34:03 +0000
commitf34227e077a8ea85f957b0bfe9113af5ac1490a7 (patch)
treeeb92bd01ee872e31e4a13674d2813c35256aaddc
parentb11b88f7a708525b6fddafbed26019239fa16f1c (diff)
parentdba82ea3e3a275c2a68e1d3249a05102016a8709 (diff)
downloadbrillo-f34227e077a8ea85f957b0bfe9113af5ac1490a7.tar.gz
Merge "Moved build metrics into brunch product build." into mnc-brillo-dev
-rw-r--r--vendorsetup.sh51
1 files changed, 0 insertions, 51 deletions
diff --git a/vendorsetup.sh b/vendorsetup.sh
index be760b7..e680f02 100644
--- a/vendorsetup.sh
+++ b/vendorsetup.sh
@@ -46,54 +46,3 @@ scan_for_brillo_devices()
}
scan_for_brillo_devices
-
-# build/envsetup.sh defines a make() function that wraps the make command and
-# does some extra stats collection to report to users. This function is called
-# by all flavors of make; mm, mma, etc.
-# We want to hook into these to take our own metrics, but not interfere with the
-# functionality, so we re-declare it under a new name, and evoke this original
-# behavior in our override (like one might make a call to "super").
-eval "overridden_$(declare -f make)"
-# TODO(arihc): move all this functionality into brunch build.
-make() {
- # TODO(arihc): This first part should be part of BDK install.
- local T="$(gettop)"
- local BRUNCH_LIB_DIR="${T}/tools/bdk/brunch/lib"
- if [ -z "$PYTHONPATH" ]; then
- export PYTHONPATH=${BRUNCH_LIB_DIR}
- else
- export PYTHONPATH=${BRUNCH_LIB_DIR}:${PYTHONPATH}
- fi
-
- # check and prompt user for opt in
- python "${BRUNCH_LIB_DIR}/tools/setup.py"
-
- # Actually perform the build (and time it)
- local start_time=$(date +"%s")
- overridden_make "$@"
- local ret=$?
- local end_time=$(date +"%s")
- local tdiff=$(($end_time-$start_time))
-
- # Determine which make function this was called from.
- local make_type="${FUNCNAME[1]}"
- if [[ -z "${make_type}" ]]; then
- make_type="make"
- fi
-
- # Send metrics only if:
- # * The user has opted in.
- # * The build was successful.
- # * The build was non-trivial.
- # TODO(arihc): Should be part of brunch build command.
- (local check_opt_in_script="${BRUNCH_LIB_DIR}/metrics/check_opt_in.py"
- python "${check_opt_in_script}"
- local opt_in=$?
- if [[ "${opt_in}" -eq 1 && "$ret" -eq 0 && \
- "$tdiff" -gt 0 ]]; then
- local data_script="${BRUNCH_LIB_DIR}/metrics/send_build.py"
- python "${data_script}" "${make_type}" "$tdiff"
- fi & )
-
- return $ret
-}