From 26954f5857387d04c427ffa2f71e988d5e69d2f9 Mon Sep 17 00:00:00 2001 From: jongmyeongko Date: Tue, 12 Jan 2016 08:20:36 +0900 Subject: [PATCH] change some returning error-codes Change-Id: If855478dc5aeb010173aca84b2d7b484ac40b517 Signed-off-by: jongmyeongko --- src/tpk/step/step_convert_xml.cc | 10 +++++----- src/tpk/step/step_parse.cc | 16 ++++++++-------- src/tpk/step/step_parse_recovery.cc | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/tpk/step/step_convert_xml.cc b/src/tpk/step/step_convert_xml.cc index 11b670f..3ce735c 100644 --- a/src/tpk/step/step_convert_xml.cc +++ b/src/tpk/step/step_convert_xml.cc @@ -40,7 +40,7 @@ Step::Status StepConvertXml::precheck() { if (!bf::exists(xml_path)) { LOG(ERROR) << "Cannot find manifest file"; - return Step::Status::INVALID_VALUE; + return Step::Status::MANIFEST_NOT_FOUND; } xml_path_ = xml_path; @@ -82,18 +82,18 @@ Step::Status StepConvertXml::process() { xmlDocPtr doc = xmlParseFile(xml_path_.string().c_str()); if (!doc) { LOG(ERROR) << "Failed to parse xml file"; - return Step::Status::ERROR; + return Step::Status::MANIFEST_ERROR; } if (!ConvertXml(doc)) - return Step::Status::ERROR; + return Step::Status::MANIFEST_ERROR; bf::path new_path = bf::path(getUserManifestPath(context_->uid.get())) / bf::path(context_->pkgid.get()); new_path += ".xml"; if (xmlSaveFile(new_path.string().c_str(), doc) == -1) { LOG(ERROR) << "Failed to write xml file"; - return Step::Status::ERROR; + return Step::Status::MANIFEST_ERROR; } context_->xml_path.set(new_path.string()); @@ -101,7 +101,7 @@ Step::Status StepConvertXml::process() { if (pkgmgr_parser_check_manifest_validation( context_->xml_path.get().c_str()) != 0) { LOG(ERROR) << "Manifest is not valid"; - return Step::Status::ERROR; + return Step::Status::MANIFEST_ERROR; } LOG(DEBUG) << "Successfully create manifest xml " diff --git a/src/tpk/step/step_parse.cc b/src/tpk/step/step_parse.cc index dc1ec2f..57083a0 100644 --- a/src/tpk/step/step_parse.cc +++ b/src/tpk/step/step_parse.cc @@ -70,7 +70,7 @@ common_installer::Step::Status StepParse::precheck() { if (!boost::filesystem::exists(tmp)) { LOG(ERROR) << "manifest not found from the package"; - return common_installer::Step::Status::INVALID_VALUE; + return common_installer::Step::Status::MANIFEST_NOT_FOUND; } return common_installer::Step::Status::OK; @@ -78,7 +78,6 @@ common_installer::Step::Status StepParse::precheck() { // TODO(jungh.yeon) : this function should be re-considered bf::path StepParse::FindIcon(const std::string& filename) { - bf::path icon_path; bf::path app_path; @@ -96,13 +95,14 @@ bf::path StepParse::FindIcon(const std::string& filename) { if (access(icon_path.c_str(), F_OK) == 0) return icon_path; - icon_path = bf::path(getIconPath(context_->uid.get()) / bf::path("default/small") / filename); + icon_path = bf::path(getIconPath(context_->uid.get()) / + bf::path("default/small") / filename); if (access(icon_path.c_str(), F_OK) == 0) return icon_path; - if (context_->uid.get() == GLOBAL_USER) + if (context_->uid.get() == GLOBAL_USER) { app_path = tzplatform_getenv(TZ_SYS_RW_APP); - else { + } else { tzplatform_set_user(context_->uid.get()); app_path = tzplatform_getenv(TZ_USER_APP); tzplatform_reset_user(); @@ -661,12 +661,12 @@ bool StepParse::FillManifestX(manifest_x* manifest) { common_installer::Step::Status StepParse::process() { if (!LocateConfigFile()) { LOG(ERROR) << "No manifest file exists"; - return common_installer::Step::Status::ERROR; + return common_installer::Step::Status::MANIFEST_NOT_FOUND; } parser_.reset(new tpk::parse::TPKConfigParser()); if (!parser_->ParseManifest(path_)) { LOG(ERROR) << "[Parse] Parse failed. " << parser_->GetErrorMessage(); - return common_installer::Step::Status::ERROR; + return common_installer::Step::Status::PARSE_ERROR; } manifest_x* manifest = @@ -675,7 +675,7 @@ common_installer::Step::Status StepParse::process() { if (!FillManifestX(const_cast(manifest))) { LOG(ERROR) << "[Parse] Storing manifest_x failed. " << parser_->GetErrorMessage(); - return common_installer::Step::Status::ERROR; + return common_installer::Step::Status::PARSE_ERROR; } if (!context_->tep_path.get().empty()) diff --git a/src/tpk/step/step_parse_recovery.cc b/src/tpk/step/step_parse_recovery.cc index 839c054..f504f81 100644 --- a/src/tpk/step/step_parse_recovery.cc +++ b/src/tpk/step/step_parse_recovery.cc @@ -28,7 +28,7 @@ common_installer::Step::Status StepParseRecovery::process() { common_installer::Step::Status StepParseRecovery::precheck() { if (context_->root_application_path.get().empty()) { LOG(ERROR) << "Root path of packages in not set"; - return Status::ERROR; + return Status::INVALID_VALUE; } if (context_->pkgid.get().empty()) { LOG(WARNING) << "Pkgid is not set. Parsing skipped"; -- 2.7.4