add a new core option to mass_builds

This commit is contained in:
Alexander Machehin 2012-12-25 18:03:41 +06:00
parent 3d707f7850
commit 7d58b89366
6 changed files with 13 additions and 8 deletions

View File

@ -12,7 +12,8 @@ class Platforms::MassBuildsController < Platforms::BaseController
def create
mass_build = @platform.mass_builds.new(:arches => params[:arches],
:auto_publish => params[:auto_publish] || false,
:projects_list => params[:projects_list])
:projects_list => params[:projects_list],
:new_core => params[:new_core])
mass_build.user = current_user
authorize! :create, mass_build

View File

@ -7,7 +7,7 @@ class MassBuild < ActiveRecord::Base
scope :outdated, where('created_at < ?', Time.now + 1.day - BuildList::MAX_LIVE_TIME)
attr_accessor :arches
attr_accessible :arches, :auto_publish, :projects_list
attr_accessible :arches, :auto_publish, :projects_list, :new_core
validates :platform_id, :arch_names, :name, :user_id, :projects_list, :presence => true
validates_inclusion_of :auto_publish, :in => [true, false]
@ -38,7 +38,7 @@ class MassBuild < ActiveRecord::Base
return if self.reload.stop_build
arches_list.each do |arch|
rep = (project.repositories & platform.repositories).first
project.build_for(platform, rep.id, user, arch, auto_publish, self.id)
project.build_for(platform, rep.id, user, arch, auto_publish, self.id, 0, new_core)
end
rescue RuntimeError, Exception
end

View File

@ -130,7 +130,7 @@ class Project < ActiveRecord::Base
#path #share by NFS
end
def build_for(platform, repository_id, user, arch = Arch.find_by_name('i586'), auto_publish = false, mass_build_id = nil, priority = 0)
def build_for(platform, repository_id, user, arch = Arch.find_by_name('i586'), auto_publish = false, mass_build_id = nil, priority = 0, new_core = false)
# Select main and project platform repository(contrib, non-free and etc)
# If main does not exist, will connect only project platform repository
# If project platform repository is main, only main will be connect
@ -149,6 +149,7 @@ class Project < ActiveRecord::Base
bl.priority = priority
bl.mass_build_id = mass_build_id
bl.save_to_repository_id = repository_id
bl.new_core = new_core
end
end

View File

@ -16,8 +16,10 @@
%h3= t("activerecord.attributes.build_list.preferences")
.both.bottom_20
= check_box_tag :auto_publish, true, @auto_publish_selected, :id => 'auto_publish'
= label_tag :auto_publish
= label_tag :auto_publish, t('activerecord.attributes.build_list.auto_publish')
%br
= check_box_tag :new_core, true, false
= label_tag :new_core, t('activerecord.attributes.build_list.new_core')
%br
%br

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20121224125838) do
ActiveRecord::Schema.define(:version => 20121225103309) do
create_table "activity_feeds", :force => true do |t|
t.integer "user_id", :null => false
@ -253,6 +253,7 @@ ActiveRecord::Schema.define(:version => 20121224125838) do
t.text "projects_list"
t.integer "missed_projects_count", :default => 0, :null => false
t.text "missed_projects_list"
t.boolean "new_core", :default => false
end
create_table "platforms", :force => true do |t|

View File

@ -13,7 +13,7 @@ namespace :build do
open(source).readlines.each do |name|
name.chomp!; name.strip! #; name.downcase!
if p = Project.joins(:repositories).where('repositories.id IN (?)', platform.repositories).find_by_name(name)
p.build_for(platform, owner, arch)
# Old code p.build_for(platform, owner, arch)
say "== Build #{p.name} =="
else
say "== Not found #{name} =="