Remove GUID and refactoring update mode
authorJihoon Chung <jihoon.chung@samsung.com>
Fri, 5 Apr 2013 14:21:05 +0000 (23:21 +0900)
committerJihoon Chung <jihoon.chung@samsung.com>
Sat, 6 Apr 2013 08:02:56 +0000 (17:02 +0900)
[Issue#] N/A
[Problem] N/A
[Cause] N/A
[Solution] Remove GUID and refactoring update installing mode
[SCMRequest] N/A

Change-Id: Ie415de2bd5c9394b36fd26f3dd53f515fa043c7c

src/jobs/widget_install/job_widget_install.cpp
src/jobs/widget_install/job_widget_install.h
src/jobs/widget_install/task_certify.cpp
src/jobs/widget_install/task_database.cpp [changed mode: 0755->0644]
src/jobs/widget_install/task_file_manipulation.cpp
src/jobs/widget_install/task_manifest_file.cpp
src/jobs/widget_install/widget_install_context.h
src/jobs/widget_install/widget_update_info.cpp
src/jobs/widget_install/widget_update_info.h
src/wrt-installer/wrt_installer.cpp
src/wrt-installer/wrt_installer.h

index 12f598c..9bfad48 100644 (file)
@@ -112,24 +112,6 @@ bool hasExtension(const std::string& filename, const std::string& extension)
     }
     return (0 == filename.compare(fileLen - extLen, extLen, extension));
 }
-
-bool checkTizenPkgIdExist(const std::string& tizenPkgId)
-{
-    std::string installPath =
-        std::string(GlobalConfig::GetUserInstalledWidgetPath()) +
-        "/" + tizenPkgId;
-    std::string preinstallPath =
-        std::string(GlobalConfig::GetUserPreloadedWidgetPath()) +
-        "/" + tizenPkgId;
-
-    struct stat dirStat;
-    if ((stat(installPath.c_str(), &dirStat) == 0) ||
-        (stat(preinstallPath.c_str(), &dirStat) == 0))
-    {
-        return true;
-    }
-    return false;
-}
 } // namespace anonymous
 
 namespace Jobs {
@@ -383,7 +365,7 @@ void JobWidgetInstall::setTizenId(
         TizenPkgId pkgId = WidgetDAOReadOnly::generatePkgId();
         LogDebug("Checking if pkg id is unique");
         while (true) {
-            if (checkTizenPkgIdExist(DPL::ToUTF8String(pkgId))) {
+            if (!validateTizenPackageID(pkgId)) {
                 //path exist, chose another one
                 pkgId = WidgetDAOReadOnly::generatePkgId();
                 continue;
@@ -473,124 +455,130 @@ ConfigureResult JobWidgetInstall::ConfigureInstallation(
     const WrtDB::ConfigParserData &configData,
     const std::string &tempPath)
 {
-    WidgetUpdateInfo update = detectWidgetUpdate(
-            configData,
-            m_installerContext.
-                widgetConfig.webAppType,
-            m_installerContext.
-                widgetConfig.tzAppid);
-    ConfigureResult result = checkWidgetUpdate(update);
-
-    // Validate tizenId
-    regex_t reg;
-    if (regcomp(&reg, REG_TIZENID_PATTERN, REG_NOSUB | REG_EXTENDED) != 0) {
-        LogDebug("Regcomp failed");
+    ConfigureResult result = ConfigureResult::Failed;
+    WidgetUpdateInfo update;
+
+    // checking installed web application
+    Try {
+        // checking existing application is installed
+        WidgetDAOReadOnly dao(m_installerContext.widgetConfig.tzAppid);
+        // no excpetion means, it isn't update mode
+        getInstallerStruct().pkgmgrInterface->sendSignal(
+                PKGMGR_START_KEY,
+                PKGMGR_START_UPDATE);
+
+        update = detectWidgetUpdate(configData,
+                                    m_installerContext.widgetConfig.tzAppid);
+        result = checkWidgetUpdate(update);
+        if (result != ConfigureResult::Updated) {
+            // Already installed TizenAppId. return failed
+            return ConfigureResult::Failed_AlreadyInstalled;
+        }
+        m_installerContext.isUpdateMode = true;
     }
+    Catch(WidgetDAOReadOnly::Exception::WidgetNotExist) {
+        result = ConfigureResult::Ok;
+        getInstallerStruct().pkgmgrInterface->sendSignal(
+                PKGMGR_START_KEY,
+                PKGMGR_START_INSTALL);
+        m_installerContext.isUpdateMode = false;
 
-    if ((regexec(&reg,
-                 DPL::ToUTF8String(m_installerContext.widgetConfig.tzAppid).
-                     c_str(),
-                     static_cast<size_t>(0), NULL, 0) == REG_NOMATCH) ||
-        (checkTizenPkgIdExist(DPL::ToUTF8String(m_installerContext.widgetConfig
-                                                    .tzPkgid)) &&
-         result != ConfigureResult::Updated))
-    {
-        //it is true when tizenId does not fit REG_TIZENID_PATTERN
-        LogError("tizen_id provided but not proper or pkgId directory exists");
-        //TODO(t.iwanek): appId is unique, what about installation of
-        // abcdefghij.test1 and abcdefghij.test2?
-        regfree(&reg);
-        return ConfigureResult::Failed_AlreadyInstalled;
+        if (!validateTizenApplicationID(
+            m_installerContext.widgetConfig.tzAppid))
+        {
+            LogError("tizen application ID is already used");
+            return ConfigureResult::Failed_InvalidConfig;
+        }
+        if (!validateTizenPackageID(m_installerContext.widgetConfig.tzPkgid)) {
+            LogError("tizen package ID is already used");
+            return ConfigureResult::Failed_AlreadyInstalled;
+        }
     }
-    regfree(&reg);
 
     configureWidgetLocation(widgetSource, tempPath);
 
     // Init installer context
     m_installerContext.installStep = InstallerContext::INSTALL_START;
     m_installerContext.job = this;
-    m_installerContext.existingWidgetInfo = update.existingWidgetInfo;
     m_installerContext.widgetConfig.shareHref = std::string();
 
     return result;
 }
 
-ConfigureResult JobWidgetInstall::checkWidgetUpdate(
-    const WidgetUpdateInfo &update)
+bool JobWidgetInstall::validateTizenApplicationID(
+    const WrtDB::TizenAppId &tizenAppId)
 {
-    LogInfo(
-        "Widget install/update: incoming guid = '" <<
-        update.incomingGUID << "'");
-    LogInfo(
-        "Widget install/update: incoming version = '" <<
-        update.incomingVersion << "'");
-
-    // Check policy
-    WidgetUpdateMode::Type updateTypeCheckBit;
-
-    if (update.existingWidgetInfo.isExist == false) {
-        LogInfo("Widget info does not exist");
-        updateTypeCheckBit = WidgetUpdateMode::NotInstalled;
-
-        getInstallerStruct().pkgmgrInterface->sendSignal(
-                PKGMGR_START_KEY,
-                PKGMGR_START_INSTALL);
-
-    } else {
-        LogInfo("Widget info exists. appid: " <<
-                update.existingWidgetInfo.tzAppid);
+    LogInfo("tizen application ID = [" << tizenAppId << "]");
 
-        getInstallerStruct().pkgmgrInterface->sendSignal(
-                PKGMGR_START_KEY,
-                PKGMGR_START_UPDATE);
+    regex_t reg;
+    if (regcomp(&reg, REG_TIZENID_PATTERN, REG_NOSUB | REG_EXTENDED) != 0) {
+        LogDebug("Regcomp failed");
+    }
 
-        TizenAppId tzAppid = update.existingWidgetInfo.tzAppid;
+    if (regexec(&reg, DPL::ToUTF8String(tizenAppId).c_str(), 0, NULL, 0)
+        == REG_NOMATCH)
+    {
+        regfree(&reg);
+        return false;
+    }
+    regfree(&reg);
+    return true;
+}
 
-        LogInfo("Widget model exists. tizen app id: " << tzAppid);
+bool JobWidgetInstall::validateTizenPackageID(
+    const WrtDB::TizenPkgId &tizenPkgId)
+{
+    std::string pkgId = DPL::ToUTF8String(tizenPkgId);
 
-        // Check running state
-        bool isRunning = false;
-        int retval = app_manager_is_running(DPL::ToUTF8String(
-                                            tzAppid).c_str(), &isRunning);
-        if (APP_MANAGER_ERROR_NONE != retval) {
-            LogError("Fail to get running state");
-            return ConfigureResult::Failed_WidgetRunning;
-        }
+    std::string installPath =
+        std::string(GlobalConfig::GetUserInstalledWidgetPath()) +
+        "/" + pkgId;
+    std::string preinstallPath =
+        std::string(GlobalConfig::GetUserPreloadedWidgetPath()) +
+        "/" + pkgId;
 
-        if (true == isRunning) {
-            // Must be deferred when update in progress
-            if (m_jobStruct.updateMode == WidgetUpdateMode::PolicyWac) {
-                LogInfo(
-                    "Widget is already running. Policy is update according to WAC");
+    struct stat dirStat;
+    if ((stat(installPath.c_str(), &dirStat) == 0) ||
+        (stat(preinstallPath.c_str(), &dirStat) == 0))
+    {
+        return false;
+    }
+    return true;
+}
 
-                return ConfigureResult::Deferred;
-            } else {
-                LogInfo(
-                    "Widget is already running. Policy is not update according to WAC");
+ConfigureResult JobWidgetInstall::checkWidgetUpdate(
+    const WidgetUpdateInfo &update)
+{
+    LogInfo("incoming version = '" << update.incomingVersion);
+    LogInfo("Tizen AppID = " << update.tzAppId);
+
+    // Check running state
+    bool isRunning = false;
+    int retval =
+        app_manager_is_running(DPL::ToUTF8String(update.tzAppId).c_str(),
+                               &isRunning);
+    if (APP_MANAGER_ERROR_NONE != retval || isRunning) {
+        LogError("Fail to get running state");
+        return ConfigureResult::Failed_WidgetRunning;
+    }
 
-                return ConfigureResult::Failed_WidgetRunning;
-            }
-        }
+    m_installerContext.widgetConfig.tzAppid = update.tzAppId;
 
-        m_installerContext.widgetConfig.tzAppid = tzAppid;
-        OptionalWidgetVersion existingVersion;
-        existingVersion = update.existingWidgetInfo.existingVersion;
-        OptionalWidgetVersion incomingVersion = update.incomingVersion;
-
-        updateTypeCheckBit = CalcWidgetUpdatePolicy(existingVersion,
-                                                    incomingVersion);
-        // Calc proceed flag
-        if ((m_jobStruct.updateMode & updateTypeCheckBit) > 0 ||
-            m_jobStruct.updateMode ==
-            WidgetUpdateMode::PolicyDirectoryForceInstall)
-        {
-            LogInfo("Whether widget policy allow proceed ok");
-            return ConfigureResult::Updated;
-        } else {
-            return ConfigureResult::Failed_LowerVersion;
-        }
+    WidgetUpdateMode::Type updateTypeCheckBit;
+    updateTypeCheckBit = CalcWidgetUpdatePolicy(update.existingVersion,
+                                                update.incomingVersion);
+    // Calc proceed flag
+    if ((m_jobStruct.updateMode & updateTypeCheckBit) > 0 ||
+        m_jobStruct.updateMode ==
+        WidgetUpdateMode::PolicyDirectoryForceInstall)
+    {
+        LogInfo("Whether widget policy allow proceed ok");
+        return ConfigureResult::Updated;
+    } else {
+        return ConfigureResult::Failed_LowerVersion;
     }
-    return ConfigureResult::Ok;
+
+    return ConfigureResult::Failed;
 }
 
 WidgetUpdateMode::Type JobWidgetInstall::CalcWidgetUpdatePolicy(
@@ -728,71 +716,22 @@ ConfigParserData JobWidgetInstall::getWidgetDataFromXML(
 
 WidgetUpdateInfo JobWidgetInstall::detectWidgetUpdate(
     const ConfigParserData &configInfo,
-    const WrtDB::WidgetType appType,
     const WrtDB::TizenAppId &tizenId)
 {
     LogInfo("Checking up widget package for config.xml...");
+    OptionalWidgetVersion incomingVersion;
 
-    DPL::OptionalString widgetGUID;
-    OptionalWidgetVersion widgetVersion;
-
-    // Check widget id
-    widgetGUID = configInfo.widget_id;
-
-    if (widgetGUID.IsNull()) {
-        LogWarning("Installed widget has no GUID");
-        return WidgetUpdateInfo();
-    }
-
-    LogDebug("Installed widget GUID: " << *widgetGUID);
-
-    // Locate widget ID with this GUID
-    // Incoming widget version
     if (!configInfo.version.IsNull()) {
-        widgetVersion =
+        incomingVersion =
             DPL::Optional<WidgetVersion>(
                 WidgetVersion(*configInfo.version));
     }
 
-    if (appType == APP_TYPE_WAC20) {
-        Try
-        {
-            // Search widget handle by GUID
-            WidgetDAOReadOnly dao(widgetGUID);
-            return WidgetUpdateInfo(
-                       widgetGUID,
-                       widgetVersion,
-                       WidgetUpdateInfo::ExistingWidgetInfo(
-                           dao.getTzAppId(), dao.getVersion()));
-        }
-        Catch(WidgetDAOReadOnly::Exception::WidgetNotExist)
-        {
-            // GUID isn't installed
-            return WidgetUpdateInfo(
-                       widgetGUID,
-                       widgetVersion,
-                       WidgetUpdateInfo::ExistingWidgetInfo());
-        }
-    } else {
-        Try
-        {
-            // Search widget handle by appId
-            WidgetDAOReadOnly dao(tizenId);
-            return WidgetUpdateInfo(
-                       widgetGUID,
-                       widgetVersion,
-                       WidgetUpdateInfo::ExistingWidgetInfo(
-                           dao.getTzAppId(), dao.getVersion()));
-        }
-        Catch(WidgetDAOReadOnly::Exception::WidgetNotExist)
-        {
-            // GUID isn't installed
-            return WidgetUpdateInfo(
-                       widgetGUID,
-                       widgetVersion,
-                       WidgetUpdateInfo::ExistingWidgetInfo());
-        }
-    }
+    WidgetDAOReadOnly dao(tizenId);
+    return WidgetUpdateInfo(
+        dao.getTzAppId(),
+        WidgetVersion(*dao.getVersion()),
+        incomingVersion);
 }
 
 void JobWidgetInstall::SendProgress()
@@ -836,10 +775,10 @@ void JobWidgetInstall::SendFinishedSuccess()
     sync();
 
     if (INSTALL_LOCATION_TYPE_EXTERNAL == m_installerContext.locationType) {
-        if (false == m_installerContext.existingWidgetInfo.isExist) {
-            WidgetInstallToExtSingleton::Instance().postInstallation(true);
-        } else {
+        if (m_installerContext.isUpdateMode) {
             WidgetInstallToExtSingleton::Instance().postUpgrade(true);
+        } else {
+            WidgetInstallToExtSingleton::Instance().postInstallation(true);
         }
         WidgetInstallToExtSingleton::Instance().deinitialize();
     }
index 0027080..73c58f1 100644 (file)
@@ -77,7 +77,6 @@ class JobWidgetInstall :
         bool isDRM);
     static WidgetUpdateInfo detectWidgetUpdate(
         const WrtDB::ConfigParserData &configInfo,
-        const WrtDB::WidgetType appType,
         const WrtDB::TizenAppId &tizenId);
     WidgetUpdateMode::Type CalcWidgetUpdatePolicy(
         const OptionalWidgetVersion &existingVersion,
@@ -96,6 +95,8 @@ class JobWidgetInstall :
     bool isDRMWidget(std::string widgetPath);
     bool DecryptDRMWidget(std::string widgetPath, std::string destPath);
     ConfigureResult PrePareInstallation(const std::string &widgetPath);
+    bool validateTizenApplicationID(const WrtDB::TizenAppId &tizenAppId);
+    bool validateTizenPackageID(const WrtDB::TizenPkgId &tizenPkgId);
     ConfigureResult checkWidgetUpdate(const WidgetUpdateInfo &update);
     void setApplicationType(const WrtDB::ConfigParserData &configInfo);
 
index 88b8fc4..db0ebad 100644 (file)
@@ -131,7 +131,7 @@ TaskCertify::TaskCertify(InstallerContext &inCont) :
 {
     AddStep(&TaskCertify::stepSignature);
     // certi comparison determines whether the update.
-    if (true == m_contextData.existingWidgetInfo.isExist) {
+    if (true == m_contextData.isUpdateMode) {
         AddStep(&TaskCertify::stepVerifyUpdate);
     }
 
old mode 100755 (executable)
new mode 100644 (file)
index 6f5d039..329b618
@@ -74,7 +74,7 @@ void TaskDatabase::StepWrtDBInsert()
         /* Set install Time */
         time(&m_context.widgetConfig.installedTime);
 
-        if (m_context.existingWidgetInfo.isExist) { //update
+        if (m_context.isUpdateMode) { //update
             LogInfo("Registering widget... (update)");
             Try
             {
@@ -181,7 +181,7 @@ void TaskDatabase::StepRegisterExternalFiles()
 {
     WrtDB::ExternalLocationList externalLocationsUpdate =
         m_context.locations->listExternalLocations();
-    if (m_context.existingWidgetInfo.isExist) { //update
+    if (m_context.isUpdateMode) { //update
         Try
         {
             WidgetDAO dao(m_context.widgetConfig.tzAppid);
index 4c34b5d..a96b8ce 100644 (file)
@@ -266,12 +266,12 @@ void TaskFileManipulation::StepPrepareExternalDir()
             list = g_list_append(list, dirDetail);
         }
 
-        if (false == m_context.existingWidgetInfo.isExist) {
-            WidgetInstallToExtSingleton::Instance().preInstallation(list,
-                                                                    folderSize);
-        } else {
+        if (m_context.isUpdateMode) {
             WidgetInstallToExtSingleton::Instance().preUpgrade(list,
                                                                folderSize);
+        } else {
+            WidgetInstallToExtSingleton::Instance().preInstallation(list,
+                                                                    folderSize);
         }
         free(dirDetail);
         g_list_free(list);
@@ -306,10 +306,10 @@ void TaskFileManipulation::StepInstallToExternal()
 void TaskFileManipulation::StepAbortCreateExternalDir()
 {
     LogError("Abort StepAbortCreateExternalDir");
-    if (false == m_context.existingWidgetInfo.isExist) {
-        WidgetInstallToExtSingleton::Instance().postInstallation(false);
-    } else {
+    if (m_context.isUpdateMode) {
         WidgetInstallToExtSingleton::Instance().postUpgrade(false);
+    } else {
+        WidgetInstallToExtSingleton::Instance().postInstallation(false);
     }
     WidgetInstallToExtSingleton::Instance().deinitialize();
 }
index 96eb80a..a5124a0 100644 (file)
@@ -105,15 +105,7 @@ TaskManifestFile::TaskManifestFile(InstallerContext &inCont) :
     m_context(inCont),
     writer(NULL)
 {
-    if (false == m_context.existingWidgetInfo.isExist) {
-        AddStep(&TaskManifestFile::stepCopyIconFiles);
-        AddStep(&TaskManifestFile::stepCreateExecFile);
-        AddStep(&TaskManifestFile::stepGenerateManifest);
-        AddStep(&TaskManifestFile::stepParseManifest);
-        AddStep(&TaskManifestFile::stepFinalize);
-
-        AddAbortStep(&TaskManifestFile::stepAbortParseManifest);
-    } else {
+    if (m_context.isUpdateMode) {
         // for widget update.
         AddStep(&TaskManifestFile::stepBackupIconFiles);
         AddStep(&TaskManifestFile::stepCopyIconFiles);
@@ -122,6 +114,14 @@ TaskManifestFile::TaskManifestFile(InstallerContext &inCont) :
         AddStep(&TaskManifestFile::stepUpdateFinalize);
 
         AddAbortStep(&TaskManifestFile::stepAbortIconFiles);
+    } else {
+        AddStep(&TaskManifestFile::stepCopyIconFiles);
+        AddStep(&TaskManifestFile::stepCreateExecFile);
+        AddStep(&TaskManifestFile::stepGenerateManifest);
+        AddStep(&TaskManifestFile::stepParseManifest);
+        AddStep(&TaskManifestFile::stepFinalize);
+
+        AddAbortStep(&TaskManifestFile::stepAbortParseManifest);
     }
 }
 
index affe621..b7b2bfe 100644 (file)
@@ -84,9 +84,7 @@ struct InstallerContext
                                                   // information.
     InstallStep installStep;              ///< current step of installation
     Jobs::WidgetInstall::JobWidgetInstall *job;
-    ///< pointer of instance of JobWidgetInstall
-    WidgetUpdateInfo::ExistingWidgetInfo existingWidgetInfo;
-    ///< Whether this is an update or normal installation
+     ///< Whether this is an update or normal installation
     Jobs::WidgetInstall::FeatureLogicPtr featureLogic;
     /** List of dev-caps that are requested in widget config file.
      * Additional flag tells whether dev cap gets "static" permission
@@ -98,6 +96,7 @@ struct InstallerContext
     std::string installInfo;            ///<For recovery>
     bool m_quiet;
     InstallLocationType locationType;
+    bool isUpdateMode;
 };
 
 #endif // INSTALLER_CONTEXT_H
index de35936..621907b 100644 (file)
 
 #include "widget_update_info.h"
 
-WidgetUpdateInfo::ExistingWidgetInfo::ExistingWidgetInfo() :
-    isExist(false)
-{}
-
-WidgetUpdateInfo::ExistingWidgetInfo::ExistingWidgetInfo(
-    const WrtDB::TizenAppId & appid,
-    const DPL::Optional<WidgetVersion> &version) :
-    tzAppid(appid),
-    isExist(true),
-    existingVersion(version)
-{}
-
-WidgetUpdateInfo::ExistingWidgetInfo::ExistingWidgetInfo(
-    const WrtDB::TizenAppId & appid,
-    const DPL::Optional<DPL::String> &version) :
-    tzAppid(appid),
-    isExist(true)
+WidgetUpdateInfo::WidgetUpdateInfo(
+    const WrtDB::TizenAppId & appId,
+    const DPL::Optional<WidgetVersion> &existingversion,
+    const DPL::Optional<WidgetVersion> &incomingversion) :
+      tzAppId(appId),
+      existingVersion(existingversion),
+      incomingVersion(incomingversion)
 {
-    if (!!version) {
-        existingVersion = WidgetVersion(*version);
-    }
 }
 
-WidgetUpdateInfo::WidgetUpdateInfo() :
-    existingWidgetInfo()
-{}
-
-WidgetUpdateInfo::WidgetUpdateInfo(
-    const DPL::Optional<WrtDB::WidgetGUID> &guid,
-    const DPL::Optional<WidgetVersion> &version,
-    ExistingWidgetInfo widgetInfo) :
-    incomingGUID(guid),
-    incomingVersion(version),
-    existingWidgetInfo(widgetInfo)
-{}
index 858fa25..21004bd 100644 (file)
  */
 struct WidgetUpdateInfo
 {
-    struct ExistingWidgetInfo
-    {
-        WrtDB::TizenAppId tzAppid;
-        bool isExist;
-        DPL::Optional<WidgetVersion> existingVersion;
-
-        ExistingWidgetInfo();
-        ExistingWidgetInfo(const WrtDB::TizenAppId & tzAppid,
-                           const DPL::Optional<WidgetVersion> &version);
-        ExistingWidgetInfo(const WrtDB::TizenAppId & tzAppid,
-                           const DPL::Optional<DPL::String> &version);
-    };
-
+    WrtDB::TizenAppId tzAppId;
+    // Existing widget
+    DPL::Optional<WidgetVersion> existingVersion;
     // Incoming widget
-    DPL::Optional<WrtDB::WidgetGUID> incomingGUID;
     DPL::Optional<WidgetVersion> incomingVersion;
-    // Existing widget
-    ExistingWidgetInfo existingWidgetInfo;
 
-    WidgetUpdateInfo();
-    WidgetUpdateInfo(const DPL::Optional<WrtDB::WidgetGUID> &guid,
-                     const DPL::Optional<WidgetVersion> &version,
-                     ExistingWidgetInfo widgetInfo);
+    WidgetUpdateInfo() {};
+    WidgetUpdateInfo(const WrtDB::TizenAppId & tzAppid,
+                     const DPL::Optional<WidgetVersion> &existringversion,
+                     const DPL::Optional<WidgetVersion> &incomingVersion);
 };
 
 #endif // SRC_DOMAIN_WIDGET_UPDATE_INFO_H
index 72c689e..c2f4702 100644 (file)
@@ -200,12 +200,6 @@ void WrtInstaller::OnCreate()
             }
             m_name = m_argv[2];
             AddStep(&WrtInstaller::uninstallPkgNameStep);
-        } else if (arg == "-ug" || arg == "--uninstall-guid") {
-            if (m_argc != 3) {
-                return showHelpAndQuit();
-            }
-            m_name = m_argv[2];
-            AddStep(&WrtInstaller::uninstallGuidStep);
         } else if (arg == "-up" || arg == "--uninstall-packagepath") {
             if (m_argc != 3) {
                 return showHelpAndQuit();
@@ -292,7 +286,7 @@ void WrtInstaller::OnTerminate()
 
 void WrtInstaller::showHelpAndQuit()
 {
-    printf("Usage: wrt-installer [OPTION]... [WIDGET: ID/NAME/GUID/PATH]...\n"
+    printf("Usage: wrt-installer [OPTION]... [WIDGET: ID/NAME/PATH]...\n"
            "Operate with WebRuntime daemon: install, uninstall"
            " and launch widgets.\n"
            "Query list of installed widgets and setup up debugging support.\n"
@@ -308,8 +302,6 @@ void WrtInstaller::showHelpAndQuit()
            "install forcibly widget package for given path\n"
            "  -un,   --uninstall-name                       "
            "uninstall widget for given package name\n"
-           "  -ug,   --uninstall-guid                       "
-           "uninstall widget for given Global Unique IDentifier\n"
            "  -up,   --uninstall-packagepath                "
            "uninstall widget for given package file path\n"
            "\n");
@@ -470,28 +462,6 @@ void WrtInstaller::uninstallPkgNameStep()
                          pkgmgrSignalInterface);
 }
 
-void WrtInstaller::uninstallGuidStep()
-{
-    LogDebug("Uninstalling widget ...");
-    std::string appid;
-    WrtErrStatus status = wrt_get_widget_by_guid(appid, m_name);
-    if (status == WRT_SUCCESS) {
-        LogDebug("Guid : " << m_name);
-        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(
-            WRTInstallerNS::QuitEvent());
-    }
-}
-
 void WrtInstaller::unistallWgtFileStep()
 {
     LogDebug("Uninstalling widget ...");
@@ -626,7 +596,6 @@ void WrtInstaller::staticWrtStatusCallback(std::string tizenId,
         resultMsg = DPL::FromUTF8String(PKGMGR_INSTALL_MSG);
         printMsg = "installation";
     } else if (current == &WrtInstaller::uninstallPkgNameStep ||
-               current == &WrtInstaller::uninstallGuidStep ||
                current == &WrtInstaller::unistallWgtFileStep)
     {
         resultMsg = DPL::FromUTF8String(PKGMGR_UNINSTALL_MSG);
index 29e9835..66fc636 100644 (file)
@@ -105,7 +105,6 @@ class WrtInstaller :
     void installNewPlugins();
     void installPluginsStep();
     void uninstallPkgNameStep();
-    void uninstallGuidStep();
     void unistallWgtFileStep();
     void shutdownStep();
     void registerCallbackStep();