diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2011-12-16 23:33:01 +0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2011-12-16 23:33:01 +0000 |
commit | 194d21f9f63ceb034f3e8294f89aa6bf6a217bc9 (patch) | |
tree | 7eb6da5955482a82f4d34b60dcb10514a4a55f59 /src/libexpr | |
parent | 3c3107da86ff71a08ce44027ee5899acf486796a (diff) | |
parent | 273b288a7e862ac1918064537ff130cc751fa9fd (diff) | |
download | guix-194d21f9f63ceb034f3e8294f89aa6bf6a217bc9.tar.gz |
* Sync with the trunk.
Diffstat (limited to 'src/libexpr')
-rw-r--r-- | src/libexpr/common-opts.cc | 11 | ||||
-rw-r--r-- | src/libexpr/common-opts.hh | 2 | ||||
-rw-r--r-- | src/libexpr/primops.cc | 17 |
3 files changed, 16 insertions, 14 deletions
diff --git a/src/libexpr/common-opts.cc b/src/libexpr/common-opts.cc index d029d2ec35..e0865d9fcc 100644 --- a/src/libexpr/common-opts.cc +++ b/src/libexpr/common-opts.cc @@ -44,4 +44,15 @@ bool parseSearchPathArg(const string & arg, Strings::iterator & i, } +Path lookupFileArg(EvalState & state, string s) +{ + if (s.size() > 2 && s.at(0) == '<' && s.at(s.size() - 1) == '>') { + Path p = state.findFile(s.substr(1, s.size() - 2)); + if (p == "") throw Error(format("file `%1%' was not found in the Nix search path (add it using $NIX_PATH or -I)") % p); + return p; + } else + return absPath(s); +} + + } diff --git a/src/libexpr/common-opts.hh b/src/libexpr/common-opts.hh index 6b7247fc3d..c28641e901 100644 --- a/src/libexpr/common-opts.hh +++ b/src/libexpr/common-opts.hh @@ -14,6 +14,8 @@ bool parseOptionArg(const string & arg, Strings::iterator & i, bool parseSearchPathArg(const string & arg, Strings::iterator & i, const Strings::iterator & argsEnd, EvalState & state); +Path lookupFileArg(EvalState & state, string s); + } diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index b11562baa4..dc361c043f 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -363,9 +363,8 @@ static void prim_derivationStrict(EvalState & state, Value * * args, Value & v) foreach (PathSet::iterator, j, refs) { drv.inputSrcs.insert(*j); if (isDerivation(*j)) - drv.inputDrvs[*j] = store -> queryDerivationOutputNames(*j); + drv.inputDrvs[*j] = store->queryDerivationOutputNames(*j); } - explicitlyPassed = true; } else if (path.at(0) == '!') { size_t index; @@ -387,7 +386,7 @@ static void prim_derivationStrict(EvalState & state, Value * * args, Value & v) debug(format("derivation uses `%1%'") % path); if (!useDrvAsSrc && isDerivation(path)) if (explicitlyPassed) - drv.inputDrvs[path] = store -> queryDerivationOutputNames(path); + drv.inputDrvs[path] = store->queryDerivationOutputNames(path); else if (drv.inputDrvs.find(path) == drv.inputDrvs.end()) drv.inputDrvs[path] = singleton<StringSet>(output); else @@ -416,17 +415,7 @@ static void prim_derivationStrict(EvalState & state, Value * * args, Value & v) HashType ht = parseHashType(outputHashAlgo); if (ht == htUnknown) throw EvalError(format("unknown hash algorithm `%1%'") % outputHashAlgo); - Hash h(ht); - if (outputHash.size() == h.hashSize * 2) - /* hexadecimal representation */ - h = parseHash(ht, outputHash); - else if (outputHash.size() == hashLength32(h)) - /* base-32 representation */ - h = parseHash32(ht, outputHash); - else - throw Error(format("hash `%1%' has wrong length for hash type `%2%'") - % outputHash % outputHashAlgo); - string s = outputHash; + Hash h = parseHash16or32(ht, outputHash); outputHash = printHash(h); if (outputHashRecursive) outputHashAlgo = "r:" + outputHashAlgo; |