aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Fernando J. Pereda <ferdy@ferdyx.org> 2007-02-20 18:01:42 +0000
committerAvatar Fernando J. Pereda <ferdy@ferdyx.org> 2007-02-20 18:01:42 +0000
commit8d1975d4ae88a0c11360206d5840450a3f3f2049 (patch)
tree55a7c4cb64efb148de9178c6438899d1f5f0aaa6
parent0519308d3fd7a06806458547018255a739eed709 (diff)
downloadpaludis-8d1975d4ae88a0c11360206d5840450a3f3f2049.tar.gz
paludis-8d1975d4ae88a0c11360206d5840450a3f3f2049.tar.xz
Add PN and friends to VDB merge hooks. Fixes ticket:88
-rw-r--r--paludis/repositories/gentoo/vdb_merger.cc24
-rw-r--r--paludis/repositories/gentoo/vdb_merger.hh4
-rw-r--r--paludis/repositories/gentoo/vdb_merger.sr1
-rw-r--r--paludis/repositories/gentoo/vdb_repository.cc3
4 files changed, 31 insertions, 1 deletions
diff --git a/paludis/repositories/gentoo/vdb_merger.cc b/paludis/repositories/gentoo/vdb_merger.cc
index 8ad3786..d987c40 100644
--- a/paludis/repositories/gentoo/vdb_merger.cc
+++ b/paludis/repositories/gentoo/vdb_merger.cc
@@ -21,6 +21,7 @@
#include <paludis/util/log.hh>
#include <paludis/util/tokeniser.hh>
#include <paludis/digests/md5.hh>
+#include <paludis/environment.hh>
#include <fstream>
#include <iostream>
#include <iomanip>
@@ -65,6 +66,29 @@ VDBMerger::~VDBMerger()
{
}
+Hook
+VDBMerger::extend_hook(const Hook & h)
+{
+ const PackageDatabaseEntry *pde(_imp->options.package);
+ std::string cat(stringify(pde->name.category));
+ std::string pn(stringify(pde->name.package));
+ std::string pvr(stringify(pde->version));
+ std::string pv(stringify(pde->version.remove_revision()));
+ std::string slot(stringify(
+ _imp->options.environment->package_database()->fetch_repository(
+ pde->repository)->version_metadata(pde->name, pde->version)->slot));
+
+ return Merger::extend_hook(h)
+ ("P", pn + "-" + pv)
+ ("PN", pn)
+ ("CATEGORY", cat)
+ ("PR", pde->version.revision_only())
+ ("PV", pv)
+ ("PVR", pvr)
+ ("PF", pn + "-" + pvr)
+ ("SLOT", slot);
+}
+
void
VDBMerger::record_install_file(const FSEntry & src, const FSEntry & dst_dir, const std::string & dst_name)
{
diff --git a/paludis/repositories/gentoo/vdb_merger.hh b/paludis/repositories/gentoo/vdb_merger.hh
index b9269cf..d3f8eb9 100644
--- a/paludis/repositories/gentoo/vdb_merger.hh
+++ b/paludis/repositories/gentoo/vdb_merger.hh
@@ -25,6 +25,8 @@
namespace paludis
{
+ class PackageDatabaseEntry;
+ class Hook;
#include <paludis/repositories/gentoo/vdb_merger-sr.hh>
@@ -39,6 +41,8 @@ namespace paludis
VDBMerger(const VDBMergerOptions &);
~VDBMerger();
+ virtual Hook extend_hook(const Hook &);
+
virtual void record_install_file(const FSEntry &, const FSEntry &, const std::string &);
virtual void record_install_dir(const FSEntry &, const FSEntry &);
virtual void record_install_sym(const FSEntry &, const FSEntry &);
diff --git a/paludis/repositories/gentoo/vdb_merger.sr b/paludis/repositories/gentoo/vdb_merger.sr
index 1de74c6..7e04b84 100644
--- a/paludis/repositories/gentoo/vdb_merger.sr
+++ b/paludis/repositories/gentoo/vdb_merger.sr
@@ -9,6 +9,7 @@ make_class_VDBMergerOptions()
key contents_file "FSEntry"
key config_protect std::string
key config_protect_mask std::string
+ key package "const PackageDatabaseEntry *"
allow_named_args
diff --git a/paludis/repositories/gentoo/vdb_repository.cc b/paludis/repositories/gentoo/vdb_repository.cc
index 108f6de..9d7e1f0 100644
--- a/paludis/repositories/gentoo/vdb_repository.cc
+++ b/paludis/repositories/gentoo/vdb_repository.cc
@@ -1645,7 +1645,8 @@ VDBRepository::merge(const MergeOptions & m)
.root(root())
.contents_file(vdb_dir / "CONTENTS")
.config_protect(config_protect)
- .config_protect_mask(config_protect_mask));
+ .config_protect_mask(config_protect_mask)
+ .package(&m.package));
if (! merger.check())
throw PackageInstallActionError("Not proceeding with install due to merge sanity check failing");