aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-02-10 02:03:02 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-02-10 02:03:02 +0000
commitf5de5528f971bd863701b8d6d73ee51b21efd667 (patch)
tree654523347802bdde5fcb245e38bf250592f4c43d
parentadf7d7f87e7701dd5dee402ac396c231489fde1d (diff)
downloadpaludis-f5de5528f971bd863701b8d6d73ee51b21efd667.tar.gz
paludis-f5de5528f971bd863701b8d6d73ee51b21efd667.tar.xz
Add output manager success indicator
-rw-r--r--paludis/repositories/accounts/accounts_id.cc2
-rw-r--r--paludis/repositories/e/e_installed_repository_id.cc1
-rw-r--r--paludis/repositories/e/ebuild_entries.cc4
-rw-r--r--paludis/repositories/unpackaged/installed_id.cc1
-rw-r--r--paludis/repositories/unpackaged/unpackaged_id.cc2
-rw-r--r--paludis/util/output_manager.hh13
-rw-r--r--paludis/util/standard_output_manager.cc5
-rw-r--r--paludis/util/standard_output_manager.hh2
8 files changed, 30 insertions, 0 deletions
diff --git a/paludis/repositories/accounts/accounts_id.cc b/paludis/repositories/accounts/accounts_id.cc
index 9bd26a7..90dccac 100644
--- a/paludis/repositories/accounts/accounts_id.cc
+++ b/paludis/repositories/accounts/accounts_id.cc
@@ -460,5 +460,7 @@ AccountsID::perform_action(Action & action) const
case last_wp:
throw InternalError(PALUDIS_HERE, "bad WantPhase");
}
+
+ output_manager->succeeded();
}
diff --git a/paludis/repositories/e/e_installed_repository_id.cc b/paludis/repositories/e/e_installed_repository_id.cc
index 0435849..0ea6f76 100644
--- a/paludis/repositories/e/e_installed_repository_id.cc
+++ b/paludis/repositories/e/e_installed_repository_id.cc
@@ -878,6 +878,7 @@ namespace
std::tr1::shared_ptr<OutputManager> output_manager(a.options.make_output_manager()(a));
std::tr1::static_pointer_cast<const EInstalledRepository>(id->repository())->perform_uninstall(
id, false, a.options.config_protect(), output_manager);
+ output_manager->succeeded();
}
void visit(const InstalledAction &)
diff --git a/paludis/repositories/e/ebuild_entries.cc b/paludis/repositories/e/ebuild_entries.cc
index ab3ebf3..12abbac 100644
--- a/paludis/repositories/e/ebuild_entries.cc
+++ b/paludis/repositories/e/ebuild_entries.cc
@@ -502,6 +502,8 @@ EbuildEntries::fetch(const std::tr1::shared_ptr<const ERepositoryID> & id,
if (! c.failures()->empty())
throw FetchActionError("Fetch of '" + stringify(*id) + "' failed", c.failures());
}
+
+ output_manager->succeeded();
}
void
@@ -771,6 +773,8 @@ EbuildEntries::install(const std::tr1::shared_ptr<const ERepositoryID> & id,
cmd();
}
}
+
+ output_manager->succeeded();
}
void
diff --git a/paludis/repositories/unpackaged/installed_id.cc b/paludis/repositories/unpackaged/installed_id.cc
index f9f5d36..2f63355 100644
--- a/paludis/repositories/unpackaged/installed_id.cc
+++ b/paludis/repositories/unpackaged/installed_id.cc
@@ -765,6 +765,7 @@ namespace
{
std::tr1::shared_ptr<OutputManager> output_manager(a.options.make_output_manager()(a));
id->uninstall(false, output_manager);
+ output_manager->succeeded();
}
};
}
diff --git a/paludis/repositories/unpackaged/unpackaged_id.cc b/paludis/repositories/unpackaged/unpackaged_id.cc
index f766fea..7c6547f 100644
--- a/paludis/repositories/unpackaged/unpackaged_id.cc
+++ b/paludis/repositories/unpackaged/unpackaged_id.cc
@@ -366,6 +366,8 @@ UnpackagedID::perform_action(Action & action) const
case last_wp:
throw InternalError(PALUDIS_HERE, "bad WantPhase");
}
+
+ output_manager->succeeded();
}
void
diff --git a/paludis/util/output_manager.hh b/paludis/util/output_manager.hh
index 35a87e6..a48c9c2 100644
--- a/paludis/util/output_manager.hh
+++ b/paludis/util/output_manager.hh
@@ -37,6 +37,19 @@ namespace paludis
virtual LogMessageHandler log_message(const std::string & id, const LogLevel, const LogContext)
PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+
+ /**
+ * Called if an action succeeds. This can be used to, for example,
+ * unlink the files behind a to-disk logged output manager.
+ *
+ * If an OutputManager is destroyed without having had this method
+ * called, it should assume failure. This might mean keeping rather
+ * than removing log files, for example.
+ *
+ * Further messages and output may occur even after a call to this
+ * method.
+ */
+ virtual void succeeded() = 0;
};
}
diff --git a/paludis/util/standard_output_manager.cc b/paludis/util/standard_output_manager.cc
index 49d34d7..4a003b3 100644
--- a/paludis/util/standard_output_manager.cc
+++ b/paludis/util/standard_output_manager.cc
@@ -48,3 +48,8 @@ StandardOutputManager::log_message(const std::string & id, const LogLevel l, con
return Log::get_instance()->message(id, l, c);
}
+void
+StandardOutputManager::succeeded()
+{
+}
+
diff --git a/paludis/util/standard_output_manager.hh b/paludis/util/standard_output_manager.hh
index 9442ea0..95c1105 100644
--- a/paludis/util/standard_output_manager.hh
+++ b/paludis/util/standard_output_manager.hh
@@ -37,6 +37,8 @@ namespace paludis
virtual LogMessageHandler log_message(const std::string & id, const LogLevel, const LogContext)
PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual void succeeded();
};
}