change some returning error-codes 60/56660/2
authorjongmyeongko <jongmyeong.ko@samsung.com>
Mon, 11 Jan 2016 23:20:36 +0000 (08:20 +0900)
committerjongmyeongko <jongmyeong.ko@samsung.com>
Tue, 12 Jan 2016 05:20:05 +0000 (14:20 +0900)
Change-Id: If855478dc5aeb010173aca84b2d7b484ac40b517
Signed-off-by: jongmyeongko <jongmyeong.ko@samsung.com>
src/tpk/step/step_convert_xml.cc
src/tpk/step/step_parse.cc
src/tpk/step/step_parse_recovery.cc

index 11b670f..3ce735c 100644 (file)
@@ -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 "
index dc1ec2f..57083a0 100644 (file)
@@ -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_x*>(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())
index 839c054..f504f81 100644 (file)
@@ -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";