summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2025-04-25 09:18:46 +0200
committerKlaus Aehlig <klaus.aehlig@huawei.com>2025-04-25 11:47:15 +0200
commit10caf1e1fba66899ddf9b4d047cd21e04e21142e (patch)
treeb4090fee9654065797d603d800c7a48dc541bfbc
parent15f3c80f2a22b136e11f0118f4886a8668469c1f (diff)
downloadjustbuild-10caf1e1fba66899ddf9b4d047cd21e04e21142e.tar.gz
just-mr: support custom message with invocation-directory name
Allow to specify a custom string that is extended by the basename of the logging directory, in case invocation logging is activated. This can be used, e.g., to point to the user to service doing something useful with the logged data (or simply presenting it in a nicer form).
-rw-r--r--share/man/just-mrrc.5.md2
-rw-r--r--src/other_tools/just_mr/cli.hpp1
-rw-r--r--src/other_tools/just_mr/launch.cpp6
-rw-r--r--src/other_tools/just_mr/rc.cpp5
4 files changed, 14 insertions, 0 deletions
diff --git a/share/man/just-mrrc.5.md b/share/man/just-mrrc.5.md
index c0227b13..b2c3e2a0 100644
--- a/share/man/just-mrrc.5.md
+++ b/share/man/just-mrrc.5.md
@@ -177,6 +177,8 @@ The just-mrrc is given by a JSON object.
directory will be created. The *`"project id"`* is given as
a separate subkey, in order to allow workspace-specific rc
files that are merged in to set this value.
+ - *`"invocation message"`* An additional info message to be shown,
+ followed by the base name of the invocation logggin directory.
- *`"metadata"`* A file name specifying where in the invocation-log
directory the metadata file should be stored. If not given,
no metadata file will be written. See **`just-profile`**(5) for
diff --git a/src/other_tools/just_mr/cli.hpp b/src/other_tools/just_mr/cli.hpp
index de1ac9d0..dd1586a4 100644
--- a/src/other_tools/just_mr/cli.hpp
+++ b/src/other_tools/just_mr/cli.hpp
@@ -92,6 +92,7 @@ struct MultiRepoGcArguments {
// Arguments for invocation logging; set only via rc files
struct InvocationLogArguments {
std::optional<std::filesystem::path> directory{std::nullopt};
+ std::optional<std::string> invocation_msg{std::nullopt};
std::optional<std::string> project_id{std::nullopt};
std::optional<std::string> metadata{std::nullopt};
std::optional<std::string> graph_file{std::nullopt};
diff --git a/src/other_tools/just_mr/launch.cpp b/src/other_tools/just_mr/launch.cpp
index 76272213..cb0f70d2 100644
--- a/src/other_tools/just_mr/launch.cpp
+++ b/src/other_tools/just_mr/launch.cpp
@@ -285,6 +285,12 @@ auto CallJust(std::optional<std::filesystem::path> const& config_file,
"{:%Y-%m-%d-%H:%M}-{}", fmt::gmtime(invocation_time), uuid);
dir = dir / invocation_id;
if (FileSystemManager::CreateDirectoryExclusive(dir)) {
+ if (invocation_log.invocation_msg) {
+ Logger::Log(LogLevel::Info,
+ "{}{}",
+ *invocation_log.invocation_msg,
+ invocation_id);
+ }
Logger::Log(
LogLevel::Info, "Invocation logged at {}", dir.string());
log_dir = dir;
diff --git a/src/other_tools/just_mr/rc.cpp b/src/other_tools/just_mr/rc.cpp
index bcb217cf..5baf302c 100644
--- a/src/other_tools/just_mr/rc.cpp
+++ b/src/other_tools/just_mr/rc.cpp
@@ -624,6 +624,11 @@ namespace {
if (profile->IsString()) {
clargs->invocation_log.profile = profile->String();
}
+ auto msg =
+ invocation_log->Get("invocation message", Expression::none_t{});
+ if (msg->IsString()) {
+ clargs->invocation_log.invocation_msg = msg->String();
+ }
}
}
// read config lookup order