Separate update package information. Phase2.
authorSoyoung Kim <sy037.kim@samsung.com>
Wed, 7 Aug 2013 05:58:44 +0000 (14:58 +0900)
committerGerrit Code Review <gerrit@gerrit.vlan144.tizendev.org>
Thu, 5 Sep 2013 10:34:55 +0000 (10:34 +0000)
[Issue#] N/A
[Problem] N/A
[Cause] N/A
[Solution] 1. To update package information separte from removefiles.
2. organize the task lists of uninstallation.
[SCMRequest] N/A

Change-Id: I8e29dcc6f66f4d5516d2596754889c218d8821be

src/CMakeLists.txt
src/jobs/widget_uninstall/job_widget_uninstall.cpp
src/jobs/widget_uninstall/task_delete_certificates.cpp [deleted file]
src/jobs/widget_uninstall/task_delete_pkginfo.cpp [new file with mode: 0644]
src/jobs/widget_uninstall/task_delete_pkginfo.h [moved from src/jobs/widget_uninstall/task_delete_certificates.h with 73% similarity]
src/jobs/widget_uninstall/task_remove_files.cpp
src/jobs/widget_uninstall/task_remove_files.h

index 794e7f1..87de01c 100644 (file)
@@ -92,7 +92,7 @@ SET(INSTALLER_SOURCES
     ${INSTALLER_JOBS}/widget_uninstall/task_db_update.cpp
     ${INSTALLER_JOBS}/widget_uninstall/task_smack.cpp
     ${INSTALLER_JOBS}/widget_uninstall/task_uninstall_ospsvc.cpp
-    ${INSTALLER_JOBS}/widget_uninstall/task_delete_certificates.cpp
+    ${INSTALLER_JOBS}/widget_uninstall/task_delete_pkginfo.cpp
     ${INSTALLER_SRC_DIR}/logic/installer_logic.cpp
     ${INSTALLER_SRC_DIR}/logic/installer_controller.cpp
     ${INSTALLER_SRC_DIR}/misc/wac_widget_id.cpp
index b5e978e..563f10a 100644 (file)
@@ -24,7 +24,7 @@
 #include <widget_uninstall/task_remove_custom_handlers.h>
 #include <widget_uninstall/task_smack.h>
 #include <widget_uninstall/task_uninstall_ospsvc.h>
-#include <widget_uninstall/task_delete_certificates.h>
+#include <widget_uninstall/task_delete_pkginfo.h>
 #include <dpl/wrt-dao-ro/global_config.h>
 #include <pkg-manager/pkgmgr_signal.h>
 #include <app2ext_interface.h>
@@ -105,17 +105,6 @@ JobWidgetUninstall::JobWidgetUninstall(
 
             LogDebug("Widget model exists. App id : " << m_context.tzAppid);
 
-            AddTask(new TaskSmack(m_context));
-            AddTask(new TaskCheck(m_context));
-
-            if (dao.getPackagingType() == PKG_TYPE_HYBRID_WEB_APP) {
-                AddTask(new TaskUninstallOspsvc(m_context));
-            }
-            AddTask(new TaskRemoveFiles(m_context));
-            AddTask(new TaskDbUpdate(m_context));
-            AddTask(new TaskRemoveCustomHandlers(m_context));
-            AddTask(new TaskDeleteCertificates(m_context));
-
             // send start signal of pkgmgr
             if (getInstallerStruct().pkgmgrInterface->setPkgname(m_context.tzPkgid))
             {
@@ -123,6 +112,17 @@ JobWidgetUninstall::JobWidgetUninstall(
                         PKGMGR_START_KEY,
                         PKGMGR_START_UNINSTALL);
             }
+
+            AddTask(new TaskCheck(m_context));
+            AddTask(new TaskDeletePkgInfo(m_context));
+            AddTask(new TaskDbUpdate(m_context));
+            AddTask(new TaskSmack(m_context));
+
+            if (dao.getPackagingType() == PKG_TYPE_HYBRID_WEB_APP) {
+                AddTask(new TaskUninstallOspsvc(m_context));
+            }
+            AddTask(new TaskRemoveCustomHandlers(m_context));
+            AddTask(new TaskRemoveFiles(m_context));
         } else if (WidgetStatus::NOT_INSTALLED == status ||
                 WidgetStatus::PREALOAD == status) {
             AddTask(new UninstallerTaskFail(status));
diff --git a/src/jobs/widget_uninstall/task_delete_certificates.cpp b/src/jobs/widget_uninstall/task_delete_certificates.cpp
deleted file mode 100644 (file)
index 1c38eca..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
- *
- *    Licensed under the Apache License, Version 2.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
- */
-/**
- * @file    task_delete_certificates.cpp
- * @author  Leerang Song(leerang.song@samsung.com)
- * @version 1.0
- * @brief   Implementation file for uninstaller delete certi info from pkgmgr
- */
-
-#include <widget_uninstall/task_delete_certificates.h>
-#include <widget_uninstall/job_widget_uninstall.h>
-#include <widget_uninstall/widget_uninstall_errors.h>
-#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
-#include <pkgmgr_installer.h>
-#include <dpl/assert.h>
-
-namespace Jobs {
-namespace WidgetUninstall {
-TaskDeleteCertificates::TaskDeleteCertificates(
-    UninstallerContext& context) :
-    DPL::TaskDecl<TaskDeleteCertificates>(this),
-    m_context(context)
-{
-    AddStep(&TaskDeleteCertificates::StartStep);
-    AddStep(&TaskDeleteCertificates::StepDeleteCertificates);
-    AddStep(&TaskDeleteCertificates::EndStep);
-}
-
-TaskDeleteCertificates::~TaskDeleteCertificates()
-{}
-
-void TaskDeleteCertificates::StepDeleteCertificates()
-{
-    if ((pkgmgr_installer_delete_certinfo(
-             const_cast<char*>((m_context.tzAppid).c_str()))) < 0)
-    {
-        LogError("pkgmgr_installer_delete_certinfo fail");
-    }
-}
-
-void TaskDeleteCertificates::StartStep()
-{
-    LogDebug("--------- <TaskDeleteCertificates> : START ----------");
-}
-
-void TaskDeleteCertificates::EndStep()
-{
-    LogDebug("--------- <TaskDeleteCertificates> : END ----------");
-}
-} //namespace WidgetUninstall
-} //namespace Jobs
diff --git a/src/jobs/widget_uninstall/task_delete_pkginfo.cpp b/src/jobs/widget_uninstall/task_delete_pkginfo.cpp
new file mode 100644 (file)
index 0000000..838a9fd
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+/**
+ * @file    task_delete_pkginfo.cpp
+ * @author  Leerang Song(leerang.song@samsung.com)
+ * @version 1.0
+ * @brief   Implementation file for uninstaller delete package information
+ */
+
+#include <string.h>
+#include <widget_uninstall/task_delete_pkginfo.h>
+#include <widget_uninstall/job_widget_uninstall.h>
+#include <widget_uninstall/widget_uninstall_errors.h>
+#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
+#include <pkgmgr/pkgmgr_parser.h>
+#include <dpl/assert.h>
+#include <dpl/utils/wrt_utility.h>
+#include <dpl/utils/path.h>
+
+namespace Jobs {
+namespace WidgetUninstall {
+TaskDeletePkgInfo::TaskDeletePkgInfo(
+    UninstallerContext& context) :
+    DPL::TaskDecl<TaskDeletePkgInfo>(this),
+    m_context(context)
+{
+    AddStep(&TaskDeletePkgInfo::StartStep);
+    AddStep(&TaskDeletePkgInfo::StepDeletePkgInfo);
+    AddStep(&TaskDeletePkgInfo::EndStep);
+}
+
+void TaskDeletePkgInfo::StartStep()
+{
+    LogDebug("--------- <TaskDeletePkgInfo> : START ----------");
+}
+
+void TaskDeletePkgInfo::EndStep()
+{
+    LogDebug("--------- <TaskDeletePkgInfo> : END ----------");
+}
+
+void TaskDeletePkgInfo::StepDeletePkgInfo()
+{
+    std::ostringstream manifest_name;
+    manifest_name << m_context.tzPkgid << ".xml";
+    DPL::Utils::Path destFile;
+    const DPL::Utils::Path PRELOAD_INSTALLED_PATH("/usr/apps");
+    const DPL::Utils::Path USR_PACKAGES_PATH("/usr/share/packages");
+    const DPL::Utils::Path OPT_PACKAGES_PATH("/opt/share/packages");
+    if (0 == (m_context.installedPath.Fullpath()).compare(0,
+            PRELOAD_INSTALLED_PATH.Fullpath().length(),
+            PRELOAD_INSTALLED_PATH.Fullpath())) {
+        LogDebug("This widget is preloaded.");
+        destFile = USR_PACKAGES_PATH;
+    } else {
+        destFile = OPT_PACKAGES_PATH;
+    }
+    destFile /= manifest_name.str();
+    DPL::Utils::Path pre_manifest = USR_PACKAGES_PATH;
+    pre_manifest /= manifest_name.str();
+
+    if (!(destFile.Exists() == 0 && pre_manifest.Exists())) {
+        if (0 !=  pkgmgr_parser_parse_manifest_for_uninstallation(
+                    destFile.Fullpath().c_str(), NULL)) {
+            LogWarning("Manifest file failed to parse for uninstallation");
+        }
+    }
+    if (!DPL::Utils::TryRemove(destFile)) {
+        LogWarning("No manifest file found: " << destFile.Fullpath());
+    } else {
+        LogDebug("Manifest file removed: " << destFile.Fullpath());
+    }
+}
+} //namespace WidgetUninstall
+} //namespace Jobs
  *    limitations under the License.
  */
 /**
- * @file    task_delete_certificates.h
+ * @file    task_delete_pkginfo.h
  * @author  Leerang Song(leerang.song@samsung.com)
  * @version 1.0
- * @brief   Header file for uninstaller task delete certi info from pkgmgr
+ * @brief   Header file for uninstaller task delete package infomation
  */
 
-#ifndef WRT_SRC_INSTALLER_CORE_JOB_WIDGET_UNINSTALL_TASK_DELETE_CERTIFICATES_H_
-#define WRT_SRC_INSTALLER_CORE_JOB_WIDGET_UNINSTALL_TASK_DELETE_CERTIFICATES_H_
+#ifndef WRT_SRC_INSTALLER_CORE_JOB_WIDGET_UNINSTALL_TASK_DELETE_PKGINFO_H_
+#define WRT_SRC_INSTALLER_CORE_JOB_WIDGET_UNINSTALL_TASK_DELETE_PKGINFO_H_
 
 #include <dpl/task.h>
 
 
 namespace Jobs {
 namespace WidgetUninstall {
-class TaskDeleteCertificates :
-    public DPL::TaskDecl<TaskDeleteCertificates>
+class TaskDeletePkgInfo :
+    public DPL::TaskDecl<TaskDeletePkgInfo>
 {
     UninstallerContext& m_context;
 
   private:
-    void StepDeleteCertificates();
+    void StepDeletePkgInfo();
 
     void StartStep();
     void EndStep();
 
   public:
-    TaskDeleteCertificates(UninstallerContext& context);
-    virtual ~TaskDeleteCertificates();
+    TaskDeletePkgInfo(UninstallerContext& context);
 };
 } //namespace WidgetUninstall
 } //namespace Jobs
 
 #endif
-// WRT_SRC_INSTALLER_CORE_JOB_WIDGET_UNINSTALL_TASK_DELETE_CERTIFICATES_H_
+// WRT_SRC_INSTALLER_CORE_JOB_WIDGET_UNINSTALL_TASK_DELETE_PKGINFO_H_
index 0a8f5c3..ffdebda 100644 (file)
@@ -47,7 +47,6 @@ TaskRemoveFiles::TaskRemoveFiles(UninstallerContext& context) :
 {
     AddStep(&TaskRemoveFiles::StartStep);
     AddStep(&TaskRemoveFiles::StepRemoveInstallationDirectory);
-    AddStep(&TaskRemoveFiles::StepRemoveManifest);
     AddStep(&TaskRemoveFiles::StepRemoveExternalLocations);
     AddStep(&TaskRemoveFiles::StepRemoveFinished);
     AddStep(&TaskRemoveFiles::EndStep);
@@ -111,40 +110,6 @@ void TaskRemoveFiles::StepRemoveFinished()
         "Widget remove steps Finished");
 }
 
-void TaskRemoveFiles::StepRemoveManifest()
-{
-    std::ostringstream manifest_name;
-    manifest_name << m_context.tzPkgid << ".xml";
-    DPL::Utils::Path destFile;
-    const DPL::Utils::Path PRELOAD_INSTALLED_PATH("/usr/apps");
-    const DPL::Utils::Path USR_PACKAGES_PATH("/usr/share/packages");
-    const DPL::Utils::Path OPT_PACKAGES_PATH("/opt/share/packages");
-    if (0 == (m_context.installedPath.Fullpath()).compare(0,
-            PRELOAD_INSTALLED_PATH.Fullpath().length(),
-            PRELOAD_INSTALLED_PATH.Fullpath())) {
-        LogDebug("This widget is preloaded.");
-        destFile = USR_PACKAGES_PATH;
-    } else {
-        destFile = OPT_PACKAGES_PATH;
-    }
-    destFile /= manifest_name.str();
-    DPL::Utils::Path pre_manifest = USR_PACKAGES_PATH;
-    pre_manifest /= manifest_name.str();
-
-    if (!(destFile.Exists() == 0 && pre_manifest.Exists())) {
-        int ret1 = pkgmgr_parser_parse_manifest_for_uninstallation(
-                destFile.Fullpath().c_str(), NULL);
-        if (ret1 != 0) {
-            LogWarning("Manifest file failed to parse for uninstallation");
-        }
-    }
-    if (!DPL::Utils::TryRemove(destFile)) {
-        LogWarning("No manifest file found: " << destFile.Fullpath());
-    } else {
-        LogDebug("Manifest file removed: " << destFile.Fullpath());
-    }
-}
-
 void TaskRemoveFiles::StepRemoveExternalLocations()
 {
     if (!m_context.removeAbnormal) {
index 19db96a..c955435 100644 (file)
@@ -48,8 +48,6 @@ class TaskRemoveFiles :
   private:
     void StepRemoveInstallationDirectory();
     void StepRemoveFinished();
-    void StepRemoveDesktop();
-    void StepRemoveManifest();
     void StepRemoveExternalLocations();
 
     void StartStep();