aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-09-27 10:15:48 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-09-27 10:15:48 +0000
commit8eda0879ff7d6df9df562cbc4d6191c55c9a4b21 (patch)
tree601bee743bb10589ef42c6a91b6406463dc6b0ba
parent41b55b9cea20f2b1013d56706d15db8496f5a809 (diff)
downloadpaludis-8eda0879ff7d6df9df562cbc4d6191c55c9a4b21.tar.gz
paludis-8eda0879ff7d6df9df562cbc4d6191c55c9a4b21.tar.xz
Ignore '* -*' in use.conf for USE_EXPAND things
-rw-r--r--paludis/environment/default/Makefile.am25
-rw-r--r--paludis/environment/default/default_environment.cc29
-rw-r--r--paludis/environment/default/default_environment_TEST.cc54
3 files changed, 74 insertions, 34 deletions
diff --git a/paludis/environment/default/Makefile.am b/paludis/environment/default/Makefile.am
index 59415ba..5f336c9 100644
--- a/paludis/environment/default/Makefile.am
+++ b/paludis/environment/default/Makefile.am
@@ -20,3 +20,28 @@ lib_LTLIBRARIES = libpaludisdefaultenvironment.la
paludis_environment_default_includedir = $(includedir)/paludis/environment/test
paludis_environment_default_include_HEADERS = default_config.hh default_environment.hh
+EXTRA_DIST = \
+ default_environment_TEST_setup.sh \
+ default_environment_TEST.cc \
+ default_environment_TEST_cleanup.sh
+
+TESTS = default_environment_TEST
+
+TESTS_ENVIRONMENT = env \
+ PALUDIS_EBUILD_DIR="$(top_srcdir)/ebuild/" \
+ PALUDIS_SKIP_CONFIG="yes" \
+ PALUDIS_REPOSITORY_SO_DIR="$(top_builddir)/paludis/repositories" \
+ TEST_SCRIPT_DIR="$(srcdir)/" \
+ bash $(top_srcdir)/test/run_test.sh
+
+check_PROGRAMS = $(TESTS)
+check_SCRIPTS = default_environment_TEST_setup.sh default_environment_TEST_cleanup.sh
+
+default_environment_TEST_SOURCES = default_environment_TEST.cc
+default_environment_TEST_LDADD = \
+ $(top_builddir)/paludis/util/test_extras.o \
+ $(top_builddir)/test/libtest.a \
+ $(top_builddir)/paludis/libpaludis.la \
+ $(top_builddir)/paludis/util/libpaludisutil.la \
+ libpaludisdefaultenvironment.la
+
diff --git a/paludis/environment/default/default_environment.cc b/paludis/environment/default/default_environment.cc
index 6356b29..938afa7 100644
--- a/paludis/environment/default/default_environment.cc
+++ b/paludis/environment/default/default_environment.cc
@@ -157,13 +157,28 @@ DefaultEnvironment::query_use(const UseFlagName & f, const PackageDatabaseEntry
throw InternalError(PALUDIS_HERE, "bad state " + stringify(state));
} while (false);
- /* and -* again */
- for (DefaultConfig::UseMinusStarIterator
- i(DefaultConfig::get_instance()->begin_use_prefixes_with_minus_star()),
- i_end(DefaultConfig::get_instance()->end_use_prefixes_with_minus_star()) ;
- i != i_end ; ++i)
- if (0 == i->compare(0, i->length(), stringify(f), 0, i->length()))
- return false;
+ /* and -* again. slight gotcha: "* -*" should not override use expand things. if it
+ * does, USERLAND etc get emptied. */
+ bool consider_minus_star(true);
+ if (e && repo && repo->use_interface)
+ {
+ UseFlagNameCollection::ConstPointer prefixes(repo->use_interface->use_expand_prefixes());
+ for (UseFlagNameCollection::Iterator i(prefixes->begin()), i_end(prefixes->end()) ;
+ i != i_end ; ++i)
+ if (0 == i->data().compare(0, i->data().length(), stringify(f), 0, i->data().length()))
+ {
+ consider_minus_star = false;
+ break;
+ }
+ }
+
+ if (consider_minus_star)
+ for (DefaultConfig::UseMinusStarIterator
+ i(DefaultConfig::get_instance()->begin_use_prefixes_with_minus_star()),
+ i_end(DefaultConfig::get_instance()->end_use_prefixes_with_minus_star()) ;
+ i != i_end ; ++i)
+ if (0 == i->compare(0, i->length(), stringify(f), 0, i->length()))
+ return false;
/* check use: package database config */
if (repo && repo->use_interface)
diff --git a/paludis/environment/default/default_environment_TEST.cc b/paludis/environment/default/default_environment_TEST.cc
index 91f97c4..0a7aa82 100644
--- a/paludis/environment/default/default_environment_TEST.cc
+++ b/paludis/environment/default/default_environment_TEST.cc
@@ -45,16 +45,16 @@ namespace test_cases
TEST_CHECK(env->query_use(UseFlagName("foo"), 0));
TEST_CHECK(! env->query_use(UseFlagName("foofoo"), 0));
- PackageDatabaseEntry e(QualifiedPackageName("cat-one/pkg-one"), VersionSpec("1"), RepositoryName("foo"));
- TEST_CHECK(env->query_use(UseFlagName("foo"), &e));
- TEST_CHECK(! env->query_use(UseFlagName("foofoo"), &e));
- TEST_CHECK(env->query_use(UseFlagName("moo"), &e));
+ PackageDatabaseEntry pde(QualifiedPackageName("cat-one/pkg-one"), VersionSpec("1"), RepositoryName("foo"));
+ TEST_CHECK(env->query_use(UseFlagName("foo"), &pde));
+ TEST_CHECK(! env->query_use(UseFlagName("foofoo"), &pde));
+ TEST_CHECK(env->query_use(UseFlagName("moo"), &pde));
- TEST_CHECK(env->query_use(UseFlagName("more_exp_one"), &e));
- TEST_CHECK(env->query_use(UseFlagName("exp_two"), &e));
- TEST_CHECK(env->query_use(UseFlagName("exp_one"), &e));
- TEST_CHECK(env->query_use(UseFlagName("third_exp_one"), &e));
- TEST_CHECK(! env->query_use(UseFlagName("third_exp_two"), &e));
+ TEST_CHECK(env->query_use(UseFlagName("more_exp_one"), &pde));
+ TEST_CHECK(env->query_use(UseFlagName("exp_two"), &pde));
+ TEST_CHECK(env->query_use(UseFlagName("exp_one"), &pde));
+ TEST_CHECK(env->query_use(UseFlagName("third_exp_one"), &pde));
+ TEST_CHECK(! env->query_use(UseFlagName("third_exp_two"), &pde));
PackageDatabaseEntry f(QualifiedPackageName("cat-one/pkg-two"), VersionSpec("3"), RepositoryName("foo"));
TEST_CHECK(env->query_use(UseFlagName("third_exp_one"), &f));
@@ -78,16 +78,16 @@ namespace test_cases
TEST_CHECK(env->query_use(UseFlagName("foo"), 0));
TEST_CHECK(! env->query_use(UseFlagName("foofoo"), 0));
- PackageDatabaseEntry e(QualifiedPackageName("cat-one/pkg-one"), VersionSpec("1"), RepositoryName("foo"));
- TEST_CHECK(env->query_use(UseFlagName("foo"), &e));
- TEST_CHECK(! env->query_use(UseFlagName("foofoo"), &e));
- TEST_CHECK(! env->query_use(UseFlagName("moo"), &e));
+ PackageDatabaseEntry pde(QualifiedPackageName("cat-one/pkg-one"), VersionSpec("1"), RepositoryName("foo"));
+ TEST_CHECK(env->query_use(UseFlagName("foo"), &pde));
+ TEST_CHECK(! env->query_use(UseFlagName("foofoo"), &pde));
+ TEST_CHECK(! env->query_use(UseFlagName("moo"), &pde));
- TEST_CHECK(! env->query_use(UseFlagName("more_exp_one"), &e));
- TEST_CHECK(env->query_use(UseFlagName("exp_two"), &e));
- TEST_CHECK(! env->query_use(UseFlagName("exp_one"), &e));
- TEST_CHECK(! env->query_use(UseFlagName("third_exp_one"), &e));
- TEST_CHECK(! env->query_use(UseFlagName("third_exp_two"), &e));
+ TEST_CHECK(env->query_use(UseFlagName("more_exp_one"), &pde));
+ TEST_CHECK(env->query_use(UseFlagName("exp_two"), &pde));
+ TEST_CHECK(env->query_use(UseFlagName("exp_one"), &pde));
+ TEST_CHECK(env->query_use(UseFlagName("third_exp_one"), &pde));
+ TEST_CHECK(! env->query_use(UseFlagName("third_exp_two"), &pde));
PackageDatabaseEntry f(QualifiedPackageName("cat-one/pkg-two"), VersionSpec("3"), RepositoryName("foo"));
TEST_CHECK(! env->query_use(UseFlagName("third_exp_one"), &f));
@@ -111,16 +111,16 @@ namespace test_cases
TEST_CHECK(env->query_use(UseFlagName("foo"), 0));
TEST_CHECK(! env->query_use(UseFlagName("foofoo"), 0));
- PackageDatabaseEntry e(QualifiedPackageName("cat-one/pkg-one"), VersionSpec("1"), RepositoryName("foo"));
- TEST_CHECK(env->query_use(UseFlagName("foo"), &e));
- TEST_CHECK(! env->query_use(UseFlagName("foofoo"), &e));
- TEST_CHECK(env->query_use(UseFlagName("moo"), &e));
+ PackageDatabaseEntry pde(QualifiedPackageName("cat-one/pkg-one"), VersionSpec("1"), RepositoryName("foo"));
+ TEST_CHECK(env->query_use(UseFlagName("foo"), &pde));
+ TEST_CHECK(! env->query_use(UseFlagName("foofoo"), &pde));
+ TEST_CHECK(env->query_use(UseFlagName("moo"), &pde));
- TEST_CHECK(env->query_use(UseFlagName("more_exp_one"), &e));
- TEST_CHECK(env->query_use(UseFlagName("exp_two"), &e));
- TEST_CHECK(! env->query_use(UseFlagName("exp_one"), &e));
- TEST_CHECK(env->query_use(UseFlagName("third_exp_one"), &e));
- TEST_CHECK(! env->query_use(UseFlagName("third_exp_two"), &e));
+ TEST_CHECK(env->query_use(UseFlagName("more_exp_one"), &pde));
+ TEST_CHECK(env->query_use(UseFlagName("exp_two"), &pde));
+ TEST_CHECK(env->query_use(UseFlagName("exp_one"), &pde));
+ TEST_CHECK(env->query_use(UseFlagName("third_exp_one"), &pde));
+ TEST_CHECK(! env->query_use(UseFlagName("third_exp_two"), &pde));
PackageDatabaseEntry f(QualifiedPackageName("cat-one/pkg-two"), VersionSpec("3"), RepositoryName("foo"));
TEST_CHECK(! env->query_use(UseFlagName("third_exp_one"), &f));