]> git.tdb.fi Git - builder.git/blobdiff - source/condition.cpp
Fix compile errors on 64-bit systems
[builder.git] / source / condition.cpp
index c4c01b21fbdf692fc92cb4fe147a4ad58b969a86..4c9ac0b84453935c8afa3b86cc4cfcdb934afcd9 100644 (file)
@@ -1,11 +1,12 @@
 /* $Id$
 
 This file is part of builder
-Copyright © 2006-2007 Mikko Rasa, Mikkosoft Productions
+Copyright © 2007-2009  Mikko Rasa, Mikkosoft Productions
 Distributed under the LGPL
 */
 
 #include <msp/strings/utils.h>
+#include "builder.h"
 #include "condition.h"
 #include "sourcepackage.h"
 
@@ -22,7 +23,7 @@ Condition::Condition(SourcePackage &p, const string &expr):
                if(*i=="and")
                        continue;
 
-               unsigned token=i->find_first_of("=!");
+               string::size_type token=i->find_first_of("=!");
                if(token==string::npos)
                        expression.insert(StringMap::value_type(*i, "!0"));
                else if(token==0 && (*i)[0]=='!')
@@ -32,12 +33,6 @@ Condition::Condition(SourcePackage &p, const string &expr):
        }
 }
 
-void Condition::resolve_refs()
-{
-       for(PkgRefList::iterator i=requires.begin(); i!=requires.end(); ++i)
-               i->resolve();
-}
-
 bool Condition::eval()
 {
        const Config &conf=pkg.get_config();
@@ -50,7 +45,13 @@ bool Condition::eval()
                if(i->second[1]=='=')
                        ++start;
 
-               if((conf.get_option(i->first).value==i->second.substr(start))==neg)
+               string value;
+               if(conf.is_option(i->first))
+                       value=conf.get_option(i->first).value;
+               else if(i->first=="arch")
+                       value=pkg.get_builder().get_current_arch().get_name();
+
+               if((value==i->second.substr(start))==neg)
                        result=false;
        }
 
@@ -67,7 +68,7 @@ Condition::Loader::Loader(Condition &c):
 
 void Condition::Loader::require(const string &pkg)
 {
-       cond.requires.push_back(PackageRef(cond.pkg.get_builder(), pkg));
+       cond.requires.push_back(pkg);
 }
 
 void Condition::Loader::build_info()