From: Mikko Rasa Date: Mon, 16 Jul 2012 17:32:05 +0000 (+0300) Subject: Variables in Build files weren't such a hot idea. KISS. X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=f7e0a54c49480981a8d9bec064375323fce0aaf1;p=builder.git Variables in Build files weren't such a hot idea. KISS. --- diff --git a/source/component.cpp b/source/component.cpp index 93d450b..3ce6b14 100644 --- a/source/component.cpp +++ b/source/component.cpp @@ -32,9 +32,6 @@ Component::Component(SourcePackage &p, Type t, const string &n): void Component::configure(const StringMap &opts, unsigned flag) { - for(StringList::iterator i=sources.begin(); i!=sources.end(); ++i) - *i = (pkg.get_source()/pkg.expand_string(*i)).str(); - for(PackageList::const_iterator i=requires.begin(); i!=requires.end(); ++i) (*i)->configure(opts, flag&2); } @@ -249,7 +246,7 @@ Component::Loader::Loader(Component &c): void Component::Loader::source(const string &s) { - obj.sources.push_back(s); + obj.sources.push_back((obj.pkg.get_source()/s).str()); } void Component::Loader::require(const string &n) diff --git a/source/config.cpp b/source/config.cpp index 4890263..c6dcb70 100644 --- a/source/config.cpp +++ b/source/config.cpp @@ -52,12 +52,6 @@ bool Config::update(const StringMap &opts) return changed_now; } -void Config::finish() -{ - for(OptionMap::iterator i=options.begin(); i!=options.end(); ++i) - i->second.value = package.expand_string(i->second.value); -} - void Config::save() const { if(!changed) diff --git a/source/config.h b/source/config.h index 64e4225..9043208 100644 --- a/source/config.h +++ b/source/config.h @@ -67,9 +67,6 @@ public: were changed. */ bool update(const StringMap &); - /** Expands any variable references in options. */ - void finish(); - void save() const; bool set_option(const std::string &, const std::string &); void load(); diff --git a/source/sourcepackage.cpp b/source/sourcepackage.cpp index 44faa07..ca49976 100644 --- a/source/sourcepackage.cpp +++ b/source/sourcepackage.cpp @@ -63,50 +63,6 @@ FS::Path SourcePackage::get_out_dir() const return source/arch.get_name()/detail; } -string SourcePackage::expand_string(const string &str) const -{ - string result = str; - string::size_type dollar = 0; - unsigned n = 0; - while((dollar = result.find('$'))!=string::npos) - { - if(n>1000) - throw bad_expansion("nested too deep"); - - string::size_type end; - string var; - if(dollar+1