#960: fix: NoMethodError "fill_packages"

This commit is contained in:
Vokhmin Alexey V 2013-03-01 20:19:15 +04:00
parent 66e1bcc4e8
commit 4d88827da4
1 changed files with 38 additions and 36 deletions

View File

@ -116,9 +116,6 @@ module AbfWorker
}]
)
end
end
private
def gather_old_packages(project_id, repository_id, platform_id)
build_lists_for_cleanup = []
@ -140,9 +137,26 @@ module AbfWorker
}
end
@redis.hset PACKAGES_FOR_CLEANUP, "#{project_id}-#{repository_id}-#{platform_id}", old_packages.to_json
redis.hset PACKAGES_FOR_CLEANUP, "#{project_id}-#{repository_id}-#{platform_id}", old_packages.to_json
end
def fill_packages(bl, results_map, field = :sha1)
results_map[:sources] |= bl.packages.by_package_type('source').pluck(field).compact if field != :sha1
binaries = bl.packages.by_package_type('binary').pluck(field).compact
arch = bl.arch.name.to_sym
results_map[:binaries][arch] |= binaries
# Publish/remove i686 RHEL packages into/from x86_64
if arch == :i586 && bl.build_for_platform.distrib_type == 'rhel' && bl.project.publish_i686_into_x86_64?
results_map[:binaries][:x86_64] |= binaries
end
end
end
private
def locked_repositories
@redis.lrange LOCKED_REPOSITORIES, 0, -1
end
@ -281,9 +295,9 @@ module AbfWorker
build_lists.each do |bl|
# remove duplicates of sources for different arches
bl.packages.by_package_type('source').each{ |s| new_sources["#{s.fullname}"] = s.sha1 }
fill_packages(bl, packages)
self.class.fill_packages(bl, packages)
bl.last_published.includes(:packages).limit(5).each{ |old_bl|
fill_packages(old_bl, old_packages, :fullname)
self.class.fill_packages(old_bl, old_packages, :fullname)
}
build_list_ids << bl.id
@redis.lpush(LOCKED_BUILD_LISTS, bl.id)
@ -309,18 +323,6 @@ module AbfWorker
return true
end
def fill_packages(bl, results_map, field = :sha1)
results_map[:sources] |= bl.packages.by_package_type('source').pluck(field).compact if field != :sha1
binaries = bl.packages.by_package_type('binary').pluck(field).compact
arch = bl.arch.name.to_sym
results_map[:binaries][arch] |= binaries
# Publish/remove i686 RHEL packages into/from x86_64
if arch == :i586 && bl.build_for_platform.distrib_type == 'rhel' && bl.project.publish_i686_into_x86_64?
results_map[:binaries][:x86_64] |= binaries
end
end
def create_tasks_for_repository_regenerate_metadata
worker_queue = 'publish_worker_default'
worker_class = 'AbfWorker::PublishWorkerDefault'