Index: third_party/node/update_node_binaries |
diff --git a/third_party/node/update_node_binaries b/third_party/node/update_node_binaries |
new file mode 100755 |
index 0000000000000000000000000000000000000000..7e659fbb1e5f322989ee74d95d143c5cf8fdb3b4 |
--- /dev/null |
+++ b/third_party/node/update_node_binaries |
@@ -0,0 +1,103 @@ |
+#!/bin/bash |
+ |
+# Copyright 2017 The Chromium Authors. All rights reserved. |
+# Use of this source code is governed by a BSD-style license that can be |
+# found in the LICENSE file. |
+ |
+# Script for updating Node binaries. |
+# 1) Update NODE_VERSION variable below to the desired version. |
+# 2) Run this script. |
+# 3) Upload the binaries to the Google Storage bucket (commands to upload |
+# binaries are printed at step 2, look for "gsutil.py"). |
+# 4) Land a CL with the changes generated by this script. |
+ |
+cd "$(dirname "$0")" |
+ |
+BASE_URL="https://nodejs.org/dist" |
+NODE_VERSION="v6.9.4" |
+ |
+####################################### |
+# Updates Node binary for Mac |
+####################################### |
+update_mac() { |
+ local SUFFIX="darwin-x64" |
+ local FILENAME="node-${NODE_VERSION}-${SUFFIX}.tar.gz" |
+ local FOLDER="mac" |
+ local URL="${BASE_URL}/${NODE_VERSION}/${FILENAME}" |
+ if [ -f "${FOLDER}/${FILENAME}" ]; then |
+ rm ${FOLDER}/${FILENAME} |
Dan Beam
2017/01/11 20:17:50
nit: in a couple cases you ask whether a directory
palmer
2017/01/11 20:53:51
It's crucial to use the quotes, by the way, to avo
Dan Beam
2017/01/11 20:58:58
yeah, this is one of the things i didn't mention b
dpapad
2017/01/11 21:58:09
Done.
dpapad
2017/01/11 21:58:09
Done.
|
+ fi |
+ wget -P ${FOLDER}/ ${URL} |
palmer
2017/01/11 20:53:51
Same thing here:
wget -P "${FOLDER}/" "${URL}
dpapad
2017/01/11 21:58:09
Done.
|
+ |
+ # Unpack temporarily, delete NPM symlink and re-pack. |
+ tar xfz ${FOLDER}/${FILENAME} -C ${FOLDER}/ |
+ rm ${FOLDER}/${FILENAME} |
+ rm ${FOLDER}/node-${NODE_VERSION}-${SUFFIX}/bin/npm |
+ |
+ # Drop the version info from the name, since it is redundant and would make |
+ # rolling new versions more involved. |
+ mv ${FOLDER}/node-${NODE_VERSION}-${SUFFIX}/ ${FOLDER}/node-${SUFFIX}/ |
+ tar cfz ${FOLDER}/node-${SUFFIX}.tar.gz -C ${FOLDER} node-${SUFFIX}/ |
+ local sha1 |
+ sha1="$(sha1sum ${FOLDER}/node-${SUFFIX}.tar.gz | cut -d ' ' -f1)" |
+ echo ${sha1} > ${FOLDER}/node-${SUFFIX}.tar.gz.sha1 |
+ echo "Please execute manually the following:" |
+ echo "> gsutil.py cp ${FOLDER}/node-${SUFFIX}.tar.gz gs://chromium-nodejs/${NODE_VERSION:1}/${sha1}" |
+ echo "DONE updating Mac." |
+} |
+ |
+####################################### |
+# Updates Node binary for Linux |
+####################################### |
+update_linux() { |
+ local SUFFIX="linux-x64" |
+ local FILENAME="node-${NODE_VERSION}-${SUFFIX}.tar.xz" |
+ local FOLDER="linux" |
+ local URL="${BASE_URL}/${NODE_VERSION}/${FILENAME}" |
+ if [ -f "${FOLDER}/${FILENAME}" ]; then |
+ rm ${FOLDER}/${FILENAME} |
+ fi |
+ wget -P ${FOLDER}/ ${URL} |
+ |
+ # Unpack temporarily, delete NPM symlink and re-pack as gz (not xz). |
+ tar xf ${FOLDER}/${FILENAME} -C ${FOLDER}/ |
+ rm ${FOLDER}/${FILENAME} |
+ rm ${FOLDER}/node-${NODE_VERSION}-${SUFFIX}/bin/npm |
+ |
+ # Drop the version info from the name, since it is redundant and would make |
+ # rolling new versions more involved. |
+ mv ${FOLDER}/node-${NODE_VERSION}-${SUFFIX}/ ${FOLDER}/node-${SUFFIX}/ |
+ tar cfz ${FOLDER}/node-${SUFFIX}.tar.gz -C ${FOLDER} node-${SUFFIX}/ |
+ local sha1 |
+ sha1="$(sha1sum ${FOLDER}/node-${SUFFIX}.tar.gz | cut -d ' ' -f1)" |
+ echo ${sha1} > ${FOLDER}/node-${SUFFIX}.tar.gz.sha1 |
+ echo "Please execute manually the following:" |
+ echo "> gsutil.py cp ${FOLDER}/node-${SUFFIX}.tar.gz gs://chromium-nodejs/${NODE_VERSION:1}/${sha1}" |
+ echo "DONE updating Linux." |
+} |
+ |
+####################################### |
+# Updates Node binary for Windows |
+####################################### |
+update_win() { |
+ local FILENAME="node.exe" |
+ local FOLDER="win" |
+ local WINDOWS_URL="${BASE_URL}/${NODE_VERSION}/win-x64/${FILENAME}" |
+ if [ -f "${FOLDER}/${FILENAME}" ]; then |
+ rm ${FOLDER}/${FILENAME} |
+ fi |
+ wget -P ${FOLDER}/ ${WINDOWS_URL} |
+ local sha1 |
+ sha1="$(sha1sum ${FOLDER}/node.exe | cut -d ' ' -f1)" |
+ echo ${sha1} > ${FOLDER}/node.exe.sha1 |
+ echo "Please execute manually the following:" |
+ echo "> gsutil.py cp ${FOLDER}/node.exe gs://chromium-nodejs/${NODE_VERSION:1}/${sha1}" |
+ echo "DONE updating Windows." |
+} |
+ |
+update_linux |
+update_mac |
+update_win |
+ |
+# Update DEPS to point to the new Google Storage bucket subfolder. |
+sed -i "s/\(chromium-nodejs\/\)\([0-9]\|\.\)\+/\1${NODE_VERSION:1}/" ../../DEPS |
Dan Beam
2017/01/11 20:17:50
nit: can you use a different sed separator? like
Dan Beam
2017/01/11 20:17:50
[0-9]\|\. could just be [0-9\.]
dpapad
2017/01/11 21:58:09
Done and done.
|