From: donghee yang Date: Thu, 18 Oct 2012 01:19:14 +0000 (+0900) Subject: [Title] Fixed some bugs about "cancel" and loggin X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fc7a297fe14af73576be3747daee896b0195d790;p=sdk%2Ftools%2Fsdk-build.git [Title] Fixed some bugs about "cancel" and loggin --- diff --git a/build-cli b/build-cli index 4e4fa0d..cfb2da9 100755 --- a/build-cli +++ b/build-cli @@ -62,6 +62,9 @@ def query( ip, port, sym ) end client.send "QUERY|#{sym.strip}" result = client.receive_data() + if result.nil? then + puts "Error: #{client.get_error_msg()}" + end client.terminate return result end @@ -159,7 +162,10 @@ begin client = BuildCommClient.create( result[0], result[1], nil, 0 ) if not client.nil? then client.send "BUILD|GIT|#{option[:project]}|#{option[:passwd]}|#{option[:os]}|#{option[:async]}|#{option[:noreverse]}|#{option[:dist]}" - client.print_stream + if not client.print_stream then + puts "ERROR: #{client.get_error_msg()}" + end + client.terminate else puts "Connection to server failed!" @@ -176,7 +182,9 @@ begin client = BuildCommClient.create( result[0], result[1], nil, 0 ) if not client.nil? then client.send "RESOLVE|GIT|#{option[:project]}|#{option[:passwd]}|#{option[:os]}|#{option[:async]}|#{option[:dist]}" - client.print_stream + if not client.print_stream then + puts "ERROR: #{client.get_error_msg()}" + end client.terminate end when "query" @@ -239,10 +247,11 @@ begin client = BuildCommClient.create( result[0], result[1], nil, 0 ) if not client.nil? then client.send "CANCEL|#{option[:job]}|#{option[:passwd]}" - result1 = client.receive_data() + result1 = client.receive_data() if result1.nil? then + puts "Error: #{client.get_error_msg()}" client.terminate - exit(-1) + exit 1 end puts result1 else @@ -311,7 +320,9 @@ begin exit(-1) end client.send("REGISTER|BINARY|#{File.basename(option[:package])}|#{option[:passwd]}|#{dock}|#{option[:dist]}") - client.print_stream + if not client.print_stream then + puts "ERROR: #{client.get_error_msg()}" + end client.terminate else diff --git a/package/changelog b/package/changelog index 52dd1f7..8238a43 100644 --- a/package/changelog +++ b/package/changelog @@ -1,3 +1,7 @@ +* 1.2.8 +- Fixed "cancel" bug +- Changed to remain logss about communication errors +== hyoun jiil 2011-10-18 * 1.2.7 - Fixed a bug that reverse build choose wrong distribution project == hyoun jiil 2011-10-17 diff --git a/package/pkginfo.manifest b/package/pkginfo.manifest index c8411e4..f3adf10 100644 --- a/package/pkginfo.manifest +++ b/package/pkginfo.manifest @@ -1,5 +1,5 @@ Source : dibs -Version :1.2.7 +Version :1.2.8 Maintainer : taejun ha, jiil hyoun , donghyuk yang , donghee yang , sungmin kim e + @error_msg = e.message return false end @@ -416,32 +437,36 @@ class BuildCommClient begin # get first line l = nil - timeout(30) do + timeout(FIRST_REPONSE_TIMEOUT) do l = @socket.gets() end if l.nil? then + @error_msg = "Connection closed or No more message" return false end # check protocol if not protocol_matched? l.strip then + @error_msg = "Comm. Protocol version is mismatched! #{VERSION}" return false end # get contents + result = true while line = @socket.gets() if line.strip == "=END" then break end if line.strip == "=CHK" then next end - # print + # execute yield line.strip if block_given? end rescue Timeout::Error - puts "WARN: Connection timed out" + @error_msg = "Connection timed out!" return false + rescue => e - puts e.message + @error_msg = e.message return false end @@ -454,20 +479,22 @@ class BuildCommClient result = [] begin - l = @socket.gets() + l = nil + timeout(FIRST_REPONSE_TIMEOUT) do + l = @socket.gets() + end if l.nil? then - puts "Connection refused" + @error_msg = "Connection closed or No more message" return nil end # check protocol if not protocol_matched? l.strip then - puts "Comm. Protocol version is mismatched! #{VERSION}" + @error_msg = "Comm. Protocol version is mismatched! #{VERSION}" return nil end - # get contents while line = @socket.gets() if line.strip == "=END" then break end @@ -475,8 +502,13 @@ class BuildCommClient # print result.push line.strip end - rescue - puts "Connection closed" + + rescue Timeout::Error + @error_msg = "Connection timed out!" + return nil + + rescue => e + @error_msg = e.message return nil end @@ -485,6 +517,7 @@ class BuildCommClient def send_file(src_file, transporter ) + result = true begin l = @socket.gets() diff --git a/src/pkg_server/client.rb b/src/pkg_server/client.rb index e1755aa..6383651 100644 --- a/src/pkg_server/client.rb +++ b/src/pkg_server/client.rb @@ -402,22 +402,23 @@ class Client end @log.info "Send register message.. [REGISTER|#{dist}|DOCK|#{dock}|#{binary_list.join("|")}]" - snapshot = nil + snapshot = nil if client.send "REGISTER|#{dist}|DOCK|#{dock}|#{binary_list.join("|")}" then - output = client.read_lines do |l| - line = l.split("|") - if line[0].strip == "ERROR" then - @log.error l.strip + result = client.read_lines do |l| + line = l.split("|") + if line[0].strip == "ERROR" then + @log.error l.strip + break + elsif line[0].strip == "SUCC" then + snapshot = line[1].strip + end + end + + if not result or snapshot.nil? then + @log.error "Failed to register! #{client.get_error_msg()}" return nil - elsif line[0].strip == "SUCC" then - snapshot = line[1].strip end end - if not output then - @log.error "Failed to register" - return nil - end - end client.terminate snapshot = @server_addr + "/snapshots/" + snapshot diff --git a/src/pkg_server/packageServer.rb b/src/pkg_server/packageServer.rb index 2f25486..80910fa 100644 --- a/src/pkg_server/packageServer.rb +++ b/src/pkg_server/packageServer.rb @@ -508,10 +508,13 @@ class PackageServer client.send("STOP|#{passwd}") ret = client.receive_data - if ret[0].strip.eql? "SUCC" then + if not ret.nil? and ret[0].strip.eql? "SUCC" then @log.output( "Package server is stopped", Log::LV_USER) else - @log.output( "Package server return error message : #{ret}", Log::LV_USER) + @log.output( "Package server return error message! #{ret}", Log::LV_USER) + if not client.get_error_msg().empty? then + @log.output( "Error: #{client.get_error_msg()}", Log::LV_USER) + end end client.terminate diff --git a/test/build-server.basic1/build-cli-18.testcase b/test/build-server.basic1/build-cli-18.testcase index 6c8a769..32218a2 100644 --- a/test/build-server.basic1/build-cli-18.testcase +++ b/test/build-server.basic1/build-cli-18.testcase @@ -26,6 +26,6 @@ Info: Zipping... Info: Creating package file ... a_0.0.2_ubuntu-32.zip Info: Checking reverse build dependency ... Info: * Will check reverse-build for projects: testb(ubuntu-32) -Info: * Added new job for reverse-build ... testb(ubuntu-32) +Info: * Added new job for reverse-build ... testb(ubuntu-32) Info: * Reverse-build FAIL ... testb(ubuntu-32) Error: Job is stopped by ERROR diff --git a/upgrade b/upgrade index f47485f..cf09cd3 100755 --- a/upgrade +++ b/upgrade @@ -215,6 +215,14 @@ begin mismatched = true end end + if not result then + log.info("Upgrading failed! #{build_client.get_error_msg()}", Log::LV_USER) + elsif mismatched then + log.info("Upgrading failed! Password mismatched!", Log::LV_USER) + end + else + log.info("Upgrading failed! #{build_client.get_error_msg()}", Log::LV_USER) + next end # terminate