diff --git a/app/controllers/build_lists_controller.rb b/app/controllers/build_lists_controller.rb index b9e6a41fa..b4a54d3dd 100644 --- a/app/controllers/build_lists_controller.rb +++ b/app/controllers/build_lists_controller.rb @@ -128,7 +128,7 @@ class BuildListsController < ApplicationController def find_project_versions @git_repository = @project.git_repository - @project_versions = @project.project_versions + @project_versions = @project.collected_project_versions end def find_build_list_by_bs diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index af0df1015..40bef8bfe 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -65,7 +65,7 @@ class ProjectsController < ApplicationController uname, unixname = params[:git_repo].split('/') owner = User.find_by_uname(uname) || Group.find_by_uname(uname) project = Project.where(:owner_id => owner.id, :owner_type => owner.class).find_by_unixname!(unixname) - project.auto_build + project.delay.auto_build # TODO don't queue duplicates # p = params.delete_if{|k,v| k == 'controller' or k == 'action'} # ActiveSupport::Notifications.instrument("event_log.observer", :object => project, :message => p.inspect) diff --git a/app/models/build_list.rb b/app/models/build_list.rb index d8f1b4ec1..1d003245d 100644 --- a/app/models/build_list.rb +++ b/app/models/build_list.rb @@ -25,8 +25,8 @@ class BuildList < ActiveRecord::Base WAITING_FOR_RESPONSE = 4000 BUILD_PENDING = 2000 BUILD_STARTED = 3000 - TEST_FAILD = 2 BUILD_PUBLISHED = 6000 + TEST_FAILD = 21 STATUSES = [WAITING_FOR_RESPONSE, BuildServer::SUCCESS, diff --git a/app/models/platform.rb b/app/models/platform.rb index 63fb70218..8071e49db 100644 --- a/app/models/platform.rb +++ b/app/models/platform.rb @@ -51,21 +51,23 @@ class Platform < ActiveRecord::Base def urpmi_list(host, pair = nil) blank_pair = {:login => 'login', :pass => 'password'} pair = blank_pair if pair.blank? - urpmi_commands = [] - - pls = Platform.main.open - #pls << self - pls.each do |pl| + urpmi_commands = ActiveSupport::OrderedHash.new + + Platform.main.open.each do |pl| + urpmi_commands[pl.name] = [] local_pair = pl.id != self.id ? blank_pair : pair - #tail = (pl.id != self.id && pl.distrib_type == APP_CONFIG['distr_types'].first) ? "/$ARCH/main/release" : "" - tail = (pl.distrib_type == APP_CONFIG['distr_types'].first) ? "/$ARCH/main/release" : "" - head = self.hidden? ? "http://#{ local_pair[:login] }@#{ local_pair[:pass] }:#{ host }/private/" : "http://#{ host }/downloads/" - urpmi_commands << [ - "urpmi.addmedia #{ head }#{ self.unixname }/repository/#{ pl.unixname }#{ tail }", - pl.name - ] + head = hidden? ? "http://#{local_pair[:login]}@#{local_pair[:pass]}:#{host}/private/" : "http://#{host}/downloads/" + if pl.distrib_type == APP_CONFIG['distr_types'].first + Arch.all.each do |arch| + tail = "/#{arch.name}/main/release" + urpmi_commands[pl.name] << "urpmi.addmedia #{unixname} #{head}#{unixname}/repository/#{pl.unixname}#{tail}" + end + else + tail = '' + urpmi_commands[pl.name] << "urpmi.addmedia #{unixname} #{head}#{unixname}/repository/#{pl.unixname}#{tail}" + end end - + return urpmi_commands end diff --git a/app/models/project.rb b/app/models/project.rb index f0df85903..09f0a463c 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -45,24 +45,24 @@ class Project < ActiveRecord::Base :pl => auto_build_list.pl, :bpl => auto_build_list.bpl, :arch => auto_build_list.arch, - :project_version => collected_project_versions.last.try(:first), + :project_version => collected_project_versions.last, :build_requires => true, - :update_type => 'bugfix') + :update_type => 'bugfix') unless build_lists.for_creation_date_period(Time.current - 15.seconds, Time.current).present? end end def project_versions - res = tags.select { |tag| tag.name =~ /^v\./ } + res = tags.select{|tag| tag.name =~ /^v\./} return res if res and res.size > 0 tags end - + def collected_project_versions - project_versions.collect { |tag| new_tag = tag.name.gsub(/^\w+\./, ""); [new_tag, new_tag] } + project_versions.collect{|tag| tag.name.gsub(/^\w+\./, "")} end def tags - self.git_repository.tags + self.git_repository.tags.sort_by{|t| t.name.gsub(/[a-zA-Z.]+/, '').to_i} end def members diff --git a/app/views/build_lists/_filter.html.haml b/app/views/build_lists/_filter.html.haml index 65bb3745d..07e8a1b73 100644 --- a/app/views/build_lists/_filter.html.haml +++ b/app/views/build_lists/_filter.html.haml @@ -16,7 +16,7 @@ - if @project_versions .group = f.label :project_version, t("activerecord.attributes.build_list.project_version"), :class => :label - = f.select :project_version, @project_versions.collect{|project_version| [project_version.name, project_version.name]}, :include_blank => true, :selected => @filter.project_version + = f.select :project_version, @project_versions, :include_blank => true, :selected => @filter.project_version .group = f.label :is_circle, t("activerecord.attributes.build_list.is_circle"), :class => :label diff --git a/app/views/shared/_urpmi_list.html.haml b/app/views/shared/_urpmi_list.html.haml index 410bca0b0..085ba0a1b 100644 --- a/app/views/shared/_urpmi_list.html.haml +++ b/app/views/shared/_urpmi_list.html.haml @@ -1,9 +1,10 @@ .group %span Данные для подключения: .group{:style => 'padding-left: 10px'} - - urpmi_commands.each do |urpmi_command| - = urpmi_command[1] + ":" + - urpmi_commands.each do |platform, commands| + #{platform}: .group{:style => 'padding-left: 20px'} - %span= urpmi_command[0] - %br + - commands.each do |command| + %span= command + %br %br \ No newline at end of file