X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fsourcepackage.cpp;h=a466089ae75aad13b049d5e5e3660a930f597ec3;hb=8d7926359d2477a9928d7367678314bcbc1f6e81;hp=e946d018a51953a44149a6888179500a2923fd32;hpb=87ea54db19306434bac3e765c9bd3464fd53f390;p=builder.git diff --git a/source/sourcepackage.cpp b/source/sourcepackage.cpp index e946d01..a466089 100644 --- a/source/sourcepackage.cpp +++ b/source/sourcepackage.cpp @@ -5,6 +5,7 @@ Copyright © 2007-2010 Mikko Rasa, Mikkosoft Productions Distributed under the LGPL */ +#include #include #include #include @@ -78,6 +79,50 @@ LibMode SourcePackage::get_library_mode() const throw Exception("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 Exception("Too much variable expansions"); + + 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 +315,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()); }