From 7ddb6bbf42b773c8b44c60d2d17a52e262bceb4d Mon Sep 17 00:00:00 2001 From: donghee yang Date: Thu, 23 Jan 2014 11:40:04 +0900 Subject: [PATCH] Build-Sever:Fixed marshal error when file-transfer [Description] Change-Id: Ia6d0166a95d221db5e2c52ea9d5cf6eec645b7af Signed-off-by: donghee yang --- package/changelog | 3 ++ package/pkginfo.manifest | 2 +- src/build_server/RemoteBuilder.rb | 55 +++++++++++++++++-------------- src/build_server/receive_file.rb | 6 +++- src/build_server/send_file.rb | 6 +++- 5 files changed, 44 insertions(+), 28 deletions(-) diff --git a/package/changelog b/package/changelog index 75725d9..5221be2 100644 --- a/package/changelog +++ b/package/changelog @@ -1,3 +1,6 @@ +* 2.1.57 +- Fixed marshar error bug and some minor bugs +== donghee yang 2014-01-23 * 2.1.56 - add gen dependency graph tool in pkg-cli == hyoun jiil 2014-01-17 diff --git a/package/pkginfo.manifest b/package/pkginfo.manifest index 066bb83..c7d4c03 100644 --- a/package/pkginfo.manifest +++ b/package/pkginfo.manifest @@ -1,5 +1,5 @@ Source : dibs -Version :2.1.56 +Version :2.1.57 Maintainer : taejun ha, jiil hyoun , donghyuk yang , donghee yang , sungmin kim &1") do |io| - if @log.path.nil? then - io.each do |l| - if l.start_with?("=TRANSFER_END") then - break - else - puts l - end + proc1 = IO.popen("#{cmd} 2>&1"); + if @log.path.nil? then + while line = proc1.gets() + if line.start_with?("=TRANSFER_END") then + break + else + puts line end end - result = Marshal.load(io.read) end - return result + status = nil + begin + pid, status = Process.waitpid2( proc1.pid ) + rescue Errno::ECHILD + return false + end + + return ((not status.nil? and status.exitstatus == 0) ? true : false); end @@ -517,23 +521,24 @@ class RemoteBuilder cmd = "#{ruby_path} \"#{File.expand_path(File.dirname(__FILE__))}/receive_file.rb\" #{@addr} #{@port} #{dock} \"#{file_path}\" #{ftp_addr} #{ftp_port} #{ftp_username} #{ftp_passwd} \"#{@log.path}\"" end cmd = Utils.generate_shell_command( cmd ) - IO.popen("#{cmd} 2>&1") do |io| - if @log.path.nil? then - io.each do |l| - if l.start_with?("=TRANSFER_END") then - @log.info("transfered") - @log.info(l) - break - else - puts l - end + proc1 = IO.popen("#{cmd} 2>&1"); + if @log.path.nil? then + while line = proc1.gets() + if line.start_with?("=TRANSFER_END") then + break + else + puts line end end - ioread = io.read - @log.info("marshal load : [#{ioread}]") - result = Marshal.load(ioread) end - return result + status = nil + begin + pid, status = Process.waitpid2( proc1.pid ) + rescue Errno::ECHILD + return false + end + + return ((not status.nil? and status.exitstatus == 0) ? true : false); end end diff --git a/src/build_server/receive_file.rb b/src/build_server/receive_file.rb index 327c507..3063834 100755 --- a/src/build_server/receive_file.rb +++ b/src/build_server/receive_file.rb @@ -89,6 +89,10 @@ ensure puts "=TRANSFER_END" STDOUT.flush end - Marshal.dump(result, $stdout) + if result then + exit 0 + else + exit 1 + end end diff --git a/src/build_server/send_file.rb b/src/build_server/send_file.rb index 496164d..d3195ed 100755 --- a/src/build_server/send_file.rb +++ b/src/build_server/send_file.rb @@ -91,6 +91,10 @@ ensure puts "=TRANSFER_END" STDOUT.flush end - Marshal.dump(result, $stdout) + if result then + exit 0 + else + exit 1 + end end -- 2.34.1