diff options
Diffstat (limited to 'src/libexpr')
-rw-r--r-- | src/libexpr/common-eval-args.cc | 4 | ||||
-rw-r--r-- | src/libexpr/flake/flake.cc | 2 | ||||
-rw-r--r-- | src/libexpr/flake/flakeref.cc | 7 | ||||
-rw-r--r-- | src/libexpr/flake/flakeref.hh | 2 | ||||
-rw-r--r-- | src/libexpr/flake/lockfile.cc | 3 | ||||
-rw-r--r-- | src/libexpr/local.mk | 2 | ||||
-rw-r--r-- | src/libexpr/parser.y | 2 | ||||
-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 |
10 files changed, 21 insertions, 24 deletions
diff --git a/src/libexpr/common-eval-args.cc b/src/libexpr/common-eval-args.cc index 9ebb6a835..bf5025147 100644 --- a/src/libexpr/common-eval-args.cc +++ b/src/libexpr/common-eval-args.cc @@ -3,8 +3,8 @@ #include "download.hh" #include "util.hh" #include "eval.hh" -#include "fetchers/registry.hh" -#include "fetchers/fetchers.hh" +#include "registry.hh" +#include "fetchers.hh" #include "flake/flakeref.hh" #include "store-api.hh" diff --git a/src/libexpr/flake/flake.cc b/src/libexpr/flake/flake.cc index 9517e3645..59362c018 100644 --- a/src/libexpr/flake/flake.cc +++ b/src/libexpr/flake/flake.cc @@ -3,7 +3,7 @@ #include "primops.hh" #include "eval-inline.hh" #include "store-api.hh" -#include "fetchers/fetchers.hh" +#include "fetchers.hh" #include "finally.hh" namespace nix { diff --git a/src/libexpr/flake/flakeref.cc b/src/libexpr/flake/flakeref.cc index 5c38f7ea5..de91f2eed 100644 --- a/src/libexpr/flake/flakeref.cc +++ b/src/libexpr/flake/flakeref.cc @@ -1,9 +1,8 @@ #include "flakeref.hh" #include "store-api.hh" -#include "fetchers/parse.hh" -#include "fetchers/fetchers.hh" -#include "fetchers/registry.hh" -#include "fetchers/regex.hh" +#include "url.hh" +#include "fetchers.hh" +#include "registry.hh" namespace nix { diff --git a/src/libexpr/flake/flakeref.hh b/src/libexpr/flake/flakeref.hh index d23a8f601..1dbb6e54d 100644 --- a/src/libexpr/flake/flakeref.hh +++ b/src/libexpr/flake/flakeref.hh @@ -2,7 +2,7 @@ #include "types.hh" #include "hash.hh" -#include "fetchers/fetchers.hh" +#include "fetchers.hh" #include <variant> diff --git a/src/libexpr/flake/lockfile.cc b/src/libexpr/flake/lockfile.cc index ee04ec64f..f73b1ac25 100644 --- a/src/libexpr/flake/lockfile.cc +++ b/src/libexpr/flake/lockfile.cc @@ -1,6 +1,5 @@ #include "lockfile.hh" #include "store-api.hh" -#include "fetchers/regex.hh" #include <nlohmann/json.hpp> @@ -268,7 +267,7 @@ InputPath parseInputPath(std::string_view s) InputPath path; for (auto & elem : tokenizeString<std::vector<std::string>>(s, "/")) { - if (!std::regex_match(elem, fetchers::flakeIdRegex)) + if (!std::regex_match(elem, flakeIdRegex)) throw Error("invalid flake input path element '%s'", elem); path.push_back(elem); } diff --git a/src/libexpr/local.mk b/src/libexpr/local.mk index eb7243b29..85cb51f34 100644 --- a/src/libexpr/local.mk +++ b/src/libexpr/local.mk @@ -11,7 +11,7 @@ libexpr_SOURCES := \ $(d)/lexer-tab.cc \ $(d)/parser-tab.cc -libexpr_LIBS = libutil libstore libnixrust +libexpr_LIBS = libutil libstore libfetchers libnixrust libexpr_LDFLAGS = ifneq ($(OS), FreeBSD) diff --git a/src/libexpr/parser.y b/src/libexpr/parser.y index dd5436c04..a30fb44b5 100644 --- a/src/libexpr/parser.y +++ b/src/libexpr/parser.y @@ -545,7 +545,7 @@ formal #include "eval.hh" #include "download.hh" -#include "fetchers/fetchers.hh" +#include "fetchers.hh" #include "store-api.hh" 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> |