#780: update publications

This commit is contained in:
Vokhmin Alexey V 2013-01-10 16:49:01 +04:00
parent 4fcedfff25
commit 4f9d63e4da
2 changed files with 9 additions and 6 deletions

View File

@ -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

View File

@ -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).