aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2008-05-20 15:37:59 +0000
committerAvatar David Leverton <levertond@googlemail.com> 2008-05-20 15:37:59 +0000
commit13a97ef3b132a134e8582fa54105e2853ac75a57 (patch)
treecf86b5616c5e0c8c9d6b0c5a4ac7c87db19c05fd
parent469846ab1baec8a1328c8bc3ac54d82bb76494ed (diff)
downloadpaludis-13a97ef3b132a134e8582fa54105e2853ac75a57.tar.gz
paludis-13a97ef3b132a134e8582fa54105e2853ac75a57.tar.xz
Fix symlink rewriting for when builddir contains symlinks. Fixes: ticket:571
-rw-r--r--paludis/repositories/e/e_repository_TEST.cc62
-rwxr-xr-xpaludis/repositories/e/e_repository_TEST_setup.sh24
-rw-r--r--paludis/repositories/e/make_ebuild_repository.cc2
3 files changed, 87 insertions, 1 deletions
diff --git a/paludis/repositories/e/e_repository_TEST.cc b/paludis/repositories/e/e_repository_TEST.cc
index d146685..eb1cca0 100644
--- a/paludis/repositories/e/e_repository_TEST.cc
+++ b/paludis/repositories/e/e_repository_TEST.cc
@@ -21,6 +21,7 @@
#include <paludis/repositories/e/e_repository_exceptions.hh>
#include <paludis/repositories/e/e_repository_id.hh>
#include <paludis/repositories/e/make_ebuild_repository.hh>
+#include <paludis/repositories/e/vdb_repository.hh>
#include <paludis/repositories/e/eapi.hh>
#include <paludis/repositories/e/dep_spec_pretty_printer.hh>
#include <paludis/repositories/fake/fake_installed_repository.hh>
@@ -1689,5 +1690,66 @@ namespace test_cases
TEST_CHECK_STRINGIFY_EQUAL(pp, "build: build,run: suggested: post: cat/pkg5");
}
} test_e_repository_dependencies_rewriter;
+
+ struct ERepositorySymlinkRewritingTest : TestCase
+ {
+ ERepositorySymlinkRewritingTest() : TestCase("symlink_rewriting") { }
+
+ unsigned max_run_time() const
+ {
+ return 3000;
+ }
+
+ bool repeatable() const
+ {
+ return false;
+ }
+
+ void run()
+ {
+ TestEnvironment env;
+ env.set_paludis_command("/bin/false");
+
+ std::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/repo20");
+ keys->insert("profiles", "e_repository_TEST_dir/repo20/profiles/profile");
+ keys->insert("layout", "traditional");
+ keys->insert("eapi_when_unknown", "0");
+ keys->insert("eapi_when_unspecified", "0");
+ keys->insert("profile_eapi", "0");
+ keys->insert("distdir", stringify(FSEntry::cwd() / "e_repository_TEST_dir" / "distdir"));
+ keys->insert("builddir", stringify(FSEntry::cwd() / "e_repository_TEST_dir" / "symlinked_build"));
+ keys->insert("root", stringify(FSEntry("e_repository_TEST_dir/root").realpath()));
+ std::tr1::shared_ptr<ERepository> repo(make_ebuild_repository(&env, keys));
+ env.package_database()->add_repository(1, repo);
+
+ keys.reset(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", "e_repository_TEST_dir/vdb");
+ keys->insert("builddir", stringify(FSEntry::cwd() / "e_repository_TEST_dir" / "build"));
+ keys->insert("root", stringify(FSEntry("e_repository_TEST_dir/root").realpath()));
+ std::tr1::shared_ptr<Repository> installed_repo(VDBRepository::make_vdb_repository(&env, keys));
+ env.package_database()->add_repository(1, installed_repo);
+
+ InstallAction action(InstallActionOptions::named_create()
+ (k::debug_build(), iado_none)
+ (k::checks(), iaco_default)
+ (k::no_config_protect(), false)
+ (k::destination(), installed_repo)
+ );
+
+ const std::tr1::shared_ptr<const PackageID> id(*env.package_database()->query(query::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("cat/pkg",
+ UserPackageDepSpecOptions()))), qo_require_exactly_one)->last());
+ TEST_CHECK(id);
+
+ id->perform_action(action);
+ TEST_CHECK_EQUAL(FSEntry("e_repository_TEST_dir/root/bar").readlink(), "/foo");
+ }
+ } test_e_repository_symlink_rewriting;
}
diff --git a/paludis/repositories/e/e_repository_TEST_setup.sh b/paludis/repositories/e/e_repository_TEST_setup.sh
index f2f1b94..666c067 100755
--- a/paludis/repositories/e/e_repository_TEST_setup.sh
+++ b/paludis/repositories/e/e_repository_TEST_setup.sh
@@ -4,10 +4,13 @@
mkdir e_repository_TEST_dir || exit 1
cd e_repository_TEST_dir || exit 1
+mkdir -p root/etc
+
mkdir -p vdb
touch vdb/THISISTHEVDB
mkdir -p build
+ln -s build symlinked_build
mkdir -p distdir
echo "already fetched" > distdir/already-fetched.txt || exit 1
@@ -1278,5 +1281,26 @@ KEYWORDS="test"
END
cd ..
+mkdir -p repo20/{eclass,distfiles,profiles/profile} || exit 1
+mkdir -p repo20/cat/pkg || exit 1
+cd repo20 || exit 1
+echo "test-repo-20" >> profiles/repo_name || exit 1
+echo "cat" >> profiles/categories || exit 1
+cat <<END > profiles/profile/make.defaults
+ARCH=test
+USERLAND="GNU"
+KERNEL="linux"
+LIBC="glibc"
+CHOST="i286-badger-linux-gnu"
+END
+cat <<END > cat/pkg/pkg-1.ebuild || exit 1
+SLOT="0"
+PLATFORMS="test"
+src_install() {
+ ln -s "\${D}/foo" "\${D}/bar" || die
+}
+END
+cd ..
+
cd ..
diff --git a/paludis/repositories/e/make_ebuild_repository.cc b/paludis/repositories/e/make_ebuild_repository.cc
index ba26d67..345845f 100644
--- a/paludis/repositories/e/make_ebuild_repository.cc
+++ b/paludis/repositories/e/make_ebuild_repository.cc
@@ -301,7 +301,7 @@ paludis::make_ebuild_repository(
.binary_uri_prefix(binary_uri_prefix)
.binary_distdir(binary_distdir)
.binary_keywords(binary_keywords)
- .builddir(builddir)));
+ .builddir(FSEntry(builddir).realpath())));
}
std::tr1::shared_ptr<Repository>