Change release version to build id 34/237834/2 submit/tizen/20200706.142233
authorJeon Sang-Heon <sh95.jeon@samsung.com>
Mon, 6 Jul 2020 13:54:25 +0000 (13:54 +0000)
committerJeon Sang-Heon <sh95.jeon@samsung.com>
Mon, 6 Jul 2020 14:15:14 +0000 (14:15 +0000)
- Change release version to build id
- Minor fix with variable name and log

Change-Id: I634a5a6f42547fe7c32f081ca1a6e94cfabef720
Signed-off-by: Jeon Sang-Heon <sh95.jeon@samsung.com>
update-manager/fota-controller.c
update-manager/fota-info-checker.c
update-manager/fota-storage-checker.c
update-manager/update-manager.h

index c52588432982f61fba97e6271d98f1201b21692e..3585eaf03eb1dc93cc6014f5e16ec5558be07790 100644 (file)
@@ -4,37 +4,37 @@ int fota_controller_verify_delta(const char *delta_path)
 {
        int ret = 0, status = 0;
        char buf[MAX_BUFFER_SIZE] = {0, };
-       char *current_release_version = NULL;
+       char *build_id = NULL;
 
        if (g_file_test(delta_path, G_FILE_TEST_EXISTS)) {
                _I("Found delta in %s, start process to verify", delta_path);
 
-               ret = util_file_untar(delta_path, RELEASE_VERSION_DIR, RELEASE_VERSION_FILE);
+               ret = util_file_untar(delta_path, BUILD_ID_DIR, BUILD_ID_FILE);
                if (ret < 0) {
-                       _E("Failed to fetch version.txt from delta : %d", ret);
+                       _E("Failed to fetch %s from delta : %d", BUILD_ID_FILE, ret);
                        status = -1;
                        goto verify_destroy;
                }
 
-               current_release_version = fota_info_get_release_version();
-               if (current_release_version == NULL) {
-                       _E("Failed to get current release version");
+               build_id = fota_info_get_build_id();
+               if (build_id == NULL) {
+                       _E("Failed to get current build id");
                        status = -1;
                        goto verify_destroy;
                }
 
-               ret = util_file_read_line(RELEASE_VERSION_PATH, buf);
+               ret = util_file_read_line(BUILD_ID_PATH, buf);
                if (ret < 0) {
-                       _E("Failed to read delta version : %d", ret);
+                       _E("Failed to read delta build id : %d", ret);
                        status = -1;
                        goto verify_destroy;
                }
 
-               if (g_strrstr(buf, current_release_version) != NULL) {
-                       _I("Delta version matched : %s", current_release_version);
+               if (g_strrstr(buf, build_id) != NULL) {
+                       _I("Delta build id matched : %s", build_id);
                } else {
-                       _I("Delta version unmatched, current : %s, delta : %s",
-                          current_release_version, buf);
+                       _I("Delta build id unmatched, current : %s, delta : %s",
+                          build_id, buf);
                        status = 1;
                }
        } else {
@@ -43,9 +43,9 @@ int fota_controller_verify_delta(const char *delta_path)
        }
 
 verify_destroy:
-       ret = remove(RELEASE_VERSION_PATH);
+       ret = remove(BUILD_ID_PATH);
        if (ret < 0)
-               _W("Failed to remove version.txt : %m");
+               _W("Failed to remove %s : %m", BUILD_ID_PATH);
 
        return status;
 }
index 0338f8f2ef2615193e36f866723a03d4d5f42b0b..9a229232752815126551e84c305ca8e45541d9a0 100644 (file)
@@ -1,11 +1,11 @@
 #include "update-manager.h"
 
-static char *release_version = NULL;
+static char *build_id = NULL;
 static char *platform_version = NULL;
 
-char *fota_info_get_release_version()
+char *fota_info_get_build_id()
 {
-       return release_version;
+       return build_id;
 }
 
 char *fota_info_get_platform_version()
@@ -18,7 +18,7 @@ int fota_info_checker_init()
        int ret = 0;
 
        _I("Start process to get fota information");
-       ret = system_info_get_platform_string(RELEASE_INFO_KEY, &release_version);
+       ret = system_info_get_platform_string(BUILD_ID_KEY, &build_id);
        if (ret != SYSTEM_INFO_ERROR_NONE) {
                _E("system_info_get_platform_string failed : %d", ret);
                return -1;
@@ -30,15 +30,15 @@ int fota_info_checker_init()
                return -1;
        }
 
-       _I("Success to get fota information, platform : %s, release : %s",
-               platform_version, release_version);
+       _I("Success to get fota information, platform : %s, build_id : %s",
+               platform_version, build_id);
        return 0;
 }
 
 int fota_info_checker_fini()
 {
-       if (release_version)
-               free(release_version);
+       if (build_id)
+               free(build_id);
 
        if (platform_version)
                free(platform_version);
index 87432cd187bc24318803ebba3bc40d984068b382..3ef6cef8c4cf37d33621eb32766b19f6e1cccf25 100644 (file)
@@ -3,7 +3,7 @@
 int fota_storage_search_delta_path(const char *mount_path, gchar **delta_path)
 {
        int status = 0;
-       char *release_version = NULL;
+       char *build_id = NULL;
        const gchar *folder_name = NULL;
        GFile *mount = NULL;
        GFileEnumerator *enumerator = NULL;
@@ -18,9 +18,9 @@ int fota_storage_search_delta_path(const char *mount_path, gchar **delta_path)
                goto search_destroy;
        }
 
-       release_version = fota_info_get_release_version();
-       if (release_version == NULL) {
-               _E("Failed to get release version");
+       build_id = fota_info_get_build_id();
+       if (build_id == NULL) {
+               _E("Failed to get build id");
                status = -1;
                goto search_destroy;
        }
@@ -30,7 +30,7 @@ int fota_storage_search_delta_path(const char *mount_path, gchar **delta_path)
                        continue;
 
                folder_name = g_file_info_get_name(info);
-               if (g_str_has_prefix(folder_name, release_version) == TRUE) {
+               if (g_str_has_prefix(folder_name, build_id) == TRUE) {
                        *delta_path = g_strjoin("/", mount_path, folder_name, FOTA_DELTA_FILE, NULL);
                        break;
                }
@@ -41,7 +41,7 @@ int fota_storage_search_delta_path(const char *mount_path, gchar **delta_path)
        if (*delta_path != NULL) {
                _I("Success to find delta path : %s", *delta_path);
        } else {
-               _I("Failed to find delta path with prefix %s", release_version);
+               _I("Failed to find delta path with prefix %s", build_id);
                status = 1;
        }
 
index c3f53329aa6abae95c504626a9bf184522e90f68..e10e14cba3d754458b4db1fb207a2849ebb8014b 100644 (file)
 #define PLATFORM_VERSION_FILE       "version"
 #define PLATFORM_VERSION_PATH       PLATFORM_VERSION_DIR "/" PLATFORM_VERSION_FILE
 
-#define RELEASE_INFO_KEY            "tizen.org/system/build.release"
-#define RELEASE_VERSION_DIR         "/tmp"
-#define RELEASE_VERSION_FILE        "version.txt"
-#define RELEASE_VERSION_PATH        RELEASE_VERSION_DIR "/" RELEASE_VERSION_FILE
+#define BUILD_ID_KEY                "http://tizen.org/system/build.id"
+#define BUILD_ID_DIR                "/tmp"
+#define BUILD_ID_FILE               "build_id.txt"
+#define BUILD_ID_PATH               BUILD_ID_DIR "/" BUILD_ID_FILE
 
 #define FOTA_REBOOT_REASON          "fota"
 #define FOTA_DIR                    "/opt/usr/data/fota"
@@ -89,7 +89,7 @@ int dbus_manager_fini(void);
 
 int fota_info_checker_init(void);
 int fota_info_checker_fini(void);
-char *fota_info_get_release_version(void);
+char *fota_info_get_build_id(void);
 char *fota_info_get_platform_version(void);
 
 int fota_storage_checker_init(void);