aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-05-01 16:25:45 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-05-01 16:25:45 +0000
commitf45f14a25ca3558b404fe6d4c38f54de147b94ac (patch)
tree830fad600d11468a2850e308576670462b903b85
parent482cb0bc467166d47bbdd86b1d78a44cc64681a9 (diff)
downloadpaludis-f45f14a25ca3558b404fe6d4c38f54de147b94ac.tar.gz
paludis-f45f14a25ca3558b404fe6d4c38f54de147b94ac.tar.xz
Allow hooks to have additional associated env vars. Provide said env vars where appropriate. Add a hook script for creating paludis.log entries.
-rw-r--r--hooks/Makefile.am.m489
-rwxr-xr-xhooks/log.bash86
-rw-r--r--paludis/default_environment.cc30
-rw-r--r--paludis/default_environment.hh2
-rw-r--r--paludis/environment.cc14
-rw-r--r--paludis/environment.hh37
-rw-r--r--paludis/test_environment.hh2
-rw-r--r--src/install.cc54
-rw-r--r--src/sync.cc12
-rw-r--r--src/uninstall.cc17
10 files changed, 287 insertions, 56 deletions
diff --git a/hooks/Makefile.am.m4 b/hooks/Makefile.am.m4
index b1cc297..1977ec7 100644
--- a/hooks/Makefile.am.m4
+++ b/hooks/Makefile.am.m4
@@ -12,7 +12,8 @@ installhookinstallallpostdir = $(libexecdir)/paludis/hooks/install_all_post
installhookcommonprog_SCRIPTS = \
gnu_info_index.bash \
- eselect_env_update.bash
+ eselect_env_update.bash \
+ log.bash
installhookinstallallpost_SCRIPTS = \
find_config_updates.bash
@@ -51,29 +52,105 @@ userhook(`sync_pre')
userhook(`sync_post')
userhook(`sync_all_pre')
userhook(`sync_all_post')
+userhook(`fetch_all_pre')
+userhook(`fetch_all_post')
+userhook(`fetch_all_all_pre')
+userhook(`fetch_all_all_post')
+userhook(`ebuild_metadata_pre')
+userhook(`ebuild_metadata_post')
+userhook(`ebuild_init_pre')
+userhook(`ebuild_init_post')
+userhook(`ebuild_fetch_pre')
+userhook(`ebuild_fetch_post')
+userhook(`ebuild_merge_pre')
+userhook(`ebuild_merge_post')
+userhook(`ebuild_unmerge_pre')
+userhook(`ebuild_unmerge_post')
+userhook(`ebuild_tidyup_pre')
+userhook(`ebuild_tidyup_post')
+userhook(`ebuild_strip_pre')
+userhook(`ebuild_strip_post')
+userhook(`ebuild_unpack_pre')
+userhook(`ebuild_unpack_post')
+userhook(`ebuild_compile_pre')
+userhook(`ebuild_compile_post')
+userhook(`ebuild_install_pre')
+userhook(`ebuild_install_post')
+userhook(`ebuild_test_pre')
+userhook(`ebuild_test_post')
+userhook(`ebuild_setup_pre')
+userhook(`ebuild_setup_post')
+userhook(`ebuild_config_pre')
+userhook(`ebuild_config_post')
+userhook(`ebuild_nofetch_pre')
+userhook(`ebuild_nofetch_post')
+userhook(`ebuild_preinst_pre')
+userhook(`ebuild_preinst_post')
+userhook(`ebuild_postinst_pre')
+userhook(`ebuild_postinst_post')
+userhook(`ebuild_prerm_pre')
+userhook(`ebuild_prerm_post')
+userhook(`ebuild_postrm_pre')
+userhook(`ebuild_postrm_post')
define(`systemhook', `
installsystemhooks$1dir = $(libexecdir)/paludis/hooks/$1
installsystemhooks$1_SCRIPTS = .keep')
+systemhook(`install_pre')
systemhook(`install_post')
+systemhook(`install_all_pre')
systemhook(`install_all_post')
+systemhook(`uninstall_pre')
+systemhook(`uninstall_post')
+systemhook(`uninstall_all_pre')
systemhook(`uninstall_all_post')
+systemhook(`sync_pre')
+systemhook(`sync_post')
+systemhook(`fetch_all_pre')
+systemhook(`fetch_all_post')
+systemhook(`fetch_all_all_pre')
+systemhook(`fetch_all_all_post')
install-data-local :
+ install -d $(DESTDIR)/$(libexecdir)/paludis/hooks/uninstall_all_pre/
install -d $(DESTDIR)/$(libexecdir)/paludis/hooks/uninstall_all_post/
- install -d $(DESTDIR)/$(libexecdir)/paludis/hooks/install_all_post/
+ install -d $(DESTDIR)/$(libexecdir)/paludis/hooks/uninstall_pre/
+ install -d $(DESTDIR)/$(libexecdir)/paludis/hooks/uninstall_post/
+ install -d $(DESTDIR)/$(libexecdir)/paludis/hooks/install_pre/
install -d $(DESTDIR)/$(libexecdir)/paludis/hooks/install_post/
+ install -d $(DESTDIR)/$(libexecdir)/paludis/hooks/install_all_pre/
+ install -d $(DESTDIR)/$(libexecdir)/paludis/hooks/install_all_post/
+ install -d $(DESTDIR)/$(libexecdir)/paludis/hooks/sync_pre/
+ install -d $(DESTDIR)/$(libexecdir)/paludis/hooks/sync_post/
+ install -d $(DESTDIR)/$(libexecdir)/paludis/hooks/fetch_all_pre/
+ install -d $(DESTDIR)/$(libexecdir)/paludis/hooks/fetch_all_post/
+ install -d $(DESTDIR)/$(libexecdir)/paludis/hooks/fetch_pre/
+ install -d $(DESTDIR)/$(libexecdir)/paludis/hooks/fetch_post/
ln -sf ../common/gnu_info_index.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/uninstall_all_post/
ln -sf ../common/gnu_info_index.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/install_all_post/
ln -sf ../common/eselect_env_update.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/uninstall_all_post/
ln -sf ../common/eselect_env_update.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/install_post/
+ ln -sf ../common/log.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/install_all_pre/
+ ln -sf ../common/log.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/install_all_post/
+ ln -sf ../common/log.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/install_pre/
+ ln -sf ../common/log.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/install_post/
+ ln -sf ../common/log.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/fetch_all_pre/
+ ln -sf ../common/log.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/fetch_all_post/
+ ln -sf ../common/log.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/fetch_pre/
+ ln -sf ../common/log.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/fetch_post/
+ ln -sf ../common/log.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/uninstall_all_pre/
+ ln -sf ../common/log.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/uninstall_all_post/
+ ln -sf ../common/log.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/uninstall_pre/
+ ln -sf ../common/log.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/uninstall_post/
+ ln -sf ../common/log.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/sync_pre/
+ ln -sf ../common/log.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/sync_post/
uninstall-local :
- rm $(DESTDIR)/$(libexecdir)/paludis/hooks/uninstall_all_post/gnu_info_index.bash
- rm $(DESTDIR)/$(libexecdir)/paludis/hooks/install_all_post/gnu_info_index.bash
- rm $(DESTDIR)/$(libexecdir)/paludis/hooks/uninstall_all_post/eselect_env_update.bash
- rm $(DESTDIR)/$(libexecdir)/paludis/hooks/install_post/eselect_env_update.bash
+ rm $(DESTDIR)/$(libexecdir)/paludis/hooks/*/gnu_info_index.bash
+ rm $(DESTDIR)/$(libexecdir)/paludis/hooks/*/find_config_updates.bash
+ rm $(DESTDIR)/$(libexecdir)/paludis/hooks/*/eselect_env_update.bash
+ rm $(DESTDIR)/$(libexecdir)/paludis/hooks/*/log.bash
Makefile.am : Makefile.am.m4
$(top_srcdir)/misc/do_m4.bash Makefile.am
diff --git a/hooks/log.bash b/hooks/log.bash
new file mode 100755
index 0000000..d4828ad
--- /dev/null
+++ b/hooks/log.bash
@@ -0,0 +1,86 @@
+#!/bin/bash
+# vim: set et sw=4 sts=4 :
+
+# Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk>
+#
+# This file is part of the Paludis package manager. Paludis is free software;
+# you can redistribute it and/or modify it under the terms of the GNU General
+# Public License as published by the Free Software Foundation; either version
+# 2 of the License, or (at your option) any later version.
+#
+# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+# Place, Suite 330, Boston, MA 02111-1307 USA
+
+mkdir -p "${ROOT}/var/log"
+
+(
+ echo -n "$(date +%s ): "
+
+ case "${HOOK}" in
+ install_pre)
+ echo "starting install of package ${TARGET}"
+ ;;
+
+ install_post)
+ echo "finished install of package ${TARGET}"
+ ;;
+
+ install_all_pre)
+ echo "starting install of targets ${TARGETS}"
+ ;;
+
+ install_all_post)
+ echo "finished install of targets ${TARGETS}"
+ ;;
+
+ uninstall_pre)
+ echo "starting uninstall of package ${TARGET}"
+ ;;
+
+ uninstall_post)
+ echo "finished uninstall of package ${TARGET}"
+ ;;
+
+ uninstall_all_pre)
+ echo "starting uninstall of targets ${TARGETS}"
+ ;;
+
+ uninstall_all_post)
+ echo "finished uninstall of targets ${TARGETS}"
+ ;;
+
+ fetch_pre)
+ echo "starting fetch of package ${TARGET}"
+ ;;
+
+ fetch_post)
+ echo "finished fetch of package ${TARGET}"
+ ;;
+
+ fetch_all_pre)
+ echo "starting fetch of targets ${TARGETS}"
+ ;;
+
+ fetch_all_post)
+ echo "finished fetch of targets ${TARGETS}"
+ ;;
+
+ sync_pre)
+ echo "starting sync of repository ${TARGET}"
+ ;;
+
+ sync_post)
+ echo "finished sync of repository ${TARGET}"
+ ;;
+
+ *)
+ echo "unknown hook ${HOOK}"
+ esac
+) >> ${ROOT}/var/log/paludis.log
+
diff --git a/paludis/default_environment.cc b/paludis/default_environment.cc
index b391572..99b334e 100644
--- a/paludis/default_environment.cc
+++ b/paludis/default_environment.cc
@@ -367,9 +367,10 @@ namespace
struct Hooker
{
- std::string hook, paludis_command;
+ Hook hook;
+ std::string paludis_command;
- Hooker(const std::string & h, const std::string & p) :
+ Hooker(const Hook & h, const std::string & p) :
hook(h),
paludis_command(p)
{
@@ -378,14 +379,19 @@ namespace
void operator() (const FSEntry & f) const
{
Context context("When running hook script '" + stringify(f) +
- "' for hook '" + hook + "':");
+ "' for hook '" + hook.name() + "':");
Log::get_instance()->message(ll_debug, "Starting hook script '" +
- stringify(f) + "' for '" + hook + "'");
+ stringify(f) + "' for '" + hook.name() + "'");
- int exit_status(run_command(make_env_command("bash '" + stringify(f) + "'")
- ("ROOT", DefaultConfig::get_instance()->root())
- ("HOOK", hook)
- ("PALUDIS_COMMAND", paludis_command)));
+ MakeEnvCommand cmd(make_env_command("bash '" + stringify(f) + "'")
+ ("ROOT", DefaultConfig::get_instance()->root())
+ ("HOOK", hook.name())
+ ("PALUDIS_COMMAND", paludis_command));
+
+ for (Hook::Iterator h(hook.begin()), h_end(hook.end()) ; h != h_end ; ++h)
+ cmd = cmd(h->first, h->second);
+
+ int exit_status(run_command(cmd));
if (0 == exit_status)
Log::get_instance()->message(ll_debug, "Hook '" + stringify(f)
+ "' returned success '" + stringify(exit_status) + "'");
@@ -397,17 +403,17 @@ namespace
}
void
-DefaultEnvironment::perform_hook(const std::string & hook) const
+DefaultEnvironment::perform_hook(const Hook & hook) const
{
- Context context("When triggering hook '" + hook + "'");
- Log::get_instance()->message(ll_debug, "Starting hook '" + hook + "'");
+ Context context("When triggering hook '" + hook.name() + "'");
+ Log::get_instance()->message(ll_debug, "Starting hook '" + hook.name() + "'");
const std::list<FSEntry> & hook_dirs(get_hook_dirs());
for (std::list<FSEntry>::const_iterator h(hook_dirs.begin()),
h_end(hook_dirs.end()) ; h != h_end ; ++h)
{
- FSEntry hh(*h / hook);
+ FSEntry hh(*h / hook.name());
if (! hh.is_directory())
continue;
diff --git a/paludis/default_environment.hh b/paludis/default_environment.hh
index b0e0d66..510c5d5 100644
--- a/paludis/default_environment.hh
+++ b/paludis/default_environment.hh
@@ -71,7 +71,7 @@ namespace paludis
virtual UseFlagNameCollection::Pointer query_enabled_use_matching(
const std::string & prefix, const PackageDatabaseEntry *) const;
- virtual void perform_hook(const std::string & hook) const;
+ virtual void perform_hook(const Hook & hook) const;
};
}
#endif
diff --git a/paludis/environment.cc b/paludis/environment.cc
index a22974d..3638ae5 100644
--- a/paludis/environment.cc
+++ b/paludis/environment.cc
@@ -331,7 +331,6 @@ Environment::add_appropriate_to_world(DepAtom::ConstPointer a) const
}
}
-
void
Environment::remove_appropriate_from_world(DepAtom::ConstPointer a) const
{
@@ -347,3 +346,16 @@ Environment::remove_appropriate_from_world(DepAtom::ConstPointer a) const
}
}
+Hook::Hook(const std::string & n) :
+ _name(n)
+{
+}
+
+Hook
+Hook::operator() (const std::string & k, const std::string & v) const
+{
+ Hook result(*this);
+ result._extra_env.insert(std::make_pair(k, v));
+ return result;
+}
+
diff --git a/paludis/environment.hh b/paludis/environment.hh
index 48d65d8..bb7ff06 100644
--- a/paludis/environment.hh
+++ b/paludis/environment.hh
@@ -35,6 +35,41 @@
namespace paludis
{
/**
+ * Represents the data for an Environment hook call.
+ *
+ * \ingroup grpenvironment
+ */
+ class Hook
+ {
+ private:
+ std::map<std::string, std::string> _extra_env;
+
+ std::string _name;
+
+ public:
+ Hook(const std::string & name);
+
+ Hook operator() (const std::string & key, const std::string & value) const;
+
+ typedef std::map<std::string, std::string>::const_iterator Iterator;
+
+ Iterator begin() const
+ {
+ return _extra_env.begin();
+ }
+
+ Iterator end() const
+ {
+ return _extra_env.end();
+ }
+
+ std::string name() const
+ {
+ return _name;
+ }
+ };
+
+ /**
* Represents a working environment, which contains an available packages
* database and provides various methods for querying package visibility
* and options.
@@ -166,7 +201,7 @@ namespace paludis
/**
* Perform a hook.
*/
- virtual void perform_hook(const std::string & Hook) const = 0;
+ virtual void perform_hook(const Hook & hook) const = 0;
};
}
diff --git a/paludis/test_environment.hh b/paludis/test_environment.hh
index ed55e79..0ae5913 100644
--- a/paludis/test_environment.hh
+++ b/paludis/test_environment.hh
@@ -77,7 +77,7 @@ namespace paludis
return UseFlagNameCollection::Pointer(new UseFlagNameCollection);
}
- virtual void perform_hook(const std::string &) const
+ virtual void perform_hook(const Hook &) const
{
}
};
diff --git a/src/install.cc b/src/install.cc
index 610b639..20feb81 100644
--- a/src/install.cc
+++ b/src/install.cc
@@ -276,53 +276,58 @@ do_install()
}
if (opts.get<p::io_fetchonly>())
- env->perform_hook("fetch_all_pre");
+ env->perform_hook(p::Hook("fetch_all_pre")("TARGETS", p::join(
+ CommandLine::get_instance()->begin_parameters(),
+ CommandLine::get_instance()->end_parameters(), " ")));
else
- env->perform_hook("install_all_pre");
+ env->perform_hook(p::Hook("install_all_pre")("TARGETS", p::join(
+ CommandLine::get_instance()->begin_parameters(),
+ CommandLine::get_instance()->end_parameters(), " ")));
for (p::DepList::Iterator dep(dep_list.begin()), dep_end(dep_list.end()) ;
dep != dep_end ; ++dep)
{
- std::string cpv = p::stringify(dep->get<p::dle_name>()) + "-" +
- p::stringify(dep->get<p::dle_version>());
+ std::string cpvr = p::stringify(dep->get<p::dle_name>()) + "-" +
+ p::stringify(dep->get<p::dle_version>()) + "::" +
+ p::stringify(dep->get<p::dle_repository>());
if (opts.get<p::io_fetchonly>())
{
- cout << endl << colour(cl_heading, "Fetching " + cpv) << endl << endl;
+ cout << endl << colour(cl_heading, "Fetching " + cpvr) << endl << endl;
// TODO: some way to reset this properly would be nice.
cerr << xterm_title("(" + p::stringify(++current_count) + " of " +
- p::stringify(max_count) + ") Fetching " + cpv);
+ p::stringify(max_count) + ") Fetching " + cpvr);
}
else
{
cout << endl << colour(cl_heading,
- "Installing " + cpv) << endl << endl;
+ "Installing " + cpvr) << endl << endl;
// TODO: some way to reset this properly would be nice.
cerr << xterm_title("(" + p::stringify(++current_count) + " of " +
- p::stringify(max_count) + ") Installing " + cpv);
+ p::stringify(max_count) + ") Installing " + cpvr);
}
if (opts.get<p::io_fetchonly>())
- env->perform_hook("fetch_pre");
+ env->perform_hook(p::Hook("fetch_pre")("TARGET", cpvr));
else
- env->perform_hook("install_pre");
+ env->perform_hook(p::Hook("install_pre")("TARGET", cpvr));
env->package_database()->fetch_repository(dep->get<p::dle_repository>())->
install(dep->get<p::dle_name>(), dep->get<p::dle_version>(), opts);
if (opts.get<p::io_fetchonly>())
- env->perform_hook("fetch_post");
+ env->perform_hook(p::Hook("fetch_post")("TARGET", cpvr));
else
- env->perform_hook("install_post");
+ env->perform_hook(p::Hook("install_post")("TARGET", cpvr));
if (! opts.get<p::io_fetchonly>())
{
// figure out if we need to unmerge anything
cout << endl << colour(cl_heading,
- "Cleaning stale versions after installing " + cpv) << endl << endl;
+ "Cleaning stale versions after installing " + cpvr) << endl << endl;
// manually invalidate any installed repos, they're probably
// wrong now
@@ -356,30 +361,35 @@ do_install()
cout << "* " << colour(cl_package_name, *c) << endl;
cout << endl;
- env->perform_hook("uninstall_all_pre");
- for (p::PackageDatabaseEntryCollection::Iterator c(clean_list.begin()),
- c_end(clean_list.end()) ; c != c_end ; ++c)
+ p::PackageDatabaseEntryCollection::Iterator c(clean_list.begin()),
+ c_end(clean_list.end());
+ env->perform_hook(p::Hook("uninstall_all_pre")("TARGETS", p::join(c, c_end, " ")));
+ for ( ; c != c_end ; ++c)
{
cout << endl << colour(cl_heading, "Cleaning " + p::stringify(*c)) << endl << endl;
// TODO: some way to reset this properly would be nice.
cerr << xterm_title("(" + p::stringify(current_count) + " of " +
- p::stringify(max_count) + ") Cleaning " + cpv + ": " + stringify(*c));
+ p::stringify(max_count) + ") Cleaning " + cpvr + ": " + stringify(*c));
- env->perform_hook("uninstall_pre");
+ env->perform_hook(p::Hook("uninstall_pre")("TARGET", stringify(*c)));
env->package_database()->fetch_repository(c->get<p::pde_repository>())->
uninstall(c->get<p::pde_name>(), c->get<p::pde_version>(), opts);
- env->perform_hook("uninstall_post");
+ env->perform_hook(p::Hook("uninstall_post")("TARGET", stringify(*c)));
}
- env->perform_hook("uninstall_all_post");
+ env->perform_hook(p::Hook("uninstall_all_pre")("TARGETS", p::join(c, c_end, " ")));
}
}
}
if (opts.get<p::io_fetchonly>())
- env->perform_hook("fetch_all_post");
+ env->perform_hook(p::Hook("fetch_all_post")("TARGETS", p::join(
+ CommandLine::get_instance()->begin_parameters(),
+ CommandLine::get_instance()->end_parameters(), " ")));
else
- env->perform_hook("install_all_post");
+ env->perform_hook(p::Hook("install_all_post")("TARGETS", p::join(
+ CommandLine::get_instance()->begin_parameters(),
+ CommandLine::get_instance()->end_parameters(), " ")));
cout << endl;
}
diff --git a/src/sync.cc b/src/sync.cc
index d174973..750601f 100644
--- a/src/sync.cc
+++ b/src/sync.cc
@@ -78,15 +78,17 @@ int do_sync()
p::create_inserter<p::RepositoryName>(std::inserter(
repo_names, repo_names.begin())));
- env->perform_hook("sync_all_pre");
+ env->perform_hook(p::Hook("sync_all_pre")("TARGETS", p::join(
+ CommandLine::get_instance()->begin_parameters(),
+ CommandLine::get_instance()->end_parameters(), " ")));
for (std::set<p::RepositoryName>::iterator r(repo_names.begin()), r_end(repo_names.end()) ;
r != r_end ; ++r)
{
try
{
- env->perform_hook("sync_pre");
+ env->perform_hook(p::Hook("sync_pre")("TARGET", stringify(*r)));
return_code |= do_one_sync(env->package_database()->fetch_repository(*r));
- env->perform_hook("sync_post");
+ env->perform_hook(p::Hook("sync_post")("TARGET", stringify(*r)));
}
catch (const p::NoSuchRepositoryError & e)
{
@@ -95,7 +97,9 @@ int do_sync()
std::cout << "Sync " << *r << " failed" << std::endl;
}
}
- env->perform_hook("sync_all_post");
+ env->perform_hook(p::Hook("sync_all_post")("TARGETS", p::join(
+ CommandLine::get_instance()->begin_parameters(),
+ CommandLine::get_instance()->end_parameters(), " ")));
}
return return_code;
diff --git a/src/uninstall.cc b/src/uninstall.cc
index fe3419e..86816a9 100644
--- a/src/uninstall.cc
+++ b/src/uninstall.cc
@@ -111,26 +111,27 @@ do_uninstall()
if (CommandLine::get_instance()->a_no_config_protection.specified())
opts.set<p::io_noconfigprotect>(true);
- env->perform_hook("uninstall_all_pre");
+ env->perform_hook(p::Hook("uninstall_all_pre")("TARGETS", join(unmerge->begin(), unmerge->end(), " ")));
for (p::PackageDatabaseEntryCollection::Iterator pkg(unmerge->begin()), pkg_end(unmerge->end()) ;
pkg != pkg_end ; ++pkg)
{
- std::string cpv = p::stringify(pkg->get<p::pde_name>()) + "-" +
- p::stringify(pkg->get<p::pde_version>());
+ std::string cpvr = p::stringify(pkg->get<p::pde_name>()) + "-" +
+ p::stringify(pkg->get<p::pde_version>()) + "::" +
+ p::stringify(pkg->get<p::pde_repository>());
cout << endl << colour(cl_heading,
- "Uninstalling " + cpv) << endl << endl;
+ "Uninstalling " + cpvr) << endl << endl;
// TODO: some way to reset this properly would be nice.
cerr << xterm_title("(" + p::stringify(++current_count) + " of " +
- p::stringify(max_count) + ") Uninstalling " + cpv);
+ p::stringify(max_count) + ") Uninstalling " + cpvr);
- env->perform_hook("uninstall_pre");
+ env->perform_hook(p::Hook("uninstall_pre")("TARGET", cpvr));
env->package_database()->fetch_repository(pkg->get<p::pde_repository>())->
uninstall(pkg->get<p::pde_name>(), pkg->get<p::pde_version>(), opts);
- env->perform_hook("uninstall_post");
+ env->perform_hook(p::Hook("uninstall_post")("TARGET", cpvr));
}
- env->perform_hook("uninstall_all_post");
+ env->perform_hook(p::Hook("uninstall_all_post")("TARGETS", join(unmerge->begin(), unmerge->end(), " ")));
return return_code;
}