unified-system-plugin: Change to include files in deviced package by flag 83/324383/6 accepted/tizen/unified/20250530.090414 accepted/tizen/unified/x/20250531.232934
authorYunhee Seo <yuni.seo@samsung.com>
Fri, 16 May 2025 06:59:15 +0000 (15:59 +0900)
committerYunhee Seo <yuni.seo@samsung.com>
Mon, 19 May 2025 08:08:47 +0000 (17:08 +0900)
Instead of separating unified-system-plugin files into a package, files
are included in the main package 'deviced' according to a flag named
enable_unified_system_service.

If flag is 1 then:
    libunified-system-service-deviced.so is included
    Unnecessary files for unified-system-plugin(deviced executable,
    systemd service files) are excluded

If flag is not 1 then:
    libunified-system-service-deviced.so is excluded
    deviced executable, systemd service files are included

Change-Id: I7770d4b734035035b0cb894ef8e8bc635e65d925
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
CMakeLists.txt
packaging/deviced.spec

index 02a486e5dc7b182a747762d85f612b2ed2157da4..5b0d48131bdc1e9cda992449e3730aa59f693b41 100644 (file)
@@ -6,7 +6,6 @@ PROJECT(deviced C)
 ########################################################
 
 SET(CMAKE_VERBOSE_MAKEFILE OFF)
-SET(LIBRARY_NAME "unified-system-service-deviced")
 
 IF("${ARCH}" STREQUAL "arm")
        OPTION(USE_ARM "Use Arm" ON)
@@ -248,16 +247,21 @@ ADD_DEFINITIONS("-DDEBUG")
 # Build libdeviced-common-private.so
 ADD_SUBDIRECTORY(src/shared)
 
-ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
 SET(deviced_LDFLAGS ${REQUIRED_PKGS_LDFLAGS})
+
+if(${ENABLE_UNIFIED_SYSTEM_SERVICE})
+SET(LIBRARY_NAME "unified-system-service-deviced")
+ADD_LIBRARY(${LIBRARY_NAME} SHARED ${SRCS})
+TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${REQUIRED_PKGS_LDFLAGS} "-lrt -ldl -lm" deviced-common-private)
+INSTALL(TARGETS ${LIBRARY_NAME} DESTINATION ${LIB_INSTALL_DIR}/system/plugin/ COMPONENT RuntimeLibraries)
+else()
+ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${REQUIRED_PKGS_LDFLAGS} "-lrt -ldl -lm" deviced-common-private)
 INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
+endif()
 
 INSTALL(DIRECTORY DESTINATION ${MAKE_INSTALL_PREFIX}${DD_PLUGIN_PATH})
 
-ADD_LIBRARY(${LIBRARY_NAME} SHARED ${SRCS})
-TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${REQUIRED_PKGS_LDFLAGS} "-lrt -ldl -lm" deviced-common-private)
-INSTALL(TARGETS ${LIBRARY_NAME} DESTINATION ${LIB_INSTALL_DIR}/system/plugin/ COMPONENT RuntimeLibraries)
 
 IF(POWER_MODULE STREQUAL on)
        ADD_EXECUTABLE(deviced-shutdown src/power-shutdown/shutdown.c src/shared/common.c)
@@ -321,10 +325,13 @@ ENDIF()
 CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
 
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/conf/org.tizen.system.deviced.conf       DESTINATION /etc/dbus-1/system.d)
+if(${ENABLE_UNIFIED_SYSTEM_SERVICE})
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/conf/org.tizen.system.deviced-unified-system-service.conf       DESTINATION /etc/dbus-1/system.d)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/systemd/org.tizen.system.deviced.service DESTINATION /usr/share/dbus-1/system-services)
+else()
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/conf/org.tizen.system.deviced.conf       DESTINATION /etc/dbus-1/system.d)
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/systemd/deviced.service                  DESTINATION /usr/lib/systemd/system)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/systemd/org.tizen.system.deviced.service DESTINATION /usr/share/dbus-1/system-services)
+endif()
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/systemd/usb-host-ffs-test-daemon.service DESTINATION /usr/lib/systemd/system)
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/systemd/usb-host-test.socket             DESTINATION /usr/lib/systemd/system)
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/systemd/strs                             DESTINATION /etc/mtp-responder-dummy)
index 4679a5902ed1414930247d441158bc32b356a9c1..cf0bee61f00454205b928b4c2f4976d4f46c2f2c 100644 (file)
@@ -2,6 +2,7 @@
 
 #Just For debugging
 %define sdb_prestart off
+%define enable_unified_system_service 0
 
 Name:       deviced
 Summary:    Deviced
@@ -59,14 +60,6 @@ Requires(preun): %{_sbindir}/update-alternatives
 %description
 Deviced
 
-%package  unified-system-plugin
-License:  Apache-2.0 and MIT
-Summary:  unified-system plugin
-Requires: %{name} = %{version}-%{release}
-
-%description unified-system-plugin
-unified-system-service plugin
-
 %package -n libdeviced
 Summary:    Deviced library
 Group:      Development/Libraries
@@ -186,6 +179,7 @@ It can test resource-driver and plugin backend call test for deviced.
        -DDEVICE_BOARD_MODULE=on \
        -DDEVICE_INPUT_MODULE=on \
        -DCRITICAL_LOG_MODULE=on \
+       -DENABLE_UNIFIED_SYSTEM_SERVICE=%{enable_unified_system_service} \
        #eol
 
 %build
@@ -207,7 +201,9 @@ sed -ie s,"##PLUGIN_LIB_DIR##,$DD_PLUGIN_PATH,g" isu/usr-lib-deviced.mount
 rm -rf %{buildroot}
 %make_install
 
+%if %{enable_unified_system_service} != 1
 %install_service multi-user.target.wants deviced.service
+%endif
 # usb_module condition is removed because it is always on
 %if %{?sdb_prestart} == on
 %install_service basic.target.wants sdb-prestart.service
@@ -217,6 +213,10 @@ mkdir -p %{buildroot}%{TZ_SYS_DUMPGEN}
 install -m 775 scripts/dump_pmstate_log.sh %{buildroot}%{TZ_SYS_DUMPGEN}/dump_pmstate_log.sh
 
 %post
+%if %{enable_unified_system_service}
+mv %{_sysconfdir}/dbus-1/system.d/org.tizen.system.deviced-unified-system-service.conf \
+       %{_sysconfdir}/dbus-1/system.d/org.tizen.system.deviced.conf
+%endif
 # Assume power module is on (-DPOWER_MODULE=on)
 update-alternatives --install %{_prefix}/lib/systemd/systemd-shutdown systemd-shutdown %{_prefix}/lib/systemd/deviced-shutdown 500
 
@@ -284,64 +284,26 @@ mv %{_sysconfdir}/deviced/power-profile-tv.conf %{_sysconfdir}/deviced/power.con
 mkdir -p %{_libdir}/deviced
 mv %{_libdir}/tv-display.so %{_libdir}/deviced/display.so
 
-%post unified-system-plugin
-mv %{_sysconfdir}/dbus-1/system.d/org.tizen.system.deviced-unified-system-service.conf \
-       %{_sysconfdir}/dbus-1/system.d/org.tizen.system.deviced.conf
-
 %files
 %manifest %{name}.manifest
 %license LICENSE.Apache-2.0
 %license LICENSE.MIT
-%{_bindir}/deviced
 %{_libdir}/libdeviced-common-private.so
+%if %{enable_unified_system_service}
+%{_libdir}/system/plugin/libunified-system-service-deviced.so
+%config %{_sysconfdir}/dbus-1/system.d/org.tizen.system.deviced-unified-system-service.conf
+%else
+%{_bindir}/deviced
 %{_unitdir}/multi-user.target.wants/deviced.service
 %{_unitdir}/deviced.service
 %{_datadir}/dbus-1/system-services/org.tizen.system.deviced.service
-%dir %{plugindir}
-%if %{?sdb_prestart} == on
-%{_unitdir}/sdb-prestart.service
-%{_unitdir}/basic.target.wants/sdb-prestart.service
-%endif
 %config %{_sysconfdir}/dbus-1/system.d/org.tizen.system.deviced.conf
-%config %{_sysconfdir}/deviced/init.conf
-%config %{_sysconfdir}/deviced/display.conf
-%if %{?battery_module} == on
-%config %{_sysconfdir}/deviced/battery.conf
 %endif
-# usbhost_test
-%{_sysconfdir}/deviced/usb-host-test/test_gadget.gs
-%{_bindir}/usb-host-ffs-test-daemon
-%{_unitdir}/usb-host-ffs-test-daemon.service
-%{_unitdir}/usb-host-test.socket
-%{_sysconfdir}/deviced/usb-host-test/descs
-%{_sysconfdir}/deviced/usb-host-test/strs
-# dummy mtp-responder
-%{_sysconfdir}/mtp-responder-dummy/strs
-%{_sysconfdir}/mtp-responder-dummy/descs
-%{_unitdir}/mtp-responder-dummy.socket
-%{_unitdir}/mtp-responder-dummy.service
-
-# Assume power module is on (-DPOWER_MODULE=on)
-%{_unitdir}/deviced-request-shutdown@.service
-%{_unitdir}/systemd-reboot.service.d/deviced-request-shutdown-reboot.conf
-%{_unitdir}/systemd-poweroff.service.d/deviced-request-shutdown-poweroff.conf
-%{_unitdir}/systemd-halt.service.d/deviced-request-shutdown-halt.conf
-%{_unitdir}/systemd-exit.service.d/deviced-request-shutdown-exit.conf
-%{_prefix}/lib/systemd/deviced-shutdown
-%{_sbindir}/deviced-request-shutdown
-
-%files unified-system-plugin
-%manifest %{name}.manifest
-%license LICENSE.Apache-2.0
-%license LICENSE.MIT
-%{_libdir}/system/plugin/libunified-system-service-deviced.so
-%{_libdir}/libdeviced-common-private.so
 %dir %{plugindir}
 %if %{?sdb_prestart} == on
 %{_unitdir}/sdb-prestart.service
 %{_unitdir}/basic.target.wants/sdb-prestart.service
 %endif
-%config %{_sysconfdir}/dbus-1/system.d/org.tizen.system.deviced-unified-system-service.conf
 %config %{_sysconfdir}/deviced/init.conf
 %config %{_sysconfdir}/deviced/display.conf
 %if %{?battery_module} == on