Include all outputs of derivations in the closure of explicitly-passed derivation paths
This required adding a queryOutputDerivationNames function in the store API
This commit is contained in:
		
							parent
							
								
									981edeab7b
								
							
						
					
					
						commit
						af2e53fd48
					
				
					 8 changed files with 58 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -820,6 +820,28 @@ PathSet LocalStore::queryDerivationOutputs(const Path & path)
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
StringSet LocalStore::queryDerivationOutputNames(const Path & path)
 | 
			
		||||
{
 | 
			
		||||
    SQLiteTxn txn(db);
 | 
			
		||||
    
 | 
			
		||||
    SQLiteStmtUse use(stmtQueryDerivationOutputs);
 | 
			
		||||
    stmtQueryDerivationOutputs.bind(queryValidPathId(path));
 | 
			
		||||
    
 | 
			
		||||
    StringSet outputNames;
 | 
			
		||||
    int r;
 | 
			
		||||
    while ((r = sqlite3_step(stmtQueryDerivationOutputs)) == SQLITE_ROW) {
 | 
			
		||||
        const char * s = (const char *) sqlite3_column_text(stmtQueryDerivationOutputs, 0);
 | 
			
		||||
        assert(s);
 | 
			
		||||
        outputNames.insert(s);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    if (r != SQLITE_DONE)
 | 
			
		||||
        throwSQLiteError(db, format("error getting output names of `%1%'") % path);
 | 
			
		||||
 | 
			
		||||
    return outputNames;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void LocalStore::startSubstituter(const Path & substituter, RunningSubstituter & run)
 | 
			
		||||
{
 | 
			
		||||
    if (run.pid != -1) return;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -118,6 +118,8 @@ public:
 | 
			
		|||
    PathSet queryValidDerivers(const Path & path);
 | 
			
		||||
 | 
			
		||||
    PathSet queryDerivationOutputs(const Path & path);
 | 
			
		||||
 | 
			
		||||
    StringSet queryDerivationOutputNames(const Path & path);
 | 
			
		||||
    
 | 
			
		||||
    PathSet querySubstitutablePaths();
 | 
			
		||||
    
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -322,6 +322,16 @@ PathSet RemoteStore::queryDerivationOutputs(const Path & path)
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
PathSet RemoteStore::queryDerivationOutputNames(const Path & path)
 | 
			
		||||
{
 | 
			
		||||
    openConnection();
 | 
			
		||||
    writeInt(wopQueryDerivationOutputNames, to);
 | 
			
		||||
    writeString(path, to);
 | 
			
		||||
    processStderr();
 | 
			
		||||
    return readStringSet(from);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Path RemoteStore::addToStore(const Path & _srcPath,
 | 
			
		||||
    bool recursive, HashType hashAlgo, PathFilter & filter)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -41,6 +41,8 @@ public:
 | 
			
		|||
    
 | 
			
		||||
    PathSet queryDerivationOutputs(const Path & path);
 | 
			
		||||
    
 | 
			
		||||
    StringSet queryDerivationOutputNames(const Path & path);
 | 
			
		||||
 | 
			
		||||
    bool hasSubstitutes(const Path & path);
 | 
			
		||||
    
 | 
			
		||||
    bool querySubstitutablePathInfo(const Path & path,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -140,6 +140,9 @@ public:
 | 
			
		|||
 | 
			
		||||
    /* Query the outputs of the derivation denoted by `path'. */
 | 
			
		||||
    virtual PathSet queryDerivationOutputs(const Path & path) = 0;
 | 
			
		||||
 | 
			
		||||
    /* Query the output names of the derivation denoted by `path'. */
 | 
			
		||||
    virtual StringSet queryDerivationOutputNames(const Path & path) = 0;
 | 
			
		||||
    
 | 
			
		||||
    /* Query whether a path has substitutes. */
 | 
			
		||||
    virtual bool hasSubstitutes(const Path & path) = 0;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -39,6 +39,7 @@ typedef enum {
 | 
			
		|||
    wopQueryFailedPaths = 24,
 | 
			
		||||
    wopClearFailedPaths = 25,
 | 
			
		||||
    wopQueryPathInfo = 26,
 | 
			
		||||
    wopQueryDerivationOutputNames = 27,
 | 
			
		||||
} WorkerOp;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue