From 7241a8f993d17af63a9bca3425215a69c70e524c Mon Sep 17 00:00:00 2001 From: Sangyoon Jang Date: Mon, 15 Jun 2020 14:42:44 +0900 Subject: [PATCH] Fix systemd and DBus configuaration, fix bus name The systemd service file and dbus configuration will be installed by rpm packaging. And the bus name is changed, following DBus naming convention. Change-Id: I388adccd490d369782bc087623bb4b36c6a31def Signed-off-by: Sangyoon Jang --- CMakeLists.txt | 7 ------- org.tizen.theme_manager.conf | 19 ------------------- packaging/tizen-theme-manager.conf | 19 +++++++++++++++++++ .../tizen-theme-manager.service | 7 +++++-- packaging/tizen-theme-manager.spec | 18 ++++++++++++++++-- src/theme/dbus/request_broker.cc | 8 ++++---- src/theme_plugin/theme_parser.cc | 13 ++++++++++--- test/unit_tests/test_theme_info_loader.cc | 4 ++-- 8 files changed, 56 insertions(+), 39 deletions(-) delete mode 100644 org.tizen.theme_manager.conf create mode 100644 packaging/tizen-theme-manager.conf rename theme-manager.service.in => packaging/tizen-theme-manager.service (51%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3fe9fb0..df103db 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,10 +43,3 @@ PKG_CHECK_MODULES(GOBJECT_DEPS REQUIRED gobject-2.0) ADD_SUBDIRECTORY(src) ADD_SUBDIRECTORY(test) - -CONFIGURE_FILE(theme-manager.service.in theme-manager.service @ONLY) - -INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/theme-manager.service DESTINATION ${UNITDIR}) -INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ DESTINATION ${SYSCONF_INSTALL_DIR}/dbus-1/system.d - FILES_MATCHING - PATTERN "*.conf") \ No newline at end of file diff --git a/org.tizen.theme_manager.conf b/org.tizen.theme_manager.conf deleted file mode 100644 index adb8b66..0000000 --- a/org.tizen.theme_manager.conf +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/packaging/tizen-theme-manager.conf b/packaging/tizen-theme-manager.conf new file mode 100644 index 0000000..23996a4 --- /dev/null +++ b/packaging/tizen-theme-manager.conf @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + diff --git a/theme-manager.service.in b/packaging/tizen-theme-manager.service similarity index 51% rename from theme-manager.service.in rename to packaging/tizen-theme-manager.service index fa5537f..a253c5c 100644 --- a/theme-manager.service.in +++ b/packaging/tizen-theme-manager.service @@ -3,8 +3,11 @@ Description=Tizen Theme Manager [Service] Type=dbus -BusName=org.tizen.theme_manager +BusName=org.tizen.ThemeManager User=app_fw Group=app_fw SmackProcessLabel=System -ExecStart=@PREFIX@/bin/theme-provider +ExecStart=/usr/bin/theme-provider + +[Install] +WantedBy=multi-user.target diff --git a/packaging/tizen-theme-manager.spec b/packaging/tizen-theme-manager.spec index df25d5d..f67e114 100644 --- a/packaging/tizen-theme-manager.spec +++ b/packaging/tizen-theme-manager.spec @@ -6,6 +6,8 @@ Group: Application Framework/Package Management License: Apache-2.0 Source0: %{name}-%{version}.tar.gz Source1001: %{name}.manifest +Source1002: %{name}.service +Source1003: %{name}.conf BuildRequires: cmake BuildRequires: pkgconfig(bundle) BuildRequires: pkgconfig(dlog) @@ -65,6 +67,11 @@ install -m 0644 tizen-theme-manager.zip %{buildroot}%{_datadir}/gcov/ %install %make_install +install -m 755 -d %{buildroot}%{_unitdir} +install -m 644 %{SOURCE1002} %{buildroot}%{_unitdir} +install -m 755 -d %{buildroot}%{_sysconfdir}/dbus-1/system.d +install -m 644 %{SOURCE1003} %{buildroot}%{_sysconfdir}/dbus-1/system.d + %if 0%{?gcov:1} mkdir -p %{buildroot}%{_datadir}/gcov/obj install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj @@ -72,6 +79,13 @@ install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj %post /sbin/ldconfig +systemctl reenable %{name} + +%preun +systemctl disable %{name} + +%postun +/sbin/ldconfig %files %defattr(-,root,root,-) @@ -82,8 +96,8 @@ install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj %{_libdir}/libtizen-theme-provider.so %{_sysconfdir}/package-manager/parserlib/metadata/libtizen-theme-plugin.so %{_datarootdir}/parser-plugins/tizen-theme-plugin.info -%{_unitdir}/theme-manager.service -%config %{_sysconfdir}/dbus-1/system.d/*theme_manager*.conf +%{_unitdir}/%{name}.service +%{_sysconfdir}/dbus-1/system.d/%{name}.conf ################################################# # tizen-theme-manager-gcov diff --git a/src/theme/dbus/request_broker.cc b/src/theme/dbus/request_broker.cc index fb43986..175a23f 100644 --- a/src/theme/dbus/request_broker.cc +++ b/src/theme/dbus/request_broker.cc @@ -23,9 +23,9 @@ namespace { -const char kDbusBusName[] = "tizen.theme_manager"; -const char kDbusInterfaceName[] = "org.tizen.theme_manager"; -const char kDbusObjectPath[] = "/org/tizen/theme_manager"; +const char kDbusBusName[] = "org.tizen.ThemeManager"; +const char kDbusInterfaceName[] = "org.tizen.ThemeManager"; +const char kDbusObjectPath[] = "/org/tizen/ThemeManager"; const char kDBusMethodSendData[] = "SendData"; } @@ -121,7 +121,7 @@ bool RequestBroker::Listen() { }; gchar introspection_xml[] = "" - " " + " " " " " " " " diff --git a/src/theme_plugin/theme_parser.cc b/src/theme_plugin/theme_parser.cc index 12c2479..82e6ce0 100644 --- a/src/theme_plugin/theme_parser.cc +++ b/src/theme_plugin/theme_parser.cc @@ -11,6 +11,7 @@ #include #include +#include "theme/dbus/request_broker.h" #include "theme/loader/theme_info.h" #include "theme/utils/logging.h" #include "theme_plugin/theme_info_builder.h" @@ -44,21 +45,27 @@ loader::ThemeInfo ThemeParser::Inflate(const std::string id, return builder.Build(); } +using ttm::dbus::Command; +using ttm::dbus::RequestBroker; int ThemeParser::Commit(ThemeOperation operation, const loader::ThemeInfo& theme) { + tizen_base::Bundle theme_info = theme.Serialize(); + tizen_base::Bundle reply; switch (operation) { case ThemeOperation::ADD: LOG(DEBUG) << "Add Theme: " << theme.GetId(); - // send dbus request at here + reply = RequestBroker::GetInst().SendData(Command::ADD, theme_info); break; case ThemeOperation::UPDATE: LOG(DEBUG) << "Update Theme: " << theme.GetId(); - // send dbus request at here + reply = RequestBroker::GetInst().SendData(Command::UPDATE, theme_info); break; case ThemeOperation::REMOVE: LOG(DEBUG) << "Remove Theme: " << theme.GetId(); - // send dbus request at here + reply = RequestBroker::GetInst().SendData(Command::REMOVE, theme_info); break; + default: + return -1; } return 0; } diff --git a/test/unit_tests/test_theme_info_loader.cc b/test/unit_tests/test_theme_info_loader.cc index 1f6d4dd..b04ceaa 100644 --- a/test/unit_tests/test_theme_info_loader.cc +++ b/test/unit_tests/test_theme_info_loader.cc @@ -107,8 +107,8 @@ TEST_F(ThemeInfoLoaderTest, LoadCurrent) { TEST_F(ThemeInfoLoaderTest, Load) { EXPECT_CALL(GetMock(), - g_dbus_message_new_method_call(StrEq("org.tizen.theme_manager"), - StrEq("/org/tizen/theme_manager"), StrEq("org.tizen.theme_manager"), + g_dbus_message_new_method_call(StrEq("org.tizen.ThemeManager"), + StrEq("/org/tizen/ThemeManager"), StrEq("org.tizen.ThemeManager"), StrEq("SendData"))).Times(1); std::shared_ptr info = loader_->Load(std::string("id")); -- 2.7.4