]> git.tdb.fi Git - builder.git/blobdiff - source/package.cpp
Move the bpk files into a subdirectory and install them
[builder.git] / source / package.cpp
index 44444add8b04acb641d97fcccff567b4c74dae87..19ee511a814cf34bf46efd20f9409c7394b5d879 100644 (file)
@@ -1,8 +1,8 @@
 #include <msp/io/print.h>
 #include <msp/strings/lexicalcast.h>
 #include <msp/strings/utils.h>
+#include "booleanevaluator.h"
 #include "builder.h"
-#include "misc.h"
 #include "package.h"
 
 using namespace std;
@@ -22,7 +22,7 @@ void Package::prepare()
        if(prepared)
                return;
 
-       for(PackageList::const_iterator i=requires.begin(); i!=requires.end(); ++i)
+       for(Requirements::const_iterator i=requires.begin(); i!=requires.end(); ++i)
                (*i)->prepare();
 
        do_prepare();
@@ -39,9 +39,8 @@ Package::Loader::Loader(Package &p):
 
 void Package::Loader::if_arch(const string &cond)
 {
-       const Architecture &arch = obj.builder.get_current_arch();
-       bool negate = (cond[0]=='!');
-       bool match = (arch.match_name(cond.substr(negate))!=negate);
+       BooleanEvaluator eval(sigc::hide<1>(sigc::mem_fun(&obj.builder.get_current_arch(), &Architecture::match_name)), false);
+       bool match = eval.evaluate(cond);
        obj.builder.get_logger().log("configure", format("%s: arch %s %smatched", obj.name, cond, (match ? "" : "not ")));
        if(match)
                load_sub_with(*this);
@@ -52,4 +51,6 @@ void Package::Loader::require(const string &n)
        Package *req = obj.builder.get_package_manager().find_package(n);
        if(req)
                obj.requires.push_back(req);
+       else
+               obj.problems.push_back(format("Required package %s not found", n));
 }