From 4f9d63e4da32aa4a2423465db127880f79a00813 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Thu, 10 Jan 2013 16:49:01 +0400 Subject: [PATCH] #780: update publications --- app/models/build_list.rb | 9 ++++++--- lib/tasks/new_core.rake | 6 +++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app/models/build_list.rb b/app/models/build_list.rb index 4f237eb93..3d779c34e 100644 --- a/app/models/build_list.rb +++ b/app/models/build_list.rb @@ -282,7 +282,7 @@ class BuildList < ActiveRecord::Base Dir.mkdir(platform_path) unless File.exists?(platform_path) end - packages = last_published.includes(:packages).limit(5).map{ |bl| bl.packages }.flatten + packages = last_published.includes(:packages).limit(5).map{ |bl| bl.packages }.flatten sources = packages.map{ |p| p.fullname if p.package_type == 'source' }.compact binaries = packages.map{ |p| p.fullname if p.package_type == 'binary' }.compact @@ -293,8 +293,11 @@ class BuildList < ActiveRecord::Base :id => id, :arch => arch.name, :distrib_type => type, - :container_sha1 => archive['sha1'], - :packages => { :sources => sources, :binaries => binaries }, + :packages => { + :sources => packages.by_package_type('source').pluck(:sha1), + :binaries => packages.by_package_type('binary').pluck(:sha1) + }, + :old_packages => { :sources => sources, :binaries => binaries }, :platform => { :platform_path => platform_path, :released => save_to_platform.released diff --git a/lib/tasks/new_core.rake b/lib/tasks/new_core.rake index bbfa37f54..5628b0067 100644 --- a/lib/tasks/new_core.rake +++ b/lib/tasks/new_core.rake @@ -80,8 +80,8 @@ namespace :new_core do system "cd #{dir} && tar -xzf #{sha1}" system "rm -f #{dir}/#{sha1}" - extract_rpms_and_update_package("#{dir}/archives/SRC_RPM", bl, 'source', token) - extract_rpms_and_update_package("#{dir}/archives/RPM", bl, 'binary', token) + extract_rpms_and_update_packages("#{dir}/archives/SRC_RPM", bl, 'source', token) + extract_rpms_and_update_packages("#{dir}/archives/RPM", bl, 'binary', token) ensure # remove the directory. FileUtils.remove_entry_secure dir @@ -91,7 +91,7 @@ namespace :new_core do say "[#{Time.zone.now}] done" end - def extract_rpms_and_update_package(dir, bl, package_type, token) + def extract_rpms_and_update_packages(dir, bl, package_type, token) Dir.glob("#{dir}/*.rpm") do |rpm_file| fullname = File.basename rpm_file package = bl.packages.by_package_type(package_type).