aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-10-29 16:46:11 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-10-29 16:46:11 +0000
commit67f433b8d1043d4d39b4e8208c5a86faa768e7b5 (patch)
tree82eb81f6cac333631b183b56d8f25b926e21bd33
parentf2c2efb21cb67ca47f30e04265a56690f37e5e88 (diff)
downloadpaludis-67f433b8d1043d4d39b4e8208c5a86faa768e7b5.tar.gz
paludis-67f433b8d1043d4d39b4e8208c5a86faa768e7b5.tar.xz
Don't go through the clean sequence if there are no packages to clean.
-rw-r--r--paludis/tasks/install_task.cc63
-rw-r--r--paludis/tasks/install_task.hh1
-rw-r--r--src/paludis/install.cc16
3 files changed, 43 insertions, 37 deletions
diff --git a/paludis/tasks/install_task.cc b/paludis/tasks/install_task.cc
index 3d68dfb..a1a7383 100644
--- a/paludis/tasks/install_task.cc
+++ b/paludis/tasks/install_task.cc
@@ -283,41 +283,46 @@ InstallTask::execute()
on_build_cleanlist_post(*dep);
/* ok, we have the cleanlist. we're about to clean */
- _imp->env->perform_hook(Hook("uninstall_all_pre")("TARGETS", join(
- clean_list.begin(), clean_list.end(), " ")));
- on_clean_all_pre(*dep, clean_list);
-
- for (PackageDatabaseEntryCollection::Iterator c(clean_list.begin()),
- c_end(clean_list.end()) ; c != c_end ; ++c)
+ if (clean_list.empty())
+ on_no_clean_needed(*dep);
+ else
{
- /* clean one item */
- _imp->env->perform_hook(Hook("uninstall_pre")("TARGET", stringify(*c)));
- on_clean_pre(*dep, *c);
-
- const RepositoryUninstallableInterface * const uninstall_interface(
- _imp->env->package_database()->fetch_repository(c->repository)->
- uninstallable_interface);
- if (! uninstall_interface)
- throw InternalError(PALUDIS_HERE, "Trying to uninstall from a non-uninstallable repo");
+ _imp->env->perform_hook(Hook("uninstall_all_pre")("TARGETS", join(
+ clean_list.begin(), clean_list.end(), " ")));
+ on_clean_all_pre(*dep, clean_list);
- try
+ for (PackageDatabaseEntryCollection::Iterator c(clean_list.begin()),
+ c_end(clean_list.end()) ; c != c_end ; ++c)
{
- uninstall_interface->uninstall(c->name, c->version, _imp->install_options);
- }
- catch (const PackageUninstallActionError & e)
- {
- _imp->env->perform_hook(Hook("uninstall_fail")("TARGET", stringify(*c))("MESSAGE", e.message()));
- throw;
+ /* clean one item */
+ _imp->env->perform_hook(Hook("uninstall_pre")("TARGET", stringify(*c)));
+ on_clean_pre(*dep, *c);
+
+ const RepositoryUninstallableInterface * const uninstall_interface(
+ _imp->env->package_database()->fetch_repository(c->repository)->
+ uninstallable_interface);
+ if (! uninstall_interface)
+ throw InternalError(PALUDIS_HERE, "Trying to uninstall from a non-uninstallable repo");
+
+ try
+ {
+ uninstall_interface->uninstall(c->name, c->version, _imp->install_options);
+ }
+ catch (const PackageUninstallActionError & e)
+ {
+ _imp->env->perform_hook(Hook("uninstall_fail")("TARGET", stringify(*c))("MESSAGE", e.message()));
+ throw;
+ }
+
+ on_clean_post(*dep, *c);
+ _imp->env->perform_hook(Hook("uninstall_post")("TARGET", stringify(*c)));
}
- on_clean_post(*dep, *c);
- _imp->env->perform_hook(Hook("uninstall_post")("TARGET", stringify(*c)));
+ /* we're done cleaning */
+ _imp->env->perform_hook(Hook("uninstall_all_post")("TARGETS", join(
+ clean_list.begin(), clean_list.end(), " ")));
+ on_clean_all_post(*dep, clean_list);
}
-
- /* we're done cleaning */
- _imp->env->perform_hook(Hook("uninstall_all_post")("TARGETS", join(
- clean_list.begin(), clean_list.end(), " ")));
- on_clean_all_post(*dep, clean_list);
}
/* update world */
diff --git a/paludis/tasks/install_task.hh b/paludis/tasks/install_task.hh
index a5df514..7e72cab 100644
--- a/paludis/tasks/install_task.hh
+++ b/paludis/tasks/install_task.hh
@@ -118,6 +118,7 @@ namespace paludis
virtual void on_install_post(const DepListEntry &) = 0;
virtual void on_install_all_post() = 0;
+ virtual void on_no_clean_needed(const DepListEntry &) = 0;
virtual void on_clean_all_pre(const DepListEntry &,
const PackageDatabaseEntryCollection &) = 0;
virtual void on_clean_pre(const DepListEntry &,
diff --git a/src/paludis/install.cc b/src/paludis/install.cc
index 52f0f41..d042627 100644
--- a/src/paludis/install.cc
+++ b/src/paludis/install.cc
@@ -149,17 +149,17 @@ namespace
virtual void on_clean_all_pre(const DepListEntry &,
const PackageDatabaseEntryCollection & c)
{
- if (c.empty())
- cout << "* No cleaning required" << endl;
- else
- {
- for (PackageDatabaseEntryCollection::Iterator cc(c.begin()),
- cc_end(c.end()) ; cc != cc_end ; ++cc)
- cout << "* " << colour(cl_package_name, *cc) << endl;
- }
+ for (PackageDatabaseEntryCollection::Iterator cc(c.begin()),
+ cc_end(c.end()) ; cc != cc_end ; ++cc)
+ cout << "* " << colour(cl_package_name, *cc) << endl;
cout << endl;
}
+ virtual void on_no_clean_needed(const DepListEntry &)
+ {
+ cout << "* No cleaning required" << endl;
+ }
+
virtual void on_clean_pre(const DepListEntry &,
const PackageDatabaseEntry & c)
{