Remove dependency to capi-system-info 68/324968/1 accepted/tizen_9.0_unified tizen_9.0 accepted/tizen/9.0/unified/20250602.180223
authorYoungjae Cho <y0.cho@samsung.com>
Tue, 27 May 2025 01:30:37 +0000 (10:30 +0900)
committerUnsung Lee <unsung.lee@samsung.com>
Thu, 29 May 2025 10:00:30 +0000 (19:00 +0900)
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 <y0.cho@samsung.com>
CMakeLists.txt
libsyscommon.pc.in
packaging/libsyscommon.spec
src/libcommon/common.c
tests/CMakeLists.txt

index 51f115ba79b2264d4bdad1b7c5c0ed78823e4870..59e1de005d2b49007af8ef300eb7846257d9ac6a 100644 (file)
@@ -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}")
index 3cfd5d6e244e457259ccaf314e305fdd4ec23588..c64cc06bca34423a34b9b7ead45bf8cf0e572f94 100644 (file)
@@ -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
index 0d8d3e8b34fb46ca56ec14d69aa18686aa197064..5909b3d56674453896d6509004a302875fa1c5f8 100644 (file)
@@ -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
index 116c131e7a6cdc790d47bf577a98b7965d9ba1a3..4ac3ebef9e02307189a4ac12bd405253527d449f 100644 (file)
 #include <string.h>
 #include <stdlib.h>
 #include <unistd.h>
+#include <errno.h>
 #include <mntent.h>
 #include <sys/stat.h>
-#include <system_info.h>
 #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)
index e53ee04e18738739c686c88d23a2324334cf10a8..3e0b15f9014ec978d4591041f5821f240fb5e8ff 100644 (file)
@@ -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})