Dist/Tizen: Use a rpm spec macro instead of the hard-coded string
authorWook Song <wook16.song@samsung.com>
Wed, 31 Jan 2024 11:54:23 +0000 (20:54 +0900)
committerjaeyun-jung <39614140+jaeyun-jung@users.noreply.github.com>
Thu, 1 Feb 2024 04:52:37 +0000 (13:52 +0900)
This is a trivial patch for cleaning up the Tizen RPM spec file. Instead
of the hard-coded string for build directory, this patch updates it to the
RPM spec macro.

Signed-off-by: Wook Song <wook16.song@samsung.com>
packaging/machine-learning-agent.spec

index a30eb2ea80da5c66edef6c227910e3837b0373f3..1224d638b28614f3c3190e813a51b2fa12cdfa96 100644 (file)
@@ -7,7 +7,6 @@
 # Below features are used for unittest.
 # Do not add neural network dependency to ML-Agent.
 %define                release_test 0
-%define                test_script $(pwd)/packaging/run_unittests.sh
 
 # To generage gcov package, --define "gcov 1"
 %if 0%{?gcov:1}
 %global debug_package %{nil}
 %global __debug_install_post %{nil}
 %endif
+###########################################################################
+# Macros for building and testing option control
+%define                builddir build
+%define                source_root %{_builddir}/%{?buildsubdir}
+%define                test_script %{source_root}/packaging/run_unittests.sh
+
 ###########################################################################
 # Package / sub-package definitions
 Name:          machine-learning-agent
@@ -168,13 +173,13 @@ CXXFLAGS=`echo $CXXFLAGS | sed -e "s|-Wp,-D_FORTIFY_SOURCE=[1-9]||g"`
 %define enable_test_coverage -Db_coverage=false
 %endif # unit_test
 
-mkdir -p build
+mkdir -p %{builddir}
 
 meson --buildtype=plain --prefix=%{_prefix} --sysconfdir=%{_sysconfdir} --libdir=%{_libdir} \
        --bindir=%{_bindir} --includedir=%{_includedir} \
        %{enable_test} %{install_test} %{enable_test_coverage} %{enable_gcov} \
        %{enable_tizen} %{service_db_path} %{service_db_key_prefix} \
-       build
+       %{builddir}
 
 ninja -C build %{?_smp_mflags}
 
@@ -190,7 +195,7 @@ bash %{test_script} ./tests/daemon/unittest_gdbus_util
 %endif # unit_test
 
 %install
-DESTDIR=%{buildroot} ninja -C build %{?_smp_mflags} install
+DESTDIR=%{buildroot} ninja -C %{builddir} %{?_smp_mflags} install
 
 %if 0%{?unit_test}
 %if 0%{?testcoverage}
@@ -210,7 +215,7 @@ find . -name "CMakeCXXCompilerId*.gcda" -delete
 # Generate report
 # TODO: the --no-external option is removed to include machine-learning-agent related source files.
 # Restore this option when there is proper way to include those source files.
-pushd build
+pushd %{builddir}
 lcov -t 'ML-Agent unittest coverage' -o unittest.info -c -d . -b $(pwd)
 # Exclude generated files (e.g., Orc, Protobuf) and device-dependent files.
 # Exclude files which are generated by gdbus-codegen and external files in /usr/*.