mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-12-03 19:06:16 +02:00
Fix getting the timestamp of GitHub flakes
This commit is contained in:
parent
dbb4bec003
commit
4da1cd59ba
1 changed files with 4 additions and 6 deletions
|
@ -912,18 +912,16 @@ CachedDownloadResult Downloader::downloadCached(
|
||||||
AutoDelete autoDelete(tmpDir, true);
|
AutoDelete autoDelete(tmpDir, true);
|
||||||
#if 0
|
#if 0
|
||||||
unpackTarfile(store->toRealPath(store->printStorePath(*storePath)), tmpDir, std::string(baseNameOf(url)));
|
unpackTarfile(store->toRealPath(store->printStorePath(*storePath)), tmpDir, std::string(baseNameOf(url)));
|
||||||
|
#else
|
||||||
|
// FIXME: this requires GNU tar for decompression.
|
||||||
|
runProgram("tar", true, {"xf", store->toRealPath(store->printStorePath(*storePath)), "-C", tmpDir});
|
||||||
|
#endif
|
||||||
auto members = readDirectory(tmpDir);
|
auto members = readDirectory(tmpDir);
|
||||||
if (members.size() != 1)
|
if (members.size() != 1)
|
||||||
throw nix::Error("tarball '%s' contains an unexpected number of top-level files", url);
|
throw nix::Error("tarball '%s' contains an unexpected number of top-level files", url);
|
||||||
auto topDir = tmpDir + "/" + members.begin()->name;
|
auto topDir = tmpDir + "/" + members.begin()->name;
|
||||||
result.lastModified = lstat(topDir).st_mtime;
|
result.lastModified = lstat(topDir).st_mtime;
|
||||||
unpackedStorePath = store->addToStore(name, topDir, true, htSHA256, defaultPathFilter, NoRepair);
|
unpackedStorePath = store->addToStore(name, topDir, true, htSHA256, defaultPathFilter, NoRepair);
|
||||||
#else
|
|
||||||
// FIXME: this requires GNU tar for decompression.
|
|
||||||
runProgram("tar", true, {"xf", store->toRealPath(store->printStorePath(*storePath)), "-C", tmpDir, "--strip-components", "1"});
|
|
||||||
result.lastModified = lstat(tmpDir).st_mtime;
|
|
||||||
unpackedStorePath = store->addToStore(name, tmpDir, true, htSHA256, defaultPathFilter, NoRepair);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
// Store the last-modified date of the tarball in the symlink
|
// Store the last-modified date of the tarball in the symlink
|
||||||
// mtime. This saves us from having to store it somewhere
|
// mtime. This saves us from having to store it somewhere
|
||||||
|
|
Loading…
Reference in a new issue