* Flag --print-invalid' in nix-store --check-validity' to print out
				
					
				
			which paths specified on the command line are invalid (i.e., don't barf when encountering an invalid path, just print it). This is useful for build-remote.pl to figure out which paths need to be copied to a remote machine. (Currently we use rsync, but that's rather inefficient.)
This commit is contained in:
		
							parent
							
								
									65f195f4c7
								
							
						
					
					
						commit
						881feb9698
					
				
					 1 changed files with 14 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -537,12 +537,23 @@ static void opRegisterValidity(Strings opFlags, Strings opArgs)
 | 
			
		|||
 | 
			
		||||
static void opCheckValidity(Strings opFlags, Strings opArgs)
 | 
			
		||||
{
 | 
			
		||||
    if (!opFlags.empty()) throw UsageError("unknown flag");
 | 
			
		||||
    bool printInvalid = false;
 | 
			
		||||
    
 | 
			
		||||
    for (Strings::iterator i = opFlags.begin();
 | 
			
		||||
         i != opFlags.end(); ++i)
 | 
			
		||||
        if (*i == "--print-invalid") printInvalid = true;
 | 
			
		||||
        else throw UsageError(format("unknown flag `%1%'") % *i);
 | 
			
		||||
 | 
			
		||||
    for (Strings::iterator i = opArgs.begin();
 | 
			
		||||
         i != opArgs.end(); ++i)
 | 
			
		||||
        if (!store->isValidPath(*i))
 | 
			
		||||
            throw Error(format("path `%1%' is not valid") % *i);
 | 
			
		||||
    {
 | 
			
		||||
        Path path = fixPath(*i);
 | 
			
		||||
        if (!store->isValidPath(path))
 | 
			
		||||
            if (printInvalid)
 | 
			
		||||
                cout << format("%1%\n") % path;
 | 
			
		||||
            else
 | 
			
		||||
                throw Error(format("path `%1%' is not valid") % path);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue