diff options
Diffstat (limited to 'meta/recipes-devtools/createrepo-c/createrepo-c/0001-Fix-setup-of-logging-log-domains-RhBug-1645897.patch')
-rw-r--r-- | meta/recipes-devtools/createrepo-c/createrepo-c/0001-Fix-setup-of-logging-log-domains-RhBug-1645897.patch | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/meta/recipes-devtools/createrepo-c/createrepo-c/0001-Fix-setup-of-logging-log-domains-RhBug-1645897.patch b/meta/recipes-devtools/createrepo-c/createrepo-c/0001-Fix-setup-of-logging-log-domains-RhBug-1645897.patch new file mode 100644 index 0000000000..6de9c05572 --- /dev/null +++ b/meta/recipes-devtools/createrepo-c/createrepo-c/0001-Fix-setup-of-logging-log-domains-RhBug-1645897.patch | |||
@@ -0,0 +1,73 @@ | |||
1 | From 80810f04f2de6bae6e394f52ad9cdd2189862f74 Mon Sep 17 00:00:00 2001 | ||
2 | From: Jaroslav Rohel <jrohel@redhat.com> | ||
3 | Date: Fri, 9 Nov 2018 07:35:13 +0100 | ||
4 | Subject: [PATCH] Fix setup of logging (log domains) (RhBug:1645897) | ||
5 | |||
6 | New debug messages were added into GLib library. These messages come | ||
7 | from the "GLib" log domain and were not hidden in the standard and | ||
8 | quiet mode of the application. | ||
9 | This fix hides log messages regardless on source log domain. | ||
10 | |||
11 | Upstream-Status: Backport | ||
12 | |||
13 | Signed-off-by: Zheng Ruoqin <zhengrq.fnst@cn.fujitsu.com> | ||
14 | --- | ||
15 | src/createrepo_shared.c | 19 ++++++------------- | ||
16 | src/misc.c | 5 ++++- | ||
17 | 2 files changed, 10 insertions(+), 14 deletions(-) | ||
18 | |||
19 | diff --git a/src/createrepo_shared.c b/src/createrepo_shared.c | ||
20 | index 8a26787..7cb8ba8 100644 | ||
21 | --- a/src/createrepo_shared.c | ||
22 | +++ b/src/createrepo_shared.c | ||
23 | @@ -270,24 +270,17 @@ cr_lock_repo(const gchar *repo_dir, | ||
24 | void | ||
25 | cr_setup_logging(gboolean quiet, gboolean verbose) | ||
26 | { | ||
27 | - g_log_set_default_handler (cr_log_fn, NULL); | ||
28 | - | ||
29 | if (quiet) { | ||
30 | // Quiet mode | ||
31 | - GLogLevelFlags levels = G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | | ||
32 | - G_LOG_LEVEL_DEBUG | G_LOG_LEVEL_WARNING; | ||
33 | - g_log_set_handler(NULL, levels, cr_null_log_fn, NULL); | ||
34 | - g_log_set_handler("C_CREATEREPOLIB", levels, cr_null_log_fn, NULL); | ||
35 | + GLogLevelFlags hidden_levels = G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | | ||
36 | + G_LOG_LEVEL_DEBUG | G_LOG_LEVEL_WARNING; | ||
37 | + g_log_set_default_handler (cr_log_fn, GINT_TO_POINTER(hidden_levels)); | ||
38 | } else if (verbose) { | ||
39 | // Verbose mode | ||
40 | - GLogLevelFlags levels = G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | | ||
41 | - G_LOG_LEVEL_DEBUG | G_LOG_LEVEL_WARNING; | ||
42 | - g_log_set_handler(NULL, levels, cr_log_fn, NULL); | ||
43 | - g_log_set_handler("C_CREATEREPOLIB", levels, cr_log_fn, NULL); | ||
44 | + g_log_set_default_handler (cr_log_fn, GINT_TO_POINTER(0)); | ||
45 | } else { | ||
46 | // Standard mode | ||
47 | - GLogLevelFlags levels = G_LOG_LEVEL_DEBUG; | ||
48 | - g_log_set_handler(NULL, levels, cr_null_log_fn, NULL); | ||
49 | - g_log_set_handler("C_CREATEREPOLIB", levels, cr_null_log_fn, NULL); | ||
50 | + GLogLevelFlags hidden_levels = G_LOG_LEVEL_DEBUG; | ||
51 | + g_log_set_default_handler (cr_log_fn, GINT_TO_POINTER(hidden_levels)); | ||
52 | } | ||
53 | } | ||
54 | diff --git a/src/misc.c b/src/misc.c | ||
55 | index 9937480..9549a44 100644 | ||
56 | --- a/src/misc.c | ||
57 | +++ b/src/misc.c | ||
58 | @@ -912,8 +912,11 @@ void | ||
59 | cr_log_fn(const gchar *log_domain, | ||
60 | GLogLevelFlags log_level, | ||
61 | const gchar *message, | ||
62 | - G_GNUC_UNUSED gpointer user_data) | ||
63 | + gpointer user_data) | ||
64 | { | ||
65 | + gint hidden_log_levels = GPOINTER_TO_INT(user_data); | ||
66 | + if (log_level & hidden_log_levels) | ||
67 | + return; | ||
68 | switch(log_level) { | ||
69 | case G_LOG_LEVEL_ERROR: | ||
70 | if (log_domain) g_printerr("%s: ", log_domain); | ||
71 | -- | ||
72 | 1.8.3.1 | ||
73 | |||