From f0b40ec80f6811e12b26b0b6f453da39bbca4636 Mon Sep 17 00:00:00 2001 From: Sean McGinnis Date: Thu, 4 Feb 2021 10:09:17 -0600 Subject: [PATCH 1/3] Add --overwrite flag to tar extraction There are times when previous actions have already extracted at least some files to the cache location. This results in subsequent cache extraction operations to emit errors such as: > /usr/bin/tar: [dest_file_path]: Cannot open: File exists This adds the --overwrite flag to the extract call to force tar to just overwrite these files rather than reporting errors. Signed-off-by: Sean McGinnis --- dist/post_run/index.js | 4 +++- dist/run/index.js | 4 +++- src/install.ts | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/dist/post_run/index.js b/dist/post_run/index.js index 78a1f20214..e5c8bf9bbf 100644 --- a/dist/post_run/index.js +++ b/dist/post_run/index.js @@ -48580,7 +48580,9 @@ function installLint(versionConfig) { repl = /\.zip$/; } else { - extractedDir = yield tc.extractTar(archivePath, process.env.HOME); + // We want to always overwrite files if the local cache already has them + let args = ['xz', '--overwrite']; + extractedDir = yield tc.extractTar(archivePath, process.env.HOME, args); } const urlParts = assetURL.split(`/`); const dirName = urlParts[urlParts.length - 1].replace(repl, ``); diff --git a/dist/run/index.js b/dist/run/index.js index 2562a9b78d..95c9890e7a 100644 --- a/dist/run/index.js +++ b/dist/run/index.js @@ -48590,7 +48590,9 @@ function installLint(versionConfig) { repl = /\.zip$/; } else { - extractedDir = yield tc.extractTar(archivePath, process.env.HOME); + // We want to always overwrite files if the local cache already has them + let args = ['xz', '--overwrite']; + extractedDir = yield tc.extractTar(archivePath, process.env.HOME, args); } const urlParts = assetURL.split(`/`); const dirName = urlParts[urlParts.length - 1].replace(repl, ``); diff --git a/src/install.ts b/src/install.ts index 218c595c89..dad6c4d17d 100644 --- a/src/install.ts +++ b/src/install.ts @@ -45,7 +45,9 @@ export async function installLint(versionConfig: VersionConfig): Promise extractedDir = await tc.extractZip(archivePath, process.env.HOME) repl = /\.zip$/ } else { - extractedDir = await tc.extractTar(archivePath, process.env.HOME) + // We want to always overwrite files if the local cache already has them + let args = ['xz', '--overwrite'] + extractedDir = await tc.extractTar(archivePath, process.env.HOME, args) } const urlParts = assetURL.split(`/`) From 0b80e46c53ef1749239d51d968b0d017d1db6af4 Mon Sep 17 00:00:00 2001 From: Sergey Vilgelm Date: Mon, 15 Feb 2021 11:54:01 -0600 Subject: [PATCH 2/3] npm run lint-fix & npm run format --- dist/post_run/index.js | 2 +- dist/run/index.js | 2 +- src/install.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/post_run/index.js b/dist/post_run/index.js index c5de8de9f3..77c60b0249 100644 --- a/dist/post_run/index.js +++ b/dist/post_run/index.js @@ -49238,7 +49238,7 @@ function installLint(versionConfig) { } else { // We want to always overwrite files if the local cache already has them - let args = ['xz', '--overwrite']; + const args = ["xz", "--overwrite"]; extractedDir = yield tc.extractTar(archivePath, process.env.HOME, args); } const urlParts = assetURL.split(`/`); diff --git a/dist/run/index.js b/dist/run/index.js index 2b6f49d1d1..0b70767897 100644 --- a/dist/run/index.js +++ b/dist/run/index.js @@ -49248,7 +49248,7 @@ function installLint(versionConfig) { } else { // We want to always overwrite files if the local cache already has them - let args = ['xz', '--overwrite']; + const args = ["xz", "--overwrite"]; extractedDir = yield tc.extractTar(archivePath, process.env.HOME, args); } const urlParts = assetURL.split(`/`); diff --git a/src/install.ts b/src/install.ts index dad6c4d17d..3037e21b45 100644 --- a/src/install.ts +++ b/src/install.ts @@ -46,7 +46,7 @@ export async function installLint(versionConfig: VersionConfig): Promise repl = /\.zip$/ } else { // We want to always overwrite files if the local cache already has them - let args = ['xz', '--overwrite'] + const args = ["xz", "--overwrite"] extractedDir = await tc.extractTar(archivePath, process.env.HOME, args) } From 85502d61d003e43db6e8447ab78e3eeda8fe4685 Mon Sep 17 00:00:00 2001 From: Sergey Vilgelm Date: Tue, 23 Feb 2021 08:07:19 -0600 Subject: [PATCH 3/3] ignore macOS --- dist/post_run/index.js | 5 ++++- dist/run/index.js | 5 ++++- src/install.ts | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/dist/post_run/index.js b/dist/post_run/index.js index 0ddf581b3a..34fdeef915 100644 --- a/dist/post_run/index.js +++ b/dist/post_run/index.js @@ -49251,7 +49251,10 @@ function installLint(versionConfig) { } else { // We want to always overwrite files if the local cache already has them - const args = ["xz", "--overwrite"]; + const args = ["xz"]; + if (process.platform.toString() != "darwin") { + args.push("--overwrite"); + } extractedDir = yield tc.extractTar(archivePath, process.env.HOME, args); } const urlParts = assetURL.split(`/`); diff --git a/dist/run/index.js b/dist/run/index.js index 85e9982526..c00fef61a3 100644 --- a/dist/run/index.js +++ b/dist/run/index.js @@ -49261,7 +49261,10 @@ function installLint(versionConfig) { } else { // We want to always overwrite files if the local cache already has them - const args = ["xz", "--overwrite"]; + const args = ["xz"]; + if (process.platform.toString() != "darwin") { + args.push("--overwrite"); + } extractedDir = yield tc.extractTar(archivePath, process.env.HOME, args); } const urlParts = assetURL.split(`/`); diff --git a/src/install.ts b/src/install.ts index 3037e21b45..19b4df52ff 100644 --- a/src/install.ts +++ b/src/install.ts @@ -46,7 +46,10 @@ export async function installLint(versionConfig: VersionConfig): Promise repl = /\.zip$/ } else { // We want to always overwrite files if the local cache already has them - const args = ["xz", "--overwrite"] + const args = ["xz"] + if (process.platform.toString() != "darwin") { + args.push("--overwrite") + } extractedDir = await tc.extractTar(archivePath, process.env.HOME, args) }