From: hataejun Date: Mon, 11 Mar 2013 02:31:27 +0000 (+0900) Subject: [Title] dibs register print progress bar X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=06c4bcd9ccf523957f70ebf1e4d49ad093b2f2ce;p=sdk%2Ftools%2Fsdk-build.git [Title] dibs register print progress bar [Type] [Module] [Priority] [Jira#] [Redmine#] 8668 [Problem] [Cause] [Solution] [TestCase] Change-Id: I309ac24a5cba6a63b950d8aa933828cb06abe8c0 --- diff --git a/src/common/FileTransferViaDirect.rb b/src/common/FileTransferViaDirect.rb index d45f79e..744c6f6 100644 --- a/src/common/FileTransferViaDirect.rb +++ b/src/common/FileTransferViaDirect.rb @@ -59,6 +59,9 @@ class FileTransferDirect case cmd when "SEND_REQ" conn.puts "FILE_INFO,#{filename},#{size},#{checksum}" + + full_size = size + old_progress = 0 # read file contents # send via tcp/ip File.open(src_file, "rb") do |io| @@ -66,6 +69,12 @@ class FileTransferDirect buf = io.read(size > 1024*1024 ? 1024*1024 : size) conn.write( buf ) size -= buf.length + + progress = ((( full_size - size ) * 10 ) / full_size ) + if not progress.eql? old_progress then + @log.info "File transfer : #{progress}0 %" + old_progress = progress + end end end diff --git a/src/common/log.rb b/src/common/log.rb index 893885f..3ea5ef4 100644 --- a/src/common/log.rb +++ b/src/common/log.rb @@ -96,7 +96,6 @@ class Log @cnt = @cnt + 1 end - def close @second_out= nil end diff --git a/src/pkg_server/client.rb b/src/pkg_server/client.rb index 0a36176..bb94695 100644 --- a/src/pkg_server/client.rb +++ b/src/pkg_server/client.rb @@ -370,7 +370,7 @@ class Client raise RuntimeError, "Failed to create BuildCommClient instance.." end - @log.info "Send ready REQ.. [UPLOAD]" + @log.info "Send UPLOAD REQ.. [UPLOAD|#{dock}]" result = client2.send("UPLOAD|#{dock}") if not result then raise RuntimeError, "Failed to send ready REQ.." @@ -423,7 +423,7 @@ class Client client = BuildCommClient.create(ip, port, @log) if client.nil? then - puts "Can't access server #{ip}:#{port}" + @log.error "Can't access server #{ip}:#{port}" return nil end @@ -445,6 +445,7 @@ class Client client.read_lines do |line| if line.eql?("WAITFORUPLOAD") then # upload + @log.info "Get WAITFORUPLOAD message" thread = Thread.new do begin upload_request(ip, port, dock, transporter, binary_path_list)