mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-16 09:51:38 +02:00
36 lines
1.3 KiB
Plaintext
36 lines
1.3 KiB
Plaintext
NODE_RELEASE_BASE_URL = "https://nodejs.org/dist/"
|
|
|
|
NODE_SHA1S = {
|
|
"node-v8.1.2-linux-x64.tar.gz":"61a609c83e2d3458cc2301a63b212a97e6b9f809",
|
|
"node-v8.1.2-darwin-x64.tar.gz":"a8b31fd645480661a8a777d9b4466dca0e6deb33",
|
|
"node-v8.11.1-linux-x64.tar.gz":"ee0213f62185c36121c2daf8dcacd34ade90b10c",
|
|
"node-v8.11.1-darwin-x64.tar.gz":"01effb57fa711aa258d7aab26c6615e1f8a64b1a"
|
|
}
|
|
|
|
def get_system_arch():
|
|
import platform
|
|
os = platform.system().lower()
|
|
return os
|
|
|
|
def fetch_node(version):
|
|
file_name = "node-%s-%s-x64" % (version, get_system_arch())
|
|
file_fullname = "node-%s-%s-x64.tar.gz" % (version, get_system_arch())
|
|
if file_fullname not in NODE_SHA1S:
|
|
raise Exception("Cannot download %s, architecture or version not supported" % file_name)
|
|
|
|
remote_file(
|
|
name = 'node-release-' + version,
|
|
url = NODE_RELEASE_BASE_URL + version + '/' + file_fullname,
|
|
sha1 = NODE_SHA1S[file_fullname],
|
|
)
|
|
|
|
genrule(
|
|
name = 'node-bin-' + version,
|
|
bash = 'tar --no-same-owner -xf $(location :node-release-' + version + ') && ' +
|
|
'mv ' + file_name + ' $OUT && ' +
|
|
'chmod +x $OUT',
|
|
out = 'node-binaries',
|
|
executable = False,
|
|
visibility = [ "PUBLIC" ],
|
|
)
|