From 62b8b3524d5e882b1811191e2a683fcc3969580d Mon Sep 17 00:00:00 2001 From: Wedge Date: Wed, 1 Apr 2020 20:45:07 +0300 Subject: [PATCH] Add enable 32bit to build lists to add i686 repos for x86_64 builds --- app/models/build_list.rb | 10 ++++++++++ app/policies/build_list_policy.rb | 1 + .../new_build/_extra_params_and_preferences.html.slim | 8 ++++++-- app/views/projects/build_lists/show.html.slim | 6 +++++- .../20200401170442_add_enable32_bit_to_build_lists.rb | 5 +++++ db/schema.rb | 3 ++- 6 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 db/migrate/20200401170442_add_enable32_bit_to_build_lists.rb diff --git a/app/models/build_list.rb b/app/models/build_list.rb index 67ec5a4f2..d2dc6a593 100644 --- a/app/models/build_list.rb +++ b/app/models/build_list.rb @@ -506,6 +506,16 @@ class BuildList < ActiveRecord::Base h["#{prefix}release"] = insert_token_to_path(path + 'release', repo.platform) h["#{prefix}updates"] = insert_token_to_path(path + 'updates', repo.platform) if repo.platform.main? h["#{prefix}testing"] = insert_token_to_path(path + 'testing', repo.platform) if include_testing_subrepository? + if enable_32bit? && arch.name == 'x86_64' + path, prefix = repo.platform.public_downloads_url( + repo.platform.main? ? nil : build_for_platform.name, + 'i686', + repo.name + ), "#{repo.platform.name}_#{repo.name}32_" + h["#{prefix}release"] = insert_token_to_path(path + 'release', repo.platform) + h["#{prefix}updates"] = insert_token_to_path(path + 'updates', repo.platform) if repo.platform.main? + h["#{prefix}testing"] = insert_token_to_path(path + 'testing', repo.platform) if include_testing_subrepository? + end end end host = EventLog.current_controller.request.host_with_port rescue ::Rosa::Application.config.action_mailer.default_url_options[:host] diff --git a/app/policies/build_list_policy.rb b/app/policies/build_list_policy.rb index 5f946913e..d5a509c59 100644 --- a/app/policies/build_list_policy.rb +++ b/app/policies/build_list_policy.rb @@ -74,6 +74,7 @@ class BuildListPolicy < ApplicationPolicy save_to_repository_id use_cached_chroot use_extra_tests + enable_32bit ) pa << { include_repos: [], diff --git a/app/views/projects/build_lists/new_build/_extra_params_and_preferences.html.slim b/app/views/projects/build_lists/new_build/_extra_params_and_preferences.html.slim index 8cc658b95..958611e5f 100644 --- a/app/views/projects/build_lists/new_build/_extra_params_and_preferences.html.slim +++ b/app/views/projects/build_lists/new_build/_extra_params_and_preferences.html.slim @@ -22,12 +22,16 @@ h4.offset10= t("activerecord.attributes.build_list.preferences") name= 'build_list[auto_create_container]' ] = BuildList.human_attribute_name :auto_create_container -- %i(include_testing_subrepository use_cached_chroot use_extra_tests save_buildroot native_build).each do |kind| +- %i(include_testing_subrepository use_cached_chroot use_extra_tests save_buildroot native_build enable_32bit).each do |kind| .checkbox label + - puts "#{kind} #{params[:build_list].try(:[], kind)}" - checked = params[:build_list].try(:[], kind) || kind == :use_cached_chroot - checked = @build_list.send(kind) if checked.nil? - = f.check_box kind, {}, "true", "false" + - if checked + = f.check_box kind, { checked: true }, "true", "false" + - else + = f.check_box kind, {}, "true", "false" = BuildList.human_attribute_name kind - selected = params[:build_list].try(:[], :external_nodes) diff --git a/app/views/projects/build_lists/show.html.slim b/app/views/projects/build_lists/show.html.slim index 910359ab1..0cd234021 100644 --- a/app/views/projects/build_lists/show.html.slim +++ b/app/views/projects/build_lists/show.html.slim @@ -102,6 +102,10 @@ div[ ng-controller='BuildListController' td= t('activerecord.attributes.build_list.save_buildroot') td= t("layout.#{@build_list.save_buildroot?}_") + tr + td= 'Enable 32bit' + td= @build_list.enable_32bit + tr td= t('activerecord.attributes.build_list.project_version') td= @build_list.project_version @@ -197,4 +201,4 @@ div[ ng-controller='BuildListController' rd-widget-body = form_for @build_list, url: publish_build_list_path(@build_list), html: {class: :"form-inline"} do |f| .buttons-block - = render 'buttons', build_list: @build_list \ No newline at end of file + = render 'buttons', build_list: @build_list diff --git a/db/migrate/20200401170442_add_enable32_bit_to_build_lists.rb b/db/migrate/20200401170442_add_enable32_bit_to_build_lists.rb new file mode 100644 index 000000000..e334d2df5 --- /dev/null +++ b/db/migrate/20200401170442_add_enable32_bit_to_build_lists.rb @@ -0,0 +1,5 @@ +class AddEnable32BitToBuildLists < ActiveRecord::Migration + def change + add_column :build_lists, :enable_32bit, :bool, default: false + end +end diff --git a/db/schema.rb b/db/schema.rb index ef0216dd3..37f594c74 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20200121215842) do +ActiveRecord::Schema.define(version: 20200401170442) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -103,6 +103,7 @@ ActiveRecord::Schema.define(version: 20200121215842) do t.string "hostname" t.string "fail_reason" t.boolean "native_build", :default=>false + t.boolean "enable_32bit", :default=>false end add_index "build_lists", ["project_id", "save_to_repository_id", "build_for_platform_id", "arch_id"], :name=>"maintainer_search_index"