From d19f96abce225be100715539f9783c6a69be1959 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Tue, 18 Dec 2012 17:18:54 +0400 Subject: [PATCH] #778: send packages for cleanup on publishing --- app/controllers/projects/build_lists_controller.rb | 1 - app/models/build_list.rb | 5 +++++ app/models/project.rb | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/controllers/projects/build_lists_controller.rb b/app/controllers/projects/build_lists_controller.rb index c13d5c254..a53adc333 100644 --- a/app/controllers/projects/build_lists_controller.rb +++ b/app/controllers/projects/build_lists_controller.rb @@ -56,7 +56,6 @@ class Projects::BuildListsController < Projects::BaseController where(:id => params[:build_list][:include_repos]).group(:platform_id).map(&:platform_id) new_core = BuildList.has_access_to_new_core?(current_user) && params[:build_list][:new_core] == '1' - params[:build_list][:auto_publish] = false if new_core Arch.where(:id => params[:arches]).each do |arch| Platform.main.where(:id => build_for_platforms).each do |build_for_platform| @build_list = @project.build_lists.build(params[:build_list]) diff --git a/app/models/build_list.rb b/app/models/build_list.rb index 56e3fcdc2..9883d6665 100644 --- a/app/models/build_list.rb +++ b/app/models/build_list.rb @@ -275,6 +275,10 @@ 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 + sources = packages.map{ |p| p.fullname if p.package_type == 'source' }.compact + binaries = packages.map{ |p| p.fullname if p.package_type == 'binary' }.compact + Resque.push( "publish_build_list_container_#{type}_worker", 'class' => "AbfWorker::PublishBuildListContainer#{type.capitalize}Worker", @@ -283,6 +287,7 @@ class BuildList < ActiveRecord::Base :arch => arch.name, :distrib_type => type, :container_sha1 => archive['sha1'], + :packages => { :sources => sources, :binaries => binaries }, :platform => { :platform_path => platform_path, :released => save_to_platform.released diff --git a/app/models/project.rb b/app/models/project.rb index 5f90c15b4..0e3cfd8fe 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -235,6 +235,7 @@ class Project < ActiveRecord::Base :released => platform.released }, :repository_name => repository.name, + :cleanup => true, :save_results => false, :time_living => 2400 # 40 min }]