X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fsourcepackage.cpp;h=4f42051e6b654d9baac64fabde7bb44e479e6ebe;hb=0c83b922e56976a30506d9f8d43c9dcd38d573b5;hp=e946d018a51953a44149a6888179500a2923fd32;hpb=87ea54db19306434bac3e765c9bd3464fd53f390;p=builder.git diff --git a/source/sourcepackage.cpp b/source/sourcepackage.cpp index e946d01..4f42051 100644 --- a/source/sourcepackage.cpp +++ b/source/sourcepackage.cpp @@ -1,10 +1,4 @@ -/* $Id$ - -This file is part of builder -Copyright © 2007-2010 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - +#include #include #include #include @@ -75,7 +69,51 @@ LibMode SourcePackage::get_library_mode() const else if(mode=="none") return DYNAMIC; else - throw Exception("Unknown library mode"); + throw runtime_error("unknown library mode"); +} + +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+1get_requires(); - for(PackageList::const_iterator j=reqs.begin(); j!=reqs.end(); ++j) - (*j)->configure(opts, flag&2); - } + i->configure(opts, flag); } void SourcePackage::init_config() @@ -274,5 +308,5 @@ void SourcePackage::Loader::tar_file(const string &f) SourcePackage &spkg = static_cast(pkg); for(ComponentList::iterator i=spkg.components.begin(); i!=spkg.components.end(); ++i) if(i->get_type()==Component::TARBALL && i->get_name()=="@src") - const_cast(i->get_sources()).push_back(spkg.source/f); + const_cast(i->get_sources()).push_back((spkg.source/f).str()); }