aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2008-04-13 16:32:19 +0000
committerAvatar David Leverton <levertond@googlemail.com> 2008-04-13 16:32:19 +0000
commit147cce38085919b5baf90c3fd200e6ea56f2cded (patch)
tree760423973aa68ff135d93362bc7bea1e375620f8
parent9e65ae748ae24e56ff4ae9f21e56af7b8b6521f3 (diff)
downloadpaludis-147cce38085919b5baf90c3fd200e6ea56f2cded.tar.gz
paludis-147cce38085919b5baf90c3fd200e6ea56f2cded.tar.xz
Fix use masking and forcing logic for visibility checks.
-rw-r--r--paludis/repositories/e/e_repository.cc4
-rw-r--r--paludis/repositories/e/e_repository_profile.cc9
-rw-r--r--paludis/repositories/e/qa/visibility.cc4
-rw-r--r--paludis/repositories/e/qa/visibility_TEST.cc50
-rwxr-xr-xpaludis/repositories/e/qa/visibility_TEST_setup.sh79
5 files changed, 140 insertions, 6 deletions
diff --git a/paludis/repositories/e/e_repository.cc b/paludis/repositories/e/e_repository.cc
index fe6c901..e2738cc 100644
--- a/paludis/repositories/e/e_repository.cc
+++ b/paludis/repositories/e/e_repository.cc
@@ -658,9 +658,7 @@ ERepository::query_use_mask(const UseFlagName & u, const PackageID & e) const
else
{
_imp->need_profiles();
- return _imp->profile_ptr->use_masked(u, e) ||
- (arch_flags()->end() != arch_flags()->find(u) &&
- use_enabled != _imp->profile_ptr->use_state_ignoring_masks(u, e));
+ return _imp->profile_ptr->use_masked(u, e);
}
}
diff --git a/paludis/repositories/e/e_repository_profile.cc b/paludis/repositories/e/e_repository_profile.cc
index 4694fb8..c178ad1 100644
--- a/paludis/repositories/e/e_repository_profile.cc
+++ b/paludis/repositories/e/e_repository_profile.cc
@@ -705,6 +705,10 @@ bool
ERepositoryProfile::use_masked(const UseFlagName & u,
const PackageID & e) const
{
+ if (_imp->repository->arch_flags()->end() != _imp->repository->arch_flags()->find(u) &&
+ use_enabled != use_state_ignoring_masks(u, e))
+ return true;
+
bool result(false);
for (StackedValuesList::const_iterator i(_imp->stacked_values_list.begin()),
i_end(_imp->stacked_values_list.end()) ; i != i_end ; ++i)
@@ -731,6 +735,11 @@ ERepositoryProfile::use_masked(const UseFlagName & u,
bool
ERepositoryProfile::use_forced(const UseFlagName & u, const PackageID & e) const
{
+ if (use_masked(u, e))
+ return false;
+ if (_imp->repository->arch_flags()->end() != _imp->repository->arch_flags()->find(u))
+ return true;
+
bool result(false);
for (StackedValuesList::const_iterator i(_imp->stacked_values_list.begin()),
i_end(_imp->stacked_values_list.end()) ; i != i_end ; ++i)
diff --git a/paludis/repositories/e/qa/visibility.cc b/paludis/repositories/e/qa/visibility.cc
index f5983b4..cb4e832 100644
--- a/paludis/repositories/e/qa/visibility.cc
+++ b/paludis/repositories/e/qa/visibility.cc
@@ -204,8 +204,8 @@ namespace
DependencySpecTree::ConstSequenceIterator end)
{
viable =
- ((! conditional_dep_spec_is_inverse(u)) && (! repo->query_use_mask(conditional_dep_spec_flag(u), *id))) ||
- ((conditional_dep_spec_is_inverse(u)) && (! repo->query_use_force(conditional_dep_spec_flag(u), *id)));
+ ((! conditional_dep_spec_is_inverse(u)) && (! (*profile)[k::profile()]->use_masked(conditional_dep_spec_flag(u), *id))) ||
+ ((conditional_dep_spec_is_inverse(u)) && (! (*profile)[k::profile()]->use_forced(conditional_dep_spec_flag(u), *id)));
if (viable)
std::for_each(cur, end, accept_visitor(*this));
diff --git a/paludis/repositories/e/qa/visibility_TEST.cc b/paludis/repositories/e/qa/visibility_TEST.cc
index d1b4743..5069156 100644
--- a/paludis/repositories/e/qa/visibility_TEST.cc
+++ b/paludis/repositories/e/qa/visibility_TEST.cc
@@ -112,6 +112,56 @@ namespace test_cases
TestMessageSuffix s4(r4.messages);
TEST_CHECK_EQUAL(r4.count, 1u);
}
+
+ {
+ tr1::shared_ptr<const PackageID> id5(*env.package_database()->query(query::Matches(parse_user_package_dep_spec(
+ "=cat-one/use-masking-1", UserPackageDepSpecOptions())), qo_require_exactly_one)->begin());
+ TestReporter r5;
+ TEST_CHECK(visibility_check(FSEntry("/var/empty"), r5, &env, repo, id5, "visibility"));
+ TestMessageSuffix s5(r5.messages);
+ TEST_CHECK_EQUAL(r5.count, 1u);
+ }
+
+ {
+ tr1::shared_ptr<const PackageID> id6(*env.package_database()->query(query::Matches(parse_user_package_dep_spec(
+ "=cat-one/use-masking-2", UserPackageDepSpecOptions())), qo_require_exactly_one)->begin());
+ TestReporter r6;
+ TEST_CHECK(visibility_check(FSEntry("/var/empty"), r6, &env, repo, id6, "visibility"));
+ TestMessageSuffix s6(r6.messages);
+ TEST_CHECK_EQUAL(r6.count, 1u);
+ }
+
+ {
+ tr1::shared_ptr<const PackageID> id7(*env.package_database()->query(query::Matches(parse_user_package_dep_spec(
+ "=cat-one/use-masking-3", UserPackageDepSpecOptions())), qo_require_exactly_one)->begin());
+ TestReporter r7;
+ TEST_CHECK(visibility_check(FSEntry("/var/empty"), r7, &env, repo, id7, "visibility"));
+ TEST_CHECK_EQUAL(r7.count, 0u);
+ }
+
+ {
+ tr1::shared_ptr<const PackageID> id8(*env.package_database()->query(query::Matches(parse_user_package_dep_spec(
+ "=cat-one/use-masking-4", UserPackageDepSpecOptions())), qo_require_exactly_one)->begin());
+ TestReporter r8;
+ TEST_CHECK(visibility_check(FSEntry("/var/empty"), r8, &env, repo, id8, "visibility"));
+ TEST_CHECK_EQUAL(r8.count, 0u);
+ }
+
+ {
+ tr1::shared_ptr<const PackageID> id9(*env.package_database()->query(query::Matches(parse_user_package_dep_spec(
+ "=cat-one/use-masking-5", UserPackageDepSpecOptions())), qo_require_exactly_one)->begin());
+ TestReporter r9;
+ TEST_CHECK(visibility_check(FSEntry("/var/empty"), r9, &env, repo, id9, "visibility"));
+ TEST_CHECK_EQUAL(r9.count, 0u);
+ }
+
+ {
+ tr1::shared_ptr<const PackageID> id10(*env.package_database()->query(query::Matches(parse_user_package_dep_spec(
+ "=cat-one/use-masking-6", UserPackageDepSpecOptions())), qo_require_exactly_one)->begin());
+ TestReporter r10;
+ TEST_CHECK(visibility_check(FSEntry("/var/empty"), r10, &env, repo, id10, "visibility"));
+ TEST_CHECK_EQUAL(r10.count, 0u);
+ }
}
} test_visibility;
}
diff --git a/paludis/repositories/e/qa/visibility_TEST_setup.sh b/paludis/repositories/e/qa/visibility_TEST_setup.sh
index d28e36a..7af3abb 100755
--- a/paludis/repositories/e/qa/visibility_TEST_setup.sh
+++ b/paludis/repositories/e/qa/visibility_TEST_setup.sh
@@ -4,9 +4,13 @@
mkdir visibility_TEST_dir || exit 1
cd visibility_TEST_dir || exit 1
-mkdir -p repo1/{eclass,distfiles,profiles/test,cat-one/{visible,masked,needs-masked}} || exit 1
+mkdir -p repo1/{eclass,distfiles,profiles/test{,64},cat-one/{visible,masked,needs-masked,use-masking}} || exit 1
cd repo1 || exit 1
echo "repo1" > profiles/repo_name || exit 1
+cat <<END > profiles/arch.list || exit 1
+test
+test64
+END
cat <<END > profiles/categories || exit 1
cat-one
END
@@ -14,8 +18,15 @@ cat <<END > profiles/test/make.defaults
ARCH=test
ACCEPT_KEYWORDS=test
END
+cat <<END > profiles/test64/make.defaults
+ARCH=test64
+ACCEPT_KEYWORDS=test64
+END
+echo masked > profiles/test64/use.mask
+echo forced > profiles/test64/use.force
cat <<END > profiles/profiles.desc
test test/ stable
+test64 test64/ stable
END
cat <<END > cat-one/visible/visible-1.ebuild
DESCRIPTION="visible"
@@ -55,6 +66,72 @@ KEYWORDS="test"
DEPEND="cat-one/masked"
RDEPEND=""
END
+cat <<END > cat-one/use-masking/use-masking-1.ebuild
+DESCRIPTION="use masking"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE=""
+LICENCE="GPL-2"
+KEYWORDS="test test64"
+DEPEND="foo? ( cat-one/visible )"
+RDEPEND=""
+END
+cat <<END > cat-one/use-masking/use-masking-2.ebuild
+DESCRIPTION="use masking"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE=""
+LICENCE="GPL-2"
+KEYWORDS="test test64"
+DEPEND="!foo? ( cat-one/visible )"
+RDEPEND=""
+END
+cat <<END > cat-one/use-masking/use-masking-3.ebuild
+DESCRIPTION="use masking"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE=""
+LICENCE="GPL-2"
+KEYWORDS="test test64"
+DEPEND="masked? ( cat-one/visible )"
+RDEPEND=""
+END
+cat <<END > cat-one/use-masking/use-masking-4.ebuild
+DESCRIPTION="use masking"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE=""
+LICENCE="GPL-2"
+KEYWORDS="test test64"
+DEPEND="!forced? ( cat-one/visible )"
+RDEPEND=""
+END
+cat <<END > cat-one/use-masking/use-masking-5.ebuild
+DESCRIPTION="use masking"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE=""
+LICENCE="GPL-2"
+KEYWORDS="test test64"
+DEPEND="test? ( cat-one/visible )"
+RDEPEND=""
+END
+cat <<END > cat-one/use-masking/use-masking-6.ebuild
+DESCRIPTION="use masking"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE=""
+LICENCE="GPL-2"
+KEYWORDS="test test64"
+DEPEND="!test64? ( cat-one/visible )"
+RDEPEND=""
+END
cd ..
cd ..