Add new install option 26/212326/5
authorIlho Kim <ilho159.kim@samsung.com>
Tue, 20 Aug 2019 08:16:31 +0000 (17:16 +0900)
committerIlho Kim <ilho159.kim@samsung.com>
Wed, 21 Aug 2019 05:21:46 +0000 (14:21 +0900)
This option will be used for fast installation without optimization

Related changes
    [app-installers] https://review.tizen.org/gerrit/#/c/platform/core/appfw/app-installers/+/212328/
    [pkgmgr-tool] https://review.tizen.org/gerrit/#/c/platform/core/appfw/pkgmgr-tool/+/212326/
    [slp-pkgmgr] https://review.tizen.org/gerrit/#/c/platform/core/appfw/slp-pkgmgr/+/212327/

Change-Id: If850c33ca51769b7e968ec944b01d016e295aa5c
Signed-off-by: Ilho Kim <ilho159.kim@samsung.com>
src/pkg_cmd.c

index 667d58b385a5f72507f22b3bf802eca8959f0ae3..0cca3115204a3a0172577ce82bd83a7e7d38056d 100644 (file)
@@ -67,7 +67,7 @@ static int __convert_to_absolute_path(char *path);
 
 /* Supported options */
 /* Note: 'G' is reserved */
-const char *short_options = "iurwmcgxCkaADL:lsd:p:t:n:T:e:M:X:Y:Z:qhG";
+const char *short_options = "iurwmcgxCkaADL:lsd:p:t:n:T:e:M:X:Y:Z:qhGS";
 const struct option long_options[] = {
        {"install", 0, NULL, 'i'},
        {"uninstall", 0, NULL, 'u'},
@@ -102,6 +102,7 @@ const struct option long_options[] = {
        {"debug-mode", 0, NULL, 'G'},
        {"getsizeinfo", 0, NULL, 'x'},
        {"uid", 1, NULL, OPTVAL_UID},
+       {"skip-optimization", 0, NULL, 'S'},
        {0, 0, 0, 0}            /* sentinel */
 };
 
@@ -150,6 +151,7 @@ struct pm_tool_args_t {
        int result;
        int uid;
        bool debug_mode;
+       bool skip_optimization;
 };
 typedef struct pm_tool_args_t pm_tool_args;
 pm_tool_args data;
@@ -439,6 +441,7 @@ static void __print_usage()
        printf("-G, --debug-mode        install the package with debug mode for sdk\n");
        printf("-D, --deactivate        disable package or app\n");
        printf("-A, --activate          enable package or app\n");
+       printf("-O, --skip-optimization         install the package with skip optimization for sdk\n");
        printf("-h, --help              print this help\n");
 
        printf("\n");
@@ -634,6 +637,9 @@ static int __install_req_dispatcher(uid_t target_uid)
        if (data.debug_mode)
                pkgmgr_client_set_debug_mode(pc, true);
 
+       if (data.skip_optimization)
+               pkgmgr_client_set_skip_optimization(pc, true);
+
        if (data.tep_path[0] != '\0')
                pkgmgr_client_set_tep_path(pc, data.tep_path, data.tep_move);
 
@@ -718,6 +724,9 @@ static int __reinstall_req_dispatcher(uid_t target_uid)
        if (data.debug_mode)
                pkgmgr_client_set_debug_mode(pc, true);
 
+       if (data.skip_optimization)
+               pkgmgr_client_set_skip_optimization(pc, true);
+
        ret = pkgmgr_client_usr_reinstall(pc, NULL,
                        data.pkgid, NULL, PM_QUIET, __return_cb, pc, target_uid);
        if (ret < 0) {
@@ -752,6 +761,9 @@ static int __mount_install_req_dispatcher(uid_t target_uid)
        if (data.debug_mode)
                pkgmgr_client_set_debug_mode(pc, true);
 
+       if (data.skip_optimization)
+               pkgmgr_client_set_skip_optimization(pc, true);
+
        if (data.tep_path[0] != '\0')
                pkgmgr_client_set_tep_path(pc, data.tep_path, data.tep_move);
 
@@ -1636,6 +1648,10 @@ int main(int argc, char *argv[])
                        data.debug_mode = true;
                        break;
 
+               case 'S':  /* skip optimization */
+                       data.skip_optimization = true;
+                       break;
+
                        /* Otherwise */
                case '?':  /* Not an option */
                        __print_usage();