From b58d2198257921d923489ce09a4e546ad0142c24 Mon Sep 17 00:00:00 2001 From: Marek Blaha Date: Tue, 25 Feb 2025 15:26:39 +0100 Subject: [PATCH] offline: Inform user about scriptlets execution Scriptlet execution can take a significant amount of time. Inform the user when it starts. --- dnf5/commands/offline/offline.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/dnf5/commands/offline/offline.cpp b/dnf5/commands/offline/offline.cpp index 50e265d85..03228b78d 100644 --- a/dnf5/commands/offline/offline.cpp +++ b/dnf5/commands/offline/offline.cpp @@ -29,6 +29,7 @@ along with libdnf. If not, see . #include #include #include +#include #include #include #include @@ -170,6 +171,24 @@ class PlymouthTransCB : public RpmTransCB { plymouth.message(message); } + void script_start( + const libdnf5::base::TransactionPackage * item, + libdnf5::rpm::Nevra nevra, + libdnf5::rpm::TransactionCallbacks::ScriptType type) override { + RpmTransCB::script_start(item, nevra, type); + + // Report only pre/post transaction scriptlets. With all scriptlets + // being reported the output flickers way too much to be usable. + using ScriptType = libdnf5::rpm::TransactionCallbacks::ScriptType; + if (type != ScriptType::PRE_TRANSACTION && type != ScriptType::POST_TRANSACTION) { + return; + } + + const auto message = fmt::format( + "Running {} scriptlet: {}...", script_type_to_string(type), to_full_nevra_string(nevra).c_str()); + plymouth.message(message); + } + private: PlymouthOutput plymouth; };