You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
lib.fileset.toSource: `root` ${toStringroot} does not exist.''
167
+
lib.fileset.toSource: `root` (${toStringroot}) does not exist.''
164
168
elseifpathTyperoot!="directory"then
165
169
throw''
166
-
lib.fileset.toSource: `root` ${toStringroot} is a file, but it should be a directory instead. Potential solutions:
170
+
lib.fileset.toSource: `root` (${toStringroot}) is a file, but it should be a directory instead. Potential solutions:
167
171
- If you want to import the file into the store _without_ a containing directory, use string interpolation or `builtins.path` instead of this function.
168
172
- If you want to import the file into the store _with_ a containing directory, set `root` to the containing directory, such as ${toString(dirOfroot)}, and set `fileset` to the file path.''
169
173
elseif!hasPrefixrootfileset._internalBasethen
170
174
throw''
171
-
lib.fileset.toSource: `fileset` could contain files in ${toStringfileset._internalBase}, which is not under the `root` ${toStringroot}. Potential solutions:
175
+
lib.fileset.toSource: `fileset` could contain files in ${toStringfileset._internalBase}, which is not under the `root` (${toStringroot}). Potential solutions:
172
176
- Set `root` to ${toStringfileset._internalBase} or any directory higher up. This changes the layout of the resulting store path.
173
-
- Set `fileset` to a file set that cannot contain files outside the `root` ${toStringroot}. This could change the files included in the result.''
177
+
- Set `fileset` to a file set that cannot contain files outside the `root` (${toStringroot}). This could change the files included in the result.''
174
178
else
175
-
builtins.seqfilter
179
+
builtins.seqsourceFilter
176
180
cleanSourceWith{
177
181
name="source";
178
182
src=root;
179
-
inheritfilter;
183
+
filter=sourceFilter;
180
184
};
181
185
182
186
/*
@@ -209,8 +213,8 @@ If a directory does not recursively contain any file, it is omitted from the sto
209
213
# This argument can also be a path,
210
214
# which gets [implicitly coerced to a file set](#sec-fileset-path-coercion).
211
215
fileset2:
212
-
let
213
-
filesets=_coerceMany"lib.fileset.union"[
216
+
_unionMany
217
+
(_coerceMany"lib.fileset.union"[
214
218
{
215
219
context="first argument";
216
220
value=fileset1;
@@ -219,9 +223,7 @@ If a directory does not recursively contain any file, it is omitted from the sto
219
223
context="second argument";
220
224
value=fileset2;
221
225
}
222
-
];
223
-
in
224
-
_unionManyfilesets;
226
+
]);
225
227
226
228
/*
227
229
The file set containing all files that are in any of the given file sets.
@@ -260,25 +262,20 @@ If a directory does not recursively contain any file, it is omitted from the sto
260
262
# The elements can also be paths,
261
263
# which get [implicitly coerced to file sets](#sec-fileset-path-coercion).
262
264
filesets:
263
-
let
264
-
# We cannot rename matched attribute arguments, so let's work around it with an extra `let in` statement
265
-
maybeFilesets=filesets;
266
-
in
267
-
let
268
-
# Annotate the elements with context, used by _coerceMany for better errors
throw"lib.fileset.unions: Expected argument to be a list, but got a ${typeOfmaybeFilesets}."
278
-
elseifmaybeFilesets==[]then
279
-
# TODO: This could be supported, but requires an extra internal representation for the empty file set
265
+
if!isListfilesetsthen
266
+
throw"lib.fileset.unions: Expected argument to be a list, but got a ${typeOffilesets}."
267
+
elseiffilesets==[]then
268
+
# TODO: This could be supported, but requires an extra internal representation for the empty file set, which would be special for not having a base path.
280
269
throw"lib.fileset.unions: Expected argument to be a list with at least one element, but it contains no elements."
281
270
else
282
-
_unionManyfilesets;
271
+
pipefilesets[
272
+
# Annotate the elements with context, used by _coerceMany for better errors
Copy file name to clipboardExpand all lines: lib/fileset/tests.sh
+14-14Lines changed: 14 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -236,7 +236,7 @@ checkFileset() (
236
236
#### Error messages #####
237
237
238
238
# Absolute paths in strings cannot be passed as `root`
239
-
expectFailure 'toSource { root = "/nix/store/foobar"; fileset = ./.; }''lib.fileset.toSource: `root` "/nix/store/foobar" is a string-like value, but it should be a path instead.
239
+
expectFailure 'toSource { root = "/nix/store/foobar"; fileset = ./.; }''lib.fileset.toSource: `root` \("/nix/store/foobar"\) is a string-like value, but it should be a path instead.
240
240
\s*Paths in strings are not supported by `lib.fileset`, use `lib.sources` or derivations instead.'
''lib.fileset.toSource: Filesystem roots are not the same for `fileset` and `root` "'"$work"'/foo/mock-root":
249
+
''lib.fileset.toSource: Filesystem roots are not the same for `fileset` and `root` \("'"$work"'/foo/mock-root"\):
250
250
\s*`root`: root "'"$work"'/foo/mock-root"
251
251
\s*`fileset`: root "'"$work"'/bar/mock-root"
252
252
\s*Different roots are not supported.'
253
253
rm -rf *
254
254
255
255
# `root` needs to exist
256
-
expectFailure 'toSource { root = ./a; fileset = ./.; }''lib.fileset.toSource: `root` '"$work"'/a does not exist.'
256
+
expectFailure 'toSource { root = ./a; fileset = ./.; }''lib.fileset.toSource: `root` \('"$work"'/a\) does not exist.'
257
257
258
258
# `root` needs to be a file
259
259
touch a
260
-
expectFailure 'toSource { root = ./a; fileset = ./a; }''lib.fileset.toSource: `root` '"$work"'/a is a file, but it should be a directory instead. Potential solutions:
260
+
expectFailure 'toSource { root = ./a; fileset = ./a; }''lib.fileset.toSource: `root` \('"$work"'/a\) is a file, but it should be a directory instead. Potential solutions:
261
261
\s*- If you want to import the file into the store _without_ a containing directory, use string interpolation or `builtins.path` instead of this function.
262
262
\s*- If you want to import the file into the store _with_ a containing directory, set `root` to the containing directory, such as '"$work"', and set `fileset` to the file path.'
263
263
rm -rf *
@@ -267,18 +267,18 @@ expectFailure 'toSource { root = ./.; fileset = abort "This should be evaluated"
267
267
268
268
# Only paths under `root` should be able to influence the result
269
269
mkdir a
270
-
expectFailure 'toSource { root = ./a; fileset = ./.; }''lib.fileset.toSource: `fileset` could contain files in '"$work"', which is not under the `root` '"$work"'/a. Potential solutions:
270
+
expectFailure 'toSource { root = ./a; fileset = ./.; }''lib.fileset.toSource: `fileset` could contain files in '"$work"', which is not under the `root` \('"$work"'/a\). Potential solutions:
271
271
\s*- Set `root` to '"$work"' or any directory higher up. This changes the layout of the resulting store path.
272
-
\s*- Set `fileset` to a file set that cannot contain files outside the `root` '"$work"'/a. This could change the files included in the result.'
272
+
\s*- Set `fileset` to a file set that cannot contain files outside the `root` \('"$work"'/a\). This could change the files included in the result.'
273
273
rm -rf *
274
274
275
275
# Path coercion only works for paths
276
276
expectFailure 'toSource { root = ./.; fileset = 10; }''lib.fileset.toSource: `fileset` is of type int, but it should be a path instead.'
277
-
expectFailure 'toSource { root = ./.; fileset = "/some/path"; }''lib.fileset.toSource: `fileset` "/some/path" is a string-like value, but it should be a path instead.
277
+
expectFailure 'toSource { root = ./.; fileset = "/some/path"; }''lib.fileset.toSource: `fileset` \("/some/path"\) is a string-like value, but it should be a path instead.
278
278
\s*Paths represented as strings are not supported by `lib.fileset`, use `lib.sources` or derivations instead.'
279
279
280
280
# Path coercion errors for non-existent paths
281
-
expectFailure 'toSource { root = ./.; fileset = ./a; }''lib.fileset.toSource: `fileset` '"$work"'/a does not exist.'
281
+
expectFailure 'toSource { root = ./.; fileset = ./a; }''lib.fileset.toSource: `fileset` \('"$work"'/a\) does not exist.'
282
282
283
283
# File sets cannot be evaluated directly
284
284
expectFailure 'union ./. ./.''lib.fileset: Directly evaluating a file set is not supported. Use `lib.fileset.toSource` to turn it into a usable source instead.'
0 commit comments