init_db: exclude hal-release information from database 02/278302/2 accepted/tizen_7.0_unified accepted/tizen_7.0_unified_hotfix tizen_7.0_hotfix accepted/tizen/7.0/unified/20221110.063529 accepted/tizen/7.0/unified/hotfix/20221116.104839 accepted/tizen/unified/20220720.064020 submit/tizen/20220719.051932 tizen_7.0_m2_release
authorYoungjae Cho <y0.cho@samsung.com>
Tue, 19 Jul 2022 00:53:11 +0000 (09:53 +0900)
committerYoungjae Cho <y0.cho@samsung.com>
Tue, 19 Jul 2022 01:37:24 +0000 (10:37 +0900)
For fota, platform-release information is only required. However the
current system-info have two kinds of release information, platform
and hal, and the hal-release information overwrites the platform-release
information. Therefore, do not include hal-release information into
system-info database so that there is only platform-release information
in the database.

Change-Id: I5fc381a3de5d2f13095645d880730531de56d1f0
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
script/make_info_file.sh
src/init_db/system_info_db_init.c

index c9b47a8..5785294 100644 (file)
@@ -30,7 +30,7 @@ Variant=$TZ_BUILD_VARIANT;
 ID=$ID;
 EOF
 
-       /usr/bin/system_info_init_db --input=/hal/etc/config/model-config.xml --release=/hal/etc/hal-info.ini --output=/hal/etc/system_info_db
+       /usr/bin/system_info_init_db --input=/hal/etc/config/model-config.xml --output=/hal/etc/system_info_db
 
 else
        cat <<EOF > /etc/info.ini
index 0874adf..be203f0 100644 (file)
@@ -400,14 +400,8 @@ static int system_info_create_db(const char *conf_path, const char *release_path
        char file_path[PATH_MAX];
        FILE *fp = NULL;
 
-       if (conf_path == NULL)
-               conf_path = MODEL_CONFIG_RO_PATH;
-
-       if (release_path == NULL)
-               release_path = INFO_FILE_PATH;
-
        if (db_path == NULL)
-               db_path = SYSTEM_INFO_DB_RO_PATH;
+               return -EINVAL;
 
        ret = mkdir(db_path, 0555);
        if (ret != 0 && errno != EEXIST) {
@@ -425,13 +419,17 @@ static int system_info_create_db(const char *conf_path, const char *release_path
                fclose(fp);
        }
 
-       ret = system_info_get_values_config_xml(db_path, conf_path);
-       if (ret < 0)
-               _E("Failed to get keys and values from xml(%d)", ret);
+       if (conf_path && conf_path[0]) {
+               ret = system_info_get_values_config_xml(db_path, conf_path);
+               if (ret < 0)
+                       _E("Failed to get keys and values from xml(%d)", ret);
+       }
 
-       ret = system_info_get_values_ini(db_path, release_path);
-       if (ret < 0)
-               _E("Failed to get keys and values from ini(%d)", ret);
+       if (release_path && release_path[0]) {
+               ret = system_info_get_values_ini(db_path, release_path);
+               if (ret < 0)
+                       _E("Failed to get keys and values from ini(%d)", ret);
+       }
 
        return 0;
 }
@@ -527,8 +525,6 @@ static int system_info_update_db(int argc, char *argv[])
        }
 
        if (conf_path[0] != '\0' && db_path[0] != '\0') {
-               if (release_path[0] == '\0') /* For backward compatibility: in case which hasn't provided -r option */
-                       strncpy(release_path, INFO_FILE_PATH, sizeof(release_path));
                printf("Make system info db(%s) by %s and %s\n", db_path, conf_path, release_path);
                return system_info_create_db(conf_path, release_path, db_path);
        }
@@ -585,7 +581,7 @@ int main(int argc, char *argv[])
        umask(0222);
 
        if (argc == 1)
-               return system_info_create_db(NULL, NULL, NULL);
+               return system_info_create_db(MODEL_CONFIG_RO_PATH, INFO_FILE_PATH, SYSTEM_INFO_DB_RO_PATH);
 
        return system_info_update_db(argc, argv);
 }