1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-07 01:51:47 +02:00

downloadCached: Return ETag

This allows fetchFlake() to return the Git revision of a GitHub
archive.
This commit is contained in:
Eelco Dolstra 2019-02-25 23:20:50 +08:00
parent 6e9182fbc2
commit 529add316c
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
7 changed files with 64 additions and 26 deletions

View file

@ -88,7 +88,7 @@ static void update(const StringSet & channelNames)
// definition from a consistent location if the redirect changes mid-download.
std::string effectiveUrl;
auto dl = getDownloader();
auto filename = dl->downloadCached(store, url, false, "", Hash(), &effectiveUrl, 0);
auto filename = dl->downloadCached(store, url, false, "", Hash(), &effectiveUrl, 0).path;
url = chomp(std::move(effectiveUrl));
// If the URL contains a version number, append it to the name
@ -123,10 +123,10 @@ static void update(const StringSet & channelNames)
// Download the channel tarball.
auto fullURL = url + "/nixexprs.tar.xz";
try {
filename = dl->downloadCached(store, fullURL, false);
filename = dl->downloadCached(store, fullURL, false).path;
} catch (DownloadError & e) {
fullURL = url + "/nixexprs.tar.bz2";
filename = dl->downloadCached(store, fullURL, false);
filename = dl->downloadCached(store, fullURL, false).path;
}
chomp(filename);
}