[Build] enable tizen feature
authorJaeyun Jung <jy1210.jung@samsung.com>
Tue, 23 Jan 2024 04:57:50 +0000 (13:57 +0900)
committerwooksong <wook16.song@samsung.com>
Tue, 23 Jan 2024 10:56:25 +0000 (19:56 +0900)
1. Add option to set DB path.
2. Enable tizen feature in spec.

Signed-off-by: Jaeyun Jung <jy1210.jung@samsung.com>
daemon/main.c
packaging/machine-learning-agent.spec
tests/services/org.tizen.machinelearning.service.service.in

index 0968d56..1a46de0 100644 (file)
@@ -27,6 +27,7 @@
 static GMainLoop *g_mainloop = NULL;
 static gboolean verbose = FALSE;
 static gboolean is_session = FALSE;
+static gchar *db_path = NULL;
 
 /**
  * @brief Handle the SIGTERM signal and quit the main loop
@@ -71,6 +72,7 @@ parse_args (gint *argc, gchar ***argv)
   static GOptionEntry entries[] = {
     { "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose, "Be verbose", NULL },
     { "session", 's', 0, G_OPTION_ARG_NONE, &is_session, "Bus type is session", NULL },
+    { "path", 'p', 0, G_OPTION_ARG_STRING, &db_path, "Path to database", NULL },
     { NULL }
   };
 
@@ -109,7 +111,9 @@ main (int argc, char **argv)
   }
 
   /* path to database */
-  svcdb_initialize (DB_PATH);
+  if (!db_path)
+    db_path = g_strdup (DB_PATH);
+  svcdb_initialize (db_path);
 
   g_mainloop = g_main_loop_new (NULL, FALSE);
   gdbus_get_system_connection (is_session);
@@ -137,5 +141,7 @@ error:
   svcdb_finalize ();
 
   is_session = verbose = FALSE;
+  g_free (db_path);
+  db_path = NULL;
   return ret;
 }
index 23d838d..a30eb2e 100644 (file)
@@ -2,8 +2,7 @@
 # Default features for Tizen release
 # If you want to build RPM for other Linux distro, you may need to
 # touch these values for your needs.
-%if %{with tizen}
-%endif
+%bcond_with tizen
 
 # Below features are used for unittest.
 # Do not add neural network dependency to ML-Agent.
 %if 0%{?_with_da_profile}
 %endif
 
-# If it is tizen, we can export Tizen API packages.
-%if %{with tizen}
-%bcond_with tizen
-%endif
-
 # Note that debug packages generate an additional build and storage cost.
 # If you do not need debug packages, run '$ gbs build ... --define "_skip_debug_rpm 1"'.
 %if "%{?_skip_debug_rpm}" == "1"
index 5d72a39..e02d334 100644 (file)
@@ -1,3 +1,3 @@
 [D-BUS Service]
 Name=org.tizen.machinelearning.service
-Exec=@build_dir@/machine-learning-agent-test --session
+Exec=@build_dir@/machine-learning-agent-test --session --path=.