aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2008-11-07 21:04:57 +0000
committerAvatar David Leverton <levertond@googlemail.com> 2008-11-07 21:04:57 +0000
commit2366036ad5da4e31aa706e8f8a70a232b517e9e3 (patch)
tree32b3de597bb501abdef785cd2bfcaf66b68da6d9
parent28c390fbc627a972581ad6d22ced070d30deac12 (diff)
downloadpaludis-2366036ad5da4e31aa706e8f8a70a232b517e9e3.tar.gz
paludis-2366036ad5da4e31aa706e8f8a70a232b517e9e3.tar.xz
Fix USE_EXPAND for installed packages.
-rw-r--r--paludis/repositories/e/e_key.cc25
-rw-r--r--paludis/repositories/e/vdb_repository_TEST.cc4
-rwxr-xr-xpaludis/repositories/e/vdb_repository_TEST_setup.sh3
3 files changed, 23 insertions, 9 deletions
diff --git a/paludis/repositories/e/e_key.cc b/paludis/repositories/e/e_key.cc
index c048399..4064aab 100644
--- a/paludis/repositories/e/e_key.cc
+++ b/paludis/repositories/e/e_key.cc
@@ -1189,17 +1189,26 @@ EChoicesKey::value() const
if (! _imp->id->eapi()->supported()->ebuild_options()->require_use_expand_in_iuse())
{
- std::tr1::shared_ptr<const Set<UnprefixedChoiceName> >
- e_values(_imp->env->known_choice_value_names(_imp->id, exp)),
- r_values;
+ std::tr1::shared_ptr<const Set<UnprefixedChoiceName> > e_values(_imp->env->known_choice_value_names(_imp->id, exp));
+ std::copy(e_values->begin(), e_values->end(), std::inserter(values, values.begin()));
if (_imp->maybe_e_repository)
- r_values = _imp->maybe_e_repository->profile()->known_choice_value_names(_imp->id, exp);
- else
- r_values = make_shared_ptr(new Set<UnprefixedChoiceName>);
+ {
+ std::tr1::shared_ptr<const Set<UnprefixedChoiceName> > r_values(
+ _imp->maybe_e_repository->profile()->known_choice_value_names(_imp->id, exp));
+ std::copy(r_values->begin(), r_values->end(), std::inserter(values, values.begin()));
+ }
- std::set_union(e_values->begin(), e_values->end(), r_values->begin(), r_values->end(),
- std::inserter(values, values.begin()));
+ if (_imp->id->raw_use_key())
+ {
+ for (Set<std::string>::ConstIterator it(_imp->id->raw_use_key()->value()->begin()),
+ it_end(_imp->id->raw_use_key()->value()->end()); it_end != it; ++it)
+ {
+ std::string flag(0 == it->compare(0, 1, "-", 0, 1) ? it->substr(1) : *it);
+ if (IsExpand(ChoiceNameWithPrefix(flag), delim)(*u))
+ values.insert(UnprefixedChoiceName(flag.substr(u->length() + delim.length())));
+ }
+ }
}
for (std::map<ChoiceNameWithPrefix, Tribool>::const_iterator i(i_values.begin()), i_end(i_values.end()) ;
diff --git a/paludis/repositories/e/vdb_repository_TEST.cc b/paludis/repositories/e/vdb_repository_TEST.cc
index ae2d84d..474d90e 100644
--- a/paludis/repositories/e/vdb_repository_TEST.cc
+++ b/paludis/repositories/e/vdb_repository_TEST.cc
@@ -141,6 +141,10 @@ namespace test_cases
TEST_CHECK(e1->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix("flag1"))->enabled());
TEST_CHECK(e1->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix("flag2"))->enabled());
TEST_CHECK(! e1->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix("flag3"))->enabled());
+ TEST_CHECK(e1->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix("test"))->enabled());
+ TEST_CHECK(e1->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix("kernel_linux"))->enabled());
+ TEST_CHECK(! e1->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix("test2")));
+ TEST_CHECK(! e1->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix("kernel_freebsd")));
}
} test_vdb_repository_query_use;
diff --git a/paludis/repositories/e/vdb_repository_TEST_setup.sh b/paludis/repositories/e/vdb_repository_TEST_setup.sh
index f24f79d..7c71d3b 100755
--- a/paludis/repositories/e/vdb_repository_TEST_setup.sh
+++ b/paludis/repositories/e/vdb_repository_TEST_setup.sh
@@ -18,8 +18,9 @@ for i in DEPEND RDEPEND LICENSE INHERITED IUSE PDEPEND PROVIDE; do
touch repo1/cat-one/pkg-one-1/${i}
done
-echo "flag1 flag2" >>repo1/cat-one/pkg-one-1/USE
+echo "test flag1 flag2 kernel_linux" >>repo1/cat-one/pkg-one-1/USE
echo "flag1 flag2 flag3" >>repo1/cat-one/pkg-one-1/IUSE
+echo "KERNEL" >repo1/cat-one/pkg-one-1/USE_EXPAND
cat <<END >repo1/cat-one/pkg-one-1/CONTENTS
dir /directory