From ee6a98ad56f0b26eb1b158545bc2a68a5178e823 Mon Sep 17 00:00:00 2001 From: Youngjae Cho Date: Tue, 27 May 2025 10:30:37 +0900 Subject: [PATCH] Remove dependency to capi-system-info MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Due to the introduction of subsession feature on buxton2, new dependency "buxton2->sessiond" was added, and it made the cycle dependency below. • buxton2 -> sessiond -> libsyscommon -> capi-system-info --(VD only)-> factory-api --(VD only)-> buxton2 To break the cycle dependency, removed libsyscommon->capi-system-info dependency. The capi-system-info had been only used to figure out whether the target is emulator or not, so changed it by exploiting predefined macro from project_config, %{_with_emulator}. Change-Id: I7b0f64ca99d9da5bce104322eb2293bb721f9ef8 Signed-off-by: Youngjae Cho --- CMakeLists.txt | 5 +++-- libsyscommon.pc.in | 2 +- packaging/libsyscommon.spec | 9 +++++++-- src/libcommon/common.c | 26 ++------------------------ tests/CMakeLists.txt | 1 - 5 files changed, 13 insertions(+), 30 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 51f115b..59e1de0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,6 +11,8 @@ ADD_SUBDIRECTORY(src/plugin-api/update-control) ADD_SUBDIRECTORY(src/plugin-api/sessiond) # ADD_SUBDIRECTORY(src/libgdbus) +ADD_DEFINITIONS("-DEMULATOR_MODE=${EMULATOR_MODE}") + SET(PREFIX ${CMAKE_INSTALL_PREFIX}) SET(EXEC_PREFIX "${PREFIX}/bin") SET(LIBDIR ${LIB_INSTALL_DIR}) @@ -38,8 +40,7 @@ pkg_check_modules(syscommon REQUIRED gio-2.0 gio-unix-2.0 dlog - json-c - capi-system-info) + json-c) FOREACH(flag ${syscommon_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") diff --git a/libsyscommon.pc.in b/libsyscommon.pc.in index 3cfd5d6..c64cc06 100644 --- a/libsyscommon.pc.in +++ b/libsyscommon.pc.in @@ -12,6 +12,6 @@ includedir=@INCLUDEDIR@ Name: libsyscommon Description: system common library Version: @VERSION@ -Requires.private: gio-2.0 gio-unix-2.0 dlog json-c capi-system-info +Requires.private: gio-2.0 gio-unix-2.0 dlog json-c Cflags: -I${includedir} @SYSCOMMON_INCLUDEDIR@ Libs: -L${libdir} -lsyscommon diff --git a/packaging/libsyscommon.spec b/packaging/libsyscommon.spec index 0d8d3e8..5909b3d 100644 --- a/packaging/libsyscommon.spec +++ b/packaging/libsyscommon.spec @@ -4,6 +4,11 @@ %define libsyscommon_plugin_api_deviced_version 0.1.0 %define libsyscommon_plugin_api_update_control_version 0.1.0 %define libsyscommon_plugin_api_sessiond_version 0.1.0 +%if "%{?_with_emulator}" == "1" +%define emulator_mode 1 +%else +%define emulator_mode 0 +%endif Name: libsyscommon Summary: System Libraries @@ -21,7 +26,6 @@ BuildRequires: pkgconfig(gio-2.0) >= 2.44 BuildRequires: pkgconfig(gio-unix-2.0) BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(json-c) -BuildRequires: pkgconfig(capi-system-info) BuildRequires: pkgconfig(capi-system-resource) Requires: /bin/cp @@ -147,7 +151,8 @@ PLUGIN_API_SESSIOND_MAJORVER=$(echo %{libsyscommon_plugin_api_sessiond_version} -DPLUGIN_API_RESOURCED_ENABLE_DLOG=1 \ -DPLUGIN_API_DEVICED_ENABLE_DLOG=1 \ -DPLUGIN_API_UPDATE_CONTROL_ENABLE_DLOG=1 \ - -DPLUGIN_API_SESSIOND_ENABLE_DLOG=1 + -DPLUGIN_API_SESSIOND_ENABLE_DLOG=1 \ + -DEMULATOR_MODE=%{emulator_mode} make %{?_smp_mflags} %install diff --git a/src/libcommon/common.c b/src/libcommon/common.c index 116c131..4ac3ebe 100644 --- a/src/libcommon/common.c +++ b/src/libcommon/common.c @@ -24,41 +24,19 @@ #include #include #include +#include #include #include -#include #include "shared/log.h" #include "libsyscommon/common.h" -#define FEATURE_MODEL_NAME "http://tizen.org/system/model_name" -#define FEATURE_MODEL_NAME_EMULATOR "Emulator" #define CONTAINER_FILE_PATH "/run/systemd/container" #define PATH_MAX 256 bool syscommon_is_emulator(void) { - int ret = 0; - char *model_name = NULL; - static bool is_emul = false; - static bool is_cached = false; - - if (is_cached) - return is_emul; - - ret = system_info_get_platform_string(FEATURE_MODEL_NAME, &model_name); - if (ret < 0) { - _E("Cannot get model name: %d, syscommon_is_emulator() returns false on operation failure", ret); - return false; - } - - if (!strncmp(FEATURE_MODEL_NAME_EMULATOR, model_name, strlen(model_name) + 1)) - is_emul = true; - - is_cached = true; - free(model_name); - - return is_emul; + return (EMULATOR_MODE == 1); } bool syscommon_is_container(void) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index e53ee04..3e0b15f 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -35,7 +35,6 @@ INCLUDE(FindPkgConfig) PKG_CHECK_MODULES(REQUIRED_PKGS REQUIRED glib-2.0 json-c - capi-system-info cmocka) ADD_EXECUTABLE(${TEST_DRIVER} ${SRCS}) -- 2.34.1