diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2021-04-09 13:51:57 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2021-04-09 13:51:57 +0200 |
commit | 42f0246698cff491f084547f7aaa9e778f629065 (patch) | |
tree | 8fc920cf581fd8533bc44d6a6dd4d8e996ebc479 /src | |
parent | 906adadacd2d1c98346a2f42c0b42a32d2806d94 (diff) |
Revert "libfetchers/tarball: Lock on effectiveUrl"
This reverts commit fc6bfb261d50102016ed812ecf9949d41fe539f7.
Fixes #4672.
Diffstat (limited to 'src')
-rw-r--r-- | src/libfetchers/fetchers.hh | 8 | ||||
-rw-r--r-- | src/libfetchers/github.cc | 6 | ||||
-rw-r--r-- | src/libfetchers/tarball.cc | 19 |
3 files changed, 9 insertions, 24 deletions
diff --git a/src/libfetchers/fetchers.hh b/src/libfetchers/fetchers.hh index c6b219c02..a72cfafa4 100644 --- a/src/libfetchers/fetchers.hh +++ b/src/libfetchers/fetchers.hh @@ -145,13 +145,7 @@ DownloadFileResult downloadFile( bool immutable, const Headers & headers = {}); -struct DownloadTarballMeta -{ - time_t lastModified; - std::string effectiveUrl; -}; - -std::pair<Tree, DownloadTarballMeta> downloadTarball( +std::pair<Tree, time_t> downloadTarball( ref<Store> store, const std::string & url, const std::string & name, diff --git a/src/libfetchers/github.cc b/src/libfetchers/github.cc index 3e5ad75a8..8352ef02d 100644 --- a/src/libfetchers/github.cc +++ b/src/libfetchers/github.cc @@ -207,16 +207,16 @@ struct GitArchiveInputScheme : InputScheme auto url = getDownloadUrl(input); - auto [tree, meta] = downloadTarball(store, url.url, "source", true, url.headers); + auto [tree, lastModified] = downloadTarball(store, url.url, "source", true, url.headers); - input.attrs.insert_or_assign("lastModified", uint64_t(meta.lastModified)); + input.attrs.insert_or_assign("lastModified", uint64_t(lastModified)); getCache()->add( store, immutableAttrs, { {"rev", rev->gitRev()}, - {"lastModified", uint64_t(meta.lastModified)} + {"lastModified", uint64_t(lastModified)} }, tree.storePath, true); diff --git a/src/libfetchers/tarball.cc b/src/libfetchers/tarball.cc index bd05bb2f1..b8d7d2c70 100644 --- a/src/libfetchers/tarball.cc +++ b/src/libfetchers/tarball.cc @@ -109,7 +109,7 @@ DownloadFileResult downloadFile( }; } -std::pair<Tree, DownloadTarballMeta> downloadTarball( +std::pair<Tree, time_t> downloadTarball( ref<Store> store, const std::string & url, const std::string & name, @@ -127,10 +127,7 @@ std::pair<Tree, DownloadTarballMeta> downloadTarball( if (cached && !cached->expired) return { Tree(store->toRealPath(cached->storePath), std::move(cached->storePath)), - { - .lastModified = time_t(getIntAttr(cached->infoAttrs, "lastModified")), - .effectiveUrl = maybeGetStrAttr(cached->infoAttrs, "effectiveUrl").value_or(url), - }, + getIntAttr(cached->infoAttrs, "lastModified") }; auto res = downloadFile(store, url, name, immutable, headers); @@ -155,7 +152,6 @@ std::pair<Tree, DownloadTarballMeta> downloadTarball( Attrs infoAttrs({ {"lastModified", uint64_t(lastModified)}, - {"effectiveUrl", res.effectiveUrl}, {"etag", res.etag}, }); @@ -168,10 +164,7 @@ std::pair<Tree, DownloadTarballMeta> downloadTarball( return { Tree(store->toRealPath(*unpackedStorePath), std::move(*unpackedStorePath)), - { - .lastModified = lastModified, - .effectiveUrl = res.effectiveUrl, - }, + lastModified, }; } @@ -230,11 +223,9 @@ struct TarballInputScheme : InputScheme return true; } - std::pair<Tree, Input> fetch(ref<Store> store, const Input & _input) override + std::pair<Tree, Input> fetch(ref<Store> store, const Input & input) override { - Input input(_input); - auto [tree, meta] = downloadTarball(store, getStrAttr(input.attrs, "url"), "source", false); - input.attrs.insert_or_assign("url", meta.effectiveUrl); + auto tree = downloadTarball(store, getStrAttr(input.attrs, "url"), "source", false).first; return {std::move(tree), input}; } }; |