aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/download.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-12-18 17:19:30 +0100
committerEelco Dolstra <edolstra@gmail.com>2019-12-18 17:19:30 +0100
commit4da1cd59ba0c371349d3fa86e3b0b6758a0a427f (patch)
treea6fdfaf25358d97c266675df535bfcaa29c3128c /src/libstore/download.cc
parentdbb4bec0036b0cf9af2679e701eb5a455901b814 (diff)
Fix getting the timestamp of GitHub flakes
Diffstat (limited to 'src/libstore/download.cc')
-rw-r--r--src/libstore/download.cc10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/libstore/download.cc b/src/libstore/download.cc
index 762b7c303..83737b307 100644
--- a/src/libstore/download.cc
+++ b/src/libstore/download.cc
@@ -912,18 +912,16 @@ CachedDownloadResult Downloader::downloadCached(
AutoDelete autoDelete(tmpDir, true);
#if 0
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);
if (members.size() != 1)
throw nix::Error("tarball '%s' contains an unexpected number of top-level files", url);
auto topDir = tmpDir + "/" + members.begin()->name;
result.lastModified = lstat(topDir).st_mtime;
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
// mtime. This saves us from having to store it somewhere