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

Side by Side Diff: third_party/node/update_node_binaries

Issue 2574033002: Downloading Node and NPM deps via gclient sync. (Closed)
Patch Set: Nit 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 cd "$(dirname "$0")"
15
16 BASE_URL="https://nodejs.org/dist"
17 NODE_VERSION="v6.9.4"
18
19 #######################################
20 # Updates Node binary for Mac
21 #######################################
22 update_mac() {
23 local SUFFIX="darwin-x64"
24 local FILENAME="node-${NODE_VERSION}-${SUFFIX}.tar.gz"
25 local FOLDER="mac"
26 local URL="${BASE_URL}/${NODE_VERSION}/${FILENAME}"
27 if [ -f "${FOLDER}/${FILENAME}" ]; then
28 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.
29 fi
30 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.
31
32 # Unpack temporarily, delete NPM symlink and re-pack.
33 tar xfz ${FOLDER}/${FILENAME} -C ${FOLDER}/
34 rm ${FOLDER}/${FILENAME}
35 rm ${FOLDER}/node-${NODE_VERSION}-${SUFFIX}/bin/npm
36
37 # Drop the version info from the name, since it is redundant and would make
38 # rolling new versions more involved.
39 mv ${FOLDER}/node-${NODE_VERSION}-${SUFFIX}/ ${FOLDER}/node-${SUFFIX}/
40 tar cfz ${FOLDER}/node-${SUFFIX}.tar.gz -C ${FOLDER} node-${SUFFIX}/
41 local sha1
42 sha1="$(sha1sum ${FOLDER}/node-${SUFFIX}.tar.gz | cut -d ' ' -f1)"
43 echo ${sha1} > ${FOLDER}/node-${SUFFIX}.tar.gz.sha1
44 echo "Please execute manually the following:"
45 echo "> gsutil.py cp ${FOLDER}/node-${SUFFIX}.tar.gz gs://chromium-nodejs/${NO DE_VERSION:1}/${sha1}"
46 echo "DONE updating Mac."
47 }
48
49 #######################################
50 # Updates Node binary for Linux
51 #######################################
52 update_linux() {
53 local SUFFIX="linux-x64"
54 local FILENAME="node-${NODE_VERSION}-${SUFFIX}.tar.xz"
55 local FOLDER="linux"
56 local URL="${BASE_URL}/${NODE_VERSION}/${FILENAME}"
57 if [ -f "${FOLDER}/${FILENAME}" ]; then
58 rm ${FOLDER}/${FILENAME}
59 fi
60 wget -P ${FOLDER}/ ${URL}
61
62 # Unpack temporarily, delete NPM symlink and re-pack as gz (not xz).
63 tar xf ${FOLDER}/${FILENAME} -C ${FOLDER}/
64 rm ${FOLDER}/${FILENAME}
65 rm ${FOLDER}/node-${NODE_VERSION}-${SUFFIX}/bin/npm
66
67 # Drop the version info from the name, since it is redundant and would make
68 # rolling new versions more involved.
69 mv ${FOLDER}/node-${NODE_VERSION}-${SUFFIX}/ ${FOLDER}/node-${SUFFIX}/
70 tar cfz ${FOLDER}/node-${SUFFIX}.tar.gz -C ${FOLDER} node-${SUFFIX}/
71 local sha1
72 sha1="$(sha1sum ${FOLDER}/node-${SUFFIX}.tar.gz | cut -d ' ' -f1)"
73 echo ${sha1} > ${FOLDER}/node-${SUFFIX}.tar.gz.sha1
74 echo "Please execute manually the following:"
75 echo "> gsutil.py cp ${FOLDER}/node-${SUFFIX}.tar.gz gs://chromium-nodejs/${NO DE_VERSION:1}/${sha1}"
76 echo "DONE updating Linux."
77 }
78
79 #######################################
80 # Updates Node binary for Windows
81 #######################################
82 update_win() {
83 local FILENAME="node.exe"
84 local FOLDER="win"
85 local WINDOWS_URL="${BASE_URL}/${NODE_VERSION}/win-x64/${FILENAME}"
86 if [ -f "${FOLDER}/${FILENAME}" ]; then
87 rm ${FOLDER}/${FILENAME}
88 fi
89 wget -P ${FOLDER}/ ${WINDOWS_URL}
90 local sha1
91 sha1="$(sha1sum ${FOLDER}/node.exe | cut -d ' ' -f1)"
92 echo ${sha1} > ${FOLDER}/node.exe.sha1
93 echo "Please execute manually the following:"
94 echo "> gsutil.py cp ${FOLDER}/node.exe gs://chromium-nodejs/${NODE_VERSION:1} /${sha1}"
95 echo "DONE updating Windows."
96 }
97
98 update_linux
99 update_mac
100 update_win
101
102 # Update DEPS to point to the new Google Storage bucket subfolder.
103 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.
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