Allow derivations-as-srcs in the context of builtins.toFile files
This commit is contained in:
		
							parent
							
								
									61af14a921
								
							
						
					
					
						commit
						1ed55234d9
					
				
					 1 changed files with 6 additions and 2 deletions
				
			
		| 
						 | 
					@ -872,8 +872,12 @@ static void prim_toFile(EvalState & state, const Pos & pos, Value * * args, Valu
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (auto path : context) {
 | 
					    for (auto path : context) {
 | 
				
			||||||
        if (path.at(0) == '=') path = string(path, 1);
 | 
					        if (path.at(0) == '=') path = string(path, 1);
 | 
				
			||||||
        if (isDerivation(path))
 | 
					        if (isDerivation(path)) {
 | 
				
			||||||
 | 
					            /* See prim_unsafeDiscardOutputDependency. */
 | 
				
			||||||
 | 
					            if (path.at(0) != '~')
 | 
				
			||||||
                throw EvalError(format("in ‘toFile’: the file ‘%1%’ cannot refer to derivation outputs, at %2%") % name % pos);
 | 
					                throw EvalError(format("in ‘toFile’: the file ‘%1%’ cannot refer to derivation outputs, at %2%") % name % pos);
 | 
				
			||||||
 | 
					            path = string(path, 1);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
        refs.insert(path);
 | 
					        refs.insert(path);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue