aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Danny van Dyk <dvandyk@exherbo.org> 2006-12-01 23:42:22 +0000
committerAvatar Danny van Dyk <dvandyk@exherbo.org> 2006-12-01 23:42:22 +0000
commit8ad318a237b9404600a420b878302b21fd332f8a (patch)
treed2a055e94df19d1e8285ee7c76d4a057d5b803c7
parentd8d3cc16a89eb8890dc0e7b7e3edca3ec1589372 (diff)
downloadpaludis-8ad318a237b9404600a420b878302b21fd332f8a.tar.gz
paludis-8ad318a237b9404600a420b878302b21fd332f8a.tar.xz
Updated CRANInstalledRepository to provide the name of the source repository.
-rw-r--r--cran/cran.bash1
-rw-r--r--paludis/repositories/cran/cran_installed_repository.cc31
-rw-r--r--paludis/repositories/cran/cran_repository.cc2
3 files changed, 33 insertions, 1 deletions
diff --git a/cran/cran.bash b/cran/cran.bash
index 6267e8a..7a2e18b 100644
--- a/cran/cran.bash
+++ b/cran/cran.bash
@@ -134,6 +134,7 @@ cran_do_merge() {
&& rm -f "${IMAGE}/${PALUDIS_CRAN_LIBRARY##${ROOT}}/R.css"
mkdir -p "${PALUDIS_CRAN_LIBRARY}/paludis/${PN}"
${PALUDIS_EBUILD_DIR}/utils/merge "${IMAGE}" "${ROOT}" "${PALUDIS_CRAN_LIBRARY}/paludis/${PN}/CONTENTS"
+ echo ${REPOSITORY} > "${PALUDIS_CRAN_LIBRARY}/paludis/${PN}/REPOSITORY"
}
cran_do_unmerge() {
diff --git a/paludis/repositories/cran/cran_installed_repository.cc b/paludis/repositories/cran/cran_installed_repository.cc
index e5a2802..9c62530 100644
--- a/paludis/repositories/cran/cran_installed_repository.cc
+++ b/paludis/repositories/cran/cran_installed_repository.cc
@@ -267,6 +267,32 @@ CRANInstalledRepository::do_has_version(const QualifiedPackageName & q,
return versions->end() != versions->find(v);
}
+namespace
+{
+ /**
+ * Fetch the contents of a VDB file.
+ *
+ * \ingroup grpcranrepository
+ */
+ std::string
+ file_contents(const FSEntry & location, const QualifiedPackageName & name,
+ const std::string & key)
+ {
+ Context context("When loading metadata for '" + stringify(name)
+ + "' key '" + key + "' from '" + stringify(location) + "':");
+
+ FSEntry f(location / stringify(name.package));
+ if (! (f / key).is_regular_file())
+ return "";
+
+ std::ifstream ff(stringify(f / key).c_str());
+ if (! ff)
+ throw InternalError("CRANInstalledRepository", "Could not read '" + stringify(f / key) + "'");
+ return strip_leading(strip_trailing(std::string((std::istreambuf_iterator<char>(ff)),
+ std::istreambuf_iterator<char>()), " \t\n"), " \t\n");
+ }
+}
+
VersionMetadata::ConstPointer
CRANInstalledRepository::do_version_metadata(
const QualifiedPackageName & q, const VersionSpec & v) const
@@ -290,6 +316,11 @@ CRANInstalledRepository::do_version_metadata(
if (d.is_regular_file())
{
CRANDescription description(stringify(q.package), d);
+ // Don't put this into CRANDescription, as it's only relevant to CRANInstalledRepository
+ std::string repo(file_contents(_imp->location, q, "REPOSITORY"));
+ if (! repo.empty())
+ description.metadata->origins.source.assign(new PackageDatabaseEntry(stringify(q.package), v,
+ RepositoryName(repo)));
result = description.metadata;
}
else
diff --git a/paludis/repositories/cran/cran_repository.cc b/paludis/repositories/cran/cran_repository.cc
index 4c7dd76..1e3c8fd 100644
--- a/paludis/repositories/cran/cran_repository.cc
+++ b/paludis/repositories/cran/cran_repository.cc
@@ -562,7 +562,7 @@ CRANRepository::do_install(const QualifiedPackageName &q, const VersionSpec &vn,
cmd = cmd("PALUDIS_BASHRC_FILES", _imp->env->bashrc_files());
cmd = cmd("ROOT", stringify(_imp->root));
cmd = cmd("WORKDIR", workdir);
-
+ cmd = cmd("REPOSITORY", stringify(name()));
if (0 != run_command(cmd))
throw PackageInstallActionError("Couldn't merge '" + stringify(q) + "-" + stringify(vn) + "' to '" +