From 26c99606c45679c30e27204732fa9bf8672701eb Mon Sep 17 00:00:00 2001 From: OlegYch Date: Fri, 27 Mar 2020 18:49:48 +0300 Subject: [PATCH] Use posix archive format This preserves timestamps with nanoseconds precision and makes the cache usable by tools which rely on it (eg https://www.scala-sbt.org/). --- __tests__/tar.test.ts | 1 + dist/restore/index.js | 9 +++++---- dist/save/index.js | 9 +++++---- src/tar.ts | 1 + 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/__tests__/tar.test.ts b/__tests__/tar.test.ts index fdf637a..1b977a9 100644 --- a/__tests__/tar.test.ts +++ b/__tests__/tar.test.ts @@ -70,6 +70,7 @@ test("create tar", async () => { expect(execMock).toHaveBeenCalledWith( `"${tarPath}"`, [ + "--posix", "-cz", "-f", CacheFilename, diff --git a/dist/restore/index.js b/dist/restore/index.js index ac49982..7294f8a 100644 --- a/dist/restore/index.js +++ b/dist/restore/index.js @@ -2182,12 +2182,12 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", { value: true }); const core = __importStar(__webpack_require__(470)); -const fs = __importStar(__webpack_require__(747)); -const crypto = __importStar(__webpack_require__(417)); const http_client_1 = __webpack_require__(539); const auth_1 = __webpack_require__(226); -const utils = __importStar(__webpack_require__(443)); +const crypto = __importStar(__webpack_require__(417)); +const fs = __importStar(__webpack_require__(747)); const constants_1 = __webpack_require__(694); +const utils = __importStar(__webpack_require__(443)); const versionSalt = "1.0"; function isSuccessStatusCode(statusCode) { if (!statusCode) { @@ -3185,8 +3185,8 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", { value: true }); const core = __importStar(__webpack_require__(470)); -const io = __importStar(__webpack_require__(1)); const glob = __importStar(__webpack_require__(281)); +const io = __importStar(__webpack_require__(1)); const fs = __importStar(__webpack_require__(747)); const path = __importStar(__webpack_require__(622)); const util = __importStar(__webpack_require__(669)); @@ -5013,6 +5013,7 @@ function createTar(archiveFolder, sourceDirectories) { fs_1.writeFileSync(path.join(archiveFolder, manifestFilename), sourceDirectories.join("\n")); const workingDirectory = getWorkingDirectory(); const args = [ + "--posix", "-cz", "-f", constants_1.CacheFilename, diff --git a/dist/save/index.js b/dist/save/index.js index ca454ed..1a48dac 100644 --- a/dist/save/index.js +++ b/dist/save/index.js @@ -2182,12 +2182,12 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", { value: true }); const core = __importStar(__webpack_require__(470)); -const fs = __importStar(__webpack_require__(747)); -const crypto = __importStar(__webpack_require__(417)); const http_client_1 = __webpack_require__(539); const auth_1 = __webpack_require__(226); -const utils = __importStar(__webpack_require__(443)); +const crypto = __importStar(__webpack_require__(417)); +const fs = __importStar(__webpack_require__(747)); const constants_1 = __webpack_require__(694); +const utils = __importStar(__webpack_require__(443)); const versionSalt = "1.0"; function isSuccessStatusCode(statusCode) { if (!statusCode) { @@ -3185,8 +3185,8 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", { value: true }); const core = __importStar(__webpack_require__(470)); -const io = __importStar(__webpack_require__(1)); const glob = __importStar(__webpack_require__(281)); +const io = __importStar(__webpack_require__(1)); const fs = __importStar(__webpack_require__(747)); const path = __importStar(__webpack_require__(622)); const util = __importStar(__webpack_require__(669)); @@ -4990,6 +4990,7 @@ function createTar(archiveFolder, sourceDirectories) { fs_1.writeFileSync(path.join(archiveFolder, manifestFilename), sourceDirectories.join("\n")); const workingDirectory = getWorkingDirectory(); const args = [ + "--posix", "-cz", "-f", constants_1.CacheFilename, diff --git a/src/tar.ts b/src/tar.ts index 3ca3019..ea76527 100644 --- a/src/tar.ts +++ b/src/tar.ts @@ -56,6 +56,7 @@ export async function createTar( const workingDirectory = getWorkingDirectory(); const args = [ + "--posix", "-cz", "-f", CacheFilename,