aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2008-01-15 21:55:51 +0000
committerAvatar David Leverton <levertond@googlemail.com> 2008-01-15 21:55:51 +0000
commit46a67ade41a654b6951492cc5ec8b289310371a9 (patch)
treed501a031db5b520094ced93522dfa0a7277f0f66
parentdf29e5f6466db32b96f5fe2c9312afc27c7ccf82 (diff)
downloadpaludis-46a67ade41a654b6951492cc5ec8b289310371a9.tar.gz
paludis-46a67ade41a654b6951492cc5ec8b289310371a9.tar.xz
Fix DEPENDENCIES
-rw-r--r--paludis/repositories/e/e_repository_TEST.cc41
-rwxr-xr-xpaludis/repositories/e/e_repository_TEST_setup.sh16
-rw-r--r--paludis/repositories/e/ebuild.cc4
-rw-r--r--paludis/repositories/e/vdb_repository_TEST.cc43
-rwxr-xr-xpaludis/repositories/e/vdb_repository_TEST_setup.sh5
5 files changed, 107 insertions, 2 deletions
diff --git a/paludis/repositories/e/e_repository_TEST.cc b/paludis/repositories/e/e_repository_TEST.cc
index 0fe1f6d..5483376 100644
--- a/paludis/repositories/e/e_repository_TEST.cc
+++ b/paludis/repositories/e/e_repository_TEST.cc
@@ -1388,5 +1388,46 @@ namespace test_cases
TEST_CHECK_EQUAL(idc->size_of_all_distfiles_key()->value(), 22);
}
} test_e_repository_dist_size;
+
+ struct ERepositoryDependenciesRewriterTest : TestCase
+ {
+ ERepositoryDependenciesRewriterTest() : TestCase("dependencies_rewriter") { }
+
+ void run()
+ {
+ TestEnvironment env;
+ tr1::shared_ptr<Map<std::string, std::string> > keys(
+ new Map<std::string, std::string>);
+ keys->insert("format", "ebuild");
+ keys->insert("names_cache", "/var/empty");
+ keys->insert("location", "e_repository_TEST_dir/repo17");
+ keys->insert("profiles", "e_repository_TEST_dir/repo17/profiles/profile");
+ tr1::shared_ptr<ERepository> repo(make_ebuild_repository(
+ &env, keys));
+ env.package_database()->add_repository(1, repo);
+
+ const tr1::shared_ptr<const PackageID> id(*env.package_database()->
+ query(query::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("category/package",
+ UserPackageDepSpecOptions()))), qo_require_exactly_one)->last());
+
+ StringifyFormatter ff;
+
+ erepository::DepSpecPrettyPrinter pd(0, tr1::shared_ptr<const PackageID>(), ff, 0, false);
+ TEST_CHECK(id->build_dependencies_key());
+ id->build_dependencies_key()->value()->accept(pd);
+ TEST_CHECK_STRINGIFY_EQUAL(pd, "cat/pkg1 build: cat/pkg2 build,run: cat/pkg3 suggested: cat/pkg4 post:");
+
+ erepository::DepSpecPrettyPrinter pr(0, tr1::shared_ptr<const PackageID>(), ff, 0, false);
+ TEST_CHECK(id->run_dependencies_key());
+ id->run_dependencies_key()->value()->accept(pr);
+ TEST_CHECK_STRINGIFY_EQUAL(pr, "cat/pkg1 build: build,run: cat/pkg3 suggested: cat/pkg4 post:");
+
+ erepository::DepSpecPrettyPrinter pp(0, tr1::shared_ptr<const PackageID>(), ff, 0, false);
+ TEST_CHECK(id->post_dependencies_key());
+ id->post_dependencies_key()->value()->accept(pp);
+ TEST_CHECK_STRINGIFY_EQUAL(pp, "build: build,run: suggested: post: cat/pkg5");
+ }
+ } test_e_repository_dependencies_rewriter;
}
diff --git a/paludis/repositories/e/e_repository_TEST_setup.sh b/paludis/repositories/e/e_repository_TEST_setup.sh
index 864d127..e8cbbd7 100755
--- a/paludis/repositories/e/e_repository_TEST_setup.sh
+++ b/paludis/repositories/e/e_repository_TEST_setup.sh
@@ -969,5 +969,21 @@ cp Manifest category/package-c/
rm Manifest
cd ..
+mkdir -p repo17/{eclass,distfiles,profiles/profile} || exit 1
+mkdir -p repo17/category/package || exit 1
+cd repo17 || exit 1
+echo "test-repo-17" >> profiles/repo_name || exit 1
+echo "category" >> profiles/categories || exit 1
+cat <<END > profiles/profile/make.defaults
+ARCH=test
+END
+cat <<END > category/package/package-1.ebuild || exit 1
+EAPI="exheres-0"
+SLOT="0"
+PLATFORMS="test"
+DEPENDENCIES="cat/pkg1 build: cat/pkg2 build,run: cat/pkg3 suggested: cat/pkg4 post: cat/pkg5"
+END
+cd ..
+
cd ..
diff --git a/paludis/repositories/e/ebuild.cc b/paludis/repositories/e/ebuild.cc
index ccc7563..9a9cf24 100644
--- a/paludis/repositories/e/ebuild.cc
+++ b/paludis/repositories/e/ebuild.cc
@@ -370,8 +370,8 @@ EbuildMetadataCommand::load(const tr1::shared_ptr<const EbuildID> & id)
DependenciesRewriter rewriter;
parse_depend(get(keys, m.metadata_dependencies), *id->eapi(), id)->accept(rewriter);
id->load_build_depend(m.metadata_dependencies + ".DEPEND", m.description_dependencies + " (build)", rewriter.depend());
- id->load_build_depend(m.metadata_dependencies + ".RDEPEND", m.description_dependencies + " (run)", rewriter.rdepend());
- id->load_build_depend(m.metadata_dependencies + ".PDEPEND", m.description_dependencies + " (post)", rewriter.pdepend());
+ id->load_run_depend(m.metadata_dependencies + ".RDEPEND", m.description_dependencies + " (run)", rewriter.rdepend());
+ id->load_post_depend(m.metadata_dependencies + ".PDEPEND", m.description_dependencies + " (post)", rewriter.pdepend());
}
else
{
diff --git a/paludis/repositories/e/vdb_repository_TEST.cc b/paludis/repositories/e/vdb_repository_TEST.cc
index 7a7adf6..7704491 100644
--- a/paludis/repositories/e/vdb_repository_TEST.cc
+++ b/paludis/repositories/e/vdb_repository_TEST.cc
@@ -18,6 +18,7 @@
*/
#include <paludis/repositories/e/vdb_repository.hh>
+#include <paludis/repositories/e/dep_spec_pretty_printer.hh>
#include <paludis/environments/test/test_environment.hh>
#include <paludis/package_database.hh>
#include <paludis/metadata_key.hh>
@@ -26,6 +27,7 @@
#include <paludis/util/options.hh>
#include <paludis/query.hh>
#include <paludis/dep_spec.hh>
+#include <paludis/stringify_formatter.hh>
#include <test/test_framework.hh>
#include <test/test_runner.hh>
#include <fstream>
@@ -352,5 +354,46 @@ namespace test_cases
"miscellaneous\n/miscellaneous with consecutive spaces\n");
}
} vdb_repository_contents_test;
+
+ struct VDBRepositoryDependenciesRewriterTest : TestCase
+ {
+ VDBRepositoryDependenciesRewriterTest() : TestCase("dependencies_rewriter") { }
+
+ void run()
+ {
+ TestEnvironment env;
+ tr1::shared_ptr<Map<std::string, std::string> > keys(
+ new Map<std::string, std::string>);
+ keys->insert("format", "vdb");
+ keys->insert("names_cache", "/var/empty");
+ keys->insert("provides_cache", "/var/empty");
+ keys->insert("location", "vdb_repository_TEST_dir/repo2");
+ tr1::shared_ptr<Repository> repo(VDBRepository::make_vdb_repository(
+ &env, keys));
+ env.package_database()->add_repository(1, repo);
+
+ const tr1::shared_ptr<const PackageID> id(*env.package_database()->
+ query(query::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("category/package",
+ UserPackageDepSpecOptions()))), qo_require_exactly_one)->last());
+
+ StringifyFormatter ff;
+
+ erepository::DepSpecPrettyPrinter pd(0, tr1::shared_ptr<const PackageID>(), ff, 0, false);
+ TEST_CHECK(id->build_dependencies_key());
+ id->build_dependencies_key()->value()->accept(pd);
+ TEST_CHECK_STRINGIFY_EQUAL(pd, "cat/pkg1 build: cat/pkg2 build,run: cat/pkg3 suggested: cat/pkg4 post:");
+
+ erepository::DepSpecPrettyPrinter pr(0, tr1::shared_ptr<const PackageID>(), ff, 0, false);
+ TEST_CHECK(id->run_dependencies_key());
+ id->run_dependencies_key()->value()->accept(pr);
+ TEST_CHECK_STRINGIFY_EQUAL(pr, "cat/pkg1 build: build,run: cat/pkg3 suggested: cat/pkg4 post:");
+
+ erepository::DepSpecPrettyPrinter pp(0, tr1::shared_ptr<const PackageID>(), ff, 0, false);
+ TEST_CHECK(id->post_dependencies_key());
+ id->post_dependencies_key()->value()->accept(pp);
+ TEST_CHECK_STRINGIFY_EQUAL(pp, "build: build,run: suggested: post: cat/pkg5");
+ }
+ } test_vdb_repository_dependencies_rewriter;
}
diff --git a/paludis/repositories/e/vdb_repository_TEST_setup.sh b/paludis/repositories/e/vdb_repository_TEST_setup.sh
index b208d1f..0991c5e 100755
--- a/paludis/repositories/e/vdb_repository_TEST_setup.sh
+++ b/paludis/repositories/e/vdb_repository_TEST_setup.sh
@@ -71,3 +71,8 @@ cat-one/bar
END
echo -n "cat-one/oink" >> world-no-match-no-eol
+mkdir -p repo2/category/package-1 || exit 1
+echo "exheres-0" >repo2/category/package-1/EAPI
+echo "0" >repo2/category/package-1/SLOT
+echo "cat/pkg1 build: cat/pkg2 build,run: cat/pkg3 suggested: cat/pkg4 post: cat/pkg5" >repo2/category/package-1/DEPENDENCIES
+