Merge pull request #900 from warpc/898-publish-i686-packages-into-x86_64-repository

[refs #898]: publish i686 packages into x86 64 repository
This commit is contained in:
Vladimir Sharshov 2013-02-07 06:57:09 -08:00
commit 0c69326e80
10 changed files with 53 additions and 24 deletions

View File

@ -2,9 +2,11 @@ Rosa.Views.ProjectModifyView = Backbone.View.extend({
initialize: function() { initialize: function() {
_.bindAll(this, 'checkboxClick'); _.bindAll(this, 'checkboxClick');
this.$checkbox_wrapper = $('#niceCheckbox1'); this.$checkbox_wrapper = $('#niceCheckbox1');
this._$checkbox = this.$checkbox_wrapper.children('#project_is_package').first(); this._$checkbox = this.$checkbox_wrapper.children('#project_is_package').first();
this.$maintainer_form = $('#maintainer_form'); this.$maintainer_form = $('#maintainer_form');
this.$publish_form = $('#publish_form');
this._$publish_checkbox = this.$publish_form.find('#project_publish_i686_into_x86_64').first();
this.$checkbox_wrapper.on('click', this.checkboxClick); this.$checkbox_wrapper.on('click', this.checkboxClick);
}, },
@ -12,8 +14,13 @@ Rosa.Views.ProjectModifyView = Backbone.View.extend({
checkboxClick: function() { checkboxClick: function() {
if (this._$checkbox.is(':checked')) { if (this._$checkbox.is(':checked')) {
this.$maintainer_form.slideDown(); this.$maintainer_form.slideDown();
this.$publish_form.slideDown();
} else { } else {
this.$maintainer_form.slideUp(); this.$maintainer_form.slideUp();
this.$publish_form.slideUp();
if (this._$publish_checkbox.is(':checked')) {
changeCheck(this.$publish_form.find('.niceCheck-main'));
}
} }
}, },

View File

@ -32,7 +32,7 @@ class Project < ActiveRecord::Base
validate { errors.add(:base, :can_have_less_or_equal, :count => MAX_OWN_PROJECTS) if owner.projects.size >= MAX_OWN_PROJECTS } validate { errors.add(:base, :can_have_less_or_equal, :count => MAX_OWN_PROJECTS) if owner.projects.size >= MAX_OWN_PROJECTS }
validate :check_default_branch validate :check_default_branch
attr_accessible :name, :description, :visibility, :srpm, :is_package, :default_branch, :has_issues, :has_wiki, :maintainer_id attr_accessible :name, :description, :visibility, :srpm, :is_package, :default_branch, :has_issues, :has_wiki, :maintainer_id, :publish_i686_into_x86_64
attr_readonly :name, :owner_id, :owner_type attr_readonly :name, :owner_id, :owner_type
scope :recent, order("name ASC") scope :recent, order("name ASC")

View File

@ -1,6 +1,6 @@
json.projects @projects do |json, project| json.projects @projects do |json, project|
json.partial! 'project', :project => project, :json => json json.partial! 'project', :project => project, :json => json
json.(project, :visibility, :description, :ancestry, :has_issues, :has_wiki, :default_branch, :is_package, :average_build_time) json.(project, :visibility, :description, :ancestry, :has_issues, :has_wiki, :default_branch, :is_package, :average_build_time, :publish_i686_into_x86_64)
json.created_at project.created_at.to_i json.created_at project.created_at.to_i
json.updated_at project.updated_at.to_i json.updated_at project.updated_at.to_i
json.partial! 'api/v1/shared/owner', :owner => project.owner json.partial! 'api/v1/shared/owner', :owner => project.owner

View File

@ -1,6 +1,6 @@
json.project do |json| json.project do |json|
json.partial! 'project', :project => @project, :json => json json.partial! 'project', :project => @project, :json => json
json.(@project, :visibility, :description, :ancestry, :has_issues, :has_wiki, :default_branch, :is_package, :average_build_time) json.(@project, :visibility, :description, :ancestry, :has_issues, :has_wiki, :default_branch, :is_package, :average_build_time, :publish_i686_into_x86_64)
json.created_at @project.created_at.to_i json.created_at @project.created_at.to_i
json.updated_at @project.updated_at.to_i json.updated_at @project.updated_at.to_i
json.partial! 'api/v1/shared/owner', :owner => @project.owner json.partial! 'api/v1/shared/owner', :owner => @project.owner

View File

@ -1,13 +1,13 @@
- act = controller.action_name.to_sym - act = controller.action_name.to_sym
- if [:new, :create].include? act - if [:new, :create].include? act
.leftlist= f.label :name, t("activerecord.attributes.project.name"), :class => :label .leftlist= f.label :name
.rightlist= f.text_field :name, :class => 'text_field', :disabled => f.object.try(:persisted?) .rightlist= f.text_field :name, :class => 'text_field', :disabled => f.object.try(:persisted?)
.both .both
.leftlist= f.label :description, t("activerecord.attributes.project.description"), :class => :label .leftlist= f.label :description
.rightlist= f.text_area :description, :class => 'text_field', :cols => 80 .rightlist= f.text_area :description, :class => 'text_field', :cols => 80
.both .both
- if [:new, :create].include? act - if [:new, :create].include? act
.leftlist= f.label :owner_id, t("activerecord.attributes.project.owner"), :class => :label .leftlist= f.label :owner
.rightlist .rightlist
= label_tag t("activerecord.attributes.project.who_owns.me") = label_tag t("activerecord.attributes.project.who_owns.me")
- if Group.can_own_project(current_user).count > 0 - if Group.can_own_project(current_user).count > 0
@ -20,7 +20,7 @@
= hidden_field_tag :who_owns, :me = hidden_field_tag :who_owns, :me
.both .both
.leftlist= f.label :visibility, t("activerecord.attributes.project.visibility"), :class => :label .leftlist= f.label :visibility
.rightlist .rightlist
=# f.select :visibility, Project::VISIBILITIES =# f.select :visibility, Project::VISIBILITIES
- Project::VISIBILITIES.each do |visibility| - Project::VISIBILITIES.each do |visibility|
@ -35,12 +35,19 @@
\  \ 
.rightlist .rightlist
.check .check
%span#niceCheckbox1.niceCheck-main= f.check_box :is_package#, :class => 'niceCheckbox1' %span#niceCheckbox1.niceCheck-main= f.check_box :is_package
.forcheck= t("activerecord.attributes.project.is_package") .forcheck= f.label :is_package
.both .both
- unless [:new, :create].include? act
#publish_form{:class => @project.publish_i686_into_x86_64 ? '' : 'hidden'}
.check
%span.niceCheck-main= f.check_box :publish_i686_into_x86_64
.forcheck= f.label :publish_i686_into_x86_64
.both
.both .both
- if [:edit, :update].include? act - if [:edit, :update].include? act
.leftlist= t("activerecord.attributes.project.default_branch") .leftlist= f.label :default_branch
.rightlist .rightlist
= f.select :default_branch, = f.select :default_branch,
options_from_collection_for_select( @project.repo.branches, options_from_collection_for_select( @project.repo.branches,
@ -50,7 +57,7 @@
#maintainer_form{:class => @project.is_package ? '' : 'hidden'} #maintainer_form{:class => @project.is_package ? '' : 'hidden'}
= f.hidden_field :maintainer_id, :value => @project.maintainer_id = f.hidden_field :maintainer_id, :value => @project.maintainer_id
.leftlist .leftlist
= t("activerecord.attributes.project.maintainer") = f.label :maintainer
.rightlist .rightlist
-# TODO: Maybe use something like Chosen with filter and prepopulated -# TODO: Maybe use something like Chosen with filter and prepopulated
-# list of potential maintainers? -# list of potential maintainers?
@ -59,7 +66,7 @@
:id_element => '#project_maintainer_id', :id_element => '#project_maintainer_id',
:placeholder => @project.maintainer.fullname :placeholder => @project.maintainer.fullname
- if [:new, :create].include? act - if [:new, :create].include? act
.leftlist= f.label :srpm, t("activerecord.attributes.project.srpm"), :class => :label .leftlist= f.label :srpm
.rightlist= f.file_field :srpm, :class => 'file_field' .rightlist= f.file_field :srpm, :class => 'file_field'
.both .both
.leftlist .leftlist

View File

@ -94,6 +94,7 @@ en:
group: Group group: Group
default_branch: Default branch default_branch: Default branch
is_package: Project is a package is_package: Project is a package
publish_i686_into_x86_64: Publish i686 packages into x86_64 repository (only for rhel)
maintainer: Maintainer of project maintainer: Maintainer of project
maintainer_id: Maintainer of project maintainer_id: Maintainer of project
errors: errors:

View File

@ -94,6 +94,7 @@ ru:
group: Группа group: Группа
default_branch: Ветка по умолчанию default_branch: Ветка по умолчанию
is_package: Проект является пакетом is_package: Проект является пакетом
publish_i686_into_x86_64: Публиковать i686 пакеты в x86_64 репозиторий (только для rhel)
maintainer_id: Майнтейнер проекта maintainer_id: Майнтейнер проекта
maintainer: Майнтейнер проекта maintainer: Майнтейнер проекта
errors: errors:

View File

@ -0,0 +1,5 @@
class AddPublishi686IntoX8664ToProject < ActiveRecord::Migration
def change
add_column :projects, :publish_i686_into_x86_64, :boolean, :default => false
end
end

View File

@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20130201094007) do ActiveRecord::Schema.define(:version => 20130207101148) do
create_table "activity_feeds", :force => true do |t| create_table "activity_feeds", :force => true do |t|
t.integer "user_id", :null => false t.integer "user_id", :null => false
@ -354,20 +354,21 @@ ActiveRecord::Schema.define(:version => 20130201094007) do
t.datetime "updated_at" t.datetime "updated_at"
t.integer "owner_id" t.integer "owner_id"
t.string "owner_type" t.string "owner_type"
t.string "visibility", :default => "open" t.string "visibility", :default => "open"
t.text "description" t.text "description"
t.string "ancestry" t.string "ancestry"
t.boolean "has_issues", :default => true t.boolean "has_issues", :default => true
t.string "srpm_file_name" t.string "srpm_file_name"
t.integer "srpm_file_size" t.integer "srpm_file_size"
t.datetime "srpm_updated_at" t.datetime "srpm_updated_at"
t.string "srpm_content_type" t.string "srpm_content_type"
t.boolean "has_wiki", :default => false t.boolean "has_wiki", :default => false
t.string "default_branch", :default => "master" t.string "default_branch", :default => "master"
t.boolean "is_package", :default => true, :null => false t.boolean "is_package", :default => true, :null => false
t.integer "average_build_time", :default => 0, :null => false t.integer "average_build_time", :default => 0, :null => false
t.integer "build_count", :default => 0, :null => false t.integer "build_count", :default => 0, :null => false
t.integer "maintainer_id" t.integer "maintainer_id"
t.boolean "publish_i686_into_x86_64", :default => false
end end
add_index "projects", ["owner_id", "name", "owner_type"], :name => "index_projects_on_name_and_owner_id_and_owner_type", :unique => true, :case_sensitive => false add_index "projects", ["owner_id", "name", "owner_type"], :name => "index_projects_on_name_and_owner_id_and_owner_type", :unique => true, :case_sensitive => false

View File

@ -268,7 +268,14 @@ module AbfWorker
def fill_packages(bl, results_map, field = :sha1) def fill_packages(bl, results_map, field = :sha1)
results_map[:sources] |= bl.packages.by_package_type('source').pluck(field).compact if field != :sha1 results_map[:sources] |= bl.packages.by_package_type('source').pluck(field).compact if field != :sha1
results_map[:binaries][bl.arch.name.to_sym] |= bl.packages.by_package_type('binary').pluck(field).compact
binaries = bl.packages.by_package_type('binary').pluck(field).compact
arch = bl.arch.name.to_sym
results_map[:binaries][arch] |= binaries
# Publish/remove i686 RHEL packages into/from x86_64
if arch == :i586 && bl.build_for_platform.distrib_type == 'rhel' && bl.project.publish_i686_into_x86_64?
results_map[:binaries][:x86_64] |= binaries
end
end end
end end