Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: third_party/node/update_node_binaries

Issue 2574033002: Downloading Node and NPM deps via gclient sync. (Closed)
Patch Set: Add missing sha1 file. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/node/package.json ('k') | third_party/node/update_npm_deps » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/bin/bash
2
3 # Copyright 2017 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
6
7 # Script for updating Node binaries.
8 # 1) Update NODE_VERSION variable below to the desired version.
9 # 2) Run this script.
10 # 3) Upload the binaries to the Google Storage bucket (commands to upload
11 # binaries are printed at step 2, look for "gsutil.py").
12 # 4) Land a CL with the changes generated by this script.
13
14 set -eu
15 cd "$(dirname "$0")"
16
17 BASE_URL="https://nodejs.org/dist"
18 NODE_VERSION="v6.9.4"
19
20 update_unix() {
21 local SUFFIX="$1"
22 local FOLDER="$2"
23 local FILENAME="node-${NODE_VERSION}-${SUFFIX}.tar.gz"
24 local URL="${BASE_URL}/${NODE_VERSION}/${FILENAME}"
25
26 rm -f "${FOLDER}/${FILENAME}"
27 wget -P "${FOLDER}/" "${URL}"
28
29 # Check SHASUMS256 of downloaded binary.
30 local sha256_expected
31 sha256_expected="$(grep "$FILENAME" SHASUMS256.txt | cut -d ' ' -f1)"
32 local sha256_actual
33 sha256_actual="$(sha256sum "${FOLDER}/${FILENAME}" | cut -d ' ' -f1)"
34
35 if [ "${sha256_expected}" != "${sha256_actual}" ]; then
36 echo "SHA256 mismatch. Exiting..."
37 exit 1
38 fi
39
40 # Unpack temporarily, delete NPM symlink and re-pack.
41 tar xfz "${FOLDER}/${FILENAME}" -C "${FOLDER}/"
42 rm "${FOLDER}/${FILENAME}"
43 rm "${FOLDER}/node-${NODE_VERSION}-${SUFFIX}/bin/npm"
44
45 # Drop the version info from the name, since it is redundant and would make
46 # rolling new versions more involved.
47 rm -rf "${FOLDER}/node-${SUFFIX}/"
48 mv "${FOLDER}/node-${NODE_VERSION}-${SUFFIX}/" "${FOLDER}/node-${SUFFIX}/"
49 tar cfz "${FOLDER}/node-${SUFFIX}.tar.gz" -C "${FOLDER}" "node-${SUFFIX}/"
50 local sha1
51 sha1="$(sha1sum ${FOLDER}/node-${SUFFIX}.tar.gz | cut -d ' ' -f1)"
52 echo "${sha1}" > "${FOLDER}/node-${SUFFIX}.tar.gz.sha1"
53 echo "Please execute manually the following:"
54 echo "> gsutil.py cp ${FOLDER}/node-${SUFFIX}.tar.gz gs://chromium-nodejs/${NO DE_VERSION:1}/${sha1}"
55 echo "DONE updating for ${SUFFIX}."
56 }
57
58 update_win() {
59 local FILENAME="node.exe"
60 local FOLDER="win"
61 local WINDOWS_URL="${BASE_URL}/${NODE_VERSION}/win-x64/${FILENAME}"
62 rm -f "${FOLDER}/${FILENAME}"
63 wget -P "${FOLDER}/" "${WINDOWS_URL}"
64
65 # Check SHASUMS256 of downloaded binary.
66 local sha256_expected
67 sha256_expected="$(grep "win-x64/$FILENAME" SHASUMS256.txt | cut -d ' ' -f1)"
68 local sha256_actual
69 sha256_actual="$(sha256sum "${FOLDER}/${FILENAME}" | cut -d ' ' -f1)"
70
71 if [ "${sha256_expected}" != "${sha256_actual}" ]; then
72 echo "SHA256 mismatch. Exiting..."
73 exit 1
74 fi
75
76 local sha1
77 sha1="$(sha1sum ${FOLDER}/node.exe | cut -d ' ' -f1)"
78 echo "${sha1}" > "${FOLDER}/node.exe.sha1"
79 echo "Please execute manually the following:"
80 echo "> gsutil.py cp ${FOLDER}/node.exe gs://chromium-nodejs/${NODE_VERSION:1} /${sha1}"
81 echo "DONE updating Windows."
82 }
83
84 # First download checksum file.
85 rm "SHASUMS256.txt"
86 wget "https://nodejs.org/dist/latest-v6.x/SHASUMS256.txt"
87
88 update_unix "darwin-x64" "mac"
89 update_unix "linux-x64" "linux"
90 update_win
91
92 # Update DEPS to point to the new Google Storage bucket subfolder.
93 sed -i "s@\(chromium-nodejs/\)\([0-9\.]\)\+@\1${NODE_VERSION:1}@" ../../DEPS
OLDNEW
« no previous file with comments | « third_party/node/package.json ('k') | third_party/node/update_npm_deps » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698