[Title] Removed supported os checking in Sub Build Server
authordonghee yang <donghee.yang@samsung.com>
Thu, 23 Aug 2012 09:27:56 +0000 (18:27 +0900)
committerdonghee yang <donghee.yang@samsung.com>
Thu, 23 Aug 2012 09:27:56 +0000 (18:27 +0900)
src/build_server/BuildJob.rb
src/build_server/GitBuildJob.rb
src/build_server/ProjectManager.rb
src/build_server/SocketJobRequestListener.rb
src/common/utils.rb
test/build-cli-11.testcase

index 96ce3271f15dbb5e5952977d9c7b411a25b22141..5afd182b7065835285d03f94b41a3d7af4a8b752 100644 (file)
@@ -576,7 +576,7 @@ class BuildJob
                for pkg in @pkginfo.packages
                        # check all supported os
                        for os in @server.supported_os_list
-                               ver_svr = @pkgsvr_client.get_attr_from_pkg( pkg.package_name, @os, "version")
+                               ver_svr = @pkgsvr_client.get_attr_from_pkg( pkg.package_name, os, "version")
                                # ignore if package does not exist
                                if ver_svr.nil? then next end
 
@@ -838,93 +838,6 @@ class BuildJob
        end
 
 
-       # build projects that dependes on me
-       # can ignore some projects
-       def check_reverse_build( ignored_projects, exit_on_error)
-               @log.info( "Checking reverse build dependency ...", Log::LV_USER)
-
-        failed_projects = []
-
-               # get reverse-dependent projects
-               rev_pkgs = [] 
-               for pkg in @pkginfo.get_target_packages(@os)
-                       rev_pkgs += @pkgsvr_client.get_reverse_build_dependent_packages(pkg.package_name, @os)
-               end
-               rev_pkgs.uniq!
-               rev_projects = @server.prjmgr.get_projects_from_pkgs(rev_pkgs)
-               for ip in ignored_projects
-                       for rp in rev_projects
-                               if rp[0] == ip[0] and rp[1] == ip[1] then       
-                                       rev_projects.delete rp
-                               end
-                       end
-               end
-
-               # create reverse build job
-               rev_build_jobs = []
-               for p in rev_projects
-                       prj = p[0]
-                       os = p[1]
-                       version = p[2]
-
-                       # check project type
-                       if prj.type != "GIT" then next end
-
-                       # if this is sub job, the job exists in parent job must be ignored
-                       if is_sub_job? then
-                               job_found = false
-                               for job in @parent.get_sub_jobs
-                                       sprj = job.get_project()
-                                       if sprj.name == prj.name and job.os == os then
-                                               job_found = true
-                                               break
-                                       end
-                               end
-
-                               if job_found then next end
-                       end
-
-                       # create job
-                       new_job = prj.create_new_job_from_version(os, version)
-                       new_job.set_rev_build_check_job(self)
-
-                       rev_build_jobs.push new_job
-               end
-
-               # reverse build
-               if rev_build_jobs.count > 0 then
-                       rev_prjs_txt = rev_build_jobs.map {|j| "#{j.get_project().name}(#{j.os})"}.join(", ")
-                       @log.info( " * Will check reverse-build for projects: #{rev_prjs_txt}", Log::LV_USER)
-               end
-               for new_job in rev_build_jobs
-                       @log.info( " * Checking reverse-build ... #{new_job.get_project().name}(#{new_job.id})", Log::LV_USER)
-                       # job init
-                       result = new_job.init()
-                       # if init is succeeded!, try to execute
-                       if result then 
-                               # check available server
-                               rserver = @server.get_available_server( new_job )
-                               if rserver != nil and rserver != @server then
-                                       new_job.set_remote_job( rserver )               
-                               end
-                               # execute
-                               new_job.execute(true)
-                               if new_job.status == "ERROR" then result = false end
-                       end
-
-                       # check result
-                       if not result then
-                               failed_projects.push [new_job.get_project(), new_job.os]
-                               if exit_on_error then
-                                       return failed_projects
-                               end
-                       end
-               end
-
-               return failed_projects
-       end
-
-
        # wait to be resolved by other jobs
        def wait_resolve()
                @log.info( "Started to build this job and wait for being resolved...", Log::LV_USER)
index 471662a95b460109dd60340f21a7b74a4e68595b..9e4d9570e4f7f9dc00d1ea740cc6cc4fdf4922a3 100644 (file)
@@ -145,20 +145,21 @@ class GitBuildJob < BuildJob
                # set up pkgsvr_client
                @pkgsvr_client =  Client.new(@pkgserver_url, @job_working_dir, @log)
 
-               # checking version if not reverse-build job
-               if not @is_rev_build_check_job and not @is_remote_job and 
-                       not check_package_version(@git_commit) then
-
-                       @status = "ERROR"
-                       return false
-               end
+               # checking version if not reverse-build job or not internal-job
+               if not @is_rev_build_check_job and not @is_internal_job  then
+                       # check availabiltiy
+                       if not @server.check_job_availability( self ) then
+                               @log.error( "No servers that are able to build your packages.", Log::LV_USER)
+                               @log.error( "Host-OS (#{@os}) is not supported in build server.", Log::LV_USER)
+                               @status = "ERROR"
+                               @server.log.info "Adding the job \"#{@id}\" is canceled"
+                               return false
+                       end
 
-               # check availabiltiy
-               if not @server.check_job_availability( self ) then
-                       @log.error( "No servers that are able to build your packages.", Log::LV_USER)
-                       @log.error( "Host-OS (#{@os}) is not supported in build server.", Log::LV_USER)
-                       @status = "ERROR"
-                       @server.log.info "Adding the job \"#{@id}\" is canceled"
+                       if not check_package_version(@git_commit) then
+                               @status = "ERROR"
+                               return false
+                       end
                end
 
                return true
index b69b4bc51215b4331290c94d988d070f25b9383d..ef2619f2cac41ba4b1f17e73195060176b9a174a 100644 (file)
@@ -226,7 +226,7 @@ class ProjectManager
                name = "UNNAMED_PRJ_#{@projects.count}"
                branch = "master"
                passwd = nil
-               os_list = @server.supported_os_list
+               os_list = Utils.get_all_OSs()
                # add
                add_git_project(name , repos, branch, passwd, os_list)
                # get
index b865b98e8465fabe33544221bd20cfb96e44b2eb..b8898bf7afca6b5a91f30d1ac3d8bea1eecfdb99 100644 (file)
@@ -164,10 +164,12 @@ class SocketJobRequestListener
                git_commit = (not tok[8].nil? and not tok[8].empty?) ? tok[8] : nil
                pkg_files = (not tok[9].nil? and not tok[9].empty?) ? tok[9].split(",") : []
 
-               # check supported os
-               os_list = check_supported_os( os_list , req )
-               if os_list.nil? or os_list.empty? then
-                       raise "Unsupported OS name is used!"
+               # check supported os if not internal job
+               if not is_internal then
+                       os_list = check_supported_os( os_list , req )
+                       if os_list.nil? or os_list.empty? then
+                               raise "Unsupported OS name is used!"
+                       end
                end
 
                # multi build job
index 11389cd13e92dbdfbd817fb4c8f871b1608912a7..5fa14b25be3f95c2f4b11fb8acedc32d8acaeeb7 100644 (file)
@@ -60,12 +60,7 @@ class Utils
 
 
        def Utils.check_host_OS()
-               if HOST_OS == "ubuntu-32" or
-                       HOST_OS == "ubuntu-64" or
-                       HOST_OS == "windows-32" or
-                       HOST_OS == "windows-64" or
-                       HOST_OS == "macos-64" then
-
+               if Utils.get_all_OSs().include? HOST_OS then
                        return true
                else
                        return false
@@ -73,6 +68,11 @@ class Utils
        end
 
 
+       def Utils.get_all_OSs()
+               return ["ubuntu-32","ubuntu-64","windows-32","windows-64","macos-64"]   
+       end
+
+
     def Utils.create_uniq_name      
         time = Time.new     
         # uniq snapshot_name name is year_month_day_hour_min_sec_microsec       
index e5cd99517b4bae223aba553fa7b5a74271b1d0ed..87e1de1ad2b9ccff9c0670e4a7b1b1c1188f8c9c 100644 (file)
@@ -4,9 +4,8 @@ echo "if there doe not exist server to build, error"
 ../build-cli build -N testa -d 127.0.0.1:2223 -o windows-32
 #POST-EXEC
 #EXPECT
-Info: Added new job
+Info: Added new job "5" for windows-32!
 Info: Initializing job...
-Info: Checking package version ...
 Error: No servers that are able to build your packages.
 Error: Host-OS (windows-32) is not supported in build server.
 Error: Job is stopped by ERROR