Fix preloading missing some files

This commit is contained in:
Stéphan Kochen
2020-08-30 08:59:50 +02:00
parent 2de21df9ef
commit c0a00b0637
2 changed files with 10 additions and 2 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long
+9 -1
View File
@@ -147,9 +147,17 @@ export default async (project: Project, cache: Cache, report: Report) => {
if (!xfs.existsSync(storePath)) {
// The nix-store command requires a correct filename on disk, so we
// prepare a temporary directory containing all the files to preload.
//
// Because some names may conflict (e.g. 'typescript-npm-xyz' and
// 'typescript-patch-xyz' both have the same derivation name), we
// create subdirectories based on hash.
const subdir = ppath.join(tempDir, sha512.slice(0, 7) as Filename);
await xfs.mkdirPromise(subdir);
const src = ppath.join(cache.cwd, filename);
const dst = ppath.join(tempDir, name as Filename);
const dst = ppath.join(subdir, name as Filename);
await xfs.copyFilePromise(src, dst);
toPreload.push(dst);
}
}