mirror of
https://github.com/NixOS/nix.git
synced 2025-11-15 15:02:42 +01:00
* 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.
This commit is contained in:
parent
b438d37558
commit
a3e6415ba8
19 changed files with 143 additions and 68 deletions
|
|
@ -294,13 +294,13 @@ struct HashSink : Sink
|
|||
};
|
||||
|
||||
|
||||
Hash hashPath(HashType ht, const Path & path)
|
||||
Hash hashPath(HashType ht, const Path & path, PathFilter & filter)
|
||||
{
|
||||
HashSink sink;
|
||||
sink.ht = ht;
|
||||
Hash hash(ht);
|
||||
start(ht, sink.ctx);
|
||||
dumpPath(path, sink);
|
||||
dumpPath(path, sink, filter);
|
||||
finish(ht, sink.ctx, hash.hash);
|
||||
return hash;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue