[gnome-software] flatpak: Add debug information about transaction operations



commit 8fdb6a499cd0ea01cdeb90f98572f36ddefc90e3
Author: Philip Withnall <withnall endlessm com>
Date:   Wed Apr 29 12:15:57 2020 +0100

    flatpak: Add debug information about transaction operations
    
    This is generally useful to know when debugging anything to do with
    flatpak transactions.
    
    Signed-off-by: Philip Withnall <withnall endlessm com>

 plugins/flatpak/gs-flatpak-transaction.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
---
diff --git a/plugins/flatpak/gs-flatpak-transaction.c b/plugins/flatpak/gs-flatpak-transaction.c
index 42d46606..336ce92c 100644
--- a/plugins/flatpak/gs-flatpak-transaction.c
+++ b/plugins/flatpak/gs-flatpak-transaction.c
@@ -173,6 +173,28 @@ _transaction_ready (FlatpakTransaction *transaction)
                                        FLATPAK_TRANSACTION_OPERATION_UPDATE)
                                gs_app_set_state (app, AS_APP_STATE_INSTALLING);
                }
+
+#if FLATPAK_CHECK_VERSION(1, 7, 3)
+               /* Debug dump. */
+               {
+                       GPtrArray *related_to_ops = flatpak_transaction_operation_get_related_to_ops (op);
+                       g_autoptr(GString) debug_message = g_string_new ("");
+
+                       g_string_append_printf (debug_message,
+                                               "%s: op %p, app %s (%p), download size %" G_GUINT64_FORMAT ", 
related-to:",
+                                               G_STRFUNC, op,
+                                               app ? gs_app_get_unique_id (app) : "?",
+                                               app,
+                                               flatpak_transaction_operation_get_download_size (op));
+                       for (gsize i = 0; related_to_ops != NULL && i < related_to_ops->len; i++) {
+                               FlatpakTransactionOperation *related_to_op = g_ptr_array_index 
(related_to_ops, i);
+                               g_string_append_printf (debug_message,
+                                                       "\n ├ %p", related_to_op);
+                       }
+                       g_string_append (debug_message, "\n └ (end)");
+                       g_debug ("%s", debug_message->str);
+               }
+#endif  /* flatpak ≥ 1.7.3 */
        }
        return TRUE;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]