Fix tools/update_traceconv
Change-Id: I523f8fcef8285e8f368b0d41ae20506154f7fb46
diff --git a/tools/update_traceconv b/tools/update_traceconv
index 694a1aa..2860273 100755
--- a/tools/update_traceconv
+++ b/tools/update_traceconv
@@ -5,8 +5,8 @@
DIR=$(mktemp -d out/perfetto.XXXXXX)
function cleanup {
- rm -rf "$WORK_DIR"
- echo "Deleted temp working directory $WORK_DIR"
+ rm -rf "$DIR"
+ echo "Deleted temp working directory $DIR"
}
#trap cleanup EXIT
@@ -18,7 +18,12 @@
tools/gn gen $DIR --args='is_clang=true is_debug=false'
tools/ninja -C $DIR trace_to_text
-hash=$(shasum $DIR/trace_to_text | cut -f1 -d' ')
+
+if which shasum; then
+ NEW_SHA=$(shasum $DIR/trace_to_text | cut -f1 -d' ') # Mac OS
+else
+ NEW_SHA=$(sha1sum $DIR/trace_to_text | cut -f1 -d' ') # Linux
+fi
if is_mac; then
platform=mac
@@ -26,11 +31,13 @@
platform=linux
fi
-name=trace_to_text-$platform-$hash
+name=trace_to_text-$platform-$NEW_SHA
gsutil cp $DIR/trace_to_text gs://perfetto/$name
gsutil cp $DIR/trace_to_text gs://chromium-telemetry/binary_dependencies/$name
+gsutil acl ch -u AllUsers:R gs://perfetto/$name
+gsutil acl ch -u AllUsers:R gs://chromium-telemetry/binary_dependencies/$name
echo 'Now run the following command to update tools/traceconv:'
-echo "sed \"s/'$platform': '[^']*',/'$platform': '$hash',/\" --in-place tools/traceconv"
+echo "sed \"s/'$platform': '[^']*',/'$platform': '$NEW_SHA',/\" --in-place tools/traceconv"