Fix clean undo operation of tag plugin 28/308928/1
authorSangyoon Jang <jeremy.jang@samsung.com>
Wed, 3 Apr 2024 00:01:17 +0000 (09:01 +0900)
committerSangyoon Jang <jeremy.jang@samsung.com>
Wed, 3 Apr 2024 00:01:17 +0000 (09:01 +0900)
Pre/Post-clean/undo does not exist.

Change-Id: If40e883e418e4c37a6e4a7f605ad13f78995b69b
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
src/common/plugins/tag_plugin.cc

index 7a24833..3fca08f 100644 (file)
@@ -105,12 +105,14 @@ bool TagPlugin::Run(xmlDocPtr doc_ptr, manifest_x* manifest,
        action_type != ActionType::Undo &&
        action_type != ActionType::Clean) ? action_type_ : action_type;
   std::string pre_function = GetFunctionName(ProcessType::Pre, type);
-  Exec(pre_function, &result, manifest->package);
-  if (result) {
-    LOG(ERROR) << "Function: " << pre_function << " of plugin "
-               << plugin_info_.path() << " failed";
-    xmlFreeDoc(plugin_doc_ptr);
-    return false;
+  if (!pre_function.empty()) {
+    Exec(pre_function, &result, manifest->package);
+    if (result) {
+      LOG(ERROR) << "Function: " << pre_function << " of plugin "
+                 << plugin_info_.path() << " failed";
+      xmlFreeDoc(plugin_doc_ptr);
+      return false;
+    }
   }
 
   std::string main_function = GetFunctionName(ProcessType::Main, type);
@@ -123,12 +125,14 @@ bool TagPlugin::Run(xmlDocPtr doc_ptr, manifest_x* manifest,
   }
 
   std::string post_function = GetFunctionName(ProcessType::Post, type);
-  Exec(post_function, &result, manifest->package);
-  if (result) {
-    LOG(ERROR) << "Function: " << post_function << " of plugin "
-               << plugin_info_.path() << " failed";
-    xmlFreeDoc(plugin_doc_ptr);
-    return false;
+  if (!post_function.empty()) {
+    Exec(post_function, &result, manifest->package);
+    if (result) {
+      LOG(ERROR) << "Function: " << post_function << " of plugin "
+                 << plugin_info_.path() << " failed";
+      xmlFreeDoc(plugin_doc_ptr);
+      return false;
+    }
   }
 
   xmlFreeDoc(plugin_doc_ptr);