3
0
Fork 0
forked from mirrors/nixpkgs

* Filter out *~ files in cleanSource.

svn path=/nixpkgs/trunk/; revision=7803
This commit is contained in:
Eelco Dolstra 2007-01-29 14:53:23 +00:00
parent bffcfd2d78
commit 83a82a22e5

View file

@ -2,7 +2,8 @@
let let
inherit (builtins) head tail isList; inherit (builtins)
head tail isList stringLength substring lessThan sub;
in in
@ -81,13 +82,24 @@ rec {
else if xs == [] || ys == [] then false else if xs == [] || ys == [] then false
else head xs == head ys && eqLists (tail xs) (tail ys); else head xs == head ys && eqLists (tail xs) (tail ys);
# Bring in a path as a source, filtering out all hidden Subversion # Determine whether a filename ends in the given suffix.
# directories. TODO: filter out backup files (*~) etc. hasSuffix = ext: fileName:
let lenFileName = stringLength fileName;
lenExt = stringLength ext;
in !(lessThan lenFileName lenExt) &&
substring (sub lenFileName lenExt) lenFileName fileName == ext;
# Bring in a path as a source, filtering out all Subversion and CVS
# directories, as well as backup files (*~).
cleanSource = cleanSource =
let filter = name: type: let filter = name: type: let baseName = baseNameOf (toString name); in ! (
type != "directory" # Filter out Subversion and CVS directories.
|| baseNameOf (toString name) != ".svn"; (type == "directory" && (name == ".svn" || name == "CVS")) ||
# Filter out backup files.
(hasSuffix "~" name)
);
in src: builtins.filterSource filter src; in src: builtins.filterSource filter src;