[Title] Not use Utils.execute_shell_return
authordonghyuk.yang <donghyuk.yang@samsung.com>
Fri, 7 Sep 2012 14:16:45 +0000 (23:16 +0900)
committerdonghyuk.yang <donghyuk.yang@samsung.com>
Fri, 7 Sep 2012 14:16:45 +0000 (23:16 +0900)
[Type]
[Module]
[Priority]
[Jira#]
[Redmine#]
[Problem]
[Cause]
[Solution]
[TestCase]

src/pkg_server/installer.rb

index 26440a6fde0a62533f952a62b044900060510c69..d9582b88fbda01d03c0ea1b3b9a6d4470aeb5488 100644 (file)
@@ -75,22 +75,30 @@ class FileInstaller
 
                 log = log + "## Extract file : #{package_file_path}\n"
                                result = extract_file(package_name, package_file_path, path, target_path, logger)
-                               if result == "" or result.nil? then     return false 
+                               if result == "" or result.nil? then     
+                                       write_log(target_path, package_name, log)
+                                       return false 
                                else log = log + result end
 
                 log = log + "## Move files : \"#{path}\" to \"#{target_path}\"\n"
                                result = move_dir(package_name, path, target_path, logger)
-                               if result.nil? then return false
+                               if result.nil? then 
+                                       write_log(target_path, package_name, log)
+                                       return false
                                else log = log + result end                                             
 
                 log = log + "## Execute install script\n"
                 result = execute_install_script(package_name, path, target_path, logger)
-                               if result.nil? then return false
+                               if result.nil? then
+                                       write_log(target_path, package_name, log)
+                                       return false
                                else log = log + result end                                             
                                                                                
                 log = log + "## Move remove script\n"
                 result = move_remove_script(package_name, path, target_path, logger)
-                               if result.nil? then return false
+                               if result.nil? then
+                                       write_log(target_path, package_name, log)
+                                       return false
                                else log = log + result end                                             
 
                 log = log + "## Remove temporary dir : #{path} #####\n"
@@ -105,7 +113,8 @@ class FileInstaller
                 logger.info "Removed #{path}"
                 raise Interrupt
             end
-
+                       write_log(target_path, package_name, log)
+=begin
             target_config_path = target_path + "/#{PACKAGE_INFO_DIR}/#{package_name}"
             if not File.exist? target_config_path then FileUtils.mkdir_p(target_config_path) end
             pkg_inst_log = "#{package_name}_inst.log"
@@ -114,7 +123,7 @@ class FileInstaller
             File.open(pkg_inst_log_path, "a+") do |f|
                 f.puts log
             end
-
+=end
         when "source" then
         end
 
@@ -122,7 +131,18 @@ class FileInstaller
                logger.info "Installed \"#{package_name}\" package.. OK"
                logger.info "  [path: #{target_path}]"
         return true;
-    end
+       end
+
+       def FileInstaller.write_log(target_path, package_name, log)
+               target_config_path = target_path + "/#{PACKAGE_INFO_DIR}/#{package_name}"
+               if not File.exist? target_config_path then FileUtils.mkdir_p(target_config_path) end
+               pkg_inst_log = "#{package_name}_inst.log"
+               pkg_inst_log_path = File.join(target_config_path, pkg_inst_log)
+
+               File.open(pkg_inst_log_path, "a+") do |f|
+                       f.puts log
+               end
+       end                     
 
     def FileInstaller.move_remove_script(package_name, path, target_path, logger)
         target_path = target_path + "/#{PACKAGE_INFO_DIR}/#{package_name}"
@@ -321,6 +341,7 @@ class FileInstaller
 
         show_file_list_command = nil
         extrach_file_list_command = nil
+               log = ""
 
         case ext
         when ".zip" then
@@ -355,14 +376,16 @@ class FileInstaller
             if Utils.is_windows_like_os( Utils::HOST_OS ) then
                 log = unzip_file(package_file_path, path)
             else
-                               result = Utils.execute_shell_return(extract_file_list_command)
-                               if result.nil? then log = nil 
-                               else log = result.join("") end                                                  
+                               #result = Utils.execute_shell_return(extract_file_list_command)
+                               #if result.nil? then log = nil 
+                               #else log = result.join("") end 
+                               log = `#{extract_file_list_command}`
             end
         when ".tar" then
-            result = Utils.execute_shell_return(extract_file_list_command)
-                       if result.nil? then log = nil
-                       else log = result.join("") end                                                  
+            #result = Utils.execute_shell_return(extract_file_list_command)
+                       #if result.nil? then log = nil
+                       #else log = result.join("") end                                                 
+                       log = `#{extract_file_list_command}`
                end
 
                if log == "" then log = nil end