end
+ def is_same_with?(wjob)
+ # must have same distribution
+ if get_distribution_name() != wjob.get_distribution_name() then
+ return false
+ end
+
+ if @type != wjob.type then return false end
+
+ prj1 = get_project()
+ prj2 = wjob.get_project()
+
+ # check project name
+ if prj1.nil? or prj2.nil? or
+ prj1.name != prj2.name then
+ return false
+ end
+
+ # check version
+ if @pkginfo.nil? or wjob.pkginfo.nil? or
+ not(Version.new(@pkginfo.get_version()) == Version.new(wjob.pkginfo.get_version())) then
+ return false
+ end
+ end
+
+
def is_compatible_with?(o)
# must have same distribution
if get_distribution_name() != o.get_distribution_name() then
end
+ def is_same_with?(wjob)
+ # must have same distribution
+ if get_distribution_name() != wjob.get_distribution_name() then
+ return false
+ end
+ if @type != wjob.type then return false end
+
+ prj1 = @project
+ prj2 = wjob.get_project()
+
+ # check project name
+ if prj1.nil? or prj2.nil? or
+ prj1.name != prj2.name then
+ return false
+ end
+
+ # check version
+ if @pkginfo.nil? or wjob.pkginfo.nil? or
+ not(Version.new(@pkginfo.get_version()) == Version.new(wjob.pkginfo.get_version())) then
+ return false
+ end
+
+ if @git_commit != wjob.git_commit then return false end
+
+ # check compat os
+ wjob.pkginfo.get_target_packages(wjob.os).each do |p|
+ if not p.os_list.include?(@os) then return false end
+ end
+
+
+ return true
+ end
+
+
#
# PROTECTED/PRIVATE METHODS
#
end
end
+ # remove duplicated jobs
+ remove_duplicated_jobs()
+
# reverse build job -> internal job -> normal job
job = get_available_job
@reverse_build_jobs.delete_if {|j| j.id == job.id}
end
+
+ # will remove redundent jobs
+ def remove_duplicated_jobs()
+ @jobs.reverse.each do |j1|
+ if j1.status != "WAITING" then next end
+
+ @jobs.each do |j2|
+ if j1.id == j2.id then next end
+ if j2.status != "WAITING" and j2.status != "WORKING" and
+ j2.status != "REMOTE_WORKING" then
+ next
+ end
+
+ if j1.is_same_with?(j2) then
+ j1.log.error("There already exists same job. (#{j2.id})", Log::LV_USER)
+ j1.status = "ERROR"
+ break
+ end
+ end
+ end
+ end
+
+
# select the job whith no build-dependency problem
def get_available_job
# select reverse build job with round-robin method
end
+ def is_same_with?(o)
+ return false
+ end
+
+
def is_compatible_with?(o)
return false
end
attr_accessor :source_path
attr_accessor :pkgsvr_client, :pkg_type
- attr_accessor :pkg_name, :pkginfo
+ attr_accessor :pkg_name, :pkginfo, :pkg_version
attr_accessor :no_reverse
else
@pkg_type = "ARCHIVE"
@pkg_name = @filename
+ @pkg_version = "0"
end
@pkginfo = nil #This info is valid only for BINARY package
@project = project
@no_reverse = true
end
+
+ def set_send_result_back( dock_num )
+ # do nothing
+ end
+
+
+ def is_send_result_back?
+ return false
+ end
+
+
def execute_shell(cmd)
# if canceled, must prevent invoking more process
check_event
end
+ def is_same_with?(wjob)
+ # must have same distribution
+ if get_distribution_name() != wjob.get_distribution_name() then
+ return false
+ end
+
+ if @type != wjob.type then return false end
+
+ case @pkg_type
+ when "BINARY"
+ if @pkg_name == wjob.pkg_name and
+ @pkg_version == wjob.pkg_version and
+ wjob.pkginfo.packages.count == 1 and
+ wjob.pkginfo.packages[0].os_list.include?(@os) then
+ return true
+ end
+ when "ARCHIVE"
+ if @pkg_name == wjob.pkg_name then return true end
+ end
+
+ return false
+ end
+
+
def is_compatible_with?(o)
return false
end
--- /dev/null
+#PRE-EXEC
+echo "This case will check redundent job"
+../../build-cli build -N testa -d 127.0.0.1:2223 -o ubuntu-32 --rebuild &
+#EXEC
+sleep 2
+../../build-cli build -N testa -d 127.0.0.1:2223 -o ubuntu-32 --rebuild
+#POST-EXEC
+#EXPECT
+Info: Added new job
+Info: Initializing job...
+Info: Checking package version ...
+Error: There already exists same job.
+Error: Building job on remote server failed!
build-cli-33.testcase
build-cli-34.testcase
build-cli-35.testcase
+build-cli-36.testcase
--- /dev/null
+#PRE-EXEC
+echo "Will check duplicated registration"
+../../build-svr register -n testserver3 -D unstable -P bin/bin_0.0.1_ubuntu-32.zip &
+#EXEC
+sleep 1
+../../build-svr register -n testserver3 -D unstable -P bin/bin_0.0.1_ubuntu-32.zip
+#POST-EXEC
+#EXPECT
+Info: Added new job
+Info: Initializing job...
+Info: Checking package version ...
+Error: There already exists same job.
build-svr3-03.testcase
build-svr3-04.testcase
build-svr3-05.testcase
+build-svr3-06.testcase