From 699493ee7346c578537f4e310702c57012686c22 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Wed, 10 Feb 2010 14:46:45 +0000 Subject: [PATCH] Fix Condition to handle booleans properly --- source/condition.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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); -- 2.45.2