2022-04-12 11:21:55 +00:00
|
|
|
#!/usr/bin/env python3
|
2015-01-23 01:11:10 +00:00
|
|
|
|
|
|
|
import argparse
|
2015-01-23 01:18:31 +00:00
|
|
|
import glob
|
2015-01-23 01:11:10 +00:00
|
|
|
import os
|
|
|
|
import shutil
|
|
|
|
import sys
|
|
|
|
|
2019-06-26 18:32:42 +00:00
|
|
|
sys.path.append(
|
|
|
|
os.path.abspath(os.path.dirname(os.path.abspath(__file__)) + "/../.."))
|
2019-06-24 17:18:04 +00:00
|
|
|
|
2022-04-04 09:32:57 +00:00
|
|
|
from lib.config import PLATFORM, get_target_arch
|
|
|
|
from lib.util import safe_mkdir, scoped_cwd, store_artifact, get_out_dir, \
|
|
|
|
get_dist_dir
|
2015-01-23 01:11:10 +00:00
|
|
|
|
2018-09-27 06:48:07 +00:00
|
|
|
DIST_DIR = get_dist_dir()
|
|
|
|
OUT_DIR = get_out_dir()
|
2018-09-27 07:17:42 +00:00
|
|
|
GEN_DIR = os.path.join(OUT_DIR, 'gen')
|
|
|
|
|
|
|
|
HEADER_TAR_NAMES = [
|
|
|
|
'node-{0}.tar.gz',
|
|
|
|
'node-{0}-headers.tar.gz',
|
|
|
|
'iojs-{0}.tar.gz',
|
|
|
|
'iojs-{0}-headers.tar.gz'
|
|
|
|
]
|
2015-01-23 01:11:10 +00:00
|
|
|
|
|
|
|
def main():
|
|
|
|
args = parse_args()
|
|
|
|
|
2022-04-04 09:32:57 +00:00
|
|
|
# Upload node's headers to artifact storage.
|
|
|
|
upload_node(args.version)
|
2015-01-23 01:18:31 +00:00
|
|
|
|
2015-01-23 01:11:10 +00:00
|
|
|
|
|
|
|
def parse_args():
|
|
|
|
parser = argparse.ArgumentParser(description='upload sumsha file')
|
|
|
|
parser.add_argument('-v', '--version', help='Specify the version',
|
|
|
|
required=True)
|
|
|
|
return parser.parse_args()
|
|
|
|
|
|
|
|
|
2022-04-04 09:32:57 +00:00
|
|
|
def upload_node(version):
|
2018-09-27 07:17:42 +00:00
|
|
|
with scoped_cwd(GEN_DIR):
|
|
|
|
generated_tar = os.path.join(GEN_DIR, 'node_headers.tar.gz')
|
|
|
|
for header_tar in HEADER_TAR_NAMES:
|
|
|
|
versioned_header_tar = header_tar.format(version)
|
|
|
|
shutil.copy2(generated_tar, os.path.join(GEN_DIR, versioned_header_tar))
|
|
|
|
|
2024-03-21 13:48:23 +00:00
|
|
|
store_artifact(GEN_DIR, f'headers/dist/{version}',
|
2022-04-04 09:32:57 +00:00
|
|
|
glob.glob('node-*.tar.gz'))
|
2024-03-21 13:48:23 +00:00
|
|
|
store_artifact(GEN_DIR, f'headers/dist/{version}',
|
2022-04-04 09:32:57 +00:00
|
|
|
glob.glob('iojs-*.tar.gz'))
|
2015-01-23 01:18:31 +00:00
|
|
|
|
2015-04-11 09:30:52 +00:00
|
|
|
if PLATFORM == 'win32':
|
2015-04-11 16:01:10 +00:00
|
|
|
if get_target_arch() == 'ia32':
|
2015-04-11 15:40:10 +00:00
|
|
|
node_lib = os.path.join(DIST_DIR, 'node.lib')
|
2015-04-30 07:36:54 +00:00
|
|
|
iojs_lib = os.path.join(DIST_DIR, 'win-x86', 'iojs.lib')
|
2018-09-27 12:38:41 +00:00
|
|
|
v4_node_lib = os.path.join(DIST_DIR, 'win-x86', 'node.lib')
|
2019-09-10 21:14:58 +00:00
|
|
|
elif get_target_arch() == 'arm64':
|
|
|
|
node_lib = os.path.join(DIST_DIR, 'arm64', 'node.lib')
|
|
|
|
iojs_lib = os.path.join(DIST_DIR, 'win-arm64', 'iojs.lib')
|
2023-02-01 11:59:16 +00:00
|
|
|
v4_node_lib = os.path.join(DIST_DIR, 'win-arm64', 'node.lib')
|
2015-04-11 15:40:10 +00:00
|
|
|
else:
|
|
|
|
node_lib = os.path.join(DIST_DIR, 'x64', 'node.lib')
|
2015-04-30 07:36:54 +00:00
|
|
|
iojs_lib = os.path.join(DIST_DIR, 'win-x64', 'iojs.lib')
|
2018-09-27 12:38:41 +00:00
|
|
|
v4_node_lib = os.path.join(DIST_DIR, 'win-x64', 'node.lib')
|
2015-04-30 07:36:54 +00:00
|
|
|
safe_mkdir(os.path.dirname(node_lib))
|
|
|
|
safe_mkdir(os.path.dirname(iojs_lib))
|
2015-04-11 15:40:10 +00:00
|
|
|
|
2018-09-27 06:48:07 +00:00
|
|
|
# Copy electron.lib to node.lib and iojs.lib.
|
|
|
|
electron_lib = os.path.join(OUT_DIR, 'electron.lib')
|
|
|
|
shutil.copy2(electron_lib, node_lib)
|
|
|
|
shutil.copy2(electron_lib, iojs_lib)
|
|
|
|
shutil.copy2(electron_lib, v4_node_lib)
|
2015-01-23 01:18:31 +00:00
|
|
|
|
2015-04-11 15:40:10 +00:00
|
|
|
# Upload the node.lib.
|
2024-03-21 13:48:23 +00:00
|
|
|
store_artifact(DIST_DIR, f'headers/dist/{version}', [node_lib])
|
2015-01-23 01:18:31 +00:00
|
|
|
|
2015-04-30 07:36:54 +00:00
|
|
|
# Upload the iojs.lib.
|
2024-03-21 13:48:23 +00:00
|
|
|
store_artifact(DIST_DIR, f'headers/dist/{version}', [iojs_lib])
|
2015-04-30 07:36:54 +00:00
|
|
|
|
2018-09-27 12:38:41 +00:00
|
|
|
# Upload the v4 node.lib.
|
2024-03-21 13:48:23 +00:00
|
|
|
store_artifact(DIST_DIR, f'headers/dist/{version}',
|
2022-04-04 09:32:57 +00:00
|
|
|
[v4_node_lib])
|
2018-09-27 12:38:41 +00:00
|
|
|
|
2015-01-23 01:18:31 +00:00
|
|
|
|
2015-01-23 01:11:10 +00:00
|
|
|
if __name__ == '__main__':
|
|
|
|
sys.exit(main())
|