From: jiil.hyoun Date: Tue, 4 Sep 2012 13:11:36 +0000 (+0900) Subject: [Title] add friend server query X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8208762c7c47df562bfc66541152158ea5285766;p=sdk%2Ftools%2Fsdk-build.git [Title] add friend server query [Type] Enhancement [Module] Toolchain / [Priority] Minor [Jira#] [Redmine#] 6794 [Problem] [Cause] [Solution] [TestCase] Change-Id: I45213ca9092fa1878d83113ab00f9a84fca55b34 --- diff --git a/build-cli b/build-cli index 5b439fc..129e73b 100755 --- a/build-cli +++ b/build-cli @@ -53,109 +53,80 @@ if not Utils.check_host_OS() then exit 1 end -def query_system_info(ip, port) - # HOST SYSTEM INFO - puts "* SYSTEM INFO *" +def query( ip, port, sym ) client = BuildCommClient.create( ip, port, nil, 0 ) - if not client.nil? then - client.send "QUERY|SYSTEM" - result0 = client.receive_data() - if result0.nil? then - client.terminate - exit 1 - end - result0 = result0[0].split(",").map { |x| x.strip } - puts "HOST-OS: #{result0[0]}" - puts "MAX_WORKING_JOBS: #{result0[1]}" - client.terminate - else + if client.nil? then puts "Connection to server failed!" - exit 1 + return nil end + client.send "QUERY|#{sym.strip}" + result = client.receive_data() + client.terminate + return result +end + +def query_system_info(ip, port) + # HOST SYSTEM INFO + puts "* SYSTEM INFO *" + data = query( ip, port, "SYSTEM") + if data.nil? then exit 1 end + + result = data[0].split(",").map { |x| x.strip } + puts "HOST-OS: #{result[0]}" + puts "MAX_WORKING_JOBS: #{result[1]}" # FTP INFO - puts "" - puts "* FTP *" - client = BuildCommClient.create( ip, port ) - if not client.nil? then - client.send "QUERY|FTP" - result0 = client.receive_data() - if result0.nil? then - client.terminate - exit 1 - end - result0 = result0[0].split(",").map { |x| x.strip } - puts "FTP_ADDR: #{result0[0]}" - puts "FTP_USERNAME: #{result0[1]}" - client.terminate - else - puts "Connection to server failed!" - exit 1 - end + puts "\n* FTP *" + data = query(ip, port, "FTP") + if data.nil? then exit 1 end + + result = data[0].split(",").map { |x| x.strip } + puts "FTP_ADDR: #{result[0]}" + puts "FTP_USERNAME: #{result[1]}" # SUPPORTED OS INFO - puts "" - puts "* SUPPORTED OS LIST *" - client = BuildCommClient.create( ip, port ) - if not client.nil? then - client.send "QUERY|OS" - result0 = client.receive_data() - if not result0.nil? then - result0.each do |item| - puts "#{item.strip}" - end - end - client.terminate - else - puts "Connection to server failed!" - exit 1 + puts "\n* SUPPORTED OS LIST *" + data = query(ip, port, "OS") + if data.nil? then exit 1 end + + data.each do |item| + puts "#{item.strip}" + end + + # Friend lists + puts "\n* FRIEND SERVER LIST (WAIT|WORK/MAX) jobs [transfer count] *" + data = query(ip, port, "FRIEND") + if data.nil? then exit 1 end + i = 0 + data.each do |item| + i = i + 1 + info = item.split(",").map { |x| x.strip } + puts "#{i}. #{info[0]} server (#{info[1]}|#{info[2]}/#{info[3]}) [#{info[4]}]" end end def query_project_list(ip, port) puts "* PROJECT(S) *" - client = BuildCommClient.create( ip, port, nil, 0 ) - if not client.nil? then - client.send "QUERY|PROJECT" - result1 = client.receive_data() - if result1.nil? then - client.terminate - exit 1 - end - result1.each do |item| - tok = item.split(",").map { |x| x.strip } - type = (tok[0]=="G" ? "NORMAL":"REMOTE") - printf("%-25s %s\n",tok[1],type) - end - else - puts "Connection to server failed!" - exit 1 + data = query( ip, port, "PROJECT") + data.each do |item| + tok = item.split(",").map { |x| x.strip } + type = (tok[0]=="G" ? "NORMAL":"REMOTE") + printf("%-25s %s\n",tok[1],type) end end def query_job_list(ip, port) puts "* JOB(S) *" - client = BuildCommClient.create( ip, port, nil, 0 ) - if not client.nil? then - client.send "QUERY|JOB" - result1 = client.receive_data() - if result1.nil? then - client.terminate - exit 1 - end - result1.each do |item| - tok = item.split(",").map { |x| x.strip } - if tok[3].nil? then - puts "#{tok[1]} #{tok[0]} #{tok[2]}" - else - puts "#{tok[1]} #{tok[0]} #{tok[2]} (#{tok[3]})" - end + data = query(ip, port, "JOB") + data.each do |item| + tok = item.split(",").map { |x| x.strip } + if tok[3].nil? then + puts "#{tok[1]} #{tok[0]} #{tok[2]}" + else + puts "#{tok[1]} #{tok[0]} #{tok[2]} (#{tok[3]})" end - else - puts "Connection to server failed!" - exit 1 end end diff --git a/package/pkginfo.manifest b/package/pkginfo.manifest index 87b9647..baca1cd 100644 --- a/package/pkginfo.manifest +++ b/package/pkginfo.manifest @@ -1,5 +1,5 @@ Source : dibs -Version :0.99.37 +Version :0.99.38 Maintainer : taejun ha, jiil hyoun , donghyuk yang , donghee yang , sungmin kim