Apply TZ_SYS_UPGRADE path to libtota 71/185571/2 accepted/tizen/unified/20180806.075501 submit/tizen/20180801.085411 submit/tizen/20180803.005755
authorSunmin Lee <sunm.lee@samsung.com>
Thu, 26 Jul 2018 01:53:17 +0000 (10:53 +0900)
committerSunmin Lee <sunm.lee@samsung.com>
Wed, 1 Aug 2018 08:16:11 +0000 (17:16 +0900)
Use a config path TZ_SYS_UPGRADE rather than hard coded path.

Change-Id: I6b9c508b09858cb44eb1c3d88e0ef3c6e646ccbb
Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>
CMakeLists.txt
packaging/libtota.spec
ss_engine/fota_common.h.in [moved from ss_engine/fota_common.h with 95% similarity]
ss_engine/fota_log.c

index 6c231b5..28ab1b9 100755 (executable)
@@ -1,6 +1,12 @@
 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
 PROJECT(tota C)
 
+CONFIGURE_FILE(
+       ${CMAKE_CURRENT_SOURCE_DIR}/ss_engine/fota_common.h.in
+       ${CMAKE_CURRENT_SOURCE_DIR}/ss_engine/fota_common.h
+       @ONLY
+)
+
 SET(SRCS
        ss_engine/SS_Common.c
        ss_engine/sha1.c
index f0cde90..a487e40 100755 (executable)
@@ -1,6 +1,6 @@
 Name:          libtota
 Summary:       fota update library
-Version:       1.2.2
+Version:       1.2.3
 Release:       0
 Group:         System
 License:       Apache-2.0 and BSD-2-Clause and BSD-3-Clause and PD
@@ -8,6 +8,7 @@ Source0:        %{name}-%{version}.tar.gz
 
 BuildRequires: cmake
 BuildRequires: pkgconfig(lib7zip)
+BuildRequires: pkgconfig(libtzplatform-config)
 
 %description
 Fota update agent which update firmware using delta files
@@ -31,7 +32,8 @@ mkdir cmake_tmp
 cd cmake_tmp
 LDFLAGS="$LDFLAGS"
 %cmake .. \
-       -DCMAKE_INSTALL_PREFIX=%{_prefix}
+       -DCMAKE_INSTALL_PREFIX=%{_prefix} \
+       -DTZ_SYS_UPGRADE_DATA=%TZ_SYS_UPGRADE_DATA
 
 make %{?jobs:-j%jobs}
 
@@ -40,12 +42,8 @@ cd cmake_tmp
 %make_install
 #mkdir -p %{buildroot}/usr/lib/
 cp libtota.a %{buildroot}%{_libdir}/libtota.a
-%post
-
-%posttrans
-if [ ! -e /opt/data/recovery ]; then
-       ln -sf /opt/data/update /opt/data/recovery
-fi
+%define tota_dir %TZ_SYS_UPGRADE_DATA
+mkdir -p %{buildroot}%{tota_dir}
 
 
 %files
@@ -54,7 +52,7 @@ fi
 %license LICENSE.BSD-2-Clause
 %license LICENSE.BSD-3-Clause
 %{_libdir}/libtota.so.*
-#%manifest fota.manifest
+%{tota_dir}
 
 %files devel
 %defattr(-,root,root,-)
similarity index 95%
rename from ss_engine/fota_common.h
rename to ss_engine/fota_common.h.in
index 8213546..8e6bbe6 100755 (executable)
@@ -64,7 +64,8 @@ typedef unsigned long long u64;
 #define SECTOR_SIZE                    512
 #define SS_KERNEL_DELTA_HEADER         128
 
-#define SS_COMMON_WORKSPACE                    "/system/opt/usr/data/fota"
+#define SS_COMMON_FOTA_PATH            "@TZ_SYS_UPGRADE_DATA@"
+#define SS_COMMON_WORKSPACE            "/system/" SS_COMMON_FOTA_PATH
 #define SS_KERNEL_UNPACK_SCRIPT                "unpack.sh"
 #define SS_KERN_UNPK_SCRIPT_PATH       SS_COMMON_WORKSPACE "/" SS_KERNEL_UNPACK_SCRIPT
 #define SS_BACKUP_SOURCE               SS_COMMON_WORKSPACE "/saved.file"       //How to make sure there is SPACE
@@ -76,7 +77,7 @@ typedef unsigned long long u64;
 #define SS_STAT_TARGET                 SS_KERNEL_WORKSPACE "/stat"
 #define SS_DD_TARGET                   SS_KERNEL_WORKSPACE "/dd"
 //#define SS_UPDATE_STATUR_PATH                SS_COMMON_WORKSPACE "/UP.STATUS"
-#define SS_UPDATE_STATUR_PATH          "/system/opt/data/recovery/UP.STATUS"
+#define SS_UPDATE_STATUR_PATH          SS_COMMON_WORKSPACE "/UP.STATUS"
 
 #define SS_GZIP_SOURCE                 "system/bin/gzip"
 #define SS_STAT_SOURCE                 "system/usr/bin/stat"
index 348dba0..c044381 100755 (executable)
@@ -25,8 +25,9 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <errno.h>
+#include "fota_common.h"
 
-#define LOG_SIZE_OPT_PATH              "/opt/data/recovery/.ua_log_size"
+#define LOG_SIZE_OPT_PATH              SS_COMMON_FOTA_PATH"/.ua_log_size"
 #define DEF_MAX_LOG_SIZE               (2*1024*1024)
 #define MAX_FILE_PATH                  512