Update application update logic accepted/tizen_2.1/20130425.214611 submit/tizen_2.1/20130425.221858
authorDuyoung Jang <duyoung.jang@samsung.com>
Thu, 25 Apr 2013 07:23:30 +0000 (16:23 +0900)
committerDuyoung Jang <duyoung.jang@samsung.com>
Thu, 25 Apr 2013 07:23:30 +0000 (16:23 +0900)
Change-Id: I7023f34292fc7ff9ffe17c2e56c36dd4e53c39f5
Signed-off-by: Duyoung Jang <duyoung.jang@samsung.com>
inc/InstallerDefs.h
src/Manager/ConfigurationManager.cpp
src/Manager/SmackManager.cpp
src/Step/SystemCheckStep.cpp
src/Step/UninstallStep.cpp

index e43b981..e710368 100755 (executable)
@@ -23,7 +23,7 @@
 
 #include "InstallerUtil.h"
 
-#define OSP_INSTALLER_VERSION "version=[20130425.3]"
+#define OSP_INSTALLER_VERSION "version=[20130425.4]"
 
 #define DIR_BIN                                L"/bin"
 #define DIR_INFO                       L"/info"
index f5aca41..a50c995 100755 (executable)
@@ -227,13 +227,26 @@ ConfigurationManager::CreateFile(InstallationContext* pContext)
                }
        }
 
+       bool firstPreloadedUpdate = false;
+
+       String roXmlPath;
+       roXmlPath.Format(1024, DIR_RO_PACKAGE_SYSTEM_MANIFEST, pContext->__packageId.GetPointer());
+
+       String rwXmlPath;
+       rwXmlPath.Format(1024, DIR_RW_PACKAGE_SYSTEM_MANIFEST, pContext->__packageId.GetPointer());
+
        if (pContext->__isPreloaded == true)
        {
-               pContext->__coreXmlPath.Format(1024, DIR_RO_PACKAGE_SYSTEM_MANIFEST, pContext->__packageId.GetPointer());
+               pContext->__coreXmlPath = roXmlPath;
        }
        else
        {
-               pContext->__coreXmlPath.Format(1024, DIR_RW_PACKAGE_SYSTEM_MANIFEST, pContext->__packageId.GetPointer());
+               pContext->__coreXmlPath = rwXmlPath;
+               if ((File::IsFileExist(roXmlPath) == true) && (File::IsFileExist(rwXmlPath) == false))
+               {
+                       AppLog("First preloaded app update");
+                       firstPreloadedUpdate = true;
+               }
        }
 
        std::unique_ptr<char[]> pXmlPath(_StringConverter::CopyToCharArrayN(pContext->__coreXmlPath));
@@ -262,7 +275,18 @@ ConfigurationManager::CreateFile(InstallationContext* pContext)
        else
        {
                AppLog("pkgmgr_parser_parse_manifest_for_uninstallation() - START");
-               pkgmgr_parser_parse_manifest_for_uninstallation(pXmlPath.get(), null);
+               if (firstPreloadedUpdate == false)
+               {
+                       AppLog(" - uninstall path=[%s]", pXmlPath.get());
+                       pkgmgr_parser_parse_manifest_for_uninstallation(pXmlPath.get(), null);
+               }
+               else
+               {
+                       std::unique_ptr<char[]> pRoXmlPath(_StringConverter::CopyToCharArrayN(roXmlPath));
+                       AppLog(" - uninstall path=[%s]", pRoXmlPath.get());
+                       pkgmgr_parser_parse_manifest_for_uninstallation(pRoXmlPath.get(), null);
+               }
+
                AppLog("pkgmgr_parser_parse_manifest_for_uninstallation() - END");
                CreateCoreXmlFile(pContext);
        }
index a902ce0..db617ac 100755 (executable)
@@ -173,11 +173,15 @@ SmackManager::AddLabelSharedDir(const PackageId& packageId, const String& dirPat
 
        if (dirPath.Contains(L"shared/data") == true)
        {
+               label = L"*";
+
+#if 0
                if (__pContext->__isPreloaded == false)
                {
                        label.Append("_shareddata");
                        AddSharedDirReaders(label);
                }
+#endif
 
                return true;
        }
index 395a406..e7dc759 100755 (executable)
@@ -264,9 +264,9 @@ SystemCheckStep::ExtractVersion(const String& version, int& major, int& minor, i
 
        version.SubString(startIndex, macroStr);
 
-       Integer::Decode(majorStr, major);
-       Integer::Decode(minorStr, minor);
-       Integer::Decode(macroStr, macro);
+       Integer::Parse(majorStr, major);
+       Integer::Parse(minorStr, minor);
+       Integer::Parse(macroStr, macro);
 
        AppLog("version = [%ls] -> major = [%d], minor = [%d], macro = [%d]", version.GetPointer(), major, minor, macro);
 
index 6b98ff9..b5fb20b 100755 (executable)
@@ -137,20 +137,16 @@ UninstallStep::OnStateGetPackageInfo(void)
 //             __pContext->__additionalErrorString = L"Thrown when the application cannot be uninstalled because the application was preloaded.";
 //     }
 //     TryReturn(isUninstallable == true, INSTALLER_ERROR_PACKAGE_INVALID, "preload app cannot be uninstalled.");
-       String filePath = PATH_USR_APPS;
-       filePath += L"/";
-       filePath += __pContext->__packageId;
-       if (File::IsFileExist(filePath) == true)
+
+       String rwXmlPath;
+       rwXmlPath.Format(1024, DIR_RW_PACKAGE_SYSTEM_MANIFEST, packageId.GetPointer());
+       if (File::IsFileExist(rwXmlPath) == false)
        {
-               AppLog("This is a preload app=[%ls]", filePath.GetPointer());
+               AppLog("This is a preload app = [%ls]", rwXmlPath.GetPointer());
                __pContext->__isPreloaded = true;
        }
 
        __pContext->__rootPath = pPackageInfoImpl->GetAppRootPath();
-//     if (__pContext->__rootPath.StartsWith(PATH_USR_APPS, 0) == true)
-//     {
-//             __pContext->__isPreloaded = true;
-//     }
 
        if (__pContext->__isHybridService == true)
        {