[Release] wrt-installer_0.1.88
authorTaejeong Lee <taejeong.lee@samsung.com>
Tue, 25 Jun 2013 04:43:00 +0000 (13:43 +0900)
committersung-su.kim <sung-su.kim@samsung.com>
Tue, 25 Jun 2013 08:42:20 +0000 (17:42 +0900)
Change-Id: I8f0e35b58198a1469529cafdf9e79d585892435e

packaging/wrt-installer.spec
src/jobs/widget_install/widget_unzip.cpp
src/jobs/widget_uninstall/task_remove_files.cpp

index 7916dc2..79adeb4 100644 (file)
@@ -1,7 +1,7 @@
 #git:framework/web/wrt-installer
 Name:       wrt-installer
 Summary:    Installer for tizen Webruntime
-Version:    0.1.87
+Version:    0.1.88
 Release:    1
 Group:      Development/Libraries
 License:    Apache License, Version 2.0
index 1b86657..df96243 100644 (file)
@@ -34,8 +34,6 @@
 using namespace WrtDB;
 
 namespace {
-const char* const NPRUNTIME_PLUGINS_DIR = "plugins/";
-
 struct PathAndFilePair
 {
     std::string path;
@@ -62,34 +60,6 @@ PathAndFilePair SplitFileAndPath(const std::string &filePath)
                                            position),
                            filePath.substr(position + 1));
 }
-
-inline bool isNPPlugin(const std::string& filePath)
-{
-    std::string::size_type pos = filePath.find(NPRUNTIME_PLUGINS_DIR);
-    // Not specified if a plug-in name MUST end with a specific extension
-    // (e.g. .so)
-    return ((std::string::npos != pos) &&
-            ('/' != filePath[filePath.length() - 1]));
-}
-
-// precondition: isNPPlugin(filePath) == true
-inline bool isValidNPPlugin(const std::string& filePath)
-{
-    return (filePath.find(GlobalConfig::GetNPRuntimePluginsPath()) == 0);
-}
-
-bool shouldBeInstalled(const std::string& filePath)
-{
-    if (isNPPlugin(filePath))
-    {
-        if (!isValidNPPlugin(filePath))
-        {
-            LogDebug("Not a valid NPRuntime plug-in: " << filePath);
-            return false;
-        }
-    }
-    return true;
-}
 }
 
 namespace Jobs {
@@ -128,50 +98,43 @@ void WidgetUnzip::unzipProgress(const std::string &destination)
     // Extract file or path
     std::string fileName = m_zipIterator->name;
 
-    if (shouldBeInstalled(m_zipIterator->name))
-    {
-        if (fileName[fileName.size() - 1] == '/') {
-            // This is path
-            std::string newPath = destination + "/" +
-                fileName.substr(0, fileName.size() - 1);
-            LogPedantic("Path to extract: " << newPath);
-
-            // Create path in case of it is empty
-            createTempPath(newPath);
-        } else {
-            // This is regular file
-            std::string fileExtractPath = destination + "/" + fileName;
-
-            LogPedantic("File to extract: " << fileExtractPath);
-
-            // Split into pat & file pair
-            PathAndFilePair pathAndFile = SplitFileAndPath(fileExtractPath);
-
-            LogPedantic("Path and file: " <<
-                        pathAndFile.path <<
-                        " : " << pathAndFile.file);
-
-            // First, ensure that path exists
-            createTempPath(pathAndFile.path);
-
-            Try
-            {
-                // Open file
-                std::unique_ptr<DPL::ZipInput::File> file(
-                    m_zip->OpenFile(fileName));
-
-                // Extract single file
-                ExtractFile(file.get(), fileExtractPath);
-            }
-            Catch(DPL::ZipInput::Exception::OpenFileFailed)
-            {
-                ThrowMsg(Exceptions::ExtractFileFailed, fileName);
-            }
+    if (fileName[fileName.size() - 1] == '/') {
+        // This is path
+        std::string newPath = destination + "/" +
+            fileName.substr(0, fileName.size() - 1);
+        LogPedantic("Path to extract: " << newPath);
+
+        // Create path in case of it is empty
+        createTempPath(newPath);
+    } else {
+        // This is regular file
+        std::string fileExtractPath = destination + "/" + fileName;
+
+        LogPedantic("File to extract: " << fileExtractPath);
+
+        // Split into pat & file pair
+        PathAndFilePair pathAndFile = SplitFileAndPath(fileExtractPath);
+
+        LogPedantic("Path and file: " <<
+                    pathAndFile.path <<
+                    " : " << pathAndFile.file);
+
+        // First, ensure that path exists
+        createTempPath(pathAndFile.path);
+
+        Try
+        {
+            // Open file
+            std::unique_ptr<DPL::ZipInput::File> file(
+                m_zip->OpenFile(fileName));
+
+            // Extract single file
+            ExtractFile(file.get(), fileExtractPath);
+        }
+        Catch(DPL::ZipInput::Exception::OpenFileFailed)
+        {
+            ThrowMsg(Exceptions::ExtractFileFailed, fileName);
         }
-    }
-    else
-    {
-        LogDebug("Skipping file: " << m_zipIterator->name);
     }
 
     // Check whether there are more files to extract
index 4a5122f..911b1bd 100644 (file)
@@ -58,9 +58,9 @@ void TaskRemoveFiles::StepRemoveInstallationDirectory()
 {
     LogInfo("StepRemoveInstallationDirectory started");
     Try {
-        if (APP2EXT_SD_CARD !=
-                app2ext_get_app_location(m_context.tzPkgid.c_str()))
-        {
+        int ret = app2ext_get_app_location(m_context.tzPkgid.c_str());
+
+        if (APP2EXT_INTERNAL_MEM == ret) {
             LogDebug("Removing directory");
             m_context.removeStarted = true;
             DPL::Utils::Path widgetDir= m_context.installedPath;
@@ -76,7 +76,7 @@ void TaskRemoveFiles::StepRemoveInstallationDirectory()
             } Catch(DPL::Utils::Path::BaseException){
                 LogWarning(dataDir.Fullpath() << " is already removed");
             }
-        } else {
+        } else if (APP2EXT_SD_CARD == ret) {
             LogDebug("Removing sdcard directory");
             Try {
                 WidgetInstallToExtSingleton::Instance().initialize(m_context.tzPkgid);
@@ -88,10 +88,12 @@ void TaskRemoveFiles::StepRemoveInstallationDirectory()
                 Throw(Jobs::WidgetUninstall::TaskRemoveFiles::Exception::
                         RemoveFilesFailed);
             }
+        } else {
+            LogError("app is not installed");
+            ThrowMsg(Exceptions::WidgetNotExist, "failed to get app location");
         }
     } Catch(Exception::RemoveFilesFailed) {
         ThrowMsg(Exceptions::RemoveFileFailure, "Cann't remove directory");
-
     }
     m_context.job->UpdateProgress(
         UninstallerContext::UNINSTALL_REMOVE_WIDGETDIR,