aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-09-11 22:54:07 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-09-11 22:54:07 +0000
commit99f7b75f68bcbd0447118b4f155b715cac4a585c (patch)
tree6e38fd269cb7d2704cd88005ce2b68e9ac98fda0
parent62fb97a6a4205491ba973a7fc7ce05ca335eb966 (diff)
downloadpaludis-99f7b75f68bcbd0447118b4f155b715cac4a585c.tar.gz
paludis-99f7b75f68bcbd0447118b4f155b715cac4a585c.tar.xz
Support -item and -* in CONFIG_PROTECT variables.
-rw-r--r--ebuild/utils/merge_common.cc18
1 files changed, 16 insertions, 2 deletions
diff --git a/ebuild/utils/merge_common.cc b/ebuild/utils/merge_common.cc
index 5dd3d15..27b9e11 100644
--- a/ebuild/utils/merge_common.cc
+++ b/ebuild/utils/merge_common.cc
@@ -48,9 +48,23 @@ using namespace paludis;
std::vector<std::string>
merge::get_config_var(const std::string & var)
{
- std::vector<std::string> result;
+ std::vector<std::string> result, preresult;
WhitespaceTokeniser::get_instance()->tokenise(getenv_with_default(var, ""),
- std::back_inserter(result));
+ std::back_inserter(preresult));
+ result.reserve(preresult.size());
+
+ for (std::vector<std::string>::const_iterator i(preresult.begin()), i_end(preresult.end()) ;
+ i != i_end ; ++i)
+ {
+ if (i->empty())
+ continue;
+ if ("-*" == *i)
+ result.clear();
+ else if ('-' == i->at(0))
+ result.erase(std::remove(result.begin(), result.end(), i->substr(1)), result.end());
+ else
+ result.push_back(*i);
+ }
return result;
}