aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-04-14 14:21:51 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-04-14 14:21:51 +0000
commit444fa889205cd6c22264b9205846dc2076a9345e (patch)
tree182ec1f52b9bba8af0fb3e06adfd8464f2f3c9a5
parent7b6973f4f7882a9719d017cb1e821ad4cefd4c12 (diff)
downloadpaludis-444fa889205cd6c22264b9205846dc2076a9345e.tar.gz
paludis-444fa889205cd6c22264b9205846dc2076a9345e.tar.xz
Allow EXPAND: var syntax in use.conf
-rw-r--r--paludis/default_config.cc26
1 files changed, 22 insertions, 4 deletions
diff --git a/paludis/default_config.cc b/paludis/default_config.cc
index 0e64e2e..6ced0c6 100644
--- a/paludis/default_config.cc
+++ b/paludis/default_config.cc
@@ -32,6 +32,7 @@
#include <fstream>
#include <algorithm>
#include <sstream>
+#include <ctype.h>
using namespace paludis;
@@ -279,14 +280,24 @@ DefaultConfig::DefaultConfig() :
if (tokens.empty())
continue;
+ std::string prefix;
if ("*" == tokens.at(0))
for (std::vector<std::string>::const_iterator t(next(tokens.begin())), t_end(tokens.end()) ;
t != t_end ; ++t)
{
if ('-' == t->at(0))
- _default_use.push_back(std::make_pair(UseFlagName(t->substr(1)), use_disabled));
+ _default_use.push_back(std::make_pair(UseFlagName(
+ prefix + t->substr(1)), use_disabled));
+ else if (':' == t->at(t->length() - 1))
+ {
+ prefix.clear();
+ std::transform(t->begin(), previous(t->end()), std::back_inserter(prefix),
+ &::tolower);
+ prefix.append("_");
+ }
else
- _default_use.push_back(std::make_pair(UseFlagName(*t), use_enabled));
+ _default_use.push_back(std::make_pair(UseFlagName(
+ prefix + *t), use_enabled));
}
else
{
@@ -296,10 +307,17 @@ DefaultConfig::DefaultConfig() :
{
if ('-' == t->at(0))
_use[a->package()].push_back(UseConfigEntry(
- a, UseFlagName(t->substr(1)), use_disabled));
+ a, UseFlagName(prefix + t->substr(1)), use_disabled));
+ else if (':' == t->at(t->length() - 1))
+ {
+ prefix.clear();
+ std::transform(t->begin(), previous(t->end()), std::back_inserter(prefix),
+ &::tolower);
+ prefix.append("_");
+ }
else
_use[a->package()].push_back(UseConfigEntry(
- a, UseFlagName(*t), use_enabled));
+ a, UseFlagName(prefix + *t), use_enabled));
}
}
}