aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-04-21 05:31:10 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-04-21 05:31:10 +0000
commite07ab0f6659ba3de1338df5c63fc4d231dd85eca (patch)
tree3081bcf81d76728cf2c48b62f96e439ec8ee4ffe
parentf56cadcede8d54aa2bbe73ceed55705c47df8555 (diff)
downloadpaludis-e07ab0f6659ba3de1338df5c63fc4d231dd85eca.tar.gz
paludis-e07ab0f6659ba3de1338df5c63fc4d231dd85eca.tar.xz
make env->query_use return false for stuff not in IUSE / USE_EXPAND / arch.list. Fixes: ticket:560
-rw-r--r--NEWS3
-rw-r--r--paludis/environments/paludis/Makefile.am14
-rwxr-xr-xpaludis/environments/paludis/paludis_environment_TEST_setup.sh43
-rw-r--r--paludis/repositories/e/e_repository.cc48
-rw-r--r--paludis/repositories/e/e_repository_TEST.cc15
-rwxr-xr-xpaludis/repositories/e/e_repository_TEST_setup.sh6
-rwxr-xr-xpython/repository_TEST_setup.sh4
-rwxr-xr-xruby/repository_TEST_setup.sh2
8 files changed, 121 insertions, 14 deletions
diff --git a/NEWS b/NEWS
index 286a5d1..e0631fa 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,9 @@ trunk/:
* reconcilio no longer accepts the --verbose switch; verbose display is
now turned on unconditionally.
+ * env->query_use(...) now issues a QA notice and returns false for E
+ repository IDs when the flag isn't in IUSE / USE_EXPAND / arch.list.
+
0.26.0_pre2:
* paludis now supports ${root} in environment.conf. This can be
used when defining the "world" key, so that the configuration
diff --git a/paludis/environments/paludis/Makefile.am b/paludis/environments/paludis/Makefile.am
index 8ee323a..80f7e9b 100644
--- a/paludis/environments/paludis/Makefile.am
+++ b/paludis/environments/paludis/Makefile.am
@@ -70,14 +70,24 @@ EXTRA_DIST = \
TESTS = paludis_environment_TEST
TESTS_ENVIRONMENT = env \
- PALUDIS_EBUILD_DIR="$(top_srcdir)/paludis/repositories/e/ebuild/" \
+ TEST_OUTPUT_WRAPPER="`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/util/outputwrapper`" \
+ PALUDIS_OUTPUTWRAPPER_DIR="`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/util/`" \
+ PALUDIS_EBUILD_DIR="`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_srcdir)/paludis/repositories/e/ebuild/`" \
+ PALUDIS_EBUILD_DIR_FALLBACK="`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/repositories/e/ebuild/`" \
+ PALUDIS_EXTRA_EBUILD_MODULES_DIRS="`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/util/`" \
PALUDIS_EAPIS_DIR="$(top_srcdir)/paludis/repositories/e/eapis/" \
PALUDIS_SUFFIXES_FILE="$(top_srcdir)/paludis/repositories/e/ebuild_entries_suffixes.conf" \
PALUDIS_DISTRIBUTIONS_DIR="$(top_srcdir)/paludis/distributions/" \
PALUDIS_DISTRIBUTION="gentoo" \
+ PALUDIS_FETCHERS_DIR="$(top_srcdir)/paludis/fetchers/" \
PALUDIS_SKIP_CONFIG="yes" \
- PALUDIS_REPOSITORY_SO_DIR="$(top_builddir)/paludis/repositories" \
TEST_SCRIPT_DIR="$(srcdir)/" \
+ PALUDIS_REPOSITORY_SO_DIR="$(top_builddir)/paludis/repositories" \
+ PALUDIS_NO_CHOWN="yes" \
+ PALUDIS_TESTS_KEEP_STDERR="yes" \
+ LD_LIBRARY_PATH="`echo $$LD_LIBRARY_PATH: | sed -e 's,^:,,'`` \
+ $(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/repositories/e/`:` \
+ $(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/repositories/e/.libs/`" \
bash $(top_srcdir)/test/run_test.sh
check_PROGRAMS = $(TESTS)
diff --git a/paludis/environments/paludis/paludis_environment_TEST_setup.sh b/paludis/environments/paludis/paludis_environment_TEST_setup.sh
index 0a2fd1b..9a481e4 100755
--- a/paludis/environments/paludis/paludis_environment_TEST_setup.sh
+++ b/paludis/environments/paludis/paludis_environment_TEST_setup.sh
@@ -5,6 +5,10 @@ mkdir paludis_environment_TEST_dir || exit 2
cd paludis_environment_TEST_dir || exit 3
mkdir -p repo/{profile,profiles,cat-one/pkg-one,cat-one/pkg-two}
+cat <<END > repo/profiles/arch.list
+foo
+keyword
+END
cat <<END > repo/profiles/repo_name
foo
END
@@ -19,34 +23,64 @@ EXP="one"
MORE_EXP="one"
THIRD_EXP="one"
END
-touch repo/cat-one/pkg-one/pkg-one-1.ebuild || exit 4
-touch repo/cat-one/pkg-two/pkg-two-3.ebuild || exit 4
+cat <<"END" > repo/cat-one/pkg-one/pkg-one-1.ebuild || exit 4
+SLOT="0"
+IUSE="moo foofoo quoted-name"
+END
+cat <<"END" > repo/cat-one/pkg-two/pkg-two-3.ebuild || exit 4
+SLOT="0"
+IUSE="moo foofoo quoted-name"
+END
mkdir -p firstrepo/profiles
cat <<END > firstrepo/profiles/repo_name
first
END
+cat <<END > firstrepo/profiles/arch.list
+foo
+keyword
+END
mkdir -p secondrepo/profiles
cat <<END > secondrepo/profiles/repo_name
second
END
+cat <<END > secondrepo/profiles/arch.list
+foo
+keyword
+END
mkdir -p thirdrepo/profiles
cat <<END > thirdrepo/profiles/repo_name
third
END
+cat <<END > thirdrepo/profiles/arch.list
+foo
+keyword
+END
mkdir -p fourthrepo/profiles
cat <<END > fourthrepo/profiles/repo_name
fourth
END
+cat <<END > fourthrepo/profiles/arch.list
+foo
+keyword
+END
mkdir -p fifthrepo/profiles
cat <<END > fifthrepo/profiles/repo_name
fifth
END
+cat <<END > fifthrepo/profiles/arch.list
+foo
+keyword
+END
mkdir -p sixthrepo/{profile,profiles,cat-one/pkg-one}
cat <<END > sixthrepo/profiles/repo_name
foo
END
+cat <<END > sixthrepo/profiles/arch.list
+foo
+keyword
+END
cat <<END > sixthrepo/profiles/categories
cat-one
END
@@ -56,7 +90,10 @@ USE="foo_c"
USE_EXPAND="FOO_CARDS"
FOO_CARDS="four"
END
-touch sixthrepo/cat-one/pkg-one/pkg-one-1.ebuild || exit 4
+cat <<END > sixthrepo/cat-one/pkg-one/pkg-one-1.ebuild || exit 4
+SLOT="0"
+IUSE="moo foofoo quoted-name"
+END
mkdir -p home1/.paludis/repositories
cat <<END > home1/.paludis/use.conf
diff --git a/paludis/repositories/e/e_repository.cc b/paludis/repositories/e/e_repository.cc
index 0777e58..1202fdc 100644
--- a/paludis/repositories/e/e_repository.cc
+++ b/paludis/repositories/e/e_repository.cc
@@ -625,6 +625,15 @@ ERepository::query_use(const UseFlagName & f, const PackageID & e) const
return use_unspecified;
const erepository::ERepositoryID & id(static_cast<const erepository::ERepositoryID &>(e));
+
+ if (! (*id.eapi())[k::supported()])
+ {
+ Log::get_instance()->message("e.query_use.unsupported_eapi", ll_qa, lc_no_context)
+ << "Was asked for the state of USE flag '" << f << "' for ID '" << e
+ << "', but this ID has an unsupported EAPI";
+ return use_disabled;
+ }
+
if (id.use_key())
{
if (id.use_key()->value()->end() != id.use_key()->value()->find(f))
@@ -635,6 +644,45 @@ ERepository::query_use(const UseFlagName & f, const PackageID & e) const
else
{
_imp->need_profiles();
+
+ /* Check that the value is in iuse, and return false if it isn't. Otherwise weird stuff
+ * happens, like ticket:560. But don't for USE_EXPAND and ARCH things on EAPIs where
+ * they don't have to be listed. */
+ do
+ {
+ if (! id.iuse_key())
+ break;
+
+ if (id.iuse_key()->value()->end() != id.iuse_key()->value()->find(IUseFlag(f, use_disabled, 0)))
+ break;
+
+ if (! (*(*id.eapi())[k::supported()])[k::ebuild_options()].require_use_expand_in_iuse)
+ {
+ if (arch_flags()->end() != arch_flags()->find(f))
+ break;
+
+ bool is_expand(false);
+ const tr1::shared_ptr<const UseFlagNameSet> prefixes(use_expand_prefixes());
+ for (UseFlagNameSet::ConstIterator p(prefixes->begin()), p_end(prefixes->end()) ;
+ p != p_end && ! is_expand ; ++p)
+ if (0 == stringify(*p).compare(0, stringify(*p).length(), stringify(f), 0, stringify(*p).length()))
+ is_expand = true;
+
+ if (is_expand)
+ break;
+
+ Log::get_instance()->message("e.query_use.not_in_iuse", ll_qa, lc_no_context)
+ << "Was asked for the state of USE flag '" << f << "' for ID '" << e
+ << "', but that flag is not listed in IUSE and is not a USE_EXPAND or ARCH value";
+ }
+ else
+ Log::get_instance()->message("e.query_use.not_in_iuse", ll_qa, lc_no_context)
+ << "Was asked for the state of USE flag '" << f << "' for ID '" << e
+ << "', but that flag is not listed in IUSE";
+
+ return use_disabled;
+ } while (false);
+
if (query_use_mask(f, e))
return use_disabled;
else if (query_use_force(f, e))
diff --git a/paludis/repositories/e/e_repository_TEST.cc b/paludis/repositories/e/e_repository_TEST.cc
index 225d37e..04fa507 100644
--- a/paludis/repositories/e/e_repository_TEST.cc
+++ b/paludis/repositories/e/e_repository_TEST.cc
@@ -699,12 +699,15 @@ namespace test_cases
{
TestMessageSuffix pass_suffix(stringify(pass), true);
- tr1::shared_ptr<const PackageID> p1(*env.package_database()->query(query::Matches(PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-one-1",
- UserPackageDepSpecOptions()))), qo_require_exactly_one)->begin());
- tr1::shared_ptr<const PackageID> p2(*env.package_database()->query(query::Matches(PackageDepSpec(parse_user_package_dep_spec("=cat-two/pkg-two-1",
- UserPackageDepSpecOptions()))), qo_require_exactly_one)->begin());
- tr1::shared_ptr<const PackageID> p4(*env.package_database()->query(query::Matches(PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-one-2",
- UserPackageDepSpecOptions()))), qo_require_exactly_one)->begin());
+ tr1::shared_ptr<const PackageID> p1(*env.package_database()->query(query::Matches(PackageDepSpec(
+ parse_user_package_dep_spec("=cat-one/pkg-one-1", UserPackageDepSpecOptions()))),
+ qo_require_exactly_one)->begin());
+ tr1::shared_ptr<const PackageID> p2(*env.package_database()->query(query::Matches(PackageDepSpec(
+ parse_user_package_dep_spec("=cat-two/pkg-two-1", UserPackageDepSpecOptions()))),
+ qo_require_exactly_one)->begin());
+ tr1::shared_ptr<const PackageID> p4(*env.package_database()->query(query::Matches(PackageDepSpec(
+ parse_user_package_dep_spec("=cat-one/pkg-one-2", UserPackageDepSpecOptions()))),
+ qo_require_exactly_one)->begin());
TEST_CHECK(repo->query_use(UseFlagName("flag1"), *p1) == use_enabled);
TEST_CHECK(repo->query_use(UseFlagName("flag2"), *p1) == use_disabled);
diff --git a/paludis/repositories/e/e_repository_TEST_setup.sh b/paludis/repositories/e/e_repository_TEST_setup.sh
index 6eb0caf..0ec4718 100755
--- a/paludis/repositories/e/e_repository_TEST_setup.sh
+++ b/paludis/repositories/e/e_repository_TEST_setup.sh
@@ -288,10 +288,16 @@ cat <<END >profiles/profile/package.use.force || exit 1
cat-two/pkg-two flag5
END
cat <<END > cat-one/pkg-one/pkg-one-1.ebuild || exit 1
+IUSE="flag1 flag2 flag3 flag4 flag5 test1 test2"
+SLOT="0"
END
cat <<END > cat-one/pkg-one/pkg-one-2.ebuild || exit 1
+IUSE="flag1 flag2 flag3 flag4 flag5 test1 test2"
+SLOT="0"
END
cat <<END > cat-two/pkg-two/pkg-two-1.ebuild || exit 1
+IUSE="flag1 flag2 flag3 flag4 flag5 test1 test2"
+SLOT="0"
END
cd ..
diff --git a/python/repository_TEST_setup.sh b/python/repository_TEST_setup.sh
index cbe51eb..d79d029 100755
--- a/python/repository_TEST_setup.sh
+++ b/python/repository_TEST_setup.sh
@@ -126,7 +126,7 @@ DESCRIPTION="Test package"
HOMEPAGE="http://paludis.pioto.org/"
SRC_URI=""
SLOT="0"
-IUSE="test1"
+IUSE="test1 test2 test3 test4 test5 test6 test7"
LICENSE="GPL-2"
KEYWORDS="test"
END
@@ -136,7 +136,7 @@ DESCRIPTION="Test package"
HOMEPAGE="http://paludis.pioto.org/"
SRC_URI=""
SLOT="0"
-IUSE="test2"
+IUSE="test1 test2 test3 test4 test5 test6 test7"
LICENSE="GPL-2"
KEYWORDS="~test"
END
diff --git a/ruby/repository_TEST_setup.sh b/ruby/repository_TEST_setup.sh
index 1ba3472..a32fd80 100755
--- a/ruby/repository_TEST_setup.sh
+++ b/ruby/repository_TEST_setup.sh
@@ -116,7 +116,7 @@ DESCRIPTION="Test package"
HOMEPAGE="http://paludis.pioto.org/"
SRC_URI=""
SLOT="0"
-IUSE="test2"
+IUSE="test1 test2 test3 test4 test5 test6 test7"
LICENSE="GPL-2"
KEYWORDS="~test"
END