nix-instantiate: Fix read-only evaluation
This commit is contained in:
		
							parent
							
								
									8d8d47abd2
								
							
						
					
					
						commit
						408a7bfac1
					
				
					 5 changed files with 17 additions and 10 deletions
				
			
		| 
						 | 
				
			
			@ -138,6 +138,7 @@ EvalState::EvalState()
 | 
			
		|||
    , sName(symbols.create("name"))
 | 
			
		||||
    , sSystem(symbols.create("system"))
 | 
			
		||||
    , sOverrides(symbols.create("__overrides"))
 | 
			
		||||
    , sOutputName(symbols.create("outputName"))
 | 
			
		||||
    , baseEnv(allocEnv(128))
 | 
			
		||||
    , baseEnvDispl(0)
 | 
			
		||||
    , staticBaseEnv(false, 0)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -93,7 +93,7 @@ public:
 | 
			
		|||
    SymbolTable symbols;
 | 
			
		||||
 | 
			
		||||
    const Symbol sWith, sOutPath, sDrvPath, sType, sMeta, sName,
 | 
			
		||||
        sSystem, sOverrides;
 | 
			
		||||
        sSystem, sOverrides, sOutputName;
 | 
			
		||||
 | 
			
		||||
    /* If set, force copying files to the Nix store even if they
 | 
			
		||||
       already exist there. */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -28,6 +28,17 @@ string DrvInfo::queryOutPath(EvalState & state) const
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
string DrvInfo::queryOutputName(EvalState & state) const
 | 
			
		||||
{
 | 
			
		||||
    if (outputName == "" && attrs) {
 | 
			
		||||
        Bindings::iterator i = attrs->find(state.sOutputName);
 | 
			
		||||
        PathSet context;
 | 
			
		||||
        (string &) outputName = i != attrs->end() ? state.coerceToString(*i->value, context) : "";
 | 
			
		||||
    }
 | 
			
		||||
    return outputName;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
MetaInfo DrvInfo::queryMetaInfo(EvalState & state) const
 | 
			
		||||
{
 | 
			
		||||
    if (metaInfoRead) return meta;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -28,6 +28,7 @@ struct DrvInfo
 | 
			
		|||
private:
 | 
			
		||||
    string drvPath;
 | 
			
		||||
    string outPath;
 | 
			
		||||
    string outputName;
 | 
			
		||||
 | 
			
		||||
    bool metaInfoRead;
 | 
			
		||||
    MetaInfo meta;
 | 
			
		||||
| 
						 | 
				
			
			@ -46,6 +47,7 @@ public:
 | 
			
		|||
 | 
			
		||||
    string queryDrvPath(EvalState & state) const;
 | 
			
		||||
    string queryOutPath(EvalState & state) const;
 | 
			
		||||
    string queryOutputName(EvalState & state) const;
 | 
			
		||||
    MetaInfo queryMetaInfo(EvalState & state) const;
 | 
			
		||||
    MetaValue queryMetaInfo(EvalState & state, const string & name) const;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue