mirror of
https://github.com/ruby/setup-ruby.git
synced 2026-09-13 14:34:21 +02:00
Fix tar extraction with windows-2016 image
1. common.js - add function win2nix(path) to convert windows style paths to nix style 2. ruby_builder.js - use Git tar for windows-2016, leave windows-2019 as is
This commit is contained in:
@@ -42,3 +42,12 @@ function findUbuntuVersion() {
|
||||
throw new Error('Could not find Ubuntu version')
|
||||
}
|
||||
}
|
||||
|
||||
// convert windows path like C:\Users\runneradmin to /c/Users/runneradmin
|
||||
export function win2nix(path) {
|
||||
if (/^[A-Z]:/i.test(path)) {
|
||||
// path starts with drive
|
||||
path = `/${path[0].toLowerCase()}${path.split(':')[1]}`
|
||||
}
|
||||
return path.replace(/\\/g, '/').replace(/ /g, '\\ ')
|
||||
}
|
||||
|
||||
+20
-3
@@ -1521,6 +1521,7 @@ __webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "measure", function() { return measure; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isHeadVersion", function() { return isHeadVersion; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getVirtualEnvironmentName", function() { return getVirtualEnvironmentName; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "win2nix", function() { return win2nix; });
|
||||
const os = __webpack_require__(87)
|
||||
const fs = __webpack_require__(747)
|
||||
const core = __webpack_require__(470)
|
||||
@@ -1566,6 +1567,15 @@ function findUbuntuVersion() {
|
||||
}
|
||||
}
|
||||
|
||||
// convert windows path like C:\Users\runneradmin to /c/Users/runneradmin
|
||||
function win2nix(path) {
|
||||
if (/^[A-Z]:/i.test(path)) {
|
||||
// path starts with drive
|
||||
path = `/${path[0].toLowerCase()}${path.split(':')[1]}`
|
||||
}
|
||||
return path.replace(/\\/g, '/').replace(/ /g, '\\ ')
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
@@ -3582,9 +3592,16 @@ async function downloadAndExtract(platform, engine, version) {
|
||||
return await tc.downloadTool(url)
|
||||
})
|
||||
|
||||
const tar = platform.startsWith('windows') ? 'C:\\Windows\\system32\\tar.exe' : 'tar'
|
||||
await common.measure('Extracting Ruby', async () =>
|
||||
exec.exec(tar, [ '-xz', '-C', rubiesDir, '-f', downloadPath ]))
|
||||
await common.measure('Extracting Ruby', async () => {
|
||||
if (process.env.ImageOS === 'win16') {
|
||||
const tar = '"C:\\Program Files\\Git\\usr\\bin\\tar.exe"'
|
||||
await exec.exec(tar, [ '-xz', '-C', common.win2nix(rubiesDir), '-f',
|
||||
common.win2nix(downloadPath) ])
|
||||
} else {
|
||||
const tar = platform.startsWith('windows') ? 'C:\\Windows\\system32\\tar.exe' : 'tar'
|
||||
await exec.exec(tar, [ '-xz', '-C', rubiesDir, '-f', downloadPath ])
|
||||
}
|
||||
})
|
||||
|
||||
return path.join(rubiesDir, `${engine}-${version}`)
|
||||
}
|
||||
|
||||
+10
-3
@@ -34,9 +34,16 @@ async function downloadAndExtract(platform, engine, version) {
|
||||
return await tc.downloadTool(url)
|
||||
})
|
||||
|
||||
const tar = platform.startsWith('windows') ? 'C:\\Windows\\system32\\tar.exe' : 'tar'
|
||||
await common.measure('Extracting Ruby', async () =>
|
||||
exec.exec(tar, [ '-xz', '-C', rubiesDir, '-f', downloadPath ]))
|
||||
await common.measure('Extracting Ruby', async () => {
|
||||
if (process.env.ImageOS === 'win16') {
|
||||
const tar = '"C:\\Program Files\\Git\\usr\\bin\\tar.exe"'
|
||||
await exec.exec(tar, [ '-xz', '-C', common.win2nix(rubiesDir), '-f',
|
||||
common.win2nix(downloadPath) ])
|
||||
} else {
|
||||
const tar = platform.startsWith('windows') ? 'C:\\Windows\\system32\\tar.exe' : 'tar'
|
||||
await exec.exec(tar, [ '-xz', '-C', rubiesDir, '-f', downloadPath ])
|
||||
}
|
||||
})
|
||||
|
||||
return path.join(rubiesDir, `${engine}-${version}`)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user