fix issue - removed foler dependency when ail-initdb failed
authorjunsuk77.oh <junsuk77.oh@samsung.com>
Thu, 11 Jul 2013 02:04:21 +0000 (11:04 +0900)
committerjunsuk77.oh <junsuk77.oh@samsung.com>
Thu, 11 Jul 2013 02:04:21 +0000 (11:04 +0900)
Change-Id: Ib2fa7d0db29182e2f509764071e84e3916e36415
Signed-off-by: junsuk77.oh <junsuk77.oh@samsung.com>
initdb/src/initdb.c
packaging/ail.spec

index 469a5ef..0cade32 100755 (executable)
@@ -92,7 +92,7 @@ char* _desktop_to_package(const char* desktop)
 
        tmp = strrchr(package, '.');
        if(tmp == NULL) {
-               _E("(tmp == NULL) return\n");
+               _E("[%s] is not a desktop file", package);
                free(package);
                return NULL;
        }
@@ -116,6 +116,8 @@ int initdb_load_directory(const char *directory)
        struct dirent entry, *result;
        int len, ret;
        char buf[BUFSZE];
+       int total_cnt = 0;
+       int ok_cnt = 0;
 
        // desktop file
        dir = opendir(directory);
@@ -126,7 +128,7 @@ int initdb_load_directory(const char *directory)
        }
 
        len = strlen(directory) + 1;
-       _D("Loading desktop files from %s\n", directory);
+       _D("Loading desktop files from %s", directory);
 
        for (ret = readdir_r(dir, &entry, &result);
                        ret == 0 && result != NULL;
@@ -134,20 +136,22 @@ int initdb_load_directory(const char *directory)
                char *package;
 
                if (entry.d_name[0] == '.') continue;
-
+               total_cnt++;
                package = _desktop_to_package(entry.d_name);
                if (!package) {
-                       _E("Failed to convert file to package[%s]\n", entry.d_name);
+                       _E("Failed to convert file to package[%s]", entry.d_name);
                        continue;
                }
 
                if (ail_desktop_add(package) != AIL_ERROR_OK) {
-                       _E("Failed to add a package[%s]\n", package);
+                       _E("Failed to add a package[%s]", package);
+               } else {
+                       ok_cnt++;
                }
-
                free(package);
        }
 
+       _D("Application-Desktop process : Success [%d], fail[%d], total[%d] \n", ok_cnt, total_cnt-ok_cnt, total_cnt);
        closedir(dir);
 
        return AIL_ERROR_OK;
@@ -255,25 +259,21 @@ int main(int argc, char *argv[])
        ret = initdb_count_app();
        if (ret > 0) {
                _D("Some Apps in the App Info DB.");
-               return AIL_ERROR_OK;
        }
 
        ret = initdb_load_directory(OPT_DESKTOP_DIRECTORY);
        if (ret == AIL_ERROR_FAIL) {
                _E("cannot load opt desktop directory.");
-               return AIL_ERROR_FAIL;
        }
 
        ret = initdb_load_directory(USR_DESKTOP_DIRECTORY);
        if (ret == AIL_ERROR_FAIL) {
                _E("cannot load usr desktop directory.");
-               return AIL_ERROR_FAIL;
        }
 
        ret = initdb_change_perm(APP_INFO_DB_FILE);
        if (ret == AIL_ERROR_FAIL) {
                _E("cannot chown.");
-               return AIL_ERROR_FAIL;
        }
 
        const char *argv_smack[] = { "/usr/bin/chsmack", "-a", APP_INFO_DB_LABEL, APP_INFO_DB_FILE, NULL };
index 385cb5b..35984b5 100755 (executable)
@@ -1,7 +1,7 @@
 #sbs-git:slp/pkgs/a/ail ail 0.2.22 29ac1f2c98453cad647cca6a92abc7da3dbb047b
 Name:       ail
 Summary:    Application Information Library
-Version:    0.2.72
+Version:    0.2.73
 Release:    1
 Group:      System/Libraries
 License:    Apache License, Version 2.0