summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2020-12-30 17:32:10 +0100
committerThomas Haller <thaller@redhat.com>2021-01-15 11:32:31 +0100
commit24c634bf573880786e709c7ddfab01ebaec7eaa7 (patch)
treef48ea64ed8b13441d45f6e2293ed194c3838bead
parentc6e132749506e77bf5afdfd9174b497b20e7595a (diff)
downloadNetworkManager-24c634bf573880786e709c7ddfab01ebaec7eaa7.tar.gz
core/logging: move "nm-logging.c" to shared/nm-log-core/libnm-log-core library
We want to move platform code to "shared/nm-platform". However, platform code uses the logging infrastructure from the daemon, there is thus an odd circular dependency. Solve that by moving the "src/nm-logging.[hc]" to a new helper library in "shared/nm-log-core".
-rw-r--r--Makefile.am39
-rw-r--r--po/POTFILES.in2
-rw-r--r--shared/meson.build21
-rw-r--r--shared/nm-default.h2
-rw-r--r--shared/nm-log-core/nm-logging.c (renamed from src/nm-logging.c)0
-rw-r--r--shared/nm-log-core/nm-logging.h (renamed from src/nm-logging.h)0
-rw-r--r--shared/nm-platform/tests/meson.build5
-rw-r--r--src/devices/wifi/nm-iwd-manager.c1
-rw-r--r--src/meson.build2
-rw-r--r--src/systemd/meson.build10
-rw-r--r--src/tests/meson.build13
11 files changed, 79 insertions, 16 deletions
diff --git a/Makefile.am b/Makefile.am
index 269fec1e50..6a53f3be6a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -464,6 +464,36 @@ shared_nm_udev_aux_libnm_udev_aux_la_LIBADD = \
###############################################################################
+noinst_LTLIBRARIES += shared/nm-log-core/libnm-log-core.la
+
+shared_nm_log_core_libnm_log_core_la_CPPFLAGS = \
+ $(dflt_cppflags) \
+ -I$(srcdir)/shared \
+ $(CODE_COVERAGE_CFLAGS) \
+ $(SANITIZER_LIB_CFLAGS) \
+ $(GLIB_CFLAGS) \
+ $(SYSTEMD_JOURNAL_CFLAGS) \
+ -DG_LOG_DOMAIN=\""NetworkManager"\" \
+ -DNETWORKMANAGER_COMPILATION='(NM_NETWORKMANAGER_COMPILATION_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_LIB)' \
+ $(NULL)
+
+shared_nm_log_core_libnm_log_core_la_SOURCES = \
+ shared/nm-log-core/nm-logging.c \
+ shared/nm-log-core/nm-logging.h \
+ $(NULL)
+
+shared_nm_log_core_libnm_log_core_la_LDFLAGS = \
+ $(CODE_COVERAGE_LDFLAGS) \
+ $(SANITIZER_LIB_LDFLAGS) \
+ $(NULL)
+
+shared_nm_log_core_libnm_log_core_la_LIBADD = \
+ $(GLIB_LIBS) \
+ $(SYSTEMD_JOURNAL_LIBS) \
+ $(NULL)
+
+###############################################################################
+
noinst_LTLIBRARIES += shared/nm-platform/libnm-platform.la
shared_nm_platform_libnm_platform_la_CPPFLAGS = \
@@ -494,6 +524,7 @@ shared_nm_platform_tests_test_nm_platform_CPPFLAGS = \
-DNETWORKMANAGER_COMPILATION_TEST \
-DNETWORKMANAGER_COMPILATION='(NM_NETWORKMANAGER_COMPILATION_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_PROG)' \
$(CODE_COVERAGE_CFLAGS) \
+ $(SYSTEMD_JOURNAL_CFLAGS) \
$(GLIB_CFLAGS) \
$(SANITIZER_LIB_CFLAGS) \
$(NULL)
@@ -505,9 +536,11 @@ shared_nm_platform_tests_test_nm_platform_LDFLAGS = \
shared_nm_platform_tests_test_nm_platform_LDADD = \
shared/nm-platform/libnm-platform.la \
+ shared/nm-log-core/libnm-log-core.la \
shared/nm-glib-aux/libnm-glib-aux.la \
shared/nm-std-aux/libnm-std-aux.la \
shared/libcsiphash.la \
+ $(SYSTEMD_JOURNAL_LIBS) \
$(GLIB_LIBS) \
$(NULL)
@@ -2168,8 +2201,6 @@ src_libNetworkManagerBase_la_SOURCES = \
\
src/nm-core-utils.c \
src/nm-core-utils.h \
- src/nm-logging.c \
- src/nm-logging.h \
\
src/NetworkManagerUtils.c \
src/NetworkManagerUtils.h \
@@ -2245,7 +2276,6 @@ endif
src_libNetworkManagerBase_la_LIBADD = \
$(GLIB_LIBS) \
- $(SYSTEMD_JOURNAL_LIBS) \
$(LIBUDEV_LIBS) \
$(NULL)
@@ -2443,6 +2473,7 @@ src_libNetworkManager_la_LIBADD = \
$(libnm_crypto_lib) \
libnm-core/nm-libnm-core-intern/libnm-libnm-core-intern.la \
shared/nm-platform/libnm-platform.la \
+ shared/nm-log-core/libnm-log-core.la \
shared/nm-udev-aux/libnm-udev-aux.la \
shared/nm-glib-aux/libnm-glib-aux.la \
shared/nm-std-aux/libnm-std-aux.la \
@@ -2555,6 +2586,7 @@ src_nm_iface_helper_LDADD = \
$(libnm_crypto_lib) \
libnm-core/nm-libnm-core-intern/libnm-libnm-core-intern.la \
shared/nm-platform/libnm-platform.la \
+ shared/nm-log-core/libnm-log-core.la \
shared/nm-udev-aux/libnm-udev-aux.la \
shared/nm-glib-aux/libnm-glib-aux.la \
shared/nm-std-aux/libnm-std-aux.la \
@@ -2608,6 +2640,7 @@ src_initrd_nm_initrd_generator_LDADD = \
$(libnm_crypto_lib) \
libnm-core/nm-libnm-core-intern/libnm-libnm-core-intern.la \
shared/nm-platform/libnm-platform.la \
+ shared/nm-log-core/libnm-log-core.la \
shared/nm-udev-aux/libnm-udev-aux.la \
shared/nm-glib-aux/libnm-glib-aux.la \
shared/nm-std-aux/libnm-std-aux.la \
diff --git a/po/POTFILES.in b/po/POTFILES.in
index cee590c0cf..b3d33487bd 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -147,6 +147,7 @@ libnm/nm-vpn-plugin-old.c
libnm/nm-vpn-service-plugin.c
data/org.freedesktop.NetworkManager.policy.in.in
shared/nm-glib-aux/nm-shared-utils.c
+shared/nm-log-core/nm-logging.c
src/NetworkManagerUtils.c
src/main.c
src/main-utils.c
@@ -179,7 +180,6 @@ src/devices/wifi/nm-wifi-utils.c
src/devices/wwan/nm-modem-broadband.c
src/nm-config.c
src/nm-iface-helper.c
-src/nm-logging.c
src/nm-manager.c
src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c
src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
diff --git a/shared/meson.build b/shared/meson.build
index eb96e4d305..fda44444e7 100644
--- a/shared/meson.build
+++ b/shared/meson.build
@@ -182,6 +182,27 @@ libnm_udev_aux_dep = declare_dependency(
link_with: libnm_udev_aux,
)
+libnm_log_core = static_library(
+ 'nm-log-core',
+ sources: 'nm-log-core/nm-logging.c',
+ dependencies: [
+ glib_nm_default_dep,
+ libsystemd_dep,
+ ],
+ c_args: [
+ '-DG_LOG_DOMAIN="NetworkManager"',
+ '-DNETWORKMANAGER_COMPILATION=(NM_NETWORKMANAGER_COMPILATION_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_LIB)',
+ ],
+)
+
+libnm_log_core_dep = declare_dependency(
+ include_directories: shared_inc,
+ dependencies: [
+ libnm_utils_base_dep,
+ ],
+ link_with: libnm_log_core,
+)
+
libnm_platform = static_library(
'nm-platform',
sources: [
diff --git a/shared/nm-default.h b/shared/nm-default.h
index 91ab085be8..f2cb024441 100644
--- a/shared/nm-default.h
+++ b/shared/nm-default.h
@@ -281,7 +281,7 @@ _nm_g_return_if_fail_warning(const char *log_domain, const char *file, int line)
#if (NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_DAEMON
#include "nm-core-types.h"
#include "nm-types.h"
- #include "nm-logging.h"
+ #include "nm-log-core/nm-logging.h"
#endif
#if (NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_PRIVATE
diff --git a/src/nm-logging.c b/shared/nm-log-core/nm-logging.c
index 495d5aca3c..495d5aca3c 100644
--- a/src/nm-logging.c
+++ b/shared/nm-log-core/nm-logging.c
diff --git a/src/nm-logging.h b/shared/nm-log-core/nm-logging.h
index d3143d3973..d3143d3973 100644
--- a/src/nm-logging.h
+++ b/shared/nm-log-core/nm-logging.h
diff --git a/shared/nm-platform/tests/meson.build b/shared/nm-platform/tests/meson.build
index 4c9d91d118..47175331fe 100644
--- a/shared/nm-platform/tests/meson.build
+++ b/shared/nm-platform/tests/meson.build
@@ -7,7 +7,10 @@ exe = executable(
'-DNETWORKMANAGER_COMPILATION_TEST',
'-DNETWORKMANAGER_COMPILATION=(NM_NETWORKMANAGER_COMPILATION_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_PROG)',
],
- dependencies: libnm_platform_dep,
+ dependencies: [
+ libnm_log_core_dep,
+ libnm_platform_dep,
+ ],
link_with: libnm_systemd_logging_stub,
)
diff --git a/src/devices/wifi/nm-iwd-manager.c b/src/devices/wifi/nm-iwd-manager.c
index 0725e5ba68..5ded8e15a6 100644
--- a/src/devices/wifi/nm-iwd-manager.c
+++ b/src/devices/wifi/nm-iwd-manager.c
@@ -9,7 +9,6 @@
#include <net/if.h>
-#include "nm-logging.h"
#include "nm-core-internal.h"
#include "nm-manager.h"
#include "nm-device-iwd.h"
diff --git a/src/meson.build b/src/meson.build
index f21ce17c44..07014bbb71 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -7,6 +7,7 @@ daemon_nm_default_dep = declare_dependency(
include_directories: src_inc,
dependencies: [
libnm_core_nm_default_dep,
+ libnm_log_core_dep,
libnm_platform_dep,
],
)
@@ -52,7 +53,6 @@ sources = files(
'nm-ip-config.c',
'nm-ip4-config.c',
'nm-ip6-config.c',
- 'nm-logging.c',
)
deps = [
diff --git a/src/systemd/meson.build b/src/systemd/meson.build
index 536dd9703f..4f3a63eda4 100644
--- a/src/systemd/meson.build
+++ b/src/systemd/meson.build
@@ -36,9 +36,13 @@ libnm_systemd_core = static_library(
'nm-sd-utils-dhcp.c',
'sd-adapt-core/nm-sd-adapt-core.c',
),
- include_directories: incs,
+ include_directories: [
+ incs,
+ src_inc,
+ ],
dependencies: [
- daemon_nm_default_dep,
+ glib_nm_default_dep,
+ libnm_core_dep,
libnm_systemd_shared_dep,
],
c_args: '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_SYSTEMD',
@@ -49,7 +53,7 @@ libnm_systemd_core_dep = declare_dependency(
include_directories: incs,
dependencies: [
glib_dep,
- daemon_nm_default_dep,
+ libnm_core_dep,
libnm_systemd_shared_dep,
],
link_with: libnm_systemd_core,
diff --git a/src/tests/meson.build b/src/tests/meson.build
index 6366225bce..1d3f596382 100644
--- a/src/tests/meson.build
+++ b/src/tests/meson.build
@@ -32,15 +32,18 @@ endforeach
exe = executable(
'test-systemd',
'test-systemd.c',
- dependencies: daemon_nm_default_dep,
+ include_directories: [
+ top_inc,
+ src_inc,
+ ],
+ dependencies: [
+ libnm_systemd_core_dep,
+ libnm_systemd_shared_dep,
+ ],
c_args: [
'-DNETWORKMANAGER_COMPILATION_TEST',
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_SYSTEMD',
],
- link_with: [
- libnm_systemd_core,
- libnm_systemd_shared,
- ],
)
test(