[title] New log system, added "query-log" command, added log status
authordibs <dibs@samsung.com>
Tue, 26 Mar 2013 12:17:03 +0000 (21:17 +0900)
committerdibs <dibs@samsung.com>
Tue, 26 Mar 2013 12:17:03 +0000 (21:17 +0900)
24 files changed:
build-cli
dibs-web/app/controllers/admin_project_controller.rb
dibs-web/app/controllers/jobs_controller.rb
dibs-web/app/controllers/projects_controller.rb
dibs-web/app/controllers/utils.rb
dibs-web/app/models/project.rb
dibs-web/config/routes.rb
dibs-web/public/index.html
dibs-web/public/javascripts/admin-distribution-modify.js
dibs-web/public/javascripts/admin-project-add.js
dibs-web/public/javascripts/admin-project-modify.js
dibs-web/public/javascripts/admin-project.js
dibs-web/public/javascripts/admin-user.js
dibs-web/public/javascripts/build.js
dibs-web/public/javascripts/dibs-api.js
src/build_server/BuildClientOptionParser.rb
src/build_server/BuildJob.rb
src/build_server/BuildServer.rb
src/build_server/CommonJob.rb
src/build_server/JobLog.rb
src/build_server/RemoteBuilder.rb
src/build_server/SocketJobRequestListener.rb
src/common/BuildComm.rb
src/common/log.rb

index f700c3ab6ee342eb272a606f48e734f84fa5fbd5..686de05fbdaf17163d74f4e4e5e16a9a47d2b700 100755 (executable)
--- a/build-cli
+++ b/build-cli
@@ -44,7 +44,7 @@ begin
        option = option_parse
 rescue => e
        puts e.message
-       exit 0
+       exit 1
 end
 
 
@@ -168,25 +168,98 @@ end
 begin
        case option[:cmd]
        when "build"
-               result = Utils.parse_server_addr(option[:domain])
-               if result.nil? then
+               client = nil
+               result = false
+               job_id = nil
+               job_status = ""
+               job_error = ""
+
+               addr = Utils.parse_server_addr(option[:domain])
+               if addr.nil? then
                        puts "Server address is incorrect. (#{option[:domain]})"
                        puts "Tune as following format."
                        puts " <ip>:<port>"
                        exit 1
                end
-               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]}|#{option[:user]}|#{option[:verbose]}"
-                       if not client.print_stream then
-                               puts "ERROR: #{client.get_error_msg()}"
+
+               # Request build
+               begin
+                       client = BuildCommClient.create( addr[0], addr[1], nil, 0 )
+                       if client.nil? then
+                               puts "Connection to server failed!"
+                               exit 1
+                       end
+
+                       cmd = "BUILD|GIT|#{option[:project]}|#{option[:passwd]}|#{option[:os]}|#{option[:async]}|#{option[:noreverse]}|#{option[:dist]}|#{option[:user]}|#{option[:rebuild]}"
+
+                       client.send(cmd)
+
+                       result = client.read_lines do |line|
+                               if line.strip.start_with?("=JOB_START") then 
+                                       job_id = line.strip.split(",")[1]
+                                       next
+                               elsif line.strip.start_with?("=JOB_STATUS") then 
+                                       data = line.strip.split(",")
+                                       job_status = data[1]
+                                       job_error = data[2]
+                                       next
+                               end
+                               # print log 
+                               puts line
                        end
 
+                       if not result then
+                               puts "Error: Communication failed! #{client.get_error_msg()}"
+                       elsif job_id.nil? then
+                               puts job_error
+                               result = false
+                       end
                        client.terminate
-               else
-                       puts "Connection to server failed!"
+               rescue => e
+                       puts "ERROR: #{e}"
+                       client.terminate
+               end
+
+               # Query log in case sync
+               if result and option[:async].eql? "NO" then
+                       begin
+                               client = BuildCommClient.create( addr[0], addr[1], nil, 0 )
+                               if client.nil? then
+                                       puts "ERROR: Can't query log, Connection to server failed!"
+                                       exit 1
+                               end
+
+                               client.send "LOG|#{job_id}"
+                               result = client.read_lines do |line|
+                                       if line.strip.start_with?("=JOB_STATUS") then 
+                                               data = line.strip.split(",")
+                                               job_status = data[1]
+                                               job_error = data[2]
+                                               next
+                                       end
+                                       # print log 
+                                       puts line
+                               end
+
+                               if not result then
+                                       puts "ERROR: Can't query log, Communication failed! #{client.get_error_msg()}"
+                               end
+                               
+                               # Check job status
+                               if not job_status.eql? "FINISHED" then
+                                       result = false
+                               end
+                               client.terminate
+                       rescue => e
+                               puts "ERROR: #{e}"
+                               client.terminate
+                       end
+               end
+
+               if not result then
                        exit 1
                end
+
 #      when "resolve"
 #              result = Utils.parse_server_addr(option[:domain])
 #              if result.nil? then
@@ -252,24 +325,49 @@ begin
                query_job_list( result[0], result[1] )
 
        when "query-log"
-               result = Utils.parse_server_addr(option[:domain])
-               if result.nil? then
-                       puts "Server address is incorrect. (#{option[:domain]})"
-                       puts "Tune as following format."
-                       puts " <ip>:<port>"
+               output = option[:output]
+               if output.nil? then
+                       log = STDOUT
+               else
+                       if File.exist? output
+                               raise RuntimeError, "The output file is already exist."
+                       end
+                       log = File.open(output, "w")
+               end
+
+               addr = Utils.parse_server_addr(option[:domain])
+               if addr.nil? then
+                       log.puts "Server address is incorrect. (#{option[:domain]})"
+                       log.puts "Tune as following format."
+                       log.puts " <ip>:<port>"
                        exit 1
                end
 
-               client = BuildCommClient.create( result[0], result[1], nil, 0 )
+               client = BuildCommClient.create( addr[0], addr[1], nil, 0 )
                if client.nil? then
-                       puts "Connection to server failed!"
+                       log.puts "Connection to server failed!"
                        return nil
                end
+
                client.send "LOG|#{option[:job].strip}"
-               client.read_lines do |line|
+               result = client.read_lines do |line|
+                       if line.strip.start_with?("=JOB_STATUS") then 
+                               data = line.strip.split(",")
+                               job_status = data[1]
+                               job_error = data[2]
+                               next
+                       end
+                       # print log 
                        puts line
                end
-               client.terminate
+
+               if not result then
+                       log.puts "ERROR: Communication failed! #{client.get_error_msg()}"
+                       client.terminate
+                       exit 1
+               else
+                       client.terminate
+               end
 
        when "cancel"
                result = Utils.parse_server_addr(option[:domain])
index e125bc606dd9fd9bced13e554e85e5bab8dc4b91..7f7d5b4ec0c92cbd597fbebf27c2025519df23d1 100644 (file)
@@ -79,6 +79,7 @@ class AdminProjectController < ApplicationController
                                project_list = Project.find_by_sql("SELECT projects.id
                                                                                                             , projects.name 
                                                                                                             , projects.ptype
+                                                                                                            , projects.status
                                                                                                          FROM projects
                                                                                                                 , distributions
                                                                                                         WHERE distributions.name = \"#{dist_name}\"
@@ -89,6 +90,7 @@ class AdminProjectController < ApplicationController
                                        doc.Project {
                                                doc.ProjectName(project.name)
                                                doc.Type(project.ptype)
+                                               doc.ProjectStatus(project.status)
             
                                                os_list = ProjectOs.find_by_sql("SELECT supported_os.name AS name
                                                                                                                   FROM project_os
@@ -133,6 +135,7 @@ class AdminProjectController < ApplicationController
                project_type = change_item[:ProjectType].upcase
                project_dist_name = change_item[:Distribution]
                project_password = change_item[:ProjectPass]
+               project_status = change_item[:ProjectStatus].upcase
 
                if project_name.nil? or project_name.empty? then
                        errmsg = "Can't find [Name] information"
@@ -140,6 +143,12 @@ class AdminProjectController < ApplicationController
                        return
                end
 
+               if not project_status.eql? "OPEN" and not project_status.eql? "CLOSE"
+                       errmsg = "project status is invalid"
+                       render :json => { :error => errmsg }, :status => 406
+                       return
+               end
+
                distribution = Distribution.find(:first, :conditions => ["name = ?", project_dist_name])
                project = Project.find(:first, :conditions => ["name = ? and distribution_id = ? and ptype = ?", project_name, distribution.id, project_type])
 
@@ -158,6 +167,7 @@ class AdminProjectController < ApplicationController
                project = Project.new
                project.name = project_name
                project.ptype = project_type
+               project.status = project_status
                project.password = project_password
                project.distribution_id = distribution.id
                #TODO: set project user is admin. admin user id is '1'
@@ -247,6 +257,7 @@ class AdminProjectController < ApplicationController
                dist_name = change_item[:Distribution]
                old_project_name = change_item[:Name]
                project_type = change_item[:ProjectType].upcase
+               project_status = change_item[:ProjectStatus].upcase
 
                if old_project_name.nil? or old_project_name.empty? then
                        errmsg = "Can't find [#{old_project_name}] information"
@@ -260,10 +271,17 @@ class AdminProjectController < ApplicationController
                        return
                end
 
+               if not project_status.eql? "OPEN" and not project_status.eql? "CLOSE"
+                       errmsg = "project status is invalid"
+                       render :json => { :error => errmsg }, :status => 406
+                       return
+               end
+
                distribution = Distribution.find(:first, :conditions => ["name = ?", dist_name])
                project = Project.find(:first, :conditions => ["name = ? and distribution_id = ? and ptype = ?", old_project_name, distribution.id, project_type])
                project.name = change_item[:NewProjectName]
                project.password = change_item[:ProjectPass]
+               project.status = project_status
 
                # remove project os and reset project os
                ProjectOs.delete_all(["project_id = ?", project.id])
@@ -303,4 +321,24 @@ class AdminProjectController < ApplicationController
                project.save
                render :json => { :success => "OK!" }
        end
+
+       def changeAllProjectStatus
+               change_group_list = params[:ChangeInfoList]
+               change_item = change_group_list[0]
+               errmsg = ""
+               
+               dist_name = change_item[:Distribution]
+               projectStatus = change_item[:ProjectStatus]
+
+               if projectStatus.nil? or not (projectStatus.eql? "OPEN" or projectStatus.eql? "CLOSE") then
+                       errmsg = "project status must be OPEN or CLOSE"
+                       render :json => { :error => errmsg }, :status => 406
+                       return
+               end
+
+               distribution = Distribution.find(:first, :conditions => ["name = ?", dist_name])
+               Project.update_all("status=\"#{projectStatus}\"", :distribution_id => distribution.id)
+
+               render :json => { :success => "OK!" }
+       end
 end
index b4f379751845e0d1b4942ff2c96d066221101385..8cd911c61ebe1eccac740e2382ee22100e89bf78 100644 (file)
@@ -516,9 +516,6 @@ class JobsController < ApplicationController
        end
 
        def log_more
-               @cursor = nil
-               @file = nil
-       
                line_cnt = 999
                conti= 1
                id = params[:id]
@@ -538,46 +535,55 @@ class JobsController < ApplicationController
                end
 
                # Get log file infomation
-               file_name = "log"
-               buildsvr_path = Server_config.find(:first, :conditions => ["property = ?", "path"])
-               directory = "#{buildsvr_path.value}/jobs/#{id}"
-       
-               # create the file path                                                                         
-               path = File.join(directory, file_name)                                                              
-       
-               # read the file                                                                               
-               if File.exist?(path)
-                       @cursor = File.size(path)
-                       @file = File.open(path, 'r')
-                       data = @file.readlines
-               end
+               server_id = Server_config.find(:first, :conditions => ["property = \"id\""])
+               path = File.join(Utils::DIBS_WEB_CONFIG_PATH, server_id.value, "#{id}.log")
        
                time = Time.new
                timestamp = time.getlocal
        
-               start_line = line 
-               last_line = start_line + line_cnt
-       
-               #count line
-               tok = nil
-               IO.popen("wc -l #{path}") do |wc|
-                       tok = wc.read.split(" ")
-               end
-               end_line = tok[0].to_i
-       
-               #check line
-               if last_line > end_line
-                       last_line = end_line
-               end
+               #check file exist 
+               if not File.exist?(path) then
+                       #if file does not exist then execute query-log command
+                       Utils.sbi_query_log_command(id)
+                       conti = 1
+               else
+                       start_line = line 
+                       last_line = start_line + line_cnt
+           
+                       #count line
+                       tok = nil
+                       IO.popen("wc -l #{path}") do |wc|
+                               tok = wc.read.split(" ")
+                       end
+                       end_line = tok[0].to_i
+           
+                       #check line
+                       if last_line > end_line
+                               last_line = end_line
+                       end
        
-               #read log file
-               temp = nil
-               if start_line < end_line
-                       IO.popen("sed -n \"#{start_line},#{last_line}p\" #{path}") do |sed| 
-                               temp = sed.read
+                       #read log file
+                       log_contents = nil
+                       if start_line < end_line
+                               IO.popen("sed -n \"#{start_line},#{last_line}p\" #{path}") do |sed| 
+                                       log_contents = sed.read
+                               end
+                       else
+                               last_line_content = IO.readlines(path)[-1]
+                               puts "!!!!!!!!!!!!!!!!!!"
+                               puts path
+
+
+                               puts IO.readlines(path)
+                               puts "!!!!!!!!!!!!!!!!!!"
+                               if last_line_content.start_with?("=STATUS,") then 
+                                       if start_line = 1 then log_contents = [last_line_content] end
+                                       conti = 0
+                               elsif job.status.eql? "FINISHED" or job.status.eql? "CANCELED" or job.status.eql? "ERROR" then
+                                       if start_line = 1 then log_contents = [last_line_content] end
+                                       conti = 0
+                               end
                        end
-               else
-                       conti= 0
                end
        
                #generate to XML
@@ -592,8 +598,8 @@ class JobsController < ApplicationController
                                doc.Status(job.status)
                                doc.Time(timestamp)
                                doc.Continue(conti)
-                               if temp
-                                       temp.each do |data|
+                               if log_contents
+                                       log_contents.each do |data|
                                                doc.LogData(data, "Line" => line) 
                                                line = line + 1
                                        end
index 947b5e0973a4d196575aa9c53b71920e00967e74..21c5cc18e853988ea91d0d737757d758f08cdd61 100644 (file)
@@ -272,6 +272,7 @@ class ProjectsController < ApplicationController
                                                doc.supportedOs(os.name)
                                        end
                                end
+                               doc.DistributionStatus(distribution.status)
                        }
     
                        projects.each do |project|
@@ -280,6 +281,7 @@ class ProjectsController < ApplicationController
                                        if checkUserAccessProject(user_id, project.id)
                                                doc.BinaryProject {
                                                        doc.ProjectName(project.name)
+                                                       doc.ProjectStatus(project.status)
                                                        if not bin.nil? then
                                                                doc.PackageName(bin.pkg_name)
                                                        end
@@ -287,6 +289,7 @@ class ProjectsController < ApplicationController
                                        else
                                                doc.OtherBinaryProject {
                                                        doc.ProjectName(project.name)
+                                                       doc.ProjectStatus(project.status)
                                                        if not bin.nil? then
                                                                doc.PackageName(bin.pkg_name)
                                                        end
@@ -304,11 +307,13 @@ class ProjectsController < ApplicationController
                                        if checkUserAccessProject(user_id, project.id)
                                                doc.Project {
                                                        doc.ProjectName(project.name)
+                                                       doc.ProjectStatus(project.status)
                                                        doc.OsList(buildOsNameList.join(","))
                                                }
                                        else
                                                doc.OtherProject {
                                                        doc.ProjectName(project.name)
+                                                       doc.ProjectStatus(project.status)
                                                        doc.OsList(buildOsNameList.join(","))
                                                }
                                        end
index 92c9826b53230ccd1f6df482fa83643c77f0c4cd..0ed307a1dcc4c41febe4afb1260e50331ea51789 100644 (file)
@@ -28,13 +28,13 @@ Contributors:
 
 # constant
 BUILD_SERVER_ADDRESS = "127.0.0.1"
+DIBS_PATH = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__))))
 
 class Utils < ApplicationController
   def Utils.sbi_build_command(distribution, project_list, os_list, password_list, email)
-       dibs_path = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__))))
        dibs_config = Server_config.find(:first, :conditions => ["property = \"port\""])
        if dibs_config.nil?
-               raise RuntimeError, "Build sever not started"
+               raise RuntimeError, "Can't find server port information"
        else
                dibs_address = BUILD_SERVER_ADDRESS + ":" + dibs_config.value
        end
@@ -51,7 +51,7 @@ class Utils < ApplicationController
                options = options + " -U #{email} "
        end
 
-       cmd = "#{dibs_path}/build-cli build #{options}"
+       cmd = "#{DIBS_PATH}/build-cli build #{options}"
 puts "Build command"
 puts "[[[#{cmd}]]]"
 
@@ -59,10 +59,9 @@ puts "[[[#{cmd}]]]"
   end
 
   def Utils.sbi_register_command(distribution, file_path, password, email)
-       dibs_path = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__))))
        dibs_config = Server_config.find(:first, :conditions => ["property = \"port\""])
        if dibs_config.nil?
-               raise RuntimeError, "Build sever not started"
+               raise RuntimeError, "Can't find server port information"
        else
                dibs_address = BUILD_SERVER_ADDRESS + ":" + dibs_config.value
        end
@@ -75,17 +74,16 @@ puts "[[[#{cmd}]]]"
                options = options + " -U #{email} "
        end
 
-       cmd = "#{dibs_path}/build-cli register #{options}"
+       cmd = "#{DIBS_PATH}/build-cli register #{options}"
 puts "Register command"
 puts "[[[#{cmd}]]]"
        return execute_shell_return(cmd)
   end
 
   def Utils.sbi_cancel_command(job_id, password)
-       dibs_path = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__))))
        dibs_config = Server_config.find(:first, :conditions => ["property = \"port\""])
        if dibs_config.nil?
-               raise RuntimeError, "Build sever not started"
+               raise RuntimeError, "Can't find server port information"
        else
                dibs_address = BUILD_SERVER_ADDRESS + ":" + dibs_config.value
        end
@@ -100,23 +98,54 @@ puts "[[[#{cmd}]]]"
                options = options + " -w #{password}"
        end
 
-       cmd = "#{dibs_path}/build-cli cancel #{options}"
+       cmd = "#{DIBS_PATH}/build-cli cancel #{options}"
 puts "Cancel command"
 puts "[[[#{cmd}]]]"
        return execute_shell_return(cmd)
   end
 
   def Utils.sbi_fullbuild_command(server_name, dist_name)
-       dibs_path = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__))))
-
        options = "-n #{server_name} --dist #{dist_name} "
-       cmd = "#{dibs_path}/build-svr fullbuild #{options}"
+       cmd = "#{DIBS_PATH}/build-svr fullbuild #{options}"
        cmd = "which ruby"
 puts "Fullbuild command"
 puts "[[[#{cmd}]]]"
        return execute_shell_return(cmd)
   end
 
+  def Utils.sbi_query_log_command(job_id)
+       dibs_web_config_path = File.join(Utils::HOME,".build_tools","web_server")
+       dibs_config = Server_config.find(:first, :conditions => ["property = \"port\""])
+       if dibs_config.nil?
+               raise RuntimeError, "Can't find server port information"
+       else
+               dibs_address = BUILD_SERVER_ADDRESS + ":" + dibs_config.value
+       end
+
+       dibs_config = Server_config.find(:first, :conditions => ["property = \"id\""])
+       if dibs_config.nil?
+               raise RuntimeError, "Can't find build server id"
+       else
+               path = File.join(dibs_web_config_path, dibs_config.value, "#{job_id}.log")
+       end
+
+       if job_id.nil? or path.nil? then
+               raise RuntimeError, "Invalid query command id : #{job_id} path : #{path}"
+       end
+
+       options = "-d #{dibs_address} "
+       options = options + " -j #{job_id}"
+       options = options + " --output #{path}"
+
+       cmd = "#{DIBS_PATH}/build-cli query-log #{options}"
+
+       fork do
+               exec(cmd)
+       end
+
+       return path
+  end
+
   def Utils.execute_shell_return(cmd)
     result_lines = []
     ret = false
@@ -128,4 +157,13 @@ puts "[[[#{cmd}]]]"
        return true
   end
 
+       # set static variable in WORKING_DIR, HOME
+       if defined?(WORKING_DIR).nil? then WORKING_DIR = Dir.pwd end
+       if defined?(HOME).nil? then
+               # get home directory, using Dir.chdir
+               Dir.chdir
+               HOME = Dir.pwd
+               Dir.chdir WORKING_DIR
+       end
+       DIBS_WEB_CONFIG_PATH = File.join(HOME,".build_tools","web_server")
 end
index 1c9d56ef91ab2e00bca9ae116901393cdfe1f8f4..c393ab3aab92dada649348b01a44a1ead165c34b 100644 (file)
@@ -1,3 +1,3 @@
 class Project < ActiveRecord::Base
-   attr_accessible :id, :distribution_id, :name, :ptype, :password
+   attr_accessible :id, :distribution_id, :name, :ptype, :password, :status
 end
index b9b9e8dcd23c918e2ca7db0400d3f391b8a146f8..1e19b748d139456427c134fb278be7834c2e8f60 100644 (file)
@@ -58,7 +58,6 @@ Dibs::Application.routes.draw do
     get "jobs/list/date/:date/:distribution/:status/:lastID" => "jobs#listSearchDate", :constraints => { :distribution => /[0-9A-Za-z\-\.\_]+/ }
 
        match "jobs/update" => "jobs#updateList", :format => "json"
-       match "jobs/log/:id" => "jobs#log"
        match "jobs/log/:id/:line" => "jobs#log_more"
        match "jobs/cancel/:id" => "jobs#cancelJob"
 
@@ -107,6 +106,7 @@ Dibs::Application.routes.draw do
        post "admin_project/addProject" 
        post "admin_project/removeProject" 
        post "admin_project/modifyProject" 
+       post "admin_project/changeAllProjectStatus" 
 
        # admin distribution
        match "admin_distribution/queryDistributionInfo/:distribution" => "admin_distribution#queryDistributionInfo", :constraints => { :distribution => /[0-9A-Za-z\-\.\_]+/ } 
index 23771bb3b3cd8718e9f8ab5f5cadea4b8610f947..529363d7d33d827daebe4c34b57d605243e80d8d 100644 (file)
@@ -191,6 +191,7 @@ Contributors:
                                                </select>
                                        </div>
                                </div>
+                               <div id="build-distribution-lock"> </div>
                                <div data-role="collapsible" data-collapsed="false" style="width: auto;" >
                                        <h3>Git project</h3>
                                        <div align="right" style="font-size: 10px">
@@ -347,7 +348,7 @@ Contributors:
                        </form>
                </div>
                <div align="right" style="font-size: 10px">
-                       <a href=#adminUser onClick="adminUserModify()" data-role="button" data-inline="true" data-icon="gear">Save</a>
+                       <a href=#adminUser onClick="adminUserModify()" data-role="button" data-inline="true" data-mini="true" data-icon="gear">Save</a>
                </div>
        </div><!-- /page -->
 
@@ -363,7 +364,7 @@ Contributors:
                        <div class="content-primary">
                                <h2>Group information</h2>
                                <div align="right" style="font-size: 10px">
-                                       <a href="#adminGroupAdd" data-role="button" data-rel="dialog"  data-inline="true" data-icon="plus"> Add group </a>
+                                       <a href="#adminGroupAdd" data-role="button" data-rel="dialog"  data-inline="true" data-mini="ture" data-icon="plus"> Add group </a>
                                </div>
                                <div data-role="content" class="container">
                                        <table class="imagetable" style="font-size: 14px" id="adminGroup-contents">
@@ -390,7 +391,7 @@ Contributors:
                        <div class="content-primary">
                                <h2>Server information</h2>
                                <div align="right" style="font-size: 10px">
-                                       <a href="#adminServerAddServerInfo" data-role="button" data-rel="dialog" data-inline="true" data-icon="plus"> Add server config </a>
+                                       <a href="#adminServerAddServerInfo" data-role="button" data-rel="dialog" data-inline="true" data-mini="ture" data-icon="plus"> Add server config </a>
                                </div>
                                <div data-role="collapsible" data-theme="c" data-content-theme="d" data-collapsed="false">
                                        <h2> Server info </h2>
@@ -398,9 +399,9 @@ Contributors:
                                        </ul>
                                </div>  
                                <div align="right" style="font-size: 10px">
-                                       <a href="#adminServerAddSupportedOs" data-role="button" data-rel="dialog" data-inline="true" data-icon="plus"> Add supported os</a>
-                                       <a href="#adminServerAddOSCategory" data-role="button" data-rel="dialog" data-inline="true" data-icon="plus"> Add os category</a>
-                                       <a href="#adminServerRemoveOSCategory" data-role="button" data-rel="dialog" data-inline="true" data-icon="minus"> Remove os category</a>
+                                       <a href="#adminServerAddSupportedOs" data-role="button" data-rel="dialog" data-inline="true" data-mini="ture" data-icon="plus"> Add supported os</a>
+                                       <a href="#adminServerAddOSCategory" data-role="button" data-rel="dialog" data-inline="true" data-mini="ture" data-icon="plus"> Add os category</a>
+                                       <a href="#adminServerRemoveOSCategory" data-role="button" data-rel="dialog" data-inline="true" data-mini="ture" data-icon="minus"> Remove os category</a>
                                </div>
                                <div data-role="collapsible" data-theme="c" data-content-theme="d" data-collapsed="false">
                                        <h2> Supported OS </h2>
@@ -408,7 +409,7 @@ Contributors:
                                        </ul>
                                </div>  
                                <div align="right" style="font-size: 10px">
-                                       <a href="#adminServerAddRemoteBuildServer" data-role="button" data-rel="dialog" data-inline="true" data-icon="plus"> Add remote build server </a>
+                                       <a href="#adminServerAddRemoteBuildServer" data-role="button" data-rel="dialog" data-inline="true" data-mini="ture" data-icon="plus"> Add remote build server </a>
                                </div>  
                                <div data-role="collapsible" data-theme="c" data-content-theme="d" data-collapsed="false">
                                        <h2> Remote build server </h2>
@@ -441,11 +442,15 @@ Contributors:
                                        </div>
                                </div>
                                <div>
+                                       <div align="right" style="font-size: 10px">
+                                               <a href="#" data-role="button" data-inline="true" data-mini="true" onClick='adminProjectAllProjectStatusChange("OPEN")'>ALL project OPEN</a>
+                                               <a href="#" data-role="button" data-inline="true" data-mini="true" onClick='adminProjectAllProjectStatusChange("CLOSE")'>ALL project CLOSE</a>
+                                       </div>
                                        <div style="margin-left: 20px; margin-right: 20px; margin-top: 10px">
                                                <div data-role="collapsible" data-theme="b" data-content-theme="c" data-collapsed="false" > 
                                                        <h2> Git project </h2>
                                                        <div align="right" style="font-size: 10px">
-                                                               <a href="#adminProjectAddGit"  data-role="button" data-rel="dialog"  data-inline="true" data-icon="plus"> Add git project</a>
+                                                               <a href="#adminProjectAddGit"  data-role="button" data-rel="dialog" data-inline="true" data-mini="true" data-icon="plus"> Add git project</a>
                                                        </div>
                                                        <br> 
                                                        <table class="imagetable" id="adminProject-git" style="font-size: 14px">
@@ -455,7 +460,7 @@ Contributors:
                                                <div data-role="collapsible" data-theme="b" data-content-theme="c" data-collapsed="false" > 
                                                        <h2> Binary project </h2>
                                                        <div align="right" style="font-size: 10px">
-                                                               <a href="#adminProjectAddBinary"  data-role="button"data-rel="dialog"  data-inline="true" data-icon="plus"> Add binary project</a>
+                                                               <a href="#adminProjectAddBinary"  data-role="button"data-rel="dialog" data-inline="true" data-mini="true" data-icon="plus"> Add binary project</a>
                                                        </div>
                                                        <table class="imagetable" id="adminProject-binary" style="font-size: 14px">
                                                        </table>
@@ -488,7 +493,7 @@ Contributors:
                                                </select>
                                        </div>
                                        <div align="right" style="font-size: 10px">
-                                               <a href="javascript:adminDistributionFullBuild()" data-role="button" data-inline="true" data-icon="gear"> Full build</a>
+                                               <!-- <a href="javascript:adminDistributionFullBuild()" data-role="button" data-inline="true" data-mini="true" data-icon="gear"> Full build</a> -->
                                        </div>
                                        <div data-role="collapsible" data-theme="c" data-content-theme="d" data-collapsed="false" > 
                                                <h2> Package server url </h2>
@@ -513,9 +518,9 @@ Contributors:
                                        </div>  
                                        <br> 
                                        <div align="right" style="font-size: 10px">
-                                               <a href="#adminDistributionAdd" data-role="button" data-rel="dialog" data-inline="true" data-icon="plus"> Add distribution</a>
-                                               <a href="#adminDistributionModify" data-role="button" data-rel="dialog" data-inline="true" data-icon="gear"> Modify distribution</a>
-                                               <a href="javascript:adminDistributionRemove()" data-role="button" data-rel="dialog" data-inline="true" data-icon="minus"> Remove distribution</a>
+                                               <a href="#adminDistributionAdd" data-role="button" data-rel="dialog" data-inline="true" data-mini="true" data-icon="plus"> Add distribution</a>
+                                               <a href="#adminDistributionModify" data-role="button" data-rel="dialog" data-inline="true" data-mini="true" data-icon="gear"> Modify distribution</a>
+                                               <a href="javascript:adminDistributionRemove()" data-role="button" data-rel="dialog" data-inline="true" data-mini="true" data-icon="minus"> Remove distribution</a>
                                        </div>
                                </div>
                        </div><!--/content-primary -->
@@ -563,7 +568,7 @@ Contributors:
                        </form>
                </div>
                <div align="right" style="font-size: 10px">
-                       <a href=# onClick="adminDistributionAdd()" data-role="button" data-inline="true" data-icon="gear">Save</a>
+                       <a href=# onClick="adminDistributionAdd()" data-role="button" data-inline="true" data-mini="true" data-icon="gear">Save</a>
                </div>
        </div><!-- /page -->
        
@@ -620,6 +625,10 @@ Contributors:
                                <label for="adminProjectAddGit-branch"> Git Branch </label>
                                <input type="text" id="adminProjectAddGit-branch" name="branch" />
                                <br>
+                               <label for="adminProjectAddGit-status"> Project status </label>
+                               <select id="adminProjectAddGit-status" name="status" >
+                               </select>
+                               <br>
                                <div data-role="fieldcontain">
                                        <fieldset data-role="controlgroup" data-mini="true" id="adminProjectAddGit-os" name="os" >
                                        </fieldset>
@@ -628,7 +637,7 @@ Contributors:
                        </form>
                </div>
                <div align="right" style="font-size: 10px">
-                       <a href="#adminProject" onClick="adminProjectAddGitProject()" data-role="button" data-inline="true" data-icon="gear">Save</a>
+                       <a href="#adminProject" onClick="adminProjectAddGitProject()" data-role="button" data-inline="true" data-mini="true" data-icon="gear">Save</a>
                </div>
        </div><!-- /page -->
        
@@ -646,6 +655,11 @@ Contributors:
                                <br>
                                <label for="adminProjectAddBinary-packagename"> Pakcage name</label>
                                <input type="text" id="adminProjectAddBinary-packagename" name="name" />
+                               <br>
+                               <label for="adminProjectAddBinary-status"> Project status </label>
+                               <select id="adminProjectAddBinary-status" name="status" >
+                               </select>
+                               <br>
                                <div data-role="fieldcontain">
                                        <fieldset data-role="controlgroup" data-mini="true" id="adminProjectAddBinary-os" name="os" >
                                        </fieldset>
@@ -654,7 +668,7 @@ Contributors:
                        </form>
                </div>
                <div align="right" style="font-size: 10px">
-                       <a href="#" onClick="adminProjectAddBinaryProject()" data-role="button" data-inline="true" data-icon="gear">Save</a>
+                       <a href="#" onClick="adminProjectAddBinaryProject()" data-role="button" data-inline="true" data-mini="true" data-icon="gear">Save</a>
                </div>
        </div><!-- /page -->
        
@@ -672,6 +686,10 @@ Contributors:
                                <label for="adminProjectModifyBinary-password"> Project password</label>
                                <input type="text" id="adminProjectModifyBinary-password" name="name" />
                                <br>
+                               <label for="adminProjectModifyBinary-status"> Project status </label>
+                               <select id="adminProjectModifyBinary-status" name="status" >
+                               </select>
+                               <br>
                                <label for="adminProjectModifyBinary-packageName"> Pakcage name</label>
                                <input type="text" id="adminProjectModifyBinary-packageName" name="name" />
                                <div data-role="fieldcontain">
@@ -682,7 +700,7 @@ Contributors:
                        </form>
                </div>
                <div align="right" style="font-size: 10px">
-                       <a href="#" onClick="adminProjectModfyBinaryProject()" data-role="button" data-inline="true" data-icon="gear">Save</a>
+                       <a href="#" onClick="adminProjectModfyBinaryProject()" data-role="button" data-inline="true" data-mini="true" data-icon="gear">Save</a>
                </div>
        </div><!-- /page -->
 
@@ -700,6 +718,10 @@ Contributors:
                                <label for="adminProjectModifyGit-password"> Project password</label>
                                <input type="text" id="adminProjectModifyGit-password" name="password" />
                                <br>
+                               <label for="adminProjectModifyGit-status"> Project status </label>
+                               <select id="adminProjectModifyGit-status" name="status" >
+                               </select>
+                               <br>
                                <label for="adminProjectModifyGit-address"> Git address </label>
                                <input type="text" id="adminProjectModifyGit-address" name="address" />
                                <br>
@@ -714,7 +736,7 @@ Contributors:
                        </form>
                </div>
                <div align="right" style="font-size: 10px">
-                       <a href="#" onClick="adminProjectModfyGitProject()" data-role="button" data-inline="true" data-icon="gear">Save</a>
+                       <a href="#" onClick="adminProjectModfyGitProject()" data-role="button" data-inline="true" data-mini="true" data-icon="gear">Save</a>
                </div>
        </div><!-- /page -->
 
@@ -747,7 +769,7 @@ Contributors:
                        </form>
                </div>
                <div align="right" style="font-size: 10px">
-                       <a href=# onClick="adminGroupAddGroup()" data-role="button" data-inline="true" data-icon="gear">Save</a>
+                       <a href=# onClick="adminGroupAddGroup()" data-role="button" data-inline="true" data-mini="true" data-icon="gear">Save</a>
                </div>
        </div><!-- /page -->
        
@@ -780,7 +802,7 @@ Contributors:
                        </form>
                </div>
                <div align="right" style="font-size: 10px">
-                       <a href="#" onClick="adminGroupModifyGroup()" data-role="button" data-inline="true" data-icon="gear">Save</a>
+                       <a href="#" onClick="adminGroupModifyGroup()" data-role="button" data-inline="true" data-mini="true" data-icon="gear">Save</a>
                </div>
        </div><!-- /page -->
        
@@ -798,7 +820,7 @@ Contributors:
                        </form>
                </div>
                <div align="right" style="font-size: 10px">
-                       <a href=# onClick="adminServerAddRemoteBuildServer()" data-role="button" data-inline="true" data-icon="gear">Save</a>
+                       <a href=# onClick="adminServerAddRemoteBuildServer()" data-role="button" data-inline="true" data-mini="true" data-icon="gear">Save</a>
                </div>
        </div><!-- /page -->
        
@@ -817,8 +839,8 @@ Contributors:
                        </form>
                </div>
                <div align="right" style="font-size: 10px">
-                       <a href=# onClick="adminServerModifyRemoteBuildServer()" data-role="button" data-inline="true" data-icon="gear">Save</a>
-                       <a href=# onClick="adminServerRemoveRemoteBuildServer()" data-role="button" data-inline="true" data-icon="minus">Delete</a>
+                       <a href=# onClick="adminServerModifyRemoteBuildServer()" data-role="button" data-inline="true" data-mini="true" data-icon="gear">Save</a>
+                       <a href=# onClick="adminServerRemoveRemoteBuildServer()" data-role="button" data-inline="true" data-mini="true" data-icon="minus">Delete</a>
                </div>
        </div><!-- /page -->
 
@@ -842,7 +864,7 @@ Contributors:
                        </form>
                </div>
                <div align="right" style="font-size: 10px">
-                       <a href="#" onClick="userModifyUserInfo()" data-role="button" data-inline="true" data-icon="gear">Save</a>
+                       <a href="#" onClick="userModifyUserInfo()" data-role="button" data-inline="true" data-mini="true" data-icon="gear">Save</a>
                </div>
        </div><!-- /page -->
        
@@ -864,7 +886,7 @@ Contributors:
                        </form>
                </div>
                <div align="right" style="font-size: 10px">
-                       <a href="#" onClick="adminServerAddSupportedOs()" data-role="button" data-inline="true" data-icon="gear">Save</a>
+                       <a href="#" onClick="adminServerAddSupportedOs()" data-role="button" data-inline="true" data-mini="true" data-icon="gear">Save</a>
                </div>
        </div><!-- /page -->
 
@@ -887,8 +909,8 @@ Contributors:
                        </form>
                </div>
                <div align="right" style="font-size: 10px">
-                       <a href="#" onClick="adminServerRemoveSupportedOS()" data-role="button" data-inline="true" data-icon="minus">Remove</a>
-                       <a href="#" onClick="adminServerModifySupportedOS()" data-role="button" data-inline="true" data-icon="gear">Save</a>
+                       <a href="#" onClick="adminServerRemoveSupportedOS()" data-role="button" data-inline="true" data-mini="true" data-icon="minus">Remove</a>
+                       <a href="#" onClick="adminServerModifySupportedOS()" data-role="button" data-inline="true" data-mini="true" data-icon="gear">Save</a>
                </div>
        </div><!-- /page -->
 
@@ -903,7 +925,7 @@ Contributors:
                        </form>
                </div>
                <div align="right" style="font-size: 10px">
-                       <a href="#" onClick="adminServerAddOSCategory()" data-role="button" data-inline="true" data-icon="gear">Save</a>
+                       <a href="#" onClick="adminServerAddOSCategory()" data-role="button" data-inline="true" data-mini="true" data-icon="gear">Save</a>
                </div>
        </div><!-- /page -->
 
@@ -922,7 +944,7 @@ Contributors:
                        </form>
                </div>
                <div align="right" style="font-size: 10px">
-                       <a href="#" onClick="adminServerRemoveOSCategory()" data-role="button" data-inline="true" data-icon="minus">Delete</a>
+                       <a href="#" onClick="adminServerRemoveOSCategory()" data-role="button" data-inline="true" data-mini="true" data-icon="minus">Delete</a>
                </div>
        </div><!-- /page -->
 
@@ -939,7 +961,7 @@ Contributors:
                        </form>
                </div>
                <div align="right" style="font-size: 10px">
-                       <a href=# onClick="adminServerAddServerInfo()" data-role="button" data-inline="true" data-icon="gear">Save</a>
+                       <a href=# onClick="adminServerAddServerInfo()" data-role="button" data-inline="true" data-mini="true" data-icon="gear">Save</a>
                </div>
        </div><!-- /page -->
 
@@ -956,8 +978,8 @@ Contributors:
                        </form>
                </div>
                <div align="right" style="font-size: 10px">
-                       <a href=# onClick="adminServerModifyServerInfo()" data-role="button" data-inline="true" data-icon="gear">Save</a>
-                       <a href=# onClick="adminServerRemoveServerInfo()" data-role="button" data-inline="true" data-icon="minus">Delete</a>
+                       <a href=# onClick="adminServerModifyServerInfo()" data-role="button" data-inline="true" data-mini="true" data-icon="gear">Save</a>
+                       <a href=# onClick="adminServerRemoveServerInfo()" data-role="button" data-inline="true" data-mini="true" data-icon="minus">Delete</a>
                </div>
        </div><!-- /page -->
 
index 679e46ae22d0b5fd7f65ae73efc928a2cf6f5a92..21c1c92dbb43fb325dbd7631997a7406895be510 100644 (file)
@@ -73,7 +73,7 @@ function adminDistributionModifyPopupInit() {
        if(serverStatusText.toUpperCase() == "CLOSE") {
                option = '<option value="CLOSE" selected="selected">CLOSE</option>';
        } else {
-               option = '<option value="CLOSE">FALSE</option>';
+               option = '<option value="CLOSE">CLOSE</option>';
        }
        $("#adminDistributionModify-status").append(option);
        $("#adminDistributionModify-status").selectmenu("refresh");
index 8aa5ddbc5c69c077c8838027c6c4505db0c46892..4ee55da506a6c6948df20a7cfeed03352d4202b6 100644 (file)
@@ -31,6 +31,14 @@ function adminProjectAddGitInit() {
        $("#adminProjectAddGit-password").val("");
        $("#adminProjectAddGit-address").val("");
        $("#adminProjectAddGit-branch").val("");
+       $("#adminProjectAddGit-status").empty();
+
+       var option; 
+       option = '<option value="OPEN" selected="selected">OPEN</option>';
+       $("#adminProjectAddGit-status").append(option);
+       option = '<option value="CLOSE">CLOSE</option>';
+       $("#adminProjectAddGit-status").append(option);
+       $("#adminProjectAddGit-status").selectmenu("refresh");
 
        queryAllOS( function (xml) {
                var osList = $(xml).find("Data").find("OsName");
@@ -55,6 +63,14 @@ function adminProjectAddBinaryInit() {
        $("#adminProjectAddBinary-name").val("");
        $("#adminProjectAddBinary-password").val("");
        $("#adminProjectAddBinary-packagename").val("");
+       $("#adminProjectAddBinary-status").empty();
+
+       var option; 
+       option = '<option value="OPEN" selected="selected">OPEN</option>';
+       $("#adminProjectAddBinary-status").append(option);
+       option = '<option value="CLOSE">CLOSE</option>';
+       $("#adminProjectAddBinary-status").append(option);
+       $("#adminProjectAddBinary-status").selectmenu("refresh");
 
        queryAllOS( function (xml) {
                var osList = $(xml).find("Data").find("OsName");
@@ -84,6 +100,7 @@ function adminProjectAddGitProject() {
        var password = $("#adminProjectAddGit-password").val();
        var address = $("#adminProjectAddGit-address").val();
        var branch = $("#adminProjectAddGit-branch").val();
+       var projectStatus = $("#adminProjectAddGit-status option:selected").val();
        var selectOsList = [];
 
        var selectArray = $("input[name='adminProjectAddGit-os-checkbox']");
@@ -98,7 +115,7 @@ function adminProjectAddGitProject() {
                return;
        }
 
-       changeInfoItem = {"Distribution":distName, "Name":name, "ProjectType":type, "ProjectPass":password, "Address":address, "Branch":branch, "OSNameList":selectOsList.toString()};
+       changeInfoItem = {"Distribution":distName, "Name":name, "ProjectType":type, "ProjectPass":password, "Address":address, "Branch":branch, "ProjectStatus":projectStatus, "OSNameList":selectOsList.toString()};
        changeInfoList.push(changeInfoItem);
        
        addProject(changeInfoList, function () {
@@ -114,6 +131,7 @@ function adminProjectAddBinaryProject() {
        var name = $("#adminProjectAddBinary-name").val();
        var password = $("#adminProjectAddBinary-password").val();
        var pkgName = $("#adminProjectAddBinary-packagename").val();
+       var projectStatus = $("#adminProjectAddBinary-status option:selected").val();
        var selectOsList = [];
 
        var selectArray = $("input[name='adminProjectAddBinary-os-checkbox']");
@@ -128,7 +146,7 @@ function adminProjectAddBinaryProject() {
                return;
        }
 
-       changeInfoItem = {"Distribution":distName, "Name":name, "ProjectType":type, "ProjectPass":password, "PackageName":pkgName, "OSNameList":selectOsList.toString()};
+       changeInfoItem = {"Distribution":distName, "Name":name, "ProjectType":type, "ProjectPass":password, "PackageName":pkgName, "ProjectStatus":projectStatus, "OSNameList":selectOsList.toString()};
        changeInfoList.push(changeInfoItem);
        
        addProject(changeInfoList, function () {
index 16930e2ce16a83cb8a0209ee342b0db2ee5ec844..338d83d2feb0e46b667569872e00bba841b00dd2 100644 (file)
@@ -29,14 +29,33 @@ Contributors:
 function adminProjectModifyBinaryProjectInit() {
        var projectName = localStorage.projectName;
        var packageName = $("#adminProject-binary-packageName-"+projectName).html();
+       var projectStatusText = $("#adminProject-binary-"+projectName+"-status").html();
 
        $("#adminProjectModifyBinary-oldName").val(projectName);
        $("#adminProjectModifyBinary-newName").val(projectName);
        $("#adminProjectModifyBinary-password").val("");
        $("#adminProjectModifyBinary-packageName").val(packageName);
+       $("#adminProjectModifyBinary-status").empty();
        $("#adminProjectModifyBinary-os").empty();
        $("#adminProjectModifyBinary-os").append("<legend> os list </legend>");
 
+       $("#adminProjectModifyBinary-status").empty();
+       var option; 
+       if(projectStatusText.toUpperCase() == "OPEN") {
+               option = '<option value="OPEN" selected="selected">OPEN</option>';
+       } else {
+               option = '<option value="OPEN">OPEN</option>';
+       }
+       $("#adminProjectModifyBinary-status").append(option);
+       
+       if(projectStatusText.toUpperCase() == "CLOSE") {
+               option = '<option value="CLOSE" selected="selected">CLOSE</option>';
+       } else {
+               option = '<option value="CLOSE">CLOSE</option>';
+       }
+       $("#adminProjectModifyBinary-status").append(option);
+       $("#adminProjectModifyBinary-status").selectmenu("refresh");
+
        queryAllOS( function (xml) {
                var osList = $(xml).find("Data").find("OsName");
                var selectedOsList = [];
@@ -72,14 +91,31 @@ function adminProjectModifyGitProjectInit() {
        var projectName = localStorage.projectName;
        var projectAddress = $("#adminProject-git-"+projectName+"-address").html();
        var projectBranch = $("#adminProject-git-"+projectName+"-branch").html();
+       var projectStatusText = $("#adminProject-git-"+projectName+"-status").html();
 
        $("#adminProjectModifyGit-oldName").val(projectName);
        $("#adminProjectModifyGit-newName").val(projectName);
        $("#adminProjectModifyGit-password").val("");
        $("#adminProjectModifyGit-address").val(projectAddress);
        $("#adminProjectModifyGit-branch").val(projectBranch);
+       $("#adminProjectModifyGit-status").empty();
        $("#adminProjectModifyGit-os").empty();
        $("#adminProjectModifyGit-os").append("<legend> os list </legend>");
+       var option; 
+       if(projectStatusText.toUpperCase() == "OPEN") {
+               option = '<option value="OPEN" selected="selected">OPEN</option>';
+       } else {
+               option = '<option value="OPEN">OPEN</option>';
+       }
+       $("#adminProjectModifyGit-status").append(option);
+       
+       if(projectStatusText.toUpperCase() == "CLOSE") {
+               option = '<option value="CLOSE" selected="selected">CLOSE</option>';
+       } else {
+               option = '<option value="CLOSE">CLOSE</option>';
+       }
+       $("#adminProjectModifyGit-status").append(option);
+       $("#adminProjectModifyGit-status").selectmenu("refresh");
 
        queryAllOS( function (xml) {
                var osList = $(xml).find("Data").find("OsName");
@@ -119,6 +155,7 @@ function adminProjectModfyBinaryProject() {
        var oldProjectName = $("#adminProjectModifyBinary-oldName").val();
        var newProjectName = $("#adminProjectModifyBinary-newName").val();
        var projectPassword = $("#adminProjectModifyBinary-password").val();
+       var projectStatus = $("#adminProjectModifyBinary-status option:selected").val();
        var packageName = $("#adminProjectModifyBinary-packageName").val();
        var selectOsList = [];
 
@@ -134,7 +171,7 @@ function adminProjectModfyBinaryProject() {
                return;
        }
                
-       changeInfoItem = {"Distribution":distName, "Name":oldProjectName, "NewProjectName":newProjectName, "ProjectType":"BINARY", "ProjectPass":projectPassword, "PackageName":packageName, "OSNameList":selectOsList.toString()};
+       changeInfoItem = {"Distribution":distName, "Name":oldProjectName, "NewProjectName":newProjectName, "ProjectType":"BINARY", "ProjectPass":projectPassword, "ProjectStatus":projectStatus, "PackageName":packageName, "OSNameList":selectOsList.toString()};
        changeInfoList.push(changeInfoItem);
 
        modifyProject(changeInfoList, function () {
@@ -151,6 +188,7 @@ function adminProjectModfyGitProject() {
        var projectPassword = $("#adminProjectModifyGit-password").val();
        var projectAddress = $("#adminProjectModifyGit-address").val();
        var projectBranch = $("#adminProjectModifyGit-branch").val();
+       var projectStatus = $("#adminProjectModifyGit-status option:selected").val();
        var selectOsList = [];
 
        var selectArray = $("input[name='adminProjectModifyGit-os-checkbox']");
@@ -165,7 +203,7 @@ function adminProjectModfyGitProject() {
                return;
        }
                
-       changeInfoItem = {"Distribution":distName, "Name":oldProjectName, "NewProjectName":newProjectName, "ProjectType":"GIT", "ProjectPass":projectPassword, "ProjectAddress":projectAddress, "ProjectBranch":projectBranch, "OSNameList":selectOsList.toString()};
+       changeInfoItem = {"Distribution":distName, "Name":oldProjectName, "NewProjectName":newProjectName, "ProjectType":"GIT", "ProjectPass":projectPassword, "ProjectAddress":projectAddress, "ProjectBranch":projectBranch, "ProjectStatus":projectStatus, "OSNameList":selectOsList.toString()};
        changeInfoList.push(changeInfoItem);
 
        modifyProject(changeInfoList, function () {
index f28ef05145cc49d30c43c209ce181c304591c198..b09953a04808f0eed27cbc405ced0957b922f6fe 100644 (file)
@@ -94,11 +94,12 @@ function adminProjectUpdateTable(projectList) {
        $("#adminProject-binary").empty();
 
        // Project table header
-       var tableHeader = "<tr><th>Project</th><th>Git repos</th><th>Branch</th><th>OS list</th><th>Modify</th><th>Delete</th>";
+       var tableHeader = "<tr><th>Project</th><th>Git repos</th><th>Branch</th><th>OS list</th><th>Status</th><th>Modify</th><th>Delete</th>";
        $("#adminProject-git").append(tableHeader);
 
        // Binary project table header
-       var tableHeader = "<tr><th>Project</th><th>Package name</th><th>OS list</th><th>Modify</th><th>Delete</th>";
+       var tableHeader = "<tr><th>Project</th><th>Package name</th><th>OS list</th><th>Status</th><th>Modify</th><th>Delete</th>";
+
        $("#adminProject-binary").append(tableHeader);
 
        var projectIdx = 1;
@@ -107,6 +108,7 @@ function adminProjectUpdateTable(projectList) {
        projectList.each(function(){
                var name = $(this).find("ProjectName").text();
                var type = $(this).find("Type").text();
+               var project_status = $(this).find("ProjectStatus").text();
                var osList = $(this).find("OS");
 
                if(type.toUpperCase() == "GIT")
@@ -132,6 +134,10 @@ function adminProjectUpdateTable(projectList) {
                        div = adminProjectApendOsCell(osList, name, "GIT");
                        cell.appendChild(div);
 
+                       cell = row.insertCell(-1);
+                       cell.setAttribute('id',"adminProject-git-"+name+"-status");
+                       cell.innerHTML = project_status;
+
                        cell = row.insertCell(-1);
                        var button = document.createElement('a');
                        button.setAttribute('href','#adminProjectModifyGit');
@@ -146,7 +152,6 @@ function adminProjectUpdateTable(projectList) {
                        cell = row.insertCell(-1);
                        var button = document.createElement('input');
                        button.setAttribute('type','button');
-                       button.setAttribute('id','button:git:'+projectIdx+':'+name);
                        button.setAttribute('data-mini','true');
                        button.setAttribute('name',name);
                        button.setAttribute('class','binaryProjectTableButton');
@@ -173,6 +178,10 @@ function adminProjectUpdateTable(projectList) {
                        div = adminProjectApendOsCell(osList, name, "BINARY");
                        cell.appendChild(div);
 
+                       cell = row.insertCell(-1);
+                       cell.setAttribute('id',"adminProject-binary-"+name+"-status");
+                       cell.innerHTML = project_status;
+
                        cell = row.insertCell(-1);
                        var button = document.createElement('a');
                        button.setAttribute('href','#adminProjectModifyBinary');
@@ -233,4 +242,21 @@ function adminProjectApendOsCell(osList, projectName, projectType) {
        return div;
 }
 
+function adminProjectAllProjectStatusChange(projectStatus) {
+       var distName = $("#adminProject-distribution-select option:selected").val();
+       var changeInfoList = [];
+       var changeInfoItem;
+
+       var r=confirm("All project status is changed to "+projectStatus+"!!!");
+       if (r==false)
+       {
+               return;
+       }
 
+       changeInfoItem = {"Distribution":distName, "ProjectStatus":projectStatus}
+       changeInfoList.push(changeInfoItem);
+
+       changeAllProjectStatus(changeInfoList, function () {
+               $.mobile.changePage("#adminProject"); 
+       });
+}
index c41f888e52b8b0b31411242e16aa5c6ba5728530..671dc8375457c404a7f5ad51fa1d9c75fe0e350e 100644 (file)
@@ -68,6 +68,7 @@ function adminUserFillTable(userList) {
                button.setAttribute('href','#adminUserModify');
                button.setAttribute('data-role','button');
                button.setAttribute('data-rel','dialog');
+               button.setAttribute('data-mini','ture');
                button.setAttribute('class','adminUser-contentsButton');
                button.setAttribute('onClick','adminUserModifySetup('+userId+')');
                button.innerHTML = " "
@@ -77,6 +78,7 @@ function adminUserFillTable(userList) {
                var button = document.createElement('input');
                button.setAttribute('type','button');
                button.setAttribute('name',email);
+               button.setAttribute('data-mini','ture');
                button.setAttribute('class','adminUser-contentsButton');
                button.setAttribute('onClick','adminUserRemoveUser('+userId+')');
                cell.appendChild(button);
index f204833721813323af13abadc77fd58b079b0178..781f9f6e34af3ec0fab7e640681f57715ac3ac4c 100644 (file)
@@ -68,10 +68,21 @@ function buildQueryProjectList() {
                $("#build-binary-table").empty();
                
                var xmlBody = $(xml).find("Data");
+               var distributionStatus = xmlBody.find("BuildServerInfo").find("DistributionStatus").text();
+               if (distributionStatus == "CLOSE") {
+                       var distributionLock = document.getElementById("build-distribution-lock");
+                       distributionLock.innerHTML = '<p> Distribution is locked </p>';
+               } else {
+                       var distributionLock = document.getElementById("build-distribution-lock");
+                       distributionLock.innerHTML = '';
+               }
+
                buildAddTableRow( xmlBody.find("BuildServerInfo").find("supportedOs"),
+                                        distributionStatus,
                                         xmlBody.find("Project"),
                                         xmlBody.find("OtherProject"));
-               buildAddBinaryTableRow( xmlBody.find("BinaryProject"),
+               buildAddBinaryTableRow( distributionStatus,
+                                        xmlBody.find("BinaryProject"),
                                         xmlBody.find("OtherBinaryProject"));
        });
 }
@@ -117,7 +128,7 @@ function contains(a, obj) {
        return false; 
 }
 
-function buildAddTableRow(supportedOs, projectList, otherProjectList) {
+function buildAddTableRow(supportedOs, distributionStatus, projectList, otherProjectList) {
        // Table header
        var idx = 0;
        var tableHeader = "";
@@ -142,8 +153,9 @@ function buildAddTableRow(supportedOs, projectList, otherProjectList) {
 
        projectList.each(function(){
                var name = $(this).find("ProjectName").text();
-               var osLists = $(this).find("OsList").text();
-               var osList = osLists.split(",");
+               var projectOsArray = $(this).find("OsList").text().split(",");
+               var projectStatus = $(this).find("ProjectStatus").text();
+               var buildAvailable = true;
        
                var row = projectTable.insertRow(-1);
                
@@ -152,40 +164,11 @@ function buildAddTableRow(supportedOs, projectList, otherProjectList) {
                cell.setAttribute('bgcolor', '#dcddc0');
                cell.innerHTML = name;
                
-               for (i=0;i<osArray.length;i++)
-               {
-                       var cell = row.insertCell(-1);
-                       var os = osArray[i];
-       
-                       cell.setAttribute('id', "buildGitProjectTable"+":"+name+":"+os);
-                       cell.setAttribute('style', 'text-align: center');
-                       cell.setAttribute('bgcolor', '#dcddc0');
-       
-                       var buttonnode = document.createElement('input');
-                       buttonnode.setAttribute('type','checkbox');
-                       buttonnode.setAttribute('id',"table"+":"+name+':'+os);
-                       buttonnode.setAttribute('name','projectBuildCheckbox'+":"+name);
-                       buttonnode.setAttribute('class','projectTableBuildButton');
-                       cell.appendChild(buttonnode);
-
-                       if(!contains(osList, os))
-                       {
-                               buttonnode.setAttribute('disabled','disabled');
-                       }
+               if (distributionStatus == "CLOSE" || projectStatus == "CLOSE")  {
+                       buildAvailable = false;
                }
-       
-               /* append all checkbox */
-               var cell = row.insertCell(-1);
-               cell.setAttribute('style', 'text-align: center');
-               cell.setAttribute('bgcolor', '#dcddc0');
-       
-               var buttonnode = document.createElement('input');
-               buttonnode.setAttribute('type','checkbox');
-               buttonnode.setAttribute('id','projectBuildCheckbox'+":"+name);
-               buttonnode.setAttribute('name','all-checkbox');
-               buttonnode.setAttribute('class','projectTableAllButton');
-               buttonnode.setAttribute('onClick','buildSelectAll(this)');
-               cell.appendChild(buttonnode);
+
+               buildAddBinaryTableCell(name, osArray, projectOsArray, buildAvailable, row);
        });
 
        otherProjectList.each(function(){
@@ -197,25 +180,11 @@ function buildAddTableRow(supportedOs, projectList, otherProjectList) {
                cell.setAttribute('bgcolor', '#c0c0c0');
                cell.innerHTML = name;
        
-               /* add empty cell for status */
-               for (i=0;i<osArray.length;i++)
-               {
-                       cell = row.insertCell(-1);
-                       cell.setAttribute('id', "table"+":"+name+"-"+osArray[i]);
-                       cell.setAttribute('style', 'text-align: left');
-                       cell.setAttribute('bgcolor', '#c0c0c0');
-                       cell.innerHTML = ""; 
-               }
-       
-               /* add empty cell for all*/
-               cell = row.insertCell(-1);
-               cell.setAttribute('style', 'text-align: left');
-               cell.setAttribute('bgcolor', '#c0c0c0');
-               cell.innerHTML = "";
+               buildAddBinaryTableCell(name, osArray, "", false, row);
        });
 }
 
-function buildAddBinaryTableRow(binaryProjectList, otherProjectList) {
+function buildAddBinaryTableRow(distributionStatus, binaryProjectList, otherProjectList) {
        var binaryProjectTable = document.getElementById("build-binary-table");
        var row = binaryProjectTable.insertRow(-1);
        var thCell = document.createElement('th');
@@ -232,9 +201,14 @@ function buildAddBinaryTableRow(binaryProjectList, otherProjectList) {
        binaryProjectList.each(function(){
                var name =  $(this).find("ProjectName").text();
                var packageName =  $(this).find("PackageName").text();
+               var projectStatus = $(this).find("ProjectStatus").text();
                var row = '<tr><td bgcolor="#dcddc0" style="text-align:left">'+name+'</td>';
                row += '<td bgcolor="#dcddc0" style="text-align:left">' + packageName + '</td>'
-               row += '<td bgcolor="#dcddc0" style="text-align:left"><a href="upload.html" onClick="buildUploadBinaryName(\'' +name+'\')" class="binary_project_button" data-role="button" data-ajax="false" data-mini="true">REGISTER</a>';
+               if (distributionStatus == "CLOSE" || projectStatus == "CLOSE")  {
+                       row += '<td bgcolor="#c0c0c0" style="text-align:left"></td>';
+               } else {
+                       row += '<td bgcolor="#dcddc0" style="text-align:left"><a href="upload.html" onClick="buildUploadBinaryName(\'' +name+'\')" class="binary_project_button" data-role="button" data-ajax="false" data-mini="true">REGISTER</a>';
+               }
                row += '</tr>'
                
                $("#build-binary-table tr:last").after(row);
@@ -273,6 +247,58 @@ function buildAddBinaryTableRow(binaryProjectList, otherProjectList) {
        });
 }
 
+function buildAddBinaryTableCell(projectName, osArray, projectOsArray, buildAvailable, row) {
+       for (i=0;i<osArray.length;i++)
+       {
+               var cell = row.insertCell(-1);
+               var os = osArray[i];
+       
+               cell.setAttribute('id', "buildGitProjectTable"+":"+projectName+":"+os);
+               cell.setAttribute('style', 'text-align: center');
+               if (buildAvailable) {
+                       /* add cell with build checkbox */
+                       cell.setAttribute('bgcolor', '#dcddc0');
+           
+                       var buttonnode = document.createElement('input');
+                       buttonnode.setAttribute('type','checkbox');
+                       buttonnode.setAttribute('id',"table"+":"+projectName+':'+os);
+                       buttonnode.setAttribute('name','projectBuildCheckbox'+":"+projectName);
+                       buttonnode.setAttribute('class','projectTableBuildButton');
+                       cell.appendChild(buttonnode);
+            
+                       if(!contains(projectOsArray, os))
+                       {
+                               buttonnode.setAttribute('disabled','disabled');
+                       }
+               } else {
+                       /* add empty cell for status */
+                       cell.setAttribute('bgcolor', '#c0c0c0');
+                       cell.innerHTML = ""; 
+               }
+       }
+
+       if (buildAvailable) {
+               /* append all checkbox */
+               var cell = row.insertCell(-1);
+               cell.setAttribute('style', 'text-align: center');
+               cell.setAttribute('bgcolor', '#dcddc0');
+               
+               var buttonnode = document.createElement('input');
+               buttonnode.setAttribute('type','checkbox');
+               buttonnode.setAttribute('id','projectBuildCheckbox'+":"+projectName);
+               buttonnode.setAttribute('name','all-checkbox');
+               buttonnode.setAttribute('class','projectTableAllButton');
+               buttonnode.setAttribute('onClick','buildSelectAll(this)');
+               cell.appendChild(buttonnode);
+       } else {
+               /* add empty cell for all*/
+               cell = row.insertCell(-1);
+               cell.setAttribute('style', 'text-align: left');
+               cell.setAttribute('bgcolor', '#c0c0c0');
+               cell.innerHTML = "";
+       }
+}
+
 function buildBuildProject() {
        var distName = $("#build-distribution-select option:selected").val();
        var buildProjectList = [];
index 4cbee8ba3a7150b2f84c555edb6baaeb4df952be..430f0e683bd3341ff3a06b8162dc941e5bec93b5 100644 (file)
@@ -245,6 +245,11 @@ function modifyProject(changeInfoList, successFunction) {
        postForServer(url, changeInfoList, successFunction);
 }
 
+function changeAllProjectStatus(changeInfoList, successFunction) {
+       var url = 'admin_project/changeAllProjectStatus';
+       postForServer(url, changeInfoList, successFunction);
+}
+
 // controller : admin_distribution
 function queryDistributionInfo(distName, successFunction) {
        var url = 'admin_distribution/queryDistributionInfo/' + distName;
index 3bdc5d0fafe362a25ed27f93c20870f0a1477c21..a2b9a714015ac2632534662e85d03dea2a0e9d93 100644 (file)
@@ -31,13 +31,12 @@ require 'optparse'
 require 'utils'
 
 class BuildClientUsage
-       BUILD="build-cli build -N <project name> -d <server address> [-o <os>] [-w <password>] [--async] [-D <distribution name>] [-U user-email] [-V]"
-       #RESOLVE="build-cli resolve -N <project name> -d <server address> [-o <os>] [-w <password>] [--async] [-D <distribution name>] [-U user-email] [-V]"
+       BUILD="build-cli build -N <project name> -d <server address> [-o <os>] [-w <password>] [--async] [-D <distribution name>] [-U user-email]"
        QUERY="build-cli query -d <server address>"
        QUERY_SYSTEM="build-cli query-system -d <server address>"
        QUERY_PROJECT="build-cli query-project -d <server address>"
        QUERY_JOB="build-cli query-job -d <server address>"
-       QUERY_LOG="build-cli query-log -d <server address> -j <job number>"
+       QUERY_LOG="build-cli query-log -d <server address> -j <job number> [--output <output file path>]"
        CANCEL="build-cli cancel -j <job number> -d <server address> [-w <password>] [-U user-email]"
        REGISTER="build-cli register -P <package file> -d <server address>  [-t <ftp server url>] [-w <password>] [-D <distribution name>] [-U user-email]"
 end
@@ -52,12 +51,6 @@ def option_error_check( options )
                        raise ArgumentError, "Usage: " + BuildClientUsage::BUILD
                end
 
-#      when "resolve" then
-#              if options[:project].nil? or options[:project].empty? or
-#                      options[:domain].nil?  or options[:domain].empty? then
-#                      raise ArgumentError, "Usage: " + BuildClientUsage::RESOLVE
-#              end
-#
        when "query" then
                if options[:domain].nil? or options[:domain].empty? then
                        raise ArgumentError, "Usage: " + BuildClientUsage::QUERY
@@ -167,6 +160,11 @@ def option_parse
                        options[:noreverse] = "YES"
                end
 
+               options[:rebuild] = "NO"
+               opts.on( '--rebuild', 'do not check package version' ) do
+                       options[:rebuild] = "YES"
+               end
+
                opts.on( '-j', '--job <job number>', 'job number' ) do|job|
                        options[:job] = job
                end
@@ -193,13 +191,18 @@ def option_parse
                        options[:user] = user
                end
 
+               options[:output] = nil
+               opts.on( '--output <output_path>', 'output file path' ) do|path|
+                       options[:output] = path
+               end
+
                options[:verbose] = "NO"
                opts.on( '-V', '--verbose', 'verbose mode' ) do
                        options[:verbose] = "YES"
                end
 
                opts.on( '-h', '--help', 'display help' ) do
-                       opts.help.split("\n").each {|op| puts op if not op.include? "--noreverse"}
+                       opts.help.split("\n").each {|op| puts op if not op.include? "--noreverse" and not op.include? "--rebuild"}
                        exit
                end
 
@@ -208,6 +211,7 @@ def option_parse
                        exit
                end
 
+
        end
 
        cmd = ARGV[0]
index 8d9c8e4d73600653295e903e2287253985d69e6f..83168f496637804a22bc0691658ae2b1f1b16c3f 100644 (file)
@@ -49,7 +49,7 @@ class BuildJob < CommonJob
 #      attr_accessor :rev_fail_projects, :rev_success_jobs
 #      attr_accessor :pending_ancestor
        attr_accessor :no_reverse
-       attr_accessor :remote_id
+       attr_accessor :remote_id, :remote_status, :remote_error_msg
 
        # initialize
        def initialize (project, os, server)
@@ -83,6 +83,8 @@ class BuildJob < CommonJob
                #@pending_ancestor = nil # for cancel pending job
                @remote_id = nil # for cancel remote_working job
                @build_dep_prjs = nil # for cacnel pending job
+               @remote_status = ""
+               @remote_error_msg = ""
 
                ## for resolving build-break
                #@rev_fail_projects = [] # list of [project,os]
index 56e926f2b3236b59def5654365f1f39ff639574c..4486a0b25b4973763c65fd8ef5e146e07d2f6d3b 100644 (file)
@@ -788,7 +788,7 @@ class BuildServer
 
                job = nil
                (@jobmgr.jobs + @jobmgr.internal_jobs + @jobmgr.reverse_build_jobs).each do |manager_job|
-                       if manager_job.id.eql? job_number then 
+                       if manager_job.id.eql? job_number.to_i then 
                                job = manager_job
                        end
                end
@@ -797,36 +797,27 @@ class BuildServer
                        job_log_path = File.join(@path, "jobs", job_number, "log")
 
                        if File.exist? job_log_path then
-                               # get job status and send it
-                               job_status = ""
-                               if job.nil? then 
-                                       get_db_connection() do |db|
-                                               job_status = db.select_one("SELECT status FROM jobs WHERE id = #{job_number}")[0]
-                                       end
-                               else
-                                       job_status = job.status
-                               end
-                               BuildCommServer.send(conn, "JOB STATUS : [[#{job_status}]]") 
-
                                begin
                                        File::Tail::Logfile.open(job_log_path) do |log|
-                                               # skip log file creation information
-                                               log.forward(1)
-
+                                               log.interval = 0.05
                                                # send log file information using file-tail
                                                log.tail { |line| 
                                                        if line.strip.empty? then next end
                                                        contents = line.sub(/^[a-zA-Z], \[.*\][ \t]*/,"")
                                                        BuildCommServer.send(conn, contents) 
-                    
+
                                                        # if read file's last line and job status ended then log file sending done
-                                                       if not job.nil? then job_status = job.status end
-                                                       if log.eof? and 
-                                                                       (job_status.eql? "FINISHED" or
-                                                                        job_status.eql? "ERROR" or 
-                                                                        job_status.eql? "CANCELED") then
+                                                       if log.eof? and (job.nil? or
+                                                                        job.status.eql? "FINISHED" or
+                                                                        job.status.eql? "ERROR" or 
+                                                                        job.status.eql? "CANCELED") then
+
                                                                # Log file send done. & send job status
-                                                               BuildCommServer.send(conn, "JOB STATUS : [[#{job_status}]]") 
+                                                               job_status = ""
+                                                               get_db_connection() do |db|
+                                                                       job_status = db.select_one("SELECT status FROM jobs WHERE id = #{job_number}")[0]
+                                                               end
+                                                               BuildCommServer.send(conn, "=JOB_STATUS,#{job_status}")
                                                                break
                                                        end
                                                }
index a3522711a7ed77c80b06f9adf55b1cce4f72a387..23e3fa4a2b9dad441f8b600d4361892268ebefe3 100644 (file)
@@ -64,6 +64,19 @@ class CommonJob
                @sub_pid = 0
        end
 
+       # processing in updated status (set stauts)
+       def status=(value)
+               @status = value
+               if not @log.nil? then
+                       @log.job_status(@status, "")
+                       @log.logger.flush
+               end
+       end
+       
+       def status
+               return @status
+       end
+
        # event check
        def check_event
                # CANCEL/CANCELING
index 2dade4432a0e80e450a75da6689845b6db29bc74..c5c9b4daa95fa0af4b809dc0676573f57461bf1f 100644 (file)
@@ -69,6 +69,14 @@ class JobLog < Log
                @second_out = nil
        end
 
+       def job_status(status, msg)
+               if msg.nil? then
+                       BuildCommServer.send( @second_out, "=JOB_STATUS,#{status}")
+               else
+                       BuildCommServer.send( @second_out, "=JOB_STATUS,#{status},#{msg}")
+               end
+       end
+
 
        def is_connected?
                if @second_out.nil? or @second_out.closed? then
index 78d3fa9322ddd06116dbdc71adaec6dd9590f18d..1a00262de129549fdb9336da3425c14d00bd3a4d 100644 (file)
@@ -99,14 +99,16 @@ class RemoteBuilder
 
                # send build request
                @log.info( "Sending build request to remote server...", Log::LV_USER )
-               result, result_files = send_build_request(git_repos, os, is_rev_build,
-                                                                                                 srcinfo, no_reverse, local_pkgs, dock, dist_name, user_email, @log.is_verbose)
 
-               @log.info( "Receiving log file from remote server...", Log::LV_USER )
-               if not receive_file_from_remote( "#{source_path}/../remote_log", dock ) then
-                       @log.warn( "File transfering failed! : remote_log", Log::LV_USER )
+               result = send_build_request(git_repos, os, is_rev_build,
+                                                                       srcinfo, no_reverse, local_pkgs, dock, dist_name, user_email)
+               if not result then
+                       @log.error( "Building job request on remote server failed!", Log::LV_USER )
+                       return false
                end
 
+               result, result_files = send_monitor_request(is_rev_build)
+
                if not result then
                        @log.error( "Building job on remote server failed!", Log::LV_USER )
                        return false
@@ -163,13 +165,12 @@ class RemoteBuilder
 
        # send build request
        protected
-       def send_build_request(git_repos, os, is_rev_build, commit, no_reverse, local_pkgs, dock, dist_name, user_email, verbose)
-               result_files = []
+       def send_build_request(git_repos, os, is_rev_build, commit, no_reverse, local_pkgs, dock, dist_name, user_email)
 
                client = BuildCommClient.create( @addr, @port, @log )
                if client.nil? then
                        @log.error( "Creating communication client failed!", Log::LV_USER)
-                       return false, result_files
+                       return false
                end
 
                # get local package names
@@ -177,46 +178,85 @@ class RemoteBuilder
 
                # send
                #          0   | 1 |    2     |   3  | 4|  5  |     6    |    7    |    8     |   9   |   10   |   11    |  12  | 13 |  14
-               # format: BUILD|GIT|repository|passwd|os|async|no_reverse|dist_name|user_email|verbose|internal|rev-build|commit|pkgs|dock_num
-               # value : BUILD|GIT|repository|      |os|NO   |no_reverse|dist_name|user_email|verbose|YES     |rev-build|commit|pkgs|dock_num
+               # format: BUILD|GIT|repository|passwd|os|async|no_reverse|dist_name|user_email|rebuild|internal|rev-build|commit|pkgs|dock_num
+               # value : BUILD|GIT|repository|      |os|NO   |no_reverse|dist_name|user_email|YES    |YES     |rev-build|commit|pkgs|dock_num
                result = true
                commit = commit.nil? ? "":commit
                pkg_list = local_pkg_names.join(",")
                rev = is_rev_build ? "YES":"NO"
-               msg = "BUILD|GIT|#{git_repos}||#{os}|NO|#{no_reverse}|#{dist_name}|#{user_email}|#{verbose}|YES|#{rev}|#{commit}|#{pkg_list}|#{dock}"
+               msg = "BUILD|GIT|#{git_repos}||#{os}|NO|#{no_reverse}|#{dist_name}|#{user_email}|YES|YES|#{rev}|#{commit}|#{pkg_list}|#{dock}"
                result = client.send( msg )
                if not result then
                        @log.error( "Communication failed! #{client.get_error_msg()}", Log::LV_USER)
-                       return false, result_files
+                       return false
                end
 
-               r_job_number = Regexp.new('Added new job "([^"]*)"')
-               error = false
-               result = client.read_lines do |l|
+               job_id = nil
+               result = client.read_lines do |line|
+                       if line.strip.start_with?("=JOB_START") then 
+                               @job.remote_id = line.strip.split(",")[1]
+                               next
+                       end
                        # write log first
                        @log.output( l.strip, Log::LV_USER)
+               end
+               
+               if not result then
+                       @log.error( "Communication failed! #{client.get_error_msg()}", Log::LV_USER)
+               elsif @job.remote_id.nil? then
+                       result = false
+                       @log.error( "Can't find remote job id", Log::LV_USER)
+               end
 
-                       # set remote job id
-                       if not @job.nil? and  @job.remote_id.nil? and l =~ r_job_number then
-                               @job.remote_id = $1
-                       end
+               # close socket
+               client.terminate
+
+               return result
+       end
+
+       # send monitor request
+       protected
+       def send_monitor_request(is_rev_build)
+               result_files = []
 
-                       # check build result
-                       if l.include? "Job is stopped by ERROR" or
-                               l.include? "Error:" then
-                               error = true
+               client = BuildCommClient.create( @addr, @port, @log )
+               if client.nil? then
+                       @log.error( "Creating communication client failed!", Log::LV_USER)
+                       return false, result_files
+               end
+
+               result = true
+               msg = "LOG|#{@job.remote_id}"
+               result = client.send( msg )
+               if not result then
+                       @log.error( "Communication failed! #{client.get_error_msg()}", Log::LV_USER)
+                       return false, result_files
+               end
+
+               result = client.read_lines do |l|
+                       if line.strip.start_with?("=JOB_STATUS") then 
+                               data = line.strip.split(",")
+                               @job.remote_status = data[1]
+                               @job.remote_error_msg = data[2]
+                               next
                        end
 
+                       # write log first
+                       @log.output( l.strip, Log::LV_USER)
+
                        # gather result files if not reverse build
                        if not is_rev_build and l =~ /Creating package file \.\.\. (.*)/ then
                                file_name = $1
                                result_files.push file_name
                        end
                end
+
                if not result then
                        @log.error( "Communication failed! #{client.get_error_msg()}", Log::LV_USER)
+               elsif not @job.remote_status.eql? "FINISHED" then 
+                       @log.error( "Job is #{@job.remote_status}! #{@job.remote_error_msg}", Log::LV_USER)
+                       result = false 
                end
-               if error then result=false end
 
                # close socket
                client.terminate
@@ -224,7 +264,6 @@ class RemoteBuilder
                return result, result_files
        end
 
-
        # receive binary package of remote server
        protected
        def receive_file_from_remote(file_path, dock = "0")
index 6d921ad2eaa18d0e03a06dade071667353c8b40e..ada11b81af7077a52d720fd57aa5bbff392b7a9d 100644 (file)
@@ -180,7 +180,7 @@ class SocketJobRequestListener
                        handle_cmd_build_internal( line, req )
                rescue BuildServerException => e
                        @log.error(e.message)
-                       BuildCommServer.send(req, e.err_message())
+                       BuildCommServer.send(req, "=JOB_STATUS,ERROR,#{e.err_message()}")
                        BuildCommServer.send_end(req)
                        BuildCommServer.disconnect(req)
                end
@@ -201,8 +201,8 @@ class SocketJobRequestListener
                end
 
                #          0  | 1 |     2      |  3   |  4    |  5  |     6    |    7    |   8      |   9   |   10   |    11   |  12  | 13 |   14
-               # Case1. BUILD|GIT|project_name|passwd|os_list|async|no_reverse|dist_name|user_email|verbose
-               # Case2. BUILD|GIT|git_repos   |      |os     |async|no_reverse|dist_name|user_email|verbose|internal|rev_build|commit|pkgs|dock_num
+               # Case1. BUILD|GIT|project_name|passwd|os_list|async|no_reverse|dist_name|user_email|rebuild
+               # Case2. BUILD|GIT|git_repos   |      |os     |async|no_reverse|dist_name|user_email|rebuild|internal|rev_build|commit|pkgs|dock_num
 
                # parse
                project_name_list = tok[2].split(",")
@@ -213,7 +213,7 @@ class SocketJobRequestListener
                no_reverse = tok[6].eql? "YES"
                dist_name = (not tok[7].nil? and not tok[7].empty?) ? tok[7].strip : ""
                user_email = (not tok[8].nil? and not tok[8].empty?) ? tok[8].strip : ""
-               verbose = tok[9].eql? "YES"
+               rebuild = tok[9].eql? "YES"
                is_internal = tok[10].eql? "YES"
                rev_job = tok[11].eql? "YES"
                git_commit = (not tok[12].nil? and not tok[12].empty?) ? tok[12] : nil
@@ -311,25 +311,24 @@ class SocketJobRequestListener
                # check reverse build
                if no_reverse then new_job.set_no_reverse end
 
+               # set force rebuild if needed
+               if rebuild then new_job.set_force_rebuild(true) end
+
                @parent_server.jobmgr.commit_job(new_job)
 
-               # create logger and set
+               # create logger and disconnect client
+               new_job.create_logger( nil, false)
+               BuildCommServer.send(req, "=JOB_START,#{new_job.id}")
+               BuildCommServer.send(req,"Info: Added new job \"#{new_job.id}\" for #{new_job.os}!")
+               if not @parent_server.job_log_url.empty? then
+                       BuildCommServer.send(req,"Info:  * Log URL : #{@parent_server.job_log_url}/#{new_job.id}/log")
+               end
+
                if async then
-                       new_job.create_logger( nil, verbose)
-                       BuildCommServer.send(req,"Info: Added new job \"#{new_job.id}\" for #{new_job.os}!")
-                       if not @parent_server.job_log_url.empty? then
-                               BuildCommServer.send(req,"Info:  * Log URL : #{@parent_server.job_log_url}/#{new_job.id}/log")
-                       end
                        BuildCommServer.send(req,"Info: Above job(s) will be processed asynchronously!")
-                       BuildCommServer.send_end(req)
-                       BuildCommServer.disconnect(req)
-               else
-                       logger = new_job.create_logger( req, verbose)
-                       logger.info( "Added new job \"#{new_job.id}\" for #{new_job.os}!", Log::LV_USER)
-                       if not @parent_server.job_log_url.empty? then
-                               logger.info( " * Log URL : #{@parent_server.job_log_url}/#{new_job.id}/log", Log::LV_USER)
-                       end
                end
+               BuildCommServer.send_end(req)
+               BuildCommServer.disconnect(req)
 
                # add to job queue
                if new_job.is_rev_build_check_job() then
@@ -354,106 +353,6 @@ class SocketJobRequestListener
        end
 
 
-       ## "RESOLVE"
-       #def handle_cmd_resolve( line, req )
-       #       @log.info "Received REQ: #{line}"
-
-       #       begin
-       #               handle_cmd_resolve_internal( line, req )
-       #       rescue BuildServerException => e
-       #               @log.error(e.message)
-       #               BuildCommServer.send(req, e.err_message())
-       #               BuildCommServer.send_end(req)
-       #               BuildCommServer.disconnect(req)
-       #       end
-
-       #       @log.info "Handled REQ: #{line}"
-       #end
-
-
-       #def handle_cmd_resolve_internal( line ,req)
-       #       tok = line.split("|").map { |x| x.strip }
-       #       if tok.count < 3 then
-       #               raise BuildServerException.new("ERR001"), line
-       #       end
-
-       #       case tok[1]
-       #               # RESOLVE|GIT|project_name|passwd|os|async|dist_name|user_email|verbose
-       #       when "GIT"
-
-       #               # parse
-       #               project_name=tok[2]
-       #               passwd=tok[3]
-       #               os=tok[4]
-       #               async = tok[5].eql? "YES"
-       #               dist_name = tok[6]
-       #               user_email = (not tok[7].nil? and not tok[7].empty?) ? tok[7].strip : ""
-       #               verbose = tok[8].eql? "YES"
-       #               if (dist_name.nil? or dist_name.empty?) then
-       #                       dist_name = @parent_server.distmgr.get_default_distribution_name()
-       #               end
-
-       #               # check distribution
-       #               check_distribution(dist_name, req)
-
-       #               # check project
-       #               prj = check_project_exist(project_name, dist_name, req)
-
-       #               # check passwd
-       #               check_project_password(prj, passwd, req)
-
-       #               # check os
-       #               os_list = check_supported_os( [os] , req )
-       #               os = os_list[0]
-
-       #               # check user email
-       #               user_id = @parent_server.check_user_id_from_email( user_email )
-       #               if user_id == -1 then
-       #                       raise BuildServerException.new("ERR004"), user_email
-       #               end
-
-       #               # check user accessable
-       #               if not check_project_user_id(project_name,dist_name,user_id) then
-       #                       raise BuildServerException.new("ERR005"), "#{user_email} -> #{project_name}"
-       #               end
-
-       #               # create new job
-       #               new_job = create_new_job( project_name, os, dist_name )
-       #               if new_job.nil? then
-       #                       raise BuildServerException.new("ERR006"), "Resolve job #{project_name} #{os}"
-       #               end
-       #               @log.info "Received a request for resolving this project : #{project_name}, #{os}"
-
-       #               new_job.user_id = user_id
-
-       #               # resolve
-       #               new_job.set_resolve_flag()
-
-       #               # create logger and set
-       #               if async then
-       #                       new_job.create_logger( nil, verbose)
-       #                       BuildCommServer.send(req,"Info: Added new job \"#{new_job.id}\" for #{new_job.os}!")
-       #                       if not @parent_server.job_log_url.empty? then
-       #                               BuildCommServer.send(req,"Info:  * Log URL : #{@parent_server.job_log_url}/#{new_job.id}/log")
-       #                       end
-       #                       BuildCommServer.send(req,"Info: Above job(s) will be processed asynchronously!")
-       #                       BuildCommServer.send_end(req)
-       #                       BuildCommServer.disconnect(req)
-       #               else
-       #                       logger = new_job.create_logger( req, verbose)
-       #                       logger.info( "Added new job \"#{new_job.id}\" for #{new_job.os}!", Log::LV_USER)
-       #                       if not @parent_server.job_log_url.empty? then
-       #                               logger.info( " * Log URL : #{@parent_server.job_log_url}/#{new_job.id}/log", Log::LV_USER)
-       #                       end
-       #               end
-
-       #               @parent_server.jobmgr.add_job( new_job )
-       #       else
-       #               raise BuildServerException.new("ERR001"), line
-       #       end
-       #end
-
-
        # "QUERY"
        def handle_cmd_query( line, req )
                begin
index 2f3817b417932b462e9f16f59413f563908abd08..55e9108ce64f68d533b8e400f24bcc5dc80dc73c 100644 (file)
@@ -336,6 +336,9 @@ class BuildCommClient
        private_class_method :new
 
        def initialize(socket, log)
+               @job_id = nil
+               @job_status = ""
+               @job_error = ""
                @log = log
                @socket = socket
                @error_msg = ""
@@ -375,6 +378,17 @@ class BuildCommClient
                return @error_msg
        end
 
+       def get_job_id 
+               return @job_id
+       end
+
+       def get_job_status
+               return @job_status
+       end
+
+       def get_job_error
+               return @job_status
+       end
 
        def set_error_msg( msg )
                @error_msg = msg
@@ -392,45 +406,6 @@ class BuildCommClient
        end
 
 
-       def print_stream
-
-               begin
-                       l = nil
-                       timeout(FIRST_RESPONSE_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}. Upgrade your DIBS client!"
-                               return false
-                       end
-
-                       # get contents
-                       while line = @socket.gets()
-                               if line.strip == "=END" then break end
-                               if line.strip == "=CHK" then next end
-                               # print
-                               puts line.strip
-                       end
-               rescue Timeout::Error
-                       @error_msg = "Connection timed out!"
-                       return false
-
-               rescue => e
-                       @error_msg = e.message
-                       return false
-               end
-
-               return true
-       end
-
-
        # handle
        def read_lines(begin_timeout = nil, data_timeout = nil)
 
@@ -467,9 +442,14 @@ class BuildCommClient
                                else
                                        line = @socket.gets()
                                end
-                               if line.nil? then break end
-                               if line.strip == "=END" then break end
-                               if line.strip == "=CHK" then next end
+
+                               if line.nil? then 
+                                       break
+                               elsif line.strip == "=END" then 
+                                       break
+                               elsif line.strip == "=CHK" then 
+                                       next 
+                               end
 
                                # execute
                                yield line.strip if block_given?
index 3ea5ef43774d98b926d1430da0508c9680d9bef7..dec73af70fc5ae8e7146f3de6820e9ee861bf21b 100644 (file)
@@ -28,9 +28,16 @@ Contributors:
 
 require "logger"
 
+class NewLogger < Logger
+       def flush
+               puts @logdev.dev.class
+               @logdev.dev.flush
+       end
+end
+
 class Log
 
-       attr_accessor :path, :cnt
+       attr_accessor :path, :cnt, :logger
 
        # Log LEVEL
        LV_NORMAL = 1
@@ -42,9 +49,9 @@ class Log
                @cnt = 0
                @path = path
                if @path.nil? then
-                       @logger = Logger.new(STDOUT)
+                       @logger = NewLogger.new(STDOUT)
                else
-                       @logger = Logger.new(path, "monthly")
+                       @logger = NewLogger.new(path, "monthly")
                end
                # if log level is bigger/equal to second out level
                # , we will send the log to second-out