From 9047f6551c0553abe3172ebc0d26c14b5fa8acbf Mon Sep 17 00:00:00 2001 From: Duyoung Jang Date: Thu, 25 Apr 2013 16:23:30 +0900 Subject: [PATCH] Update application update logic Change-Id: I7023f34292fc7ff9ffe17c2e56c36dd4e53c39f5 Signed-off-by: Duyoung Jang --- inc/InstallerDefs.h | 2 +- src/Manager/ConfigurationManager.cpp | 30 +++++++++++++++++++++++++++--- src/Manager/SmackManager.cpp | 4 ++++ src/Step/SystemCheckStep.cpp | 6 +++--- src/Step/UninstallStep.cpp | 14 +++++--------- 5 files changed, 40 insertions(+), 16 deletions(-) diff --git a/inc/InstallerDefs.h b/inc/InstallerDefs.h index e43b981..e710368 100755 --- a/inc/InstallerDefs.h +++ b/inc/InstallerDefs.h @@ -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" diff --git a/src/Manager/ConfigurationManager.cpp b/src/Manager/ConfigurationManager.cpp index f5aca41..a50c995 100755 --- a/src/Manager/ConfigurationManager.cpp +++ b/src/Manager/ConfigurationManager.cpp @@ -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 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 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); } diff --git a/src/Manager/SmackManager.cpp b/src/Manager/SmackManager.cpp index a902ce0..db617ac 100755 --- a/src/Manager/SmackManager.cpp +++ b/src/Manager/SmackManager.cpp @@ -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; } diff --git a/src/Step/SystemCheckStep.cpp b/src/Step/SystemCheckStep.cpp index 395a406..e7dc759 100755 --- a/src/Step/SystemCheckStep.cpp +++ b/src/Step/SystemCheckStep.cpp @@ -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); diff --git a/src/Step/UninstallStep.cpp b/src/Step/UninstallStep.cpp index 6b98ff9..b5fb20b 100755 --- a/src/Step/UninstallStep.cpp +++ b/src/Step/UninstallStep.cpp @@ -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) { -- 2.7.4