From: Mikko Rasa Date: Wed, 10 Feb 2010 14:46:45 +0000 (+0000) Subject: Fix Condition to handle booleans properly X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=699493ee7346c578537f4e310702c57012686c22;p=builder.git Fix Condition to handle booleans properly --- diff --git a/source/condition.cpp b/source/condition.cpp index 4c7b5ed..136b852 100644 --- a/source/condition.cpp +++ b/source/condition.cpp @@ -25,9 +25,9 @@ Condition::Condition(SourcePackage &p, const string &expr): string::size_type token = i->find_first_of("=!"); if(token==string::npos) - expression.insert(StringMap::value_type(*i, "!0")); + expression.insert(StringMap::value_type(*i, "=")); else if(token==0 && (*i)[0]=='!') - expression.insert(StringMap::value_type(*i, "=0")); + expression.insert(StringMap::value_type(*i, "!")); else expression.insert(StringMap::value_type(i->substr(0, token), i->substr(token))); } @@ -48,7 +48,12 @@ bool Condition::eval() bool match = false; if(conf.is_option(i->first)) - match = (conf.get_option(i->first).value==value); + { + if(value.empty()) + match = lexical_cast(conf.get_option(i->first).value); + else + match = (conf.get_option(i->first).value==value); + } else if(i->first=="arch") match = pkg.get_builder().get_current_arch().match_name(value);