diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2006-12-12T23·05+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2006-12-12T23·05+0000 |
commit | a3e6415ba8cf1b8d2a1db40c06997d997eac8afc (patch) | |
tree | 16e43edf9a785101b562ee3bfa6cbaeb600fc22a /src/libstore/store-api.cc | |
parent | b438d37558eab56a2927771013c9080675381ba8 (diff) |
* New primop builtins.filterSource, which can be used to filter files
from a source directory. All files for which a predicate function returns true are copied to the store. Typical example is to leave out the .svn directory: stdenv.mkDerivation { ... src = builtins.filterSource (path: baseNameOf (toString path) != ".svn") ./source-dir; # as opposed to # src = ./source-dir; } This is important because the .svn directory influences the hash in a rather unpredictable and variable way.
Diffstat (limited to 'src/libstore/store-api.cc')
-rw-r--r-- | src/libstore/store-api.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc index 677c3ca3e909..be9ea788bc20 100644 --- a/src/libstore/store-api.cc +++ b/src/libstore/store-api.cc @@ -94,9 +94,9 @@ Path makeFixedOutputPath(bool recursive, std::pair<Path, Hash> computeStorePathForPath(const Path & srcPath, - bool fixed, bool recursive, string hashAlgo) + bool fixed, bool recursive, string hashAlgo, PathFilter & filter) { - Hash h = hashPath(htSHA256, srcPath); + Hash h = hashPath(htSHA256, srcPath, filter); string baseName = baseNameOf(srcPath); @@ -104,7 +104,7 @@ std::pair<Path, Hash> computeStorePathForPath(const Path & srcPath, if (fixed) { HashType ht(parseHashType(hashAlgo)); - Hash h2 = recursive ? hashPath(ht, srcPath) : hashFile(ht, srcPath); + Hash h2 = recursive ? hashPath(ht, srcPath, filter) : hashFile(ht, srcPath); dstPath = makeFixedOutputPath(recursive, hashAlgo, h2, baseName); } |