diff options
author | Dongeup Ham <dongeup.ham@samsung.com> | 2012-11-05 10:26:03 +0900 |
---|---|---|
committer | Dongeup Ham <dongeup.ham@samsung.com> | 2012-11-05 10:26:03 +0900 |
commit | b3a15131cb80364229ede77333775da1e6a26bd4 (patch) | |
tree | 7c07daf818c10d4619ff3eb9f565cdfa4fe8f59b /src/Manager | |
parent | e6d819a0b8c20f6883d23397eac9bfae53305844 (diff) | |
download | installer-b3a15131cb80364229ede77333775da1e6a26bd4.tar.gz installer-b3a15131cb80364229ede77333775da1e6a26bd4.tar.bz2 installer-b3a15131cb80364229ede77333775da1e6a26bd4.zip |
Installer Logs are modified.
Change-Id: Ifc2d2863e495ec626dc3799f551135dcf2cf7713
Diffstat (limited to 'src/Manager')
-rwxr-xr-x | src/Manager/InstallerManager.cpp | 201 | ||||
-rwxr-xr-x | src/Manager/InstallerManager.h | 18 | ||||
-rwxr-xr-x | src/Manager/SignatureManager.cpp | 6 |
3 files changed, 135 insertions, 90 deletions
diff --git a/src/Manager/InstallerManager.cpp b/src/Manager/InstallerManager.cpp index f386efe..7c682c8 100755 --- a/src/Manager/InstallerManager.cpp +++ b/src/Manager/InstallerManager.cpp @@ -43,8 +43,10 @@ const int BUFSIZE = 512; InstallerManager* InstallerManager::__pInstallerManager = null; InstallerManager::InstallerManager(void) -: __pContext(null) -, __pInstaller(null) +:__pContext(null) +,__pInstaller(null) +,__errorType(0) +,__operation(INSTALLER_OPERATION_INSTALL) { } @@ -312,32 +314,36 @@ InstallerManager::GetContext(void) } int -InstallerManager::Request(const String& path, InstallerOperation operation, RequesterType requesterType, String& appid, int& errorType, bool hybridService) +InstallerManager::Request(const String& path, InstallerOperation operation, RequesterType requesterType, bool hybridService) { InstallationContext* pContext = null; - InstallerError error = INSTALLER_ERROR_NONE; + InstallerError errorType = INSTALLER_ERROR_NONE; InstallerManager* pInstallManager = null; + String appId; AppLogTag(OSP_INSTALLER, "------------------------------------------"); AppLogTag(OSP_INSTALLER, "InstallerManager::Request"); AppLogTag(OSP_INSTALLER, "------------------------------------------"); - AppLogTag(OSP_INSTALLER, "# operation = [%s]", (operation == INSTALLER_OPERATION_INSTALL) ? "Install":"Uninstall"); - AppLogTag(OSP_INSTALLER, "# path = [%ls]", path.GetPointer()); + AppLogTag(OSP_INSTALLER, " # operation = [%s]", (operation == INSTALLER_OPERATION_INSTALL)?"Installation":"Uninstallation"); + AppLogTag(OSP_INSTALLER, " # path = [%ls]", path.GetPointer()); AppLogTag(OSP_INSTALLER, "------------------------------------------"); + SetInstallerOperation(operation); + pInstallManager = InstallerManager::GetInstance(); - TryCatch(pInstallManager, error = INSTALLER_ERROR_INTERNAL_STATE, "[osp-installer] pInstallManager is null."); + TryCatch(pInstallManager, errorType = INSTALLER_ERROR_INTERNAL_STATE, "[osp-installer] pInstallManager is null."); - error = pInstallManager->Construct(path, operation, requesterType, hybridService); - TryCatch(error == INSTALLER_ERROR_NONE, , "[osp-installer] pInstallManager->Construct() failed."); + errorType = pInstallManager->Construct(path, operation, requesterType, hybridService); + TryCatch(errorType == INSTALLER_ERROR_NONE, , "[osp-installer] pInstallManager->Construct() failed."); - error = pInstallManager->Activate(); - TryCatch(error == INSTALLER_ERROR_NONE, , "[osp-installer] pInstallManager->Activate() failed."); + errorType = pInstallManager->Activate(); + TryCatch(errorType == INSTALLER_ERROR_NONE, , "[osp-installer] pInstallManager->Activate() failed."); pContext = pInstallManager->GetContext(); - TryCatch(pContext, error = INSTALLER_ERROR_INTERNAL_STATE, "[osp-installer] pContext is null."); + TryCatch(pContext, errorType = INSTALLER_ERROR_INTERNAL_STATE, "[osp-installer] pContext is null."); - appid = pContext->GetAppId(); + appId = pContext->GetAppId(); + SetAppId(appId); CATCH: if (File::IsFileExist(DIR_OSP_APPLICATIONS_TEMP) == true) @@ -345,18 +351,13 @@ CATCH: InstallerUtil::Remove(DIR_OSP_APPLICATIONS_TEMP); } - if (pInstallManager) - { - pInstallManager->Release(); - } - - if (error != INSTALLER_ERROR_NONE) + if (errorType != INSTALLER_ERROR_NONE) { - fprintf(stderr, " ErrorType [%d]\n", error); + fprintf(stderr, " ErrorType [%d]\n", errorType); } - errorType = error; - return error; + SetErrorType(errorType); + return errorType; } int @@ -368,6 +369,9 @@ InstallerManager::RequestRecursiveDirectory(const Osp::Base::String& path, int& int res = false; String appid; InstallerError error = INSTALLER_ERROR_NONE; + int totalCount = 0; + int successCount = 0; + int failureCount = 0; pDir = new Directory; // Allocate %Directory instance TryCatch(pDir, res = false, "[osp-installer] pDir is null"); @@ -427,37 +431,38 @@ InstallerManager::RequestRecursiveDirectory(const Osp::Base::String& path, int& continue; } - fprintf(stderr, "---------------------------------------------------\n"); - AppLogTag(OSP_INSTALLER, "---------------------------------------------------"); + totalCount++; + + fprintf(stderr, "------------------------------------------\n"); + AppLogTag(OSP_INSTALLER, "------------------------------------------"); fprintf(stderr, " # directory = [%ls]\n", entryDir.GetPointer()); AppLogTag(OSP_INSTALLER, " # directory = [%ls]", entryDir.GetPointer()); - Request(entryDir, INSTALLER_OPERATION_INSTALL, REQUESTER_TYPE_PRELOADED, appid, errorType); - - fprintf(stderr, " # appid = [%ls], error = [%d]\n", appid.GetPointer(), errorType); - AppLogTag(OSP_INSTALLER, " # appid = [%ls], error = [%d]", appid.GetPointer(), errorType); - - if (errorType != 0) + errorType = Request(entryDir, INSTALLER_OPERATION_INSTALL, REQUESTER_TYPE_PRELOADED); + if (errorType == 0) { - fprintf(stderr, " # result = [installation][failure <------------------------]\n"); - AppLogTag(OSP_INSTALLER, " # result = [installation][failure <------------------------]"); + successCount++; } else { - fprintf(stderr, " # result = [installation][success]\n"); - AppLogTag(OSP_INSTALLER, " # result = [installation][success]"); + failureCount++; } - fprintf(stderr, "---------------------------------------------------\n"); - AppLogTag(OSP_INSTALLER, "---------------------------------------------------"); + PrintResult(); + + fprintf(stderr, "------------------------------------------\n"); + AppLogTag(OSP_INSTALLER, "------------------------------------------"); } - delete pDir; - pDir = null; - return error; + fprintf(stderr, "------------------------------------------\n"); + fprintf(stderr, "recursive directory installation\n"); + fprintf(stderr, " # totalCount = [%d]\n", totalCount); + fprintf(stderr, " # successCount = [%d]\n", successCount); + fprintf(stderr, " # failureCount = [%d]\n", failureCount); CATCH: + delete pDirEnum; delete pDir; return error; } @@ -467,15 +472,11 @@ InstallerManager::RequestByCommand(int argc, char **argv) { int mode = 0; char buf[BUFSIZE] = {0}; - String appId; - int errorType = -1; - int result = 0; + // String appId; + int errorType = 0; bool output = false; bool hybridService = false; - fprintf(stderr, "%s\n", OSP_INSTALLER_VERSION); - AppLogTag(OSP_INSTALLER, "%s", OSP_INSTALLER_VERSION); - fprintf(stderr, " # argc = [%d]\n", argc); AppLogTag(OSP_INSTALLER, " # argc = [%d]", argc); @@ -497,61 +498,39 @@ InstallerManager::RequestByCommand(int argc, char **argv) { case INSTALLER_MODE_INSTALL: { - fprintf(stderr, "---------------------------------------------------\n"); - AppLogTag(OSP_INSTALLER, "---------------------------------------------------"); + fprintf(stderr, "------------------------------------------\n"); + AppLogTag(OSP_INSTALLER, "------------------------------------------"); fprintf(stderr, " # directory = [%s]\n", buf); AppLogTag(OSP_INSTALLER, " # directory = [%s]", buf); - result = InstallerManager::Request(buf, INSTALLER_OPERATION_INSTALL, REQUESTER_TYPE_NORMAL, appId, errorType, hybridService); - - fprintf(stderr, " # appId = [%ls], error = [%d]\n", appId.GetPointer(), errorType); - AppLogTag(OSP_INSTALLER, " # appId = [%ls], error = [%d]", appId.GetPointer(), errorType); - + errorType = Request(buf, INSTALLER_OPERATION_INSTALL, REQUESTER_TYPE_NORMAL, hybridService); if (errorType != 0) { - RemoveGarbage(buf); - fprintf(stderr, " # result = [Installation][failure]\n"); - AppLogTag(OSP_INSTALLER, " # result = [Installation][failure]"); - } - else - { - fprintf(stderr, " # result = [Installation][success]\n"); - AppLogTag(OSP_INSTALLER, " # result = [Installation][success]"); + // in case of command, garbage directory is not deleted. + // RemoveGarbage(buf); } + PrintResult(); } break; case INSTALLER_MODE_UNINSTALL: { - fprintf(stderr, "---------------------------------------------------\n"); - AppLogTag(OSP_INSTALLER, "---------------------------------------------------"); + fprintf(stderr, "------------------------------------------\n"); + AppLogTag(OSP_INSTALLER, "------------------------------------------"); fprintf(stderr, " # directory = [%s]\n", buf); AppLogTag(OSP_INSTALLER, " # directory = [%s]", buf); - result = Request(buf, INSTALLER_OPERATION_UNINSTALL, REQUESTER_TYPE_NORMAL, appId, errorType, hybridService); - - fprintf(stderr, " # appId = [%ls], error = [%d]\n", appId.GetPointer(), errorType); - AppLogTag(OSP_INSTALLER, " # appId = [%ls], error = [%d]", appId.GetPointer(), errorType); - - if (errorType != 0) - { - fprintf(stderr, " # result = [Uninstallation][failure]\n"); - AppLogTag(OSP_INSTALLER, " # result = [Uninstallation][failure]"); - } - else - { - fprintf(stderr, " # result = [Uninstallation][success]\n"); - AppLogTag(OSP_INSTALLER, " # result = [Uninstallation][success]"); - } + errorType = Request(buf, INSTALLER_OPERATION_UNINSTALL, REQUESTER_TYPE_NORMAL, hybridService); + PrintResult(); } break; case INSTALLER_MODE_RECURSIVE_DIRECTORY_INSTALL: { - fprintf(stderr, "---------------------------------------------------\n"); - AppLogTag(OSP_INSTALLER, "---------------------------------------------------"); + fprintf(stderr, "------------------------------------------\n"); + AppLogTag(OSP_INSTALLER, "------------------------------------------"); - result = RequestRecursiveDirectory(buf, errorType); + errorType = RequestRecursiveDirectory(buf, errorType); } break; @@ -562,8 +541,7 @@ InstallerManager::RequestByCommand(int argc, char **argv) break; } - fprintf(stderr, "---------------------------------------------------\n"); - AppLogTag(OSP_INSTALLER, "---------------------------------------------------"); + fprintf(stderr, "==========================================\n"); if (output == true) { @@ -725,11 +703,11 @@ InstallerManager::ReqeustByTest(void) if (readBuf[0] == '+') { - errorType = Request(path, INSTALLER_OPERATION_INSTALL, REQUESTER_TYPE_NORMAL, appId, errorType); + errorType = Request(path, INSTALLER_OPERATION_INSTALL, REQUESTER_TYPE_NORMAL); } else if (readBuf[0] == '-') { - errorType = Request(path, INSTALLER_OPERATION_UNINSTALL, REQUESTER_TYPE_NORMAL, appId, errorType); + errorType = Request(path, INSTALLER_OPERATION_UNINSTALL, REQUESTER_TYPE_NORMAL); } else if (readBuf[0] == '*') { @@ -742,7 +720,7 @@ CATCH: } void -InstallerManager::DisplayPackageInfo(const char* appId) +InstallerManager::PrintPackageInfo(const char* appId) { _PackageInfoImpl* pPackageInfoImpl = null; ArrayList* pAppList = null; @@ -813,4 +791,57 @@ InstallerManager::DisplayPackageInfo(const char* appId) delete pPackageInfoImpl; } +void +InstallerManager::PrintResult(void) +{ + String appId = GetAppId(); + int errorType = GetErrorType(); + InstallerOperation operation = GetInstallerOperation(); + + AppLogTag(OSP_INSTALLER, "=========================================="); + AppLogTag(OSP_INSTALLER, "%s Result", (operation == INSTALLER_OPERATION_INSTALL)?"Installation":"Uninstallation"); + AppLogTag(OSP_INSTALLER, " # %s", OSP_INSTALLER_VERSION); + AppLogTag(OSP_INSTALLER, " # AppId = [%ls], errorType = [%d]", appId.GetPointer(), errorType); + AppLogTag(OSP_INSTALLER, " # result = [%s]", (errorType == 0)?"Success":"Failure"); + AppLogTag(OSP_INSTALLER, "=========================================="); + + fprintf(stderr, " # AppId = [%ls], errorType = [%d]\n", appId.GetPointer(), errorType); + fprintf(stderr, " # operation = [%s]\n", (operation == INSTALLER_OPERATION_INSTALL)?"Installation":"Uninstallation"); + fprintf(stderr, " # result = [%s]\n", (errorType == 0)?"Success":"Failure"); +} + +const String& +InstallerManager::GetAppId(void) const +{ + return __appId; +} + +void +InstallerManager::SetAppId(const String& appId) +{ + __appId = appId; +} + +int +InstallerManager::GetErrorType(void) const +{ + return __errorType; +} + +void +InstallerManager::SetErrorType(int errorType) +{ + __errorType = errorType; +} + +void +InstallerManager::SetInstallerOperation(InstallerOperation op) +{ + __operation = op; +} +InstallerOperation +InstallerManager::GetInstallerOperation(void) const +{ + return __operation; +} diff --git a/src/Manager/InstallerManager.h b/src/Manager/InstallerManager.h index 77eb604..f61dcef 100755 --- a/src/Manager/InstallerManager.h +++ b/src/Manager/InstallerManager.h @@ -44,7 +44,7 @@ public: static InstallerManager* GetInstance(void); void Release(void); - int Request(const Osp::Base::String& path, InstallerOperation op, RequesterType requesterType, Osp::Base::String& appid, int& errorType, bool hybridService = false); + int Request(const Osp::Base::String& path, InstallerOperation op, RequesterType requesterType, bool hybridService = false); int RequestRecursiveDirectory(const Osp::Base::String& path, int& errorType); bool RemoveGarbage(const char* pDirectory); @@ -52,7 +52,17 @@ public: int RequestByCommand(int argc, char **argv); int ReqeustByTest(void); - void DisplayPackageInfo(const char* appId); + void PrintPackageInfo(const char* appId); + void PrintResult(void); + + const Osp::Base::String& GetAppId(void) const; + void SetAppId(const Osp::Base::String& appId); + + int GetErrorType(void) const; + void SetErrorType(int errorType); + + void SetInstallerOperation(InstallerOperation op); + InstallerOperation GetInstallerOperation(void) const; private: InstallerManager(const InstallerManager& value); @@ -81,6 +91,10 @@ private: InstallationContext* __pContext; Installer* __pInstaller; + Osp::Base::String __appId; + int __errorType; + InstallerOperation __operation; + }; // InstallerManager #endif //_INSTALLER_MANAGER_H_ diff --git a/src/Manager/SignatureManager.cpp b/src/Manager/SignatureManager.cpp index 55a0fc2..f7b6f5c 100755 --- a/src/Manager/SignatureManager.cpp +++ b/src/Manager/SignatureManager.cpp @@ -180,7 +180,7 @@ SignatureManager::Validate(X509CertificatePath* pCertPath) { TryReturn(pCertPath, false, "[osp-installer] pCertPath is null."); - AppLogTag(OSP_INSTALLER, "------------------------------"); + AppLogTag(OSP_INSTALLER, "------------------------------------------"); AppLogTag(OSP_INSTALLER, "# signature.xml"); ValidationResult valResult = VALIDATION_SUCCESS; valResult = pCertPath->Validate(); @@ -189,7 +189,7 @@ SignatureManager::Validate(X509CertificatePath* pCertPath) { AppLogTag(OSP_INSTALLER, "Validate() fail! - ValidationResult = [%d]", valResult); - AppLogTag(OSP_INSTALLER, "------------------------------"); + AppLogTag(OSP_INSTALLER, "------------------------------------------"); return false; } else @@ -202,7 +202,7 @@ SignatureManager::Validate(X509CertificatePath* pCertPath) } AppLogTag(OSP_INSTALLER, "Validate() success!"); - AppLogTag(OSP_INSTALLER, "------------------------------"); + AppLogTag(OSP_INSTALLER, "------------------------------------------"); ICertificate *pTrustCa = null; pTrustCa = pCertPath->GetTrustAnchorN(); |