From: donghyuk.yang Date: Fri, 7 Sep 2012 14:16:45 +0000 (+0900) Subject: [Title] Not use Utils.execute_shell_return X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=44daa712fd41bcaa5b9dcc3a75d74dd6602766e4;p=sdk%2Ftools%2Fsdk-build.git [Title] Not use Utils.execute_shell_return [Type] [Module] [Priority] [Jira#] [Redmine#] [Problem] [Cause] [Solution] [TestCase] --- diff --git a/src/pkg_server/installer.rb b/src/pkg_server/installer.rb index 26440a6..d9582b8 100644 --- a/src/pkg_server/installer.rb +++ b/src/pkg_server/installer.rb @@ -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