Templatise tokenizeString()
This commit is contained in:
		
							parent
							
								
									00092b2d35
								
							
						
					
					
						commit
						76e88871b2
					
				
					 10 changed files with 30 additions and 39 deletions
				
			
		| 
						 | 
				
			
			@ -1435,7 +1435,7 @@ HookReply DerivationGoal::tryBuildHook()
 | 
			
		|||
    /* Tell the hook about system features (beyond the system type)
 | 
			
		||||
       required from the build machine.  (The hook could parse the
 | 
			
		||||
       drv file itself, but this is easier.) */
 | 
			
		||||
    Strings features = tokenizeString(drv.env["requiredSystemFeatures"]);
 | 
			
		||||
    Strings features = tokenizeString<Strings>(drv.env["requiredSystemFeatures"]);
 | 
			
		||||
    foreach (Strings::iterator, i, features) checkStoreName(*i); /* !!! abuse */
 | 
			
		||||
 | 
			
		||||
    /* Send the request to the hook. */
 | 
			
		||||
| 
						 | 
				
			
			@ -1594,7 +1594,7 @@ void DerivationGoal::startBuilder()
 | 
			
		|||
       fixed-output derivations is by definition pure (since we
 | 
			
		||||
       already know the cryptographic hash of the output). */
 | 
			
		||||
    if (fixedOutput) {
 | 
			
		||||
        Strings varNames = tokenizeString(drv.env["impureEnvVars"]);
 | 
			
		||||
        Strings varNames = tokenizeString<Strings>(drv.env["impureEnvVars"]);
 | 
			
		||||
        foreach (Strings::iterator, i, varNames) env[*i] = getEnv(*i);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1606,7 +1606,7 @@ void DerivationGoal::startBuilder()
 | 
			
		|||
       by `nix-store --register-validity'.  However, the deriver
 | 
			
		||||
       fields are left empty. */
 | 
			
		||||
    string s = drv.env["exportReferencesGraph"];
 | 
			
		||||
    Strings ss = tokenizeString(s);
 | 
			
		||||
    Strings ss = tokenizeString<Strings>(s);
 | 
			
		||||
    if (ss.size() % 2 != 0)
 | 
			
		||||
        throw BuildError(format("odd number of tokens in `exportReferencesGraph': `%1%'") % s);
 | 
			
		||||
    for (Strings::iterator i = ss.begin(); i != ss.end(); ) {
 | 
			
		||||
| 
						 | 
				
			
			@ -1911,14 +1911,11 @@ void DerivationGoal::initChild()
 | 
			
		|||
               outside of the namespace.  Making a subtree private is
 | 
			
		||||
               local to the namespace, though, so setting MS_PRIVATE
 | 
			
		||||
               does not affect the outside world. */
 | 
			
		||||
            Strings mounts = tokenizeString(readFile("/proc/self/mountinfo", true), "\n");
 | 
			
		||||
            Strings mounts = tokenizeString<Strings>(readFile("/proc/self/mountinfo", true), "\n");
 | 
			
		||||
            foreach (Strings::iterator, i, mounts) {
 | 
			
		||||
                Strings fields = tokenizeString(*i, " ");
 | 
			
		||||
                assert(fields.size() >= 5);
 | 
			
		||||
                Strings::iterator j = fields.begin();
 | 
			
		||||
                std::advance(j, 4);
 | 
			
		||||
                if (mount(0, j->c_str(), 0, MS_PRIVATE, 0) == -1)
 | 
			
		||||
                    throw SysError(format("unable to make filesystem `%1%' private") % *j);
 | 
			
		||||
                vector<string> fields = tokenizeString<vector<string> >(*i, " ");
 | 
			
		||||
                if (mount(0, fields.at(4).c_str(), 0, MS_PRIVATE, 0) == -1)
 | 
			
		||||
                    throw SysError(format("unable to make filesystem `%1%' private") % fields.at(4));
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            /* Bind-mount all the directories from the "host"
 | 
			
		||||
| 
						 | 
				
			
			@ -2053,7 +2050,7 @@ void DerivationGoal::initChild()
 | 
			
		|||
PathSet parseReferenceSpecifiers(const Derivation & drv, string attr)
 | 
			
		||||
{
 | 
			
		||||
    PathSet result;
 | 
			
		||||
    Paths paths = tokenizeString(attr);
 | 
			
		||||
    Paths paths = tokenizeString<Paths>(attr);
 | 
			
		||||
    foreach (Strings::iterator, i, paths) {
 | 
			
		||||
        if (isStorePath(*i))
 | 
			
		||||
            result.insert(*i);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue