aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Paul Mulders <info@mld.demon.nl> 2010-03-06 14:42:12 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-03-06 14:09:28 +0000
commit333bb718dbc63b2a335348300e20510229dcfd11 (patch)
treec01e7efc64d1cee8cedae0ef0c45e5dabb9c366a
parent4f64c70b09cd995fbd9cd2b36f59f1164a0013c0 (diff)
downloadpaludis-333bb718dbc63b2a335348300e20510229dcfd11.tar.gz
paludis-333bb718dbc63b2a335348300e20510229dcfd11.tar.xz
Make user package dep spec smarter.
-rw-r--r--paludis/user_dep_spec.cc3
-rw-r--r--paludis/user_dep_spec_TEST.cc25
2 files changed, 19 insertions, 9 deletions
diff --git a/paludis/user_dep_spec.cc b/paludis/user_dep_spec.cc
index 3afc32c..8603a23 100644
--- a/paludis/user_dep_spec.cc
+++ b/paludis/user_dep_spec.cc
@@ -74,7 +74,8 @@ namespace
{
if (options[updso_no_disambiguation])
throw PackageDepSpecError("Need an explicit category specified");
- result.package(env->package_database()->fetch_unique_qualified_package_name(PackageNamePart(s), filter));
+ result.package(env->package_database()->fetch_unique_qualified_package_name(PackageNamePart(s),
+ filter::And(filter, filter::Matches(result, MatchPackageOptions()))));
}
}
diff --git a/paludis/user_dep_spec_TEST.cc b/paludis/user_dep_spec_TEST.cc
index bd33d08..05444af 100644
--- a/paludis/user_dep_spec_TEST.cc
+++ b/paludis/user_dep_spec_TEST.cc
@@ -344,16 +344,25 @@ namespace test_cases
TEST_CHECK_THROWS(parse_user_package_dep_spec("pkg5", &env, UserPackageDepSpecOptions() + updso_no_disambiguation), PackageDepSpecError);
- PackageDepSpec d(parse_user_package_dep_spec("=pkg1-42", &env, UserPackageDepSpecOptions()));
- TEST_CHECK_STRINGIFY_EQUAL(d, "=cat/pkg1-42");
- PackageDepSpec e(parse_user_package_dep_spec("=pkg1-42:0", &env, UserPackageDepSpecOptions()));
- TEST_CHECK_STRINGIFY_EQUAL(e, "=cat/pkg1-42:0");
+ PackageDepSpec d(parse_user_package_dep_spec("=pkg1-1", &env, UserPackageDepSpecOptions()));
+ TEST_CHECK_STRINGIFY_EQUAL(d, "=cat/pkg1-1");
+ TEST_CHECK_THROWS(parse_user_package_dep_spec("=pkg1-42", &env, UserPackageDepSpecOptions()), NoSuchPackageError);
+
+ PackageDepSpec e(parse_user_package_dep_spec("=pkg1-1:0", &env, UserPackageDepSpecOptions()));
+ TEST_CHECK_STRINGIFY_EQUAL(e, "=cat/pkg1-1:0");
+ TEST_CHECK_THROWS(parse_user_package_dep_spec("=pkg1-42:0", &env, UserPackageDepSpecOptions()), NoSuchPackageError);
+
PackageDepSpec f(parse_user_package_dep_spec("pkg1:0", &env, UserPackageDepSpecOptions()));
TEST_CHECK_STRINGIFY_EQUAL(f, "cat/pkg1:0");
- PackageDepSpec g(parse_user_package_dep_spec("pkg1[foo]", &env, UserPackageDepSpecOptions()));
- TEST_CHECK_STRINGIFY_EQUAL(g, "cat/pkg1[foo]");
- PackageDepSpec h(parse_user_package_dep_spec("pkg1[=42]", &env, UserPackageDepSpecOptions()));
- TEST_CHECK_STRINGIFY_EQUAL(h, "=cat/pkg1-42");
+
+ PackageDepSpec g(parse_user_package_dep_spec("pkg1[-foo]", &env, UserPackageDepSpecOptions()));
+ TEST_CHECK_STRINGIFY_EQUAL(g, "cat/pkg1[-foo]");
+ TEST_CHECK_THROWS(parse_user_package_dep_spec("pkg1[foo]", &env, UserPackageDepSpecOptions()), NoSuchPackageError);
+
+ PackageDepSpec h(parse_user_package_dep_spec("pkg1[=1]", &env, UserPackageDepSpecOptions()));
+ TEST_CHECK_STRINGIFY_EQUAL(h, "=cat/pkg1-1");
+ TEST_CHECK_THROWS(parse_user_package_dep_spec("pkg1[=42]", &env, UserPackageDepSpecOptions()), NoSuchPackageError);
+
PackageDepSpec i(parse_user_package_dep_spec("pkg1::fake", &env, UserPackageDepSpecOptions()));
TEST_CHECK_STRINGIFY_EQUAL(i, "cat/pkg1::fake");
}