From 87d48e41f2106e7c7da95f13c52018f8fbdeb275 Mon Sep 17 00:00:00 2001 From: Vishniakov Nikolai Date: Mon, 18 Sep 2023 14:45:58 +0200 Subject: [PATCH] Use runtime version 2023.1 by default, extend download runtime script --- src/bindings/js/node/package.json | 4 +- .../js/node/scripts/download_runtime.js | 80 +++++++++++++------ 2 files changed, 57 insertions(+), 27 deletions(-) diff --git a/src/bindings/js/node/package.json b/src/bindings/js/node/package.json index 9ef70211d5844f..4f519656b01823 100644 --- a/src/bindings/js/node/package.json +++ b/src/bindings/js/node/package.json @@ -34,10 +34,10 @@ }, "gypfile": true, "binary": { - "version": "2023.1.0.dev20230811", + "version": "2023.1.0.12185.47b736f63ed", "module_path": "./ov_runtime/", "package_name": "{letter}_openvino_toolkit_{os}_{version}_{arch}.{extension}", "host": "https://storage.openvinotoolkit.org/", - "remote_path": "repositories/openvino/packages/master/2023.1.0.dev20230811/" + "remote_path": "repositories/openvino/packages/2023.1/" } } diff --git a/src/bindings/js/node/scripts/download_runtime.js b/src/bindings/js/node/scripts/download_runtime.js index 423efeef1e39eb..64909d228566fc 100644 --- a/src/bindings/js/node/scripts/download_runtime.js +++ b/src/bindings/js/node/scripts/download_runtime.js @@ -39,7 +39,7 @@ async function main() { packageName = packageName.replace('{version}', packageJson.binary.version); const binaryUrl = packageJson.binary.host + packageJson.binary['remote_path'] - + packageName; + + `${osInfo.dir}/` + packageName; try { await fetchRuntime(binaryUrl); @@ -57,7 +57,7 @@ async function main() { async function detectOS() { const platform = os.platform(); - if (!['win32', 'linux'].includes(platform)) { + if (!['win32', 'linux', 'darwin'].includes(platform)) { console.error(`Platform '${platform}' doesn't support`); process.exit(1); } @@ -65,51 +65,81 @@ async function detectOS() { const platformMapping = { win32: { os: 'windows', + dir: 'windows', letter: 'w', extension: 'zip', }, linux: { letter: 'l', + dir: 'linux', extension: 'tgz', - } + }, + darwin: { + letter: 'm', + dir: 'macos', + extension: 'tgz', + }, }; const arch = os.arch(); - if (!['arm64', 'x64'].includes(arch)) { + if (!['arm64', 'armhf', 'x64'].includes(arch)) { console.error(`Architecture '${arch}' doesn't support`); process.exit(1); } const archMapping = { arm64: 'arm64', + armhf: 'armhf', x64: 'x86_64', }; - platformMapping.arch = archMapping[arch]; - - if (platform === 'linux') { - const osReleaseData = await fs.readFile('/etc/os-release', 'utf8'); - const os = osReleaseData.includes('Ubuntu 22') - ? 'ubuntu22' - : osReleaseData.includes('Ubuntu 20') - ? 'ubuntu20' - : osReleaseData.includes('Ubuntu 18') - ? 'ubuntu18' - : ['arm64', 'armhf'].includes(platformMapping.arch) - && osReleaseData.includes('ID=debian') - ? 'debian9' - : null; - - if (!os) { - console.error('Cannot detect your OS'); - process.exit(1); - } + let osVersion = null; + switch(platform) { + case 'linux': + const osReleaseData = await fs.readFile('/etc/os-release', 'utf8'); + + osVersion = osReleaseData.includes('Ubuntu 22') + ? 'ubuntu22' + : osReleaseData.includes('Ubuntu 20') + ? 'ubuntu20' + : osReleaseData.includes('Ubuntu 18') + ? 'ubuntu18' + : ['arm64', 'armhf'].includes(arch) + && osReleaseData.includes('ID=debian') + ? 'debian9' + : null; + + break; + + case 'darwin': + const [major, minor] = os.release().split('.'); - platformMapping.linux.os = os; + osVersion = (major === 10 && minor >= 15) + ? 'macos_10_15' + : major === 11 + ? 'macos_11_0' + : null; + + break; + + case 'win32': + osVersion = true; + + break; } - return { platform, arch: archMapping[arch], ...platformMapping[platform] }; + if (!osVersion) { + console.error('Cannot detect your OS'); + process.exit(1); + } + + return { + platform, + os: osVersion, + arch: archMapping[arch], + ...platformMapping[platform] + }; } async function checkDirExistence(pathToDir) {