aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-07-26 21:51:17 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-07-26 21:51:17 +0000
commitf51124da6d5dd1376c2c7963c59b7c63080bc5d3 (patch)
treee6a711cfe1eb169ed173b8b016c5772e68b515c4
parentfb7b15e54d6c6306755fc598d8de140236979400 (diff)
downloadpaludis-f51124da6d5dd1376c2c7963c59b7c63080bc5d3.tar.gz
paludis-f51124da6d5dd1376c2c7963c59b7c63080bc5d3.tar.xz
Fix environment test cases. Fixes: ticket:307
-rw-r--r--paludis/environments/paludis/Makefile.am5
-rw-r--r--paludis/environments/paludis/paludis_environment_TEST.cc123
-rwxr-xr-xpaludis/environments/paludis/paludis_environment_TEST_setup.sh7
-rw-r--r--paludis/environments/portage/Makefile.am4
-rw-r--r--paludis/environments/portage/portage_environment_TEST.cc109
-rwxr-xr-xpaludis/environments/portage/portage_environment_TEST_setup.sh20
6 files changed, 137 insertions, 131 deletions
diff --git a/paludis/environments/paludis/Makefile.am b/paludis/environments/paludis/Makefile.am
index 4106b32..e4fc51e 100644
--- a/paludis/environments/paludis/Makefile.am
+++ b/paludis/environments/paludis/Makefile.am
@@ -70,10 +70,9 @@ EXTRA_DIST = \
TESTS = paludis_environment_TEST
TESTS_ENVIRONMENT = env \
- PALUDIS_EBUILD_DIR="$(top_srcdir)/ebuild/" \
- PALUDIS_EAPIS_DIR="$(top_srcdir)/paludis/eapis/" \
+ PALUDIS_EBUILD_DIR="$(top_srcdir)/paludis/repositories/e/ebuild/" \
+ PALUDIS_EAPIS_DIR="$(top_srcdir)/paludis/repositories/e/eapis/" \
PALUDIS_DISTRIBUTIONS_DIR="$(top_srcdir)/paludis/distributions/" \
- PALUDIS_DISTRIBUTION="gentoo" \
PALUDIS_SKIP_CONFIG="yes" \
PALUDIS_REPOSITORY_SO_DIR="$(top_builddir)/paludis/repositories" \
TEST_SCRIPT_DIR="$(srcdir)/" \
diff --git a/paludis/environments/paludis/paludis_environment_TEST.cc b/paludis/environments/paludis/paludis_environment_TEST.cc
index 911cd06..ed14d7e 100644
--- a/paludis/environments/paludis/paludis_environment_TEST.cc
+++ b/paludis/environments/paludis/paludis_environment_TEST.cc
@@ -20,6 +20,10 @@
#include "paludis_environment.hh"
#include "paludis_config.hh"
#include <paludis/util/fs_entry.hh>
+#include <paludis/util/sequence.hh>
+#include <paludis/util/set.hh>
+#include <paludis/query.hh>
+#include <paludis/package_id.hh>
#include <test/test_runner.hh>
#include <test/test_framework.hh>
#include <libwrapiter/libwrapiter_forward_iterator.hh>
@@ -37,31 +41,27 @@ namespace test_cases
void run()
{
-#if 0
setenv("PALUDIS_HOME", stringify(FSEntry::cwd() / "paludis_environment_TEST_dir" / "home1").c_str(), 1);
unsetenv("PALUDIS_SKIP_CONFIG");
tr1::shared_ptr<Environment> env(new PaludisEnvironment(""));
-
- PackageDatabaseEntry x(QualifiedPackageName("x/x"), VersionSpec("0"), RepositoryName("foo"));
- TEST_CHECK(env->query_use(UseFlagName("foo"), x));
- TEST_CHECK(! env->query_use(UseFlagName("foofoo"), x));
-
- 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"), 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));
- TEST_CHECK(env->query_use(UseFlagName("third_exp_two"), f));
-#endif
+ const tr1::shared_ptr<const PackageID> one(*env->package_database()->query(
+ query::Matches(PackageDepSpec("=cat-one/pkg-one-1", pds_pm_permissive)), qo_require_exactly_one)->begin());
+ const tr1::shared_ptr<const PackageID> three(*env->package_database()->query(
+ query::Matches(PackageDepSpec("=cat-one/pkg-two-3", pds_pm_permissive)), qo_require_exactly_one)->begin());
+
+ TEST_CHECK(env->query_use(UseFlagName("foo"), *one));
+ TEST_CHECK(! env->query_use(UseFlagName("foofoo"), *one));
+ TEST_CHECK(env->query_use(UseFlagName("moo"), *one));
+
+ TEST_CHECK(env->query_use(UseFlagName("more_exp_one"), *one));
+ TEST_CHECK(env->query_use(UseFlagName("exp_two"), *one));
+ TEST_CHECK(env->query_use(UseFlagName("exp_one"), *one));
+ TEST_CHECK(env->query_use(UseFlagName("third_exp_one"), *one));
+ TEST_CHECK(! env->query_use(UseFlagName("third_exp_two"), *one));
+
+ TEST_CHECK(env->query_use(UseFlagName("third_exp_one"), *three));
+ TEST_CHECK(env->query_use(UseFlagName("third_exp_two"), *three));
}
} paludis_environment_use_test;
@@ -71,16 +71,15 @@ namespace test_cases
void run()
{
-#if 0
setenv("PALUDIS_HOME", stringify(FSEntry::cwd() / "paludis_environment_TEST_dir" / "home5").c_str(), 1);
unsetenv("PALUDIS_SKIP_CONFIG");
tr1::shared_ptr<Environment> env(new PaludisEnvironment(""));
- PackageDatabaseEntry pde1(QualifiedPackageName("cat/one"), VersionSpec("1"), RepositoryName("foo"));
- tr1::shared_ptr<const UseFlagNameCollection> k1(env->known_use_expand_names(UseFlagName("foo_cards"), pde1));
+ const tr1::shared_ptr<const PackageID> one(*env->package_database()->query(
+ query::Matches(PackageDepSpec("=cat-one/pkg-one-1", pds_pm_permissive)), qo_require_exactly_one)->begin());
+ tr1::shared_ptr<const UseFlagNameSet> k1(env->known_use_expand_names(UseFlagName("foo_cards"), *one));
TEST_CHECK_EQUAL(join(k1->begin(), k1->end(), " "), "foo_cards_one foo_cards_three foo_cards_two");
-#endif
}
} paludis_environment_use_test_known;
@@ -90,31 +89,28 @@ namespace test_cases
void run()
{
-#if 0
setenv("PALUDIS_HOME", stringify(FSEntry::cwd() / "paludis_environment_TEST_dir" / "home2").c_str(), 1);
unsetenv("PALUDIS_SKIP_CONFIG");
tr1::shared_ptr<Environment> env(new PaludisEnvironment(""));
- PackageDatabaseEntry x(QualifiedPackageName("x/x"), VersionSpec("0"), RepositoryName("foo"));
- TEST_CHECK(env->query_use(UseFlagName("foo"), x));
- TEST_CHECK(! env->query_use(UseFlagName("foofoo"), x));
-
- 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"), 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));
- TEST_CHECK(env->query_use(UseFlagName("third_exp_two"), f));
-#endif
+ const tr1::shared_ptr<const PackageID> one(*env->package_database()->query(
+ query::Matches(PackageDepSpec("=cat-one/pkg-one-1", pds_pm_permissive)), qo_require_exactly_one)->begin());
+ const tr1::shared_ptr<const PackageID> three(*env->package_database()->query(
+ query::Matches(PackageDepSpec("=cat-one/pkg-two-3", pds_pm_permissive)), qo_require_exactly_one)->begin());
+
+ TEST_CHECK(env->query_use(UseFlagName("foo"), *one));
+ TEST_CHECK(! env->query_use(UseFlagName("foofoo"), *one));
+ TEST_CHECK(! env->query_use(UseFlagName("moo"), *one));
+
+ TEST_CHECK(env->query_use(UseFlagName("more_exp_one"), *one));
+ TEST_CHECK(env->query_use(UseFlagName("exp_two"), *one));
+ TEST_CHECK(! env->query_use(UseFlagName("exp_one"), *one));
+ TEST_CHECK(env->query_use(UseFlagName("third_exp_one"), *one));
+ TEST_CHECK(! env->query_use(UseFlagName("third_exp_two"), *one));
+
+ TEST_CHECK(! env->query_use(UseFlagName("third_exp_one"), *three));
+ TEST_CHECK(env->query_use(UseFlagName("third_exp_two"), *three));
}
} paludis_environment_use_test_minus_star;
@@ -124,31 +120,28 @@ namespace test_cases
void run()
{
-#if 0
setenv("PALUDIS_HOME", stringify(FSEntry::cwd() / "paludis_environment_TEST_dir" / "home3").c_str(), 1);
unsetenv("PALUDIS_SKIP_CONFIG");
tr1::shared_ptr<Environment> env(new PaludisEnvironment(""));
- PackageDatabaseEntry x(QualifiedPackageName("x/x"), VersionSpec("0"), RepositoryName("foo"));
- TEST_CHECK(env->query_use(UseFlagName("foo"), x));
- TEST_CHECK(! env->query_use(UseFlagName("foofoo"), x));
-
- 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"), 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));
- TEST_CHECK(env->query_use(UseFlagName("third_exp_two"), f));
-#endif
+ const tr1::shared_ptr<const PackageID> one(*env->package_database()->query(
+ query::Matches(PackageDepSpec("=cat-one/pkg-one-1", pds_pm_permissive)), qo_require_exactly_one)->begin());
+ const tr1::shared_ptr<const PackageID> three(*env->package_database()->query(
+ query::Matches(PackageDepSpec("=cat-one/pkg-two-3", pds_pm_permissive)), qo_require_exactly_one)->begin());
+
+ TEST_CHECK(env->query_use(UseFlagName("foo"), *one));
+ TEST_CHECK(! env->query_use(UseFlagName("foofoo"), *one));
+ TEST_CHECK(env->query_use(UseFlagName("moo"), *one));
+
+ TEST_CHECK(env->query_use(UseFlagName("more_exp_one"), *one));
+ TEST_CHECK(env->query_use(UseFlagName("exp_two"), *one));
+ TEST_CHECK(! env->query_use(UseFlagName("exp_one"), *one));
+ TEST_CHECK(env->query_use(UseFlagName("third_exp_one"), *one));
+ TEST_CHECK(! env->query_use(UseFlagName("third_exp_two"), *one));
+
+ TEST_CHECK(! env->query_use(UseFlagName("third_exp_one"), *three));
+ TEST_CHECK(env->query_use(UseFlagName("third_exp_two"), *three));
}
} paludis_environment_use_test_minus_star_partial;
diff --git a/paludis/environments/paludis/paludis_environment_TEST_setup.sh b/paludis/environments/paludis/paludis_environment_TEST_setup.sh
index 68a2685..7c39a64 100755
--- a/paludis/environments/paludis/paludis_environment_TEST_setup.sh
+++ b/paludis/environments/paludis/paludis_environment_TEST_setup.sh
@@ -4,7 +4,7 @@
mkdir paludis_environment_TEST_dir || exit 2
cd paludis_environment_TEST_dir || exit 3
-mkdir -p repo/{profile,profiles,cat-one/pkg-one}
+mkdir -p repo/{profile,profiles,cat-one/pkg-one,cat-one/pkg-two}
cat <<END > repo/profiles/repo_name
foo
END
@@ -19,6 +19,8 @@ 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
mkdir -p firstrepo/profiles
cat <<END > firstrepo/profiles/repo_name
@@ -54,6 +56,7 @@ USE="foo_c"
USE_EXPAND="FOO_CARDS"
FOO_CARDS="four"
END
+touch sixthrepo/cat-one/pkg-one/pkg-one-1.ebuild || exit 4
mkdir -p home1/.paludis/repositories
cat <<END > home1/.paludis/use.conf
@@ -172,7 +175,7 @@ END
mkdir -p home5/.paludis/repositories
cat <<END > home5/.paludis/use.conf
*/* foo FOO_CARDS: one
-cat/one FOO_CARDS: -two three
+cat-one/pkg-one FOO_CARDS: -two three
END
cat <<END > home5/.paludis/keywords.conf
*/* keyword
diff --git a/paludis/environments/portage/Makefile.am b/paludis/environments/portage/Makefile.am
index c21ab73..a18260a 100644
--- a/paludis/environments/portage/Makefile.am
+++ b/paludis/environments/portage/Makefile.am
@@ -42,9 +42,9 @@ EXTRA_DIST = \
TESTS = portage_environment_TEST
TESTS_ENVIRONMENT = env \
- PALUDIS_EBUILD_DIR="$(top_srcdir)/ebuild/" \
+ PALUDIS_EBUILD_DIR="$(top_srcdir)/paludis/repositories/e/ebuild/" \
PALUDIS_SKIP_CONFIG="yes" \
- PALUDIS_EAPIS_DIR="$(top_srcdir)/paludis/eapis/" \
+ PALUDIS_EAPIS_DIR="$(top_srcdir)/paludis/repositories/e/eapis/" \
PALUDIS_DISTRIBUTIONS_DIR="$(top_srcdir)/paludis/distributions/" \
PALUDIS_DISTRIBUTION="gentoo" \
PALUDIS_REPOSITORY_SO_DIR="$(top_builddir)/paludis/repositories" \
diff --git a/paludis/environments/portage/portage_environment_TEST.cc b/paludis/environments/portage/portage_environment_TEST.cc
index 19706ec..8a7860f 100644
--- a/paludis/environments/portage/portage_environment_TEST.cc
+++ b/paludis/environments/portage/portage_environment_TEST.cc
@@ -21,6 +21,13 @@
#include <test/test_runner.hh>
#include <test/test_framework.hh>
#include <paludis/util/join.hh>
+#include <paludis/util/set.hh>
+#include <paludis/util/sequence.hh>
+#include <paludis/package_id.hh>
+#include <paludis/query.hh>
+#include <paludis/package_database.hh>
+#include <paludis/dep_spec.hh>
+#include <paludis/name.hh>
#include <libwrapiter/libwrapiter_forward_iterator.hh>
#include <libwrapiter/libwrapiter_output_iterator.hh>
@@ -41,15 +48,13 @@ namespace
}
};
-#if 0
bool accept_keyword(const TestPortageEnvironment & env,
- const KeywordName & k, const PackageDatabaseEntry & e)
+ const KeywordName & k, const PackageID & e)
{
- tr1::shared_ptr<KeywordNameCollection> kk(new KeywordNameCollection::Concrete);
+ tr1::shared_ptr<KeywordNameSet> kk(new KeywordNameSet);
kk->insert(k);
return env.accept_keywords(kk, e);
}
-#endif
}
namespace test_cases
@@ -60,26 +65,25 @@ namespace test_cases
void run()
{
-#if 0
PortageEnvironment env("portage_environment_TEST_dir/query_use");
- PackageDatabaseEntry x(QualifiedPackageName("x/x"), VersionSpec("0"), RepositoryName("repo"));
+ const tr1::shared_ptr<const PackageID> idx(*env.package_database()->query(
+ query::Matches(PackageDepSpec("=cat-one/pkg-x-1", pds_pm_permissive)), qo_require_exactly_one)->begin());
- TEST_CHECK(env.query_use(UseFlagName("one"), x));
- TEST_CHECK(env.query_use(UseFlagName("two"), x));
- TEST_CHECK(! env.query_use(UseFlagName("three"), x));
- TEST_CHECK(! env.query_use(UseFlagName("four"), x));
- TEST_CHECK(! env.query_use(UseFlagName("five"), x));
+ const tr1::shared_ptr<const PackageID> id1(*env.package_database()->query(
+ query::Matches(PackageDepSpec("=cat-one/pkg-one-1", pds_pm_permissive)), qo_require_exactly_one)->begin());
- PackageDatabaseEntry d(QualifiedPackageName("app/one"), VersionSpec("1"),
- RepositoryName("repo"));
+ TEST_CHECK(env.query_use(UseFlagName("one"), *idx));
+ TEST_CHECK(env.query_use(UseFlagName("two"), *idx));
+ TEST_CHECK(! env.query_use(UseFlagName("three"), *idx));
+ TEST_CHECK(! env.query_use(UseFlagName("four"), *idx));
+ TEST_CHECK(! env.query_use(UseFlagName("five"), *idx));
- TEST_CHECK(! env.query_use(UseFlagName("one"), d));
- TEST_CHECK(env.query_use(UseFlagName("two"), d));
- TEST_CHECK(! env.query_use(UseFlagName("three"), d));
- TEST_CHECK(env.query_use(UseFlagName("four"), d));
- TEST_CHECK(! env.query_use(UseFlagName("five"), d));
-#endif
+ TEST_CHECK(! env.query_use(UseFlagName("one"), *id1));
+ TEST_CHECK(env.query_use(UseFlagName("two"), *id1));
+ TEST_CHECK(! env.query_use(UseFlagName("three"), *id1));
+ TEST_CHECK(env.query_use(UseFlagName("four"), *id1));
+ TEST_CHECK(! env.query_use(UseFlagName("five"), *id1));
}
} test_query_use;
@@ -89,13 +93,12 @@ namespace test_cases
void run()
{
-#if 0
PortageEnvironment env("portage_environment_TEST_dir/known_use_expand_names");
- PackageDatabaseEntry pde1(QualifiedPackageName("app/one"), VersionSpec("1"), RepositoryName("foo"));
- tr1::shared_ptr<const UseFlagNameCollection> k1(env.known_use_expand_names(UseFlagName("foo_cards"), pde1));
+ const tr1::shared_ptr<const PackageID> id1(*env.package_database()->query(
+ query::Matches(PackageDepSpec("=cat-one/pkg-one-1", pds_pm_permissive)), qo_require_exactly_one)->begin());
+ tr1::shared_ptr<const UseFlagNameSet> k1(env.known_use_expand_names(UseFlagName("foo_cards"), *id1));
TEST_CHECK_EQUAL(join(k1->begin(), k1->end(), " "), "foo_cards_one foo_cards_three");
-#endif
}
} test_known_use_expand;
@@ -105,37 +108,39 @@ namespace test_cases
void run()
{
-#if 0
TestPortageEnvironment env("portage_environment_TEST_dir/accept_keywords");
- PackageDatabaseEntry x(QualifiedPackageName("x/x"), VersionSpec("0"), RepositoryName("repo"));
-
- TEST_CHECK(accept_keyword(env, KeywordName("arch"), x));
- TEST_CHECK(accept_keyword(env, KeywordName("other_arch"), x));
- TEST_CHECK(! accept_keyword(env, KeywordName("~arch"), x));
-
- PackageDatabaseEntry d1(QualifiedPackageName("app/one"), VersionSpec("1"),
- RepositoryName("repo"));
- TEST_CHECK(accept_keyword(env, KeywordName("arch"), d1));
- TEST_CHECK(accept_keyword(env, KeywordName("other_arch"), d1));
- TEST_CHECK(accept_keyword(env, KeywordName("~arch"), d1));
-
- PackageDatabaseEntry d2(QualifiedPackageName("app/two"), VersionSpec("1"),
- RepositoryName("repo"));
- TEST_CHECK(accept_keyword(env, KeywordName("other_arch"), d2));
- TEST_CHECK(accept_keyword(env, KeywordName("arch"), d2));
- TEST_CHECK(accept_keyword(env, KeywordName("~arch"), d2));
-
- PackageDatabaseEntry d3(QualifiedPackageName("app/three"), VersionSpec("1"),
- RepositoryName("repo"));
- TEST_CHECK(! accept_keyword(env, KeywordName("other_arch"), d3));
- TEST_CHECK(! accept_keyword(env, KeywordName("arch"), d3));
- TEST_CHECK(! accept_keyword(env, KeywordName("~arch"), d3));
-
- PackageDatabaseEntry d4(QualifiedPackageName("app/four"), VersionSpec("1"),
- RepositoryName("repo"));
- TEST_CHECK(accept_keyword(env, KeywordName("fred"), d4));
-#endif
+ const tr1::shared_ptr<const PackageID> idx(*env.package_database()->query(
+ query::Matches(PackageDepSpec("=cat-one/pkg-x-1", pds_pm_permissive)), qo_require_exactly_one)->begin());
+
+ TEST_CHECK(accept_keyword(env, KeywordName("arch"), *idx));
+ TEST_CHECK(accept_keyword(env, KeywordName("other_arch"), *idx));
+ TEST_CHECK(! accept_keyword(env, KeywordName("~arch"), *idx));
+
+ const tr1::shared_ptr<const PackageID> id1(*env.package_database()->query(
+ query::Matches(PackageDepSpec("=cat-one/pkg-one-1", pds_pm_permissive)), qo_require_exactly_one)->begin());
+
+ TEST_CHECK(accept_keyword(env, KeywordName("arch"), *id1));
+ TEST_CHECK(accept_keyword(env, KeywordName("other_arch"), *id1));
+ TEST_CHECK(accept_keyword(env, KeywordName("~arch"), *id1));
+
+ const tr1::shared_ptr<const PackageID> id2(*env.package_database()->query(
+ query::Matches(PackageDepSpec("=cat-one/pkg-two-1", pds_pm_permissive)), qo_require_exactly_one)->begin());
+
+ TEST_CHECK(accept_keyword(env, KeywordName("other_arch"), *id2));
+ TEST_CHECK(accept_keyword(env, KeywordName("arch"), *id2));
+ TEST_CHECK(accept_keyword(env, KeywordName("~arch"), *id2));
+
+ const tr1::shared_ptr<const PackageID> id3(*env.package_database()->query(
+ query::Matches(PackageDepSpec("=cat-one/pkg-three-1", pds_pm_permissive)), qo_require_exactly_one)->begin());
+
+ TEST_CHECK(! accept_keyword(env, KeywordName("other_arch"), *id3));
+ TEST_CHECK(! accept_keyword(env, KeywordName("arch"), *id3));
+ TEST_CHECK(! accept_keyword(env, KeywordName("~arch"), *id3));
+
+ const tr1::shared_ptr<const PackageID> id4(*env.package_database()->query(
+ query::Matches(PackageDepSpec("=cat-one/pkg-four-1", pds_pm_permissive)), qo_require_exactly_one)->begin());
+ TEST_CHECK(accept_keyword(env, KeywordName("fred"), *id4));
}
} test_accept_keywords;
}
diff --git a/paludis/environments/portage/portage_environment_TEST_setup.sh b/paludis/environments/portage/portage_environment_TEST_setup.sh
index 77c7375..a6b9d74 100755
--- a/paludis/environments/portage/portage_environment_TEST_setup.sh
+++ b/paludis/environments/portage/portage_environment_TEST_setup.sh
@@ -13,10 +13,16 @@ FOO_CARDS="four"
USE="foo_c"
END
-mkdir -p repo/profiles
+mkdir -p repo/{profiles,cat-one/pkg-{one,two,three,four,x}}
cat <<"END" > repo/profiles/repo_name
repo
END
+echo cat-one > repo/profiles/categories
+touch repo/cat-one/pkg-one/pkg-one-1.ebuild || exit 4
+touch repo/cat-one/pkg-two/pkg-two-1.ebuild || exit 4
+touch repo/cat-one/pkg-three/pkg-three-1.ebuild || exit 4
+touch repo/cat-one/pkg-four/pkg-four-1.ebuild || exit 4
+touch repo/cat-one/pkg-x/pkg-x-1.ebuild || exit 4
mkdir -p query_use/${SYSCONFDIR}/portage
ln -s $(pwd )/profile query_use/${SYSCONFDIR}/make.profile
@@ -25,7 +31,7 @@ USE="one two -three"
PORTDIR="`pwd`/repo"
END
cat <<"END" > query_use/${SYSCONFDIR}/portage/package.use
-app/one -one four
+cat-one/pkg-one -one four
END
mkdir -p accept_keywords/${SYSCONFDIR}/portage
@@ -36,10 +42,10 @@ PORTDIR="`pwd`/repo"
ACCEPT_KEYWORDS="other_arch"
END
cat <<"END" > accept_keywords/${SYSCONFDIR}/portage/package.keywords
-app/one ~arch
-app/two
-app/three -*
-app/four **
+cat-one/pkg-one ~arch
+cat-one/pkg-two
+cat-one/pkg-three -*
+cat-one/pkg-four **
END
mkdir -p known_use_expand_names/${SYSCONFDIR}/portage
@@ -51,6 +57,6 @@ 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
+cat-one/pkg-one -foo_cards_two foo_cards_three
END