Merge pull request #905 from warpc/874-create-repo-file-for-rhel-container

[refs #874]: direct sending of params what used for executable scripts without abf-workers changes, refactoring;
This commit is contained in:
Vladimir Sharshov 2013-02-11 06:32:40 -08:00
commit 9b17336c7c
1 changed files with 58 additions and 45 deletions

View File

@ -72,29 +72,36 @@ module AbfWorker
packages = {:sources => [], :binaries => {:x86_64 => [], :i586 => []}} packages = {:sources => [], :binaries => {:x86_64 => [], :i586 => []}}
packages[:sources] = build_list.packages.by_package_type('source').pluck(:sha1).compact packages[:sources] = build_list.packages.by_package_type('source').pluck(:sha1).compact
packages[:binaries][build_list.arch.name.to_sym] = build_list.packages.by_package_type('binary').pluck(:sha1).compact packages[:binaries][build_list.arch.name.to_sym] = build_list.packages.by_package_type('binary').pluck(:sha1).compact
distrib_type = build_list.build_for_platform.distrib_type
cmd_params = {
'RELEASED' => false,
'REPOSITORY_NAME' => build_list.save_to_repository.name,
'TYPE' => distrib_type,
'IS_CONTAINER' => true,
'ID' => build_list.id,
'PLATFORM_NAME' => build_list.save_to_platform.name
}.map{ |k, v| "#{k}=#{v}" }.join(' ')
Resque.push( Resque.push(
'publish_worker_default', 'publish_worker_default',
'class' => 'AbfWorker::PublishWorkerDefault', 'class' => 'AbfWorker::PublishWorkerDefault',
'args' => [{ 'args' => [{
:id => build_list.id, :id => build_list.id,
:arch => build_list.arch.name, :arch => build_list.arch.name,
:distrib_type => build_list.build_for_platform.distrib_type, :distrib_type => distrib_type,
:platform => { :cmd_params => cmd_params,
:platform_path => platform_path, :platform => {:platform_path => platform_path},
:released => false :repository => {:id => build_list.save_to_repository_id},
}, :type => :publish,
:repository => { :time_living => 9600, # 160 min
:name => build_list.save_to_repository.name, :packages => packages,
:id => build_list.save_to_repository.id :old_packages => {:sources => [], :binaries => {:x86_64 => [], :i586 => []}},
}, :build_list_ids => [build_list.id],
:type => :publish,
:time_living => 9600, # 160 min
:packages => packages,
:old_packages => {:sources => [], :binaries => {:x86_64 => [], :i586 => []}},
:build_list_ids => [build_list.id],
:projects_for_cleanup => [], :projects_for_cleanup => [],
:extra => {:create_container => true} :extra => {:create_container => true}
}] }]
) )
end end
@ -112,24 +119,28 @@ module AbfWorker
Repository.where(:id => (resign_repos - locked_repositories)).each do |r| Repository.where(:id => (resign_repos - locked_repositories)).each do |r|
@redis.lrem RESIGN_REPOSITORIES, 0, r.id @redis.lrem RESIGN_REPOSITORIES, 0, r.id
@redis.lpush LOCKED_REPOSITORIES, r.id @redis.lpush LOCKED_REPOSITORIES, r.id
distrib_type = r.platform.distrib_type
cmd_params = {
'RELEASED' => r.platform.released,
'REPOSITORY_NAME' => r.name,
'TYPE' => distrib_type
}.map{ |k, v| "#{k}=#{v}" }.join(' ')
Resque.push( Resque.push(
'publish_worker_default', 'publish_worker_default',
'class' => "AbfWorker::PublishWorkerDefault", 'class' => "AbfWorker::PublishWorkerDefault",
'args' => [{ 'args' => [{
:id => r.id, :id => r.id,
:arch => 'x86_64', :arch => 'x86_64',
:distrib_type => r.platform.distrib_type, :distrib_type => distrib_type,
:platform => { :cmd_params => cmd_params,
:platform_path => "#{r.platform.path}/repository", :platform => {:platform_path => "#{r.platform.path}/repository"},
:released => r.platform.released :repository => {:id => r.id},
}, :type => :resign,
:repository => { :skip_feedback => true,
:name => r.name, :time_living => 9600 # 160 min
:id => r.id
},
:type => :resign,
:skip_feedback => true,
:time_living => 9600 # 160 min
}] }]
) )
end end
@ -207,20 +218,22 @@ module AbfWorker
worker_queue = bl.worker_queue_with_priority("publish_worker") worker_queue = bl.worker_queue_with_priority("publish_worker")
worker_class = bl.worker_queue_class("AbfWorker::PublishWorker") worker_class = bl.worker_queue_class("AbfWorker::PublishWorker")
distrib_type = bl.build_for_platform.distrib_type
cmd_params = {
'RELEASED' => bl.save_to_platform.released,
'REPOSITORY_NAME' => bl.save_to_repository.name,
'TYPE' => distrib_type
}.map{ |k, v| "#{k}=#{v}" }.join(' ')
options = { options = {
:id => bl.id, :id => bl.id,
:arch => bl.arch.name, :arch => bl.arch.name,
:distrib_type => bl.build_for_platform.distrib_type, :distrib_type => distrib_type,
:platform => { :cmd_params => cmd_params,
:platform_path => platform_path, :platform => {:platform_path => platform_path},
:released => bl.save_to_platform.released :repository => {:id => bl.save_to_repository.id},
}, :type => :publish,
:repository => { :time_living => 9600 # 160 min
:name => bl.save_to_repository.name,
:id => bl.save_to_repository.id
},
:type => :publish,
:time_living => 9600 # 160 min
} }
packages = {:sources => [], :binaries => {:x86_64 => [], :i586 => []}} packages = {:sources => [], :binaries => {:x86_64 => [], :i586 => []}}