unified-system-plugin: Change to include files in storaged package by flag 01/324401/3 accepted/tizen/unified/20250530.090418 accepted/tizen/unified/x/20250531.232939
authorYunhee Seo <yuni.seo@samsung.com>
Fri, 16 May 2025 08:45:53 +0000 (17:45 +0900)
committerYunhee Seo <yuni.seo@samsung.com>
Fri, 16 May 2025 11:22:36 +0000 (20:22 +0900)
Instead of separating unified-system-plugin files into a package, files
are included in the main package 'storaged' according to a flag named
enable_unified_system_service.
flag name is synced same as other services.

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

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

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

index a306ef6c586cae706438b964064e5685a66cb05b..470231b2bba32dffdf4bb1eda2150ab84cffa3e2 100644 (file)
@@ -42,28 +42,33 @@ FOREACH(flag ${${PROJECT_NAME}_pkgs_CFLAGS})
 ENDFOREACH(flag)
 
 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -Werror -rdynamic -Wno-deprecated-declarations")
-SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -g -fno-omit-frame-pointer -finstrument-functions -DUNIFIED_SYSTEM_SERVICE_ENABLED=${UNIFIED_SYSTEM_SERVICE_ON}")
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -g -fno-omit-frame-pointer -finstrument-functions -DUNIFIED_SYSTEM_SERVICE_ENABLED=${ENABLE_UNIFIED_SYSTEM_SERVICE}")
 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -lrt -fPIE")
 SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie")
 # To apply Armoring(Full RELRO), which means GOT Table becomes read-only.
 SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,relro,-z,now")
 
-ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${${PROJECT_NAME}_pkgs_LDFLAGS} "-ldl" "-lm")
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
-
+if(${ENABLE_UNIFIED_SYSTEM_SERVICE})
 ADD_LIBRARY(${LIBRARY_NAME} SHARED ${SRCS})
 TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${${PROJECT_NAME}_pkgs_LDFLAGS} "-ldl" "-lm")
 INSTALL(TARGETS ${LIBRARY_NAME} DESTINATION ${LIB_INSTALL_DIR}/system/plugin/ COMPONENT RuntimeLibraries)
+else()
+ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${${PROJECT_NAME}_pkgs_LDFLAGS} "-ldl" "-lm")
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
+endif()
 
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/conf/org.tizen.system.storage.conf DESTINATION /etc/dbus-1/system.d)
+if (${ENABLE_UNIFIED_SYSTEM_SERVICE})
 INSTALL(FILES ${CMAKE_SOURCE_DIR}/conf/org.tizen.system.storage-unified-system-service.conf DESTINATION /etc/dbus-1/system.d)
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/conf/block.conf DESTINATION /etc/storaged)
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/conf/storage.conf DESTINATION /etc/storaged)
+else()
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/conf/org.tizen.system.storage.conf DESTINATION /etc/dbus-1/system.d)
 INSTALL(FILES ${CMAKE_SOURCE_DIR}/systemd/org.tizen.system.storage.service DESTINATION /usr/share/dbus-1/system-services)
 INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/systemd/ DESTINATION lib/systemd/system
        FILES_MATCHING
        PATTERN "storaged.service")
+endif()
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/conf/block.conf DESTINATION /etc/storaged)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/conf/storage.conf DESTINATION /etc/storaged)
 
 IF(BLOCK_MODULE STREQUAL on)
        ADD_SUBDIRECTORY(src/block)
index 417f47197c1cb86d9e7ebec289898ce23f53bd43..a5a59149deffd663efe048017e9ae67b010eb5bc 100644 (file)
@@ -1,7 +1,7 @@
 #These options are DEACTIVATED by default.
 %bcond_with emulator
 %define extended_storage 0
-%define unified_system_service_on 0
+%define enable_unified_system_service 0
 
 Name:       storaged
 Summary:    Storaged
@@ -54,12 +54,6 @@ Requires: /usr/bin/newfs_msdos
 %description
 storage daemon.
 
-%package  unified-system-plugin
-Summary:  unified-system-service plugin
-Requires: %{name} = %{version}-%{release}
-%description unified-system-plugin
-unified-system-service plugin
-
 %package  module_block
 Summary:  block module plugin
 Requires: %{name} = %{version}-%{release}
@@ -118,7 +112,7 @@ This package can be installed optional for auto dbus test.
        -DBLOCK_TMPFS=on \
        -DSTORAGE_MODULE=on \
        -DEXTENDED_STORAGE=%{extended_storage} \
-       -DUNIFIED_SYSTEM_SERVICE_ON=%{unified_system_service_on} \
+       -DENABLE_UNIFIED_SYSTEM_SERVICE=%{enable_unified_system_service} \
        -DCRITICAL_LOG_MODULE=on \
        #eol
 
@@ -131,7 +125,9 @@ make %{?jobs:-j%jobs}
 rm -rf %{buildroot}
 %make_install
 
+%if %{enable_unified_system_service} != 1
 %install_service delayed.target.wants storaged.service
+%endif
 
 %if "%{asan}" == "1"
 mkdir -p %{buildroot}%{_unitdir}/storaged.service.d
@@ -141,35 +137,32 @@ install -m 644 systemd/storaged.asan.conf %{buildroot}%{_unitdir}/storaged.servi
 %find_lang extended-sd
 
 %post
+%if %{enable_unified_system_service}
+mv %{_sysconfdir}/dbus-1/system.d/org.tizen.system.storage-unified-system-service.conf \
+       %{_sysconfdir}/dbus-1/system.d/org.tizen.system.storage.conf
+%endif
+
 systemctl daemon-reload
 if [ "$1" == "1" ]; then
     systemctl restart storaged.service
 fi
 
-%post unified-system-plugin
-mv %{_sysconfdir}/dbus-1/system.d/org.tizen.system.storage-unified-system-service.conf \
-       %{_sysconfdir}/dbus-1/system.d/org.tizen.system.storage.conf
-
 %postun
 systemctl daemon-reload
 
 %files
 %manifest %{name}.manifest
 %license LICENSE.Apache-2.0
+%if %{enable_unified_system_service}
+%config %{_sysconfdir}/dbus-1/system.d/org.tizen.system.storage-unified-system-service.conf
+%{_libdir}/system/plugin/libunified-system-service-storaged.so
+%else
 %config %{_sysconfdir}/dbus-1/system.d/org.tizen.system.storage.conf
 %{_datadir}/dbus-1/system-services/org.tizen.system.storage.service
 %{_unitdir}/delayed.target.wants/storaged.service
 %{_unitdir}/storaged.service
 %{_bindir}/storaged
-%if "%{asan}" == "1"
-%{_unitdir}/storaged.service.d/storaged.asan.conf
 %endif
-
-%files unified-system-plugin
-%manifest %{name}.manifest
-%license LICENSE.Apache-2.0
-%config %{_sysconfdir}/dbus-1/system.d/org.tizen.system.storage-unified-system-service.conf
-%{_libdir}/system/plugin/libunified-system-service-storaged.so
 %if "%{asan}" == "1"
 %{_unitdir}/storaged.service.d/storaged.asan.conf
 %endif