aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-04-28 08:40:50 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-04-28 08:40:50 +0000
commit0a13a6f0dd4f73007d597995dd1f8d6d2c9f6d8a (patch)
tree817a2e6a6f583e283cbe95f8ca237cd8b4623260
parent079a575ff6585bef45efde467a290eccbd7812c9 (diff)
downloadpaludis-0a13a6f0dd4f73007d597995dd1f8d6d2c9f6d8a.tar.gz
paludis-0a13a6f0dd4f73007d597995dd1f8d6d2c9f6d8a.tar.xz
Fix USE_EXPAND for PortageEnvironment too. Add lots of USE_EXPAND test cases
-rw-r--r--paludis/environments/paludis/paludis_environment_TEST.cc17
-rwxr-xr-xpaludis/environments/paludis/paludis_environment_TEST_setup.sh32
-rw-r--r--paludis/environments/portage/portage_environment.cc1
-rw-r--r--paludis/environments/portage/portage_environment_TEST.cc15
-rwxr-xr-xpaludis/environments/portage/portage_environment_TEST_setup.sh14
5 files changed, 79 insertions, 0 deletions
diff --git a/paludis/environments/paludis/paludis_environment_TEST.cc b/paludis/environments/paludis/paludis_environment_TEST.cc
index a456467..479ff84 100644
--- a/paludis/environments/paludis/paludis_environment_TEST.cc
+++ b/paludis/environments/paludis/paludis_environment_TEST.cc
@@ -61,6 +61,23 @@ namespace test_cases
}
} paludis_environment_use_test;
+ struct TestPaludisEnvironmentKnownUse : TestCase
+ {
+ TestPaludisEnvironmentKnownUse() : TestCase("known use") { }
+
+ void run()
+ {
+ setenv("PALUDIS_HOME", stringify(FSEntry::cwd() / "paludis_environment_TEST_dir" / "home5").c_str(), 1);
+ unsetenv("PALUDIS_SKIP_CONFIG");
+
+ std::tr1::shared_ptr<Environment> env(new PaludisEnvironment(""));
+
+ PackageDatabaseEntry pde1(QualifiedPackageName("cat/one"), VersionSpec("1"), RepositoryName("foo"));
+ std::tr1::shared_ptr<const UseFlagNameCollection> k1(env->known_use_expand_names(UseFlagName("foo_cards"), pde1));
+ TEST_CHECK_EQUAL(join(k1->begin(), k1->end(), " "), "foo_cards_one foo_cards_three foo_cards_two");
+ }
+ } paludis_environment_use_test_known;
+
struct TestPaludisEnvironmentUseMinusStar : TestCase
{
TestPaludisEnvironmentUseMinusStar() : TestCase("use -*") { }
diff --git a/paludis/environments/paludis/paludis_environment_TEST_setup.sh b/paludis/environments/paludis/paludis_environment_TEST_setup.sh
index 402bf36..68a2685 100755
--- a/paludis/environments/paludis/paludis_environment_TEST_setup.sh
+++ b/paludis/environments/paludis/paludis_environment_TEST_setup.sh
@@ -41,6 +41,20 @@ cat <<END > fifthrepo/profiles/repo_name
fifth
END
+mkdir -p sixthrepo/{profile,profiles,cat-one/pkg-one}
+cat <<END > sixthrepo/profiles/repo_name
+foo
+END
+cat <<END > sixthrepo/profiles/categories
+cat-one
+END
+cat <<END > sixthrepo/profile/make.defaults
+ARCH="keyword"
+USE="foo_c"
+USE_EXPAND="FOO_CARDS"
+FOO_CARDS="four"
+END
+
mkdir -p home1/.paludis/repositories
cat <<END > home1/.paludis/use.conf
*/* foo bar baz -fnord
@@ -155,4 +169,22 @@ master_repository = second
importance = 5
END
+mkdir -p home5/.paludis/repositories
+cat <<END > home5/.paludis/use.conf
+*/* foo FOO_CARDS: one
+cat/one FOO_CARDS: -two three
+END
+cat <<END > home5/.paludis/keywords.conf
+*/* keyword
+END
+cat <<END > home5/.paludis/licenses.conf
+*/* *
+END
+cat <<END > home5/.paludis/repositories/foo.conf
+format = ebuild
+names_cache = /var/empty
+location = `pwd`/sixthrepo
+profiles = `pwd`/sixthrepo/profile
+cache = /var/empty
+END
diff --git a/paludis/environments/portage/portage_environment.cc b/paludis/environments/portage/portage_environment.cc
index e1ade6c..7714f79 100644
--- a/paludis/environments/portage/portage_environment.cc
+++ b/paludis/environments/portage/portage_environment.cc
@@ -552,6 +552,7 @@ PortageEnvironment::known_use_expand_names(const UseFlagName & prefix,
std::tr1::shared_ptr<UseFlagNameCollection> result(new UseFlagNameCollection::Concrete);
std::string prefix_lower;
std::transform(prefix.data().begin(), prefix.data().end(), std::back_inserter(prefix_lower), &::tolower);
+ prefix_lower.append("_");
for (std::set<std::string>::const_iterator i(_imp->use_with_expands.begin()),
i_end(_imp->use_with_expands.end()) ; i != i_end ; ++i)
diff --git a/paludis/environments/portage/portage_environment_TEST.cc b/paludis/environments/portage/portage_environment_TEST.cc
index ded6bcc..9007afa 100644
--- a/paludis/environments/portage/portage_environment_TEST.cc
+++ b/paludis/environments/portage/portage_environment_TEST.cc
@@ -22,6 +22,7 @@
#include <test/test_framework.hh>
#include <paludis/package_database_entry.hh>
#include <paludis/util/collection_concrete.hh>
+#include <paludis/util/join.hh>
using namespace paludis;
using namespace test;
@@ -78,6 +79,20 @@ namespace test_cases
}
} test_query_use;
+ struct KnownUseNamesTest : TestCase
+ {
+ KnownUseNamesTest() : TestCase("known_use_expand_names") { }
+
+ void run()
+ {
+ PortageEnvironment env("portage_environment_TEST_dir/known_use_expand_names");
+
+ PackageDatabaseEntry pde1(QualifiedPackageName("app/one"), VersionSpec("1"), RepositoryName("foo"));
+ std::tr1::shared_ptr<const UseFlagNameCollection> k1(env.known_use_expand_names(UseFlagName("foo_cards"), pde1));
+ TEST_CHECK_EQUAL(join(k1->begin(), k1->end(), " "), "foo_cards_one foo_cards_three");
+ }
+ } test_known_use_expand;
+
struct AcceptKeywordsTest : TestCase
{
AcceptKeywordsTest() : TestCase("accept_keywords") { }
diff --git a/paludis/environments/portage/portage_environment_TEST_setup.sh b/paludis/environments/portage/portage_environment_TEST_setup.sh
index e76df25..77c7375 100755
--- a/paludis/environments/portage/portage_environment_TEST_setup.sh
+++ b/paludis/environments/portage/portage_environment_TEST_setup.sh
@@ -8,6 +8,9 @@ mkdir -p profile
cat <<"END" > profile/make.defaults
ARCH="arch"
ACCEPT_KEYWORDS="arch"
+USE_EXPAND="FOO_CARDS"
+FOO_CARDS="four"
+USE="foo_c"
END
mkdir -p repo/profiles
@@ -39,4 +42,15 @@ app/three -*
app/four **
END
+mkdir -p known_use_expand_names/${SYSCONFDIR}/portage
+ln -s $(pwd )/profile known_use_expand_names/${SYSCONFDIR}/make.profile
+cat <<END > known_use_expand_names/${SYSCONFDIR}/make.conf
+USE="one two -three foo"
+PORTDIR="`pwd`/repo"
+ACCEPT_KEYWORDS="other_arch"
+FOO_CARDS="one"
+END
+cat <<"END" > known_use_expand_names/${SYSCONFDIR}/portage/package.use
+app/one -foo_cards_two foo_cards_three
+END