[Release] wrt-installer_0.1.9
[framework/web/wrt-installer.git] / src / wrt-installer / wrt_installer.cpp
index 425d655..9037cff 100644 (file)
@@ -50,8 +50,6 @@
 #include <widget_parser.h>
 #include <root_parser.h>
 
-
-
 #define NOFILE_CNT_FOR_INSTALLER 9999
 
 using namespace WrtDB;
@@ -68,7 +66,10 @@ const char * const CONFIG_XML = "config.xml";
 
 struct free_deleter
 {
-    void operator()(void* x) { free(x); }
+    void operator()(void* x)
+    {
+        free(x);
+    }
 };
 
 struct PluginInstallerData
@@ -81,6 +82,7 @@ struct PluginInstallerData
 WrtInstaller::WrtInstaller(int argc, char **argv) :
     Application(argc, argv, "backend", false),
     DPL::TaskDecl<WrtInstaller>(this),
+    m_installPolicy(WRT_WIM_NOT_INSTALLED),
     m_packagePath(),
     m_handle(-1),
     m_initialized(false),
@@ -110,16 +112,26 @@ void WrtInstaller::OnStop()
 void WrtInstaller::OnCreate()
 {
     LogInfo("Creating DummyClient");
+    fprintf(stderr,
+            "===========================================================\n");
+    fprintf(stderr, "# wrt-installer #\n");
+    fprintf(stderr, "# argc [%d]\n", m_argc);
+    fprintf(stderr, "# argv[0] = [%s]\n", m_argv[0]);
+    fprintf(stderr, "# argv[1] = [%s]\n", m_argv[1]);
+    fprintf(stderr, "# argv[2] = [%s]\n", m_argv[2]);
+    fprintf(stderr,
+            "===========================================================\n");
 
     AddStep(&WrtInstaller::initStep);
 
     std::string arg = m_argv[0];
 
-    pkgmgrSignalInterface = std::static_pointer_cast<PackageManager::IPkgmgrSignal>(
-                                std::shared_ptr<PackageManager::PkgmgrSignalDummy>(
-                                        new PackageManager::PkgmgrSignalDummy()
-                                )
-                            );
+    pkgmgrSignalInterface =
+        std::static_pointer_cast<PackageManager::IPkgmgrSignal>(
+            std::shared_ptr<PackageManager::PkgmgrSignalDummy>(
+                new PackageManager::PkgmgrSignalDummy()
+                )
+            );
 
     if (arg.empty()) {
         return showHelpAndQuit();
@@ -127,8 +139,7 @@ void WrtInstaller::OnCreate()
 
     installNewPlugins();
 
-    if (arg.find("wrt-installer") != std::string::npos)
-    {
+    if (arg.find("wrt-installer") != std::string::npos) {
         if (m_argc <= 1) {
             return showHelpAndQuit();
         }
@@ -159,9 +170,7 @@ void WrtInstaller::OnCreate()
             if (-1 != stat(m_argv[2], &info) && S_ISDIR(info.st_mode)) {
                 LogInfo("Installing package directly from directory");
                 m_installPolicy = WRT_WIM_POLICY_DIRECTORY_FORCE_INSTALL;
-            }
-            else
-            {
+            } else {
                 LogInfo("Installing from regular location");
                 m_installPolicy = WRT_WIM_POLICY_WAC;
             }
@@ -205,50 +214,49 @@ void WrtInstaller::OnCreate()
         } else {
             return showHelpAndQuit();
         }
-
     } else if (arg.find("backend") != std::string::npos) {
         using namespace PackageManager;
         m_installByPkgmgr = true;
 
-        auto pkgmgrSignal =  std::shared_ptr<PackageManager::PkgmgrSignal>(
-                                new PackageManager::PkgmgrSignal()
-                             );
+        auto pkgmgrSignal = std::shared_ptr<PackageManager::PkgmgrSignal>(
+                new PackageManager::PkgmgrSignal()
+                );
 
         pkgmgrSignal->initialize(m_argc, m_argv);
         m_quiet = pkgmgrSignal->isNoPopupRequired();
-        LogDebug("backend m_quiet"<<m_quiet);
+        LogDebug("backend m_quiet" << m_quiet);
 
         int reqType = pkgmgrSignal->getRequestedType();
 
         pkgmgrSignalInterface =
-                std::static_pointer_cast<PackageManager::IPkgmgrSignal>(pkgmgrSignal);
+            std::static_pointer_cast<PackageManager::IPkgmgrSignal>(
+                pkgmgrSignal);
         switch (reqType) {
-            case PKGMGR_REQ_INSTALL:
-                m_packagePath = m_argv[4];
-                struct stat info;
-                if (-1 != stat(m_argv[4], &info) && S_ISDIR(info.st_mode)) {
-                    LogInfo("Installing package directly from directory");
-                    m_installPolicy = WRT_WIM_POLICY_DIRECTORY_FORCE_INSTALL;
-                }
-                else
-                {
-                    LogInfo("Installing from regular location");
-                    m_installPolicy = WRT_WIM_POLICY_WAC;
-                }
-                AddStep(&WrtInstaller::installStep);
-                break;
-            case PKGMGR_REQ_UNINSTALL:
-                m_name = m_argv[4];
-                AddStep(&WrtInstaller::uninstallPkgNameStep);
-                break;
-            default:
-                LogDebug("Not available type");
-                break;
+        case PKGMGR_REQ_INSTALL:
+            m_packagePath = m_argv[4];
+            struct stat info;
+            if (-1 != stat(m_argv[4], &info) && S_ISDIR(info.st_mode)) {
+                LogInfo("Installing package directly from directory");
+                m_installPolicy = WRT_WIM_POLICY_DIRECTORY_FORCE_INSTALL;
+            } else {
+                LogInfo("Installing from regular location");
+                m_installPolicy = WRT_WIM_POLICY_WAC;
+            }
+            AddStep(&WrtInstaller::installStep);
+            break;
+        case PKGMGR_REQ_UNINSTALL:
+            m_name = m_argv[4];
+            AddStep(&WrtInstaller::uninstallPkgNameStep);
+            break;
+        default:
+            LogDebug("Not available type");
+            break;
         }
     }
 
     AddStep(&WrtInstaller::shutdownStep);
-    DPL::Event::ControllerEventHandler<WRTInstallerNS::NextStepEvent>::PostEvent(
+    DPL::Event::ControllerEventHandler<WRTInstallerNS::NextStepEvent>::
+        PostEvent(
         WRTInstallerNS::NextStepEvent());
 }
 
@@ -315,7 +323,8 @@ void WrtInstaller::OnEventReceived(const WRTInstallerNS::QuitEvent& /*event*/)
     if (m_initialized) {
         LogDebug("Wrt Shutdown now");
         SwitchToStep(&WrtInstaller::shutdownStep);
-        DPL::Event::ControllerEventHandler<WRTInstallerNS::NextStepEvent>::PostEvent(
+        DPL::Event::ControllerEventHandler<WRTInstallerNS::NextStepEvent>::
+            PostEvent(
             WRTInstallerNS::NextStepEvent());
     } else {
         LogDebug("Quiting application");
@@ -341,9 +350,9 @@ void WrtInstaller::OnEventReceived(
         (*m_pluginsPaths).pop_front();
 
         wrt_install_plugin(privateData->pluginPath.c_str(),
-                static_cast<void*>(privateData),
-                &staticWrtPluginInstallationCallback,
-                &staticWrtPluginInstallProgressCb);
+                           static_cast<void*>(privateData),
+                           &staticWrtPluginInstallationCallback,
+                           &staticWrtPluginInstallProgressCb);
     } else {
         delete privateData;
     }
@@ -358,7 +367,7 @@ void WrtInstaller::installStep()
 {
     LogDebug("Installing widget ...");
     std::unique_ptr<char, free_deleter> packagePath(canonicalize_file_name(
-            m_packagePath.c_str()));
+                                                        m_packagePath.c_str()));
 
     wrt_install_widget(packagePath ? packagePath.get() : m_packagePath.c_str(),
                        this, &staticWrtStatusCallback,
@@ -373,14 +382,15 @@ void WrtInstaller::installStep()
 void WrtInstaller::installPluginsStep()
 {
     LogDebug("Installing plugins ...");
+    fprintf(stderr, "Installing plugins ...\n");
 
     if (m_startupPluginInstallation) {
         LogInfo("Plugin installation started because new plugin package found");
     } else if (!PluginUtils::lockPluginInstallation()) {
         LogError("Failed to open plugin installation lock file"
-                " Plugins are currently installed by other process");
+                 " Plugins are currently installed by other process");
         staticWrtPluginInstallationCallback(WRT_PLUGIN_INSTALLER_ERROR_LOCK,
-                this);
+                                            this);
         return;
     }
 
@@ -394,22 +404,25 @@ void WrtInstaller::installPluginsStep()
     }
 
     LogInfo("Plugin DIRECTORY IS" << PLUGIN_PATH);
-    struct dirent* libdir;
-
-    errno = 0;
 
     std::list<std::string> pluginsPaths;
-
-    while ((libdir = readdir(dir)) != 0) {
-        if (strcmp(libdir->d_name, ".") == 0 ||
-            strcmp(libdir->d_name, "..") == 0)
+    struct dirent libdir;
+    struct dirent *result;
+    int return_code;
+    errno = 0;
+    for (return_code = readdir_r(dir, &libdir, &result);
+            result != NULL && return_code == 0;
+            return_code = readdir_r(dir, &libdir, &result))
+    {
+        if (strcmp(libdir.d_name, ".") == 0 ||
+            strcmp(libdir.d_name, "..") == 0)
         {
             continue;
         }
 
         std::string path = PLUGIN_PATH;
         path += "/";
-        path += libdir->d_name;
+        path += libdir.d_name;
 
         struct stat tmp;
 
@@ -426,6 +439,10 @@ void WrtInstaller::installPluginsStep()
         pluginsPaths.push_back(path);
     }
 
+    if (return_code != 0 || errno != 0) {
+        LogError("readdir_r() failed with " << DPL::GetErrnoString());
+    }
+
     //set nb of plugins to install
     //this value indicate how many callbacks are expected
     m_numPluginsToInstall = pluginsPaths.size();
@@ -438,7 +455,7 @@ void WrtInstaller::installPluginsStep()
 
     if (-1 == TEMP_FAILURE_RETRY(closedir(dir))) {
         LogError("Failed to close dir: " << PLUGIN_PATH << " with error: "
-                << DPL::GetErrnoString());
+                                         << DPL::GetErrnoString());
     }
 }
 
@@ -447,26 +464,29 @@ void WrtInstaller::uninstallPkgNameStep()
     LogDebug("Uninstalling widget ...");
     LogDebug("Package name : " << m_name);
     wrt_uninstall_widget(m_name.c_str(), this, &staticWrtStatusCallback,
-            (!m_quiet || m_installByPkgmgr)
-            ? &staticWrtUninstallProgressCallback : NULL,
-            pkgmgrSignalInterface);
+                         (!m_quiet || m_installByPkgmgr)
+                         ? &staticWrtUninstallProgressCallback : NULL,
+                         pkgmgrSignalInterface);
 }
 
 void WrtInstaller::uninstallGuidStep()
 {
     LogDebug("Uninstalling widget ...");
-    std::string pkgname;
-    WrtErrStatus status = wrt_get_widget_by_guid(pkgname, m_name);
+    std::string appid;
+    WrtErrStatus status = wrt_get_widget_by_guid(appid, m_name);
     if (status == WRT_SUCCESS) {
         LogDebug("Guid : " << m_name);
-        wrt_uninstall_widget(pkgname.c_str(), this, &staticWrtStatusCallback,
-                !m_quiet ? &staticWrtUninstallProgressCallback : NULL,
-                pkgmgrSignalInterface);
+        wrt_uninstall_widget(
+            appid.c_str(), this, &staticWrtStatusCallback,
+            !m_quiet ? &staticWrtUninstallProgressCallback :
+            NULL,
+            pkgmgrSignalInterface);
     } else {
         printf("failed: can not uninstall widget\n");
         LogError("Fail to uninstalling widget... ");
         m_returnStatus = -1;
-        DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>::PostEvent(
+        DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>::
+            PostEvent(
             WRTInstallerNS::QuitEvent());
     }
 }
@@ -482,11 +502,11 @@ void WrtInstaller::unistallWgtFileStep()
 
         // Open zip file
         std::unique_ptr<DPL::ZipInput> zipFile(
-                new DPL::ZipInput(m_packagePath));
+            new DPL::ZipInput(m_packagePath));
 
         // Open config.xml file
         std::unique_ptr<DPL::ZipInput::File> configFile(
-                zipFile->OpenFile(CONFIG_XML));
+            zipFile->OpenFile(CONFIG_XML));
 
         // Extract config
         DPL::BinaryQueue buffer;
@@ -494,27 +514,30 @@ void WrtInstaller::unistallWgtFileStep()
         DPL::AbstractWaitableOutputAdapter outputAdapter(&buffer);
         DPL::Copy(&inputAdapter, &outputAdapter);
         parser.Parse(&buffer,
-                ElementParserPtr(
-                    new RootParser<WidgetParser>(configInfo,
-                        DPL::FromUTF32String(
-                            L"widget"))));
+                     ElementParserPtr(
+                         new RootParser<WidgetParser>(configInfo,
+                                                      DPL::FromUTF32String(
+                                                          L"widget"))));
 
         DPL::OptionalString widgetGUID = configInfo.widget_id;
 
         std::string guid = DPL::ToUTF8String(*widgetGUID);
 
-        std::string pkgname;
-        WrtErrStatus status = wrt_get_widget_by_guid(pkgname, guid);
+        std::string appid;
+        WrtErrStatus status = wrt_get_widget_by_guid(appid, guid);
         if (status == WRT_SUCCESS) {
-            LogDebug("Pkgname from packagePath : " << pkgname);
-            wrt_uninstall_widget(pkgname.c_str(), this, &staticWrtStatusCallback,
-                    !m_quiet ? &staticWrtUninstallProgressCallback : NULL,
-                    pkgmgrSignalInterface);
+            LogDebug("Appid from packagePath : " << appid);
+            wrt_uninstall_widget(
+                appid.c_str(), this, &staticWrtStatusCallback,
+                !m_quiet ? &staticWrtUninstallProgressCallback
+                : NULL,
+                pkgmgrSignalInterface);
         } else {
             LogError("Fail to uninstalling widget... ");
             m_returnStatus = -1;
-            DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>::PostEvent(
-                    WRTInstallerNS::QuitEvent());
+            DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>::
+                PostEvent(
+                WRTInstallerNS::QuitEvent());
         }
     }
     Catch(DPL::ZipInput::Exception::OpenFailed)
@@ -522,24 +545,27 @@ void WrtInstaller::unistallWgtFileStep()
         LogError("Failed to open widget package");
         printf("failed: widget package does not exist\n");
         m_returnStatus = -1;
-        DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>::PostEvent(
-                WRTInstallerNS::QuitEvent());
+        DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>::
+            PostEvent(
+            WRTInstallerNS::QuitEvent());
     }
     Catch(DPL::ZipInput::Exception::OpenFileFailed)
     {
         printf("failed: widget config file does not exist\n");
         LogError("Failed to open config.xml file");
         m_returnStatus = -1;
-        DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>::PostEvent(
-                WRTInstallerNS::QuitEvent());
+        DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>::
+            PostEvent(
+            WRTInstallerNS::QuitEvent());
     }
     Catch(ElementParser::Exception::ParseError)
     {
         printf("failed: can not parse config file\n");
         LogError("Failed to parse config.xml file");
         m_returnStatus = -1;
-        DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>::PostEvent(
-                WRTInstallerNS::QuitEvent());
+        DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>::
+            PostEvent(
+            WRTInstallerNS::QuitEvent());
     }
 }
 
@@ -549,13 +575,14 @@ void WrtInstaller::shutdownStep()
     if (m_initialized) {
         wrt_installer_shutdown();
         m_initialized = false;
-        DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>::PostEvent(
+        DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>::
+            PostEvent(
             WRTInstallerNS::QuitEvent());
     }
 }
 
 void WrtInstaller::staticWrtInitCallback(WrtErrStatus status,
-                                      void* userdata)
+                                         void* userdata)
 {
     WrtInstaller *This = static_cast<WrtInstaller*>(userdata);
     Assert(This);
@@ -575,7 +602,8 @@ void WrtInstaller::staticWrtInitCallback(WrtErrStatus status,
     } else {
         LogError("Init unsuccesfull");
         This->m_returnStatus = -1;
-        This->DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>::PostEvent(
+        This->DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>::
+            PostEvent(
             WRTInstallerNS::QuitEvent());
     }
 }
@@ -591,16 +619,15 @@ void WrtInstaller::staticWrtStatusCallback(std::string tizenId,
     DPL::String resultMsg;
     std::string printMsg;
 
-    if (current == &WrtInstaller::installStep)
-    {
+    if (current == &WrtInstaller::installStep) {
         resultMsg = DPL::FromUTF8String(PKGMGR_INSTALL_MSG);
-        printMsg = "installed";
+        printMsg = "installation";
     } else if (current == &WrtInstaller::uninstallPkgNameStep ||
-            current == &WrtInstaller::uninstallGuidStep ||
-            current == &WrtInstaller::unistallWgtFileStep)
+               current == &WrtInstaller::uninstallGuidStep ||
+               current == &WrtInstaller::unistallWgtFileStep)
     {
         resultMsg = DPL::FromUTF8String(PKGMGR_UNINSTALL_MSG);
-        printMsg = "uninstalled";
+        printMsg = "uninstallation";
     }
 
     if (WRT_SUCCESS != status) {
@@ -609,7 +636,7 @@ void WrtInstaller::staticWrtStatusCallback(std::string tizenId,
         This->m_returnStatus = -1;
 
         if (This->popupsEnabled()) {
-            resultMsg +=  L" : " + DPL::FromUTF8String(PKGMGR_END_FAILURE);
+            resultMsg += L" : " + DPL::FromUTF8String(PKGMGR_END_FAILURE);
             This->m_popup->showPopup(This, resultMsg, failResultCallback);
         } else {
             This->DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>
@@ -619,76 +646,85 @@ void WrtInstaller::staticWrtStatusCallback(std::string tizenId,
         switch (status) {
             case WRT_INSTALLER_ERROR_INVALID_WIDGET_PACKAGE:
                 This->m_returnStatus = 1; //this status is specific
-                printf("failed: invalid widget package\n");
+                fprintf(stderr, "## wrt-installer : %s %s has failed - invalid widget package\n",
+                        tizenId.c_str(), printMsg.c_str());
                 break;
 
             case WRT_INSTALLER_ERROR_WIDGET_DOES_NOT_EXIST:
-                printf("failed: widget package does not exist\n");
+                fprintf(stderr, "## wrt-installer : %s %s has failed - widget package does not exist\n",
+                        tizenId.c_str(), printMsg.c_str());
                 break;
 
             case WRT_INSTALLER_ERROR_ALREADY_UNINSTALLING:
-                printf("failed: already uninstalling\n");
-                break;
-
-            case WRT_INSTALLER_ERROR_OUT_OUT_DISK_SPACE:
-                printf("failed: out of disk space\n");
+                fprintf(stderr, "## wrt-installer : %s %s has failed - already uninstalling\n",
+                        tizenId.c_str(), printMsg.c_str());
                 break;
 
             case WRT_INSTALLER_ERROR_INVALID_CERTIFICATE:
-                printf("failed: invalid certificate\n");
+                fprintf(stderr,"## wrt-installer : %s %s has failed - invalid certificate\n",
+                        tizenId.c_str(), printMsg.c_str());
                 break;
 
             case WRT_INSTALLER_ERROR_ALREADY_INSTALLED:
-                printf("failed: already installed\n");
+                fprintf(stderr,"## wrt-installer : %s %s has failed - already installed\n",
+                        tizenId.c_str(), printMsg.c_str());
                 break;
 
             case WRT_INSTALLER_ERROR_INTERNAL:
-                printf("failed: internal error\n");
+                fprintf(stderr,"## wrt-installer : %s %s has failed - internal error\n",
+                        tizenId.c_str(), printMsg.c_str());
                 break;
 
             case WRT_INSTALLER_ERROR_NOT_ALLOWED:
-                printf("failed: installation or update not allowed; invalid"
-                       " mode\n");
+                fprintf(stderr,"## wrt-installer : %s %s has failed - installation or update not allowed; invalid"
+                       " mode\n", tizenId.c_str(), printMsg.c_str());
                 break;
 
             case WRT_INSTALLER_ERROR_DEFERRED:
-                printf("deferred: widget update will continue after the widget"
+                fprintf(stderr,"## wrt-installer : deferred: widget update will continue after the widget"
                        " has been stopped\n");
                 break;
 
             case WRT_INSTALLER_ERROR_DATABASE_FAILURE:
-                printf("failed: database failure\n");
+                fprintf(stderr,"## wrt-installer : %s %s has failed - database failure\n",
+                        tizenId.c_str(), printMsg.c_str());
                 break;
 
             case WRT_INSTALLER_ERROR_OSPSVC:
-                printf("failed: during installation or uninstallation osp service\n");
+                fprintf(stderr,"## wrt-installer : %s %s has failed - during installation or"
+                        " uninstallation osp service\n", tizenId.c_str(),
+                        printMsg.c_str());
                 break;
 
             case WRT_INSTALLER_ERROR_UNKNOWN:
-                printf("failed: unknown error\n");
+                fprintf(stderr,"## wrt-installer : %s %s has failed - unknown error\n",
+                        tizenId.c_str(), printMsg.c_str());
                 break;
 
             default:
                 break;
         }
     } else {
-
-        printf("%s : %s\n", printMsg.c_str(), tizenId.c_str());
+        fprintf(stderr,
+                "## wrt-installer : %s %s was successful.\n",
+                tizenId.c_str(),
+                printMsg.c_str());
         LogDebug("Status succesfull");
         This->m_returnStatus = 0;
-        resultMsg +=  L" : " + DPL::FromUTF8String(PKGMGR_END_SUCCESS);
+        resultMsg += L" : " + DPL::FromUTF8String(PKGMGR_END_SUCCESS);
 
         if (This->popupsEnabled()) {
             This->m_popup->showPopup(This, resultMsg, showResultCallback);
         } else {
-            This->DPL::Event::ControllerEventHandler<WRTInstallerNS::NextStepEvent>
+            This->DPL::Event::ControllerEventHandler<WRTInstallerNS::
+                                                         NextStepEvent>
                 ::PostEvent(WRTInstallerNS::NextStepEvent());
         }
     }
 }
 
 void WrtInstaller::staticWrtPluginInstallationCallback(WrtErrStatus status,
-                                                    void* userdata)
+                                                       void* userdata)
 {
     Assert(userdata);
 
@@ -704,6 +740,7 @@ void WrtInstaller::staticWrtPluginInstallationCallback(WrtErrStatus status,
 
     if (This->m_numPluginsToInstall < 1) {
         LogDebug("All plugins installation completed");
+        fprintf(stderr, "All plugins installation completed.\n");
 
         //remove installation request
         if (!PluginUtils::removeInstallationRequiredFlag()) {
@@ -726,17 +763,24 @@ void WrtInstaller::staticWrtPluginInstallationCallback(WrtErrStatus status,
     } else {
         if (This->popupsEnabled()) {
             This->m_popup->init();
-            float percent = (This->m_totalPlugins - This->m_numPluginsToInstall)/(float)This->m_totalPlugins;
+            float percent =
+                (This->m_totalPlugins -
+                 This->m_numPluginsToInstall) / (float)This->m_totalPlugins;
             elm_progressbar_value_set(This->m_popup->m_progressbar, percent);
             evas_object_show(This->m_popup->m_popup);
         }
 
-        This->DPL::Event::ControllerEventHandler<WRTInstallerNS::InstallPluginEvent>::PostEvent(
-                WRTInstallerNS::InstallPluginEvent());
+        This->DPL::Event::ControllerEventHandler<WRTInstallerNS::
+                                                     InstallPluginEvent>::
+            PostEvent(
+            WRTInstallerNS::InstallPluginEvent());
     }
 
     if (WRT_SUCCESS == status) {
         This->m_returnStatus = 0;
+        fprintf(stderr,
+                "## wrt-installer : plugin installation successfull [%s]\n",
+                path.c_str());
         LogDebug("One plugin Installation succesfull: " << path);
         return;
     }
@@ -746,6 +790,8 @@ void WrtInstaller::staticWrtPluginInstallationCallback(WrtErrStatus status,
 
     if (WRT_PLUGIN_INSTALLER_ERROR_WAITING == status) {
         LogInfo("Plugin installation is waiting for dependencies");
+        fprintf(stderr, "## wrt-installer : plugin installation failed [%s]\n",
+                path.c_str());
     }
 
     switch (status) {
@@ -788,30 +834,30 @@ void WrtInstaller::staticWrtPluginInstallProgressCb(float percent,
 }
 
 void WrtInstaller::staticWrtInstallProgressCallback(float percent,
-        const char* description, void* userdata)
+                                                    const char* description,
+                                                    void* userdata)
 {
     WrtInstaller *This = static_cast<WrtInstaller*>(userdata);
-    std::stringstream percentStr;
     LogInfo(" progress: " << percent <<
             " description: " << description);
 
     if (This->popupsEnabled()) {
         This->m_popup->init();
-        elm_progressbar_value_set(This->m_popup->m_progressbar, percent/100.0);
+        elm_progressbar_value_set(This->m_popup->m_progressbar, percent / 100.0);
         evas_object_show(This->m_popup->m_popup);
     }
 }
 void WrtInstaller::staticWrtUninstallProgressCallback(float percent,
-        const char* description, void* userdata)
+                                                      const char* description,
+                                                      void* userdata)
 {
     WrtInstaller *This = static_cast<WrtInstaller*>(userdata);
-    std::stringstream percentStr;
     LogInfo(" progress: " << percent <<
             " description: " << description);
 
     if (This->popupsEnabled()) {
         This->m_popup->init();
-        elm_progressbar_value_set(This->m_popup->m_progressbar, percent/100.0);
+        elm_progressbar_value_set(This->m_popup->m_progressbar, percent / 100.0);
         evas_object_show(This->m_popup->m_popup);
     }
 }
@@ -820,8 +866,7 @@ WrtInstaller::InstallerPopup::InstallerPopup() :
     m_win(NULL),
     m_popup(NULL),
     m_progressbar(NULL)
-{
-}
+{}
 
 WrtInstaller::InstallerPopup::~InstallerPopup()
 {
@@ -844,9 +889,9 @@ void WrtInstaller::InstallerPopup::init()
         elm_object_style_set(m_progressbar, "list_progress");
         elm_progressbar_horizontal_set(m_progressbar, EINA_TRUE);
         evas_object_size_hint_align_set(m_progressbar, EVAS_HINT_FILL,
-            EVAS_HINT_FILL);
+                                        EVAS_HINT_FILL);
         evas_object_size_hint_weight_set(m_progressbar, EVAS_HINT_EXPAND,
-            EVAS_HINT_EXPAND);
+                                         EVAS_HINT_EXPAND);
         elm_object_content_set(m_popup, m_progressbar);
         elm_progressbar_value_set(m_progressbar, 0.0);
         evas_object_show(m_progressbar);
@@ -862,8 +907,9 @@ Evas_Object* WrtInstaller::InstallerPopup::createWin(const char *name)
     win = elm_win_add(NULL, name, ELM_WIN_DIALOG_BASIC);
 
     int w, h;
-    if(!win)
+    if (!win) {
         return NULL;
+    }
 
     elm_win_alpha_set(win, EINA_TRUE);
     elm_win_title_set(win, name);
@@ -881,14 +927,14 @@ void WrtInstaller::InstallerPopup::showPopup(void* userdata,
 {
     Evas_Object *btn;
 
-
     LogDebug("Result Popup Created");
     evas_object_del(m_popup);
     m_popup = NULL;
 
     m_popup = elm_popup_add(m_win);
-    if (!m_popup)
+    if (!m_popup) {
         return;
+    }
 
     btn = elm_button_add(m_popup);
     if (!btn) {
@@ -903,7 +949,6 @@ void WrtInstaller::InstallerPopup::showPopup(void* userdata,
 
     evas_object_show(m_popup);
     evas_object_show(m_win);
-
 }
 
 void WrtInstaller::showResultCallback(void *data, Evas_Object* /*obj*/,
@@ -965,8 +1010,8 @@ int main(int argc, char *argv[])
         // Check and re-set the file open limitation
         struct rlimit rlim;
         if (getrlimit(RLIMIT_NOFILE, &rlim) != -1) {
-            LogDebug("RLIMIT_NOFILE sft(" << rlim.rlim_cur << ")" );
-            LogDebug("RLIMIT_NOFILE hrd(" << rlim.rlim_max << ")" );
+            LogDebug("RLIMIT_NOFILE sft(" << rlim.rlim_cur << ")");
+            LogDebug("RLIMIT_NOFILE hrd(" << rlim.rlim_max << ")");
 
             if (rlim.rlim_cur < NOFILE_CNT_FOR_INSTALLER) {
                 rlim.rlim_cur = NOFILE_CNT_FOR_INSTALLER;