aboutsummaryrefslogtreecommitdiff
path: root/src/builder.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/builder.cpp33
1 files changed, 25 insertions, 8 deletions
diff --git a/src/builder.cpp b/src/builder.cpp
index 852d70d..6bde1b4 100644
--- a/src/builder.cpp
+++ b/src/builder.cpp
@@ -248,9 +248,8 @@ void Builder::processRequires( std::list<std::string> &lInput )
248 if( re->execute( (*j).c_str() ) ) 248 if( re->execute( (*j).c_str() ) )
249 { 249 {
250 varmap *revars = regexVars( re ); 250 varmap *revars = regexVars( re );
251 FILE *fcmd = popen( 251 std::string s = varRepl( (*i).second.c_str(), "", revars );
252 varRepl( (*i).second.c_str(), "", revars ).c_str(), 252 FILE *fcmd = popen( s.c_str(), "r" );
253 "r" );
254 std::string rhs; 253 std::string rhs;
255 bool bHeader = true; 254 bool bHeader = true;
256 for(;;) 255 for(;;)
@@ -296,7 +295,7 @@ void Builder::processRequires( std::list<std::string> &lInput )
296 ); 295 );
297 rhs = ""; 296 rhs = "";
298 } 297 }
299 fclose( fcmd ); 298 pclose( fcmd );
300 delete revars; 299 delete revars;
301 } 300 }
302 } 301 }
@@ -407,17 +406,17 @@ std::string Builder::varRepl( const char *sSrc, const char *cont, varmap *mExtra
407 } 406 }
408 else if( *s == '}' && bVar ) 407 else if( *s == '}' && bVar )
409 { 408 {
410 if( hasVar( &mVar, var ) ) 409 if( hasVar( mExtra, var ) )
411 { 410 {
412 out += mVar[var]; 411 out += (*mExtra)[var];
413 } 412 }
414 else if( hasVar( mCont, var ) ) 413 else if( hasVar( mCont, var ) )
415 { 414 {
416 out += (*mCont)[var]; 415 out += (*mCont)[var];
417 } 416 }
418 else if( hasVar( mExtra, var ) ) 417 else if( hasVar( &mVar, var ) )
419 { 418 {
420 out += (*mExtra)[var]; 419 out += mVar[var];
421 } 420 }
422 var = ""; 421 var = "";
423 bVar = false; 422 bVar = false;
@@ -464,3 +463,21 @@ std::list<Rule *> Builder::findRuleChain( Rule *pRule )
464 return ret; 463 return ret;
465} 464}
466 465
466void cleanList( std::list<std::string> &lst )
467{
468 std::map<std::string, bool> m;
469
470 for( std::list<std::string>::iterator i = lst.begin(); i != lst.end(); i++ )
471 {
472 if( m.find( *i ) == m.end() )
473 m[ *i ] = true;
474 else
475 {
476 std::list<std::string>::iterator j = i;
477 j--;
478 lst.erase( i );
479 i = j;
480 }
481 }
482}
483