diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2020-03-30 14:03:28 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2020-03-30 14:04:53 +0200 |
commit | e0a0ae0467fa8cdcc542f593b9d94283f04508ff (patch) | |
tree | 9ee49c40c301f51c4f20a0d9ad2031c7de001100 /src/libexpr/primops | |
parent | 4ba4c7ff66c95319d98fa859428f60f30f94edd4 (diff) |
Move fetchers from libstore to libfetchers
Diffstat (limited to 'src/libexpr/primops')
-rw-r--r-- | src/libexpr/primops/fetchGit.cc | 8 | ||||
-rw-r--r-- | src/libexpr/primops/fetchMercurial.cc | 11 | ||||
-rw-r--r-- | src/libexpr/primops/fetchTree.cc | 4 |
3 files changed, 11 insertions, 12 deletions
diff --git a/src/libexpr/primops/fetchGit.cc b/src/libexpr/primops/fetchGit.cc index 638c14970..812de9d91 100644 --- a/src/libexpr/primops/fetchGit.cc +++ b/src/libexpr/primops/fetchGit.cc @@ -2,8 +2,8 @@ #include "eval-inline.hh" #include "store-api.hh" #include "hash.hh" -#include "fetchers/fetchers.hh" -#include "fetchers/parse.hh" +#include "fetchers.hh" +#include "url.hh" namespace nix { @@ -48,14 +48,14 @@ static void prim_fetchGit(EvalState & state, const Pos & pos, Value * * args, Va if (evalSettings.pureEval && !rev) throw Error("in pure evaluation mode, 'fetchGit' requires a Git revision"); - auto parsedUrl = fetchers::parseURL( + auto parsedUrl = parseURL( url.find("://") != std::string::npos ? "git+" + url : "git+file://" + url); if (ref) parsedUrl.query.insert_or_assign("ref", *ref); if (rev) parsedUrl.query.insert_or_assign("rev", rev->gitRev()); // FIXME: use name - auto input = inputFromURL(parsedUrl); + auto input = fetchers::inputFromURL(parsedUrl); auto [tree, input2] = input->fetchTree(state.store); diff --git a/src/libexpr/primops/fetchMercurial.cc b/src/libexpr/primops/fetchMercurial.cc index 5d6b65c3b..f18351646 100644 --- a/src/libexpr/primops/fetchMercurial.cc +++ b/src/libexpr/primops/fetchMercurial.cc @@ -1,9 +1,8 @@ #include "primops.hh" #include "eval-inline.hh" #include "store-api.hh" -#include "fetchers/fetchers.hh" -#include "fetchers/parse.hh" -#include "fetchers/regex.hh" +#include "fetchers.hh" +#include "url.hh" #include <regex> @@ -31,7 +30,7 @@ static void prim_fetchMercurial(EvalState & state, const Pos & pos, Value * * ar // Ugly: unlike fetchGit, here the "rev" attribute can // be both a revision or a branch/tag name. auto value = state.forceStringNoCtx(*attr.value, *attr.pos); - if (std::regex_match(value, fetchers::revRegex)) + if (std::regex_match(value, revRegex)) rev = Hash(value, htSHA1); else ref = value; @@ -55,14 +54,14 @@ static void prim_fetchMercurial(EvalState & state, const Pos & pos, Value * * ar if (evalSettings.pureEval && !rev) throw Error("in pure evaluation mode, 'fetchMercurial' requires a Mercurial revision"); - auto parsedUrl = fetchers::parseURL( + auto parsedUrl = parseURL( url.find("://") != std::string::npos ? "hg+" + url : "hg+file://" + url); if (rev) parsedUrl.query.insert_or_assign("rev", rev->gitRev()); if (ref) parsedUrl.query.insert_or_assign("ref", *ref); // FIXME: use name - auto input = inputFromURL(parsedUrl); + auto input = fetchers::inputFromURL(parsedUrl); auto [tree, input2] = input->fetchTree(state.store); diff --git a/src/libexpr/primops/fetchTree.cc b/src/libexpr/primops/fetchTree.cc index 8e8b48fc8..035586c25 100644 --- a/src/libexpr/primops/fetchTree.cc +++ b/src/libexpr/primops/fetchTree.cc @@ -1,8 +1,8 @@ #include "primops.hh" #include "eval-inline.hh" #include "store-api.hh" -#include "fetchers/fetchers.hh" -#include "fetchers/registry.hh" +#include "fetchers.hh" +#include "registry.hh" #include "download.hh" #include <ctime> |