#755: add workers for publishing build_lists

This commit is contained in:
Vokhmin Alexey V 2012-12-06 14:11:51 +04:00
parent 4b5a45bb1a
commit 1f74b25522
4 changed files with 71 additions and 0 deletions

View File

@ -288,6 +288,16 @@ class BuildList < ActiveRecord::Base
@status ||= BUILD_PENDING
end
def publish_container
type = save_to_platform.distrib_type
Resque.push(
"publish_build_list_container_#{type}",
'class' => "AbfWorker::PublishBuildListContainer#{type.capitalize}",
'args' => [{:id => id}]
)
true
end
def add_to_queue
if new_core?
add_to_abf_worker_queue

View File

@ -0,0 +1,43 @@
module AbfWorker
module Helpers
module PublishBuildListContainerHelper
def perform(options)
initialize_worker BuildList.find(options['id'])
publish
end
private
def publish
@build_list.packages.each do |package|
pdir_srpm = @platsdir + "/" + pname + "/repository/" + bpname + "/SRPMS/" + repo + "/" + version
pdir_rpm = @platsdir + "/" + pname + "/repository/" + bpname + "/" + arch + "/" + repo + "/" + version
end
end
def initialize_worker(id)
@build_list = BuildList.find(id)
save_to_platform = @build_list.save_to_platform
@plid = save_to_platform.id
@pname = save_to_platform.name
@version = save_to_platform.released ? 'updates' : 'release'
# TODO: where I can find it???
@platsdir = "#{APP_CONFIG[root]}/platforms"
@arch = @build_list.arch.name
# TODO: what is it???
only_newer = res[0]["only_newer"]
build_for_platform = @build_list.build_for_platform
@idbuild_platform = build_for_platform.id
@bpname = build_for_platform.name
@blname = "#{@build_list.items.first.name}-#{@build_list.bs_id}"
@bprid = @build_list.project_id
@bprname = @build_list.project.name
end
end
end
end

View File

@ -0,0 +1,9 @@
module AbfWorker
class PublishBuildListContainerMdv
extend AbfWorker::Helpers::PublishBuildListContainerHelper
@queue = :publish_build_list_container_mdv
# see: PublishBuildListContainerHelper#perform
end
end

View File

@ -0,0 +1,9 @@
module AbfWorker
class PublishBuildListContainerRhel
extend AbfWorker::Helpers::PublishBuildListContainerHelper
@queue = :publish_build_list_container_rhel
# see: PublishBuildListContainerHelper#perform
end
end