From 0b5276a3160fb5c262bbf46ad4cf62226a63a279 Mon Sep 17 00:00:00 2001 From: Ben Anderson Date: Sat, 6 Jan 2024 10:45:47 +1300 Subject: [PATCH 01/12] Send deprecation notices to the rails log (#241) Prior to this change, messages were being sent to the ActiveSupport::Notifications system in production (as per the Rails default) which doesn't appear to have any active listeners, meaning these notices were just being sent into the void. Send the messages to the log instead, so that we can see them. --- config/environments/production.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index a0951a24..e8b7beea 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -49,7 +49,7 @@ config.i18n.fallbacks = true # Send deprecation notices to registered listeners - config.active_support.deprecation = :notify + config.active_support.deprecation = :log # Compress JavaScript and CSS config.assets.compress = true From b084e51ec878bb3ff0fbacbade4fbc456f97ba14 Mon Sep 17 00:00:00 2001 From: Ben Anderson Date: Sat, 6 Jan 2024 10:46:26 +1300 Subject: [PATCH 02/12] Commit updated db/schema.rb (#225) Rails 4.2 introduced `force: :cascade` and uses that by default when dumping the schema[1] to make it possible to reload a schema when foreign keys are in place, so we now get a slightly different dump format. There are also other trivial differences. Commit this new version to reduce diff's when the schema is dumped. Note that there are additional differences when dumping databases created pre-4.2 (to do with `limit: 255`, see #225 for discussion), but they will be addressed separately. [1] https://guides.rubyonrails.org/v4.2/4_2_release_notes.html#active-record-notable-changes --- db/schema.rb | 82 ++++++++++++++++++++++++++-------------------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index 29dea819..a096daf6 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -16,7 +16,7 @@ # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" - create_table "contest_relations", force: true do |t| + create_table "contest_relations", force: :cascade do |t| t.integer "user_id" t.integer "contest_id" t.datetime "started_at" @@ -40,7 +40,7 @@ add_index "contest_relations", ["contest_id", "user_id"], name: "index_contest_relations_on_contest_id_and_user_id", unique: true, using: :btree add_index "contest_relations", ["user_id", "started_at"], name: "index_contest_relations_on_user_id_and_started_at", using: :btree - create_table "contest_scores", force: true do |t| + create_table "contest_scores", force: :cascade do |t| t.integer "contest_relation_id", null: false t.integer "problem_id", null: false t.integer "score" @@ -52,7 +52,7 @@ add_index "contest_scores", ["contest_relation_id", "problem_id"], name: "index_contest_scores_on_contest_relation_id_and_problem_id", using: :btree - create_table "contest_supervisors", force: true do |t| + create_table "contest_supervisors", force: :cascade do |t| t.integer "contest_id" t.integer "user_id" t.string "site_type" @@ -62,7 +62,7 @@ t.datetime "scheduled_start_time" end - create_table "contests", force: true do |t| + create_table "contests", force: :cascade do |t| t.string "name" t.datetime "start_time" t.datetime "end_time" @@ -80,13 +80,13 @@ t.boolean "only_rank_official_contestants", default: false end - create_table "entities", force: true do |t| + create_table "entities", force: :cascade do |t| t.string "name" t.integer "entity_id" t.string "entity_type" end - create_table "evaluators", force: true do |t| + create_table "evaluators", force: :cascade do |t| t.string "name", null: false t.text "description", default: "", null: false t.text "source", default: "", null: false @@ -95,7 +95,7 @@ t.datetime "updated_at" end - create_table "file_attachments", force: true do |t| + create_table "file_attachments", force: :cascade do |t| t.string "name" t.string "file_attachment" t.integer "owner_id" @@ -103,7 +103,7 @@ t.datetime "updated_at", null: false end - create_table "filelinks", force: true do |t| + create_table "filelinks", force: :cascade do |t| t.integer "root_id" t.integer "file_attachment_id" t.datetime "created_at" @@ -115,7 +115,7 @@ add_index "filelinks", ["file_attachment_id"], name: "index_filelinks_on_file_attachment_id", using: :btree add_index "filelinks", ["root_id", "filepath"], name: "index_filelinks_on_root_id_and_filepath", using: :btree - create_table "group_contests", force: true do |t| + create_table "group_contests", force: :cascade do |t| t.integer "group_id" t.integer "contest_id" end @@ -123,13 +123,13 @@ add_index "group_contests", ["contest_id", "group_id"], name: "index_group_contests_on_contest_id_and_group_id", using: :btree add_index "group_contests", ["group_id", "contest_id"], name: "index_group_contests_on_group_id_and_contest_id", using: :btree - create_table "group_memberships", force: true do |t| + create_table "group_memberships", force: :cascade do |t| t.integer "group_id" t.integer "member_id" t.datetime "created_at" end - create_table "group_problem_sets", force: true do |t| + create_table "group_problem_sets", force: :cascade do |t| t.integer "group_id" t.integer "problem_set_id" t.string "name" @@ -138,7 +138,7 @@ add_index "group_problem_sets", ["group_id", "problem_set_id"], name: "index_group_problem_sets_on_group_id_and_problem_set_id", using: :btree add_index "group_problem_sets", ["problem_set_id", "group_id"], name: "index_group_problem_sets_on_problem_set_id_and_group_id", using: :btree - create_table "groups", force: true do |t| + create_table "groups", force: :cascade do |t| t.string "name" t.datetime "created_at" t.datetime "updated_at" @@ -147,7 +147,7 @@ t.integer "membership", default: 0, null: false end - create_table "item_histories", force: true do |t| + create_table "item_histories", force: :cascade do |t| t.integer "item_id" t.boolean "active" t.integer "action" @@ -158,7 +158,7 @@ t.datetime "updated_at" end - create_table "items", force: true do |t| + create_table "items", force: :cascade do |t| t.integer "product_id" t.integer "owner_id" t.integer "organisation_id" @@ -170,7 +170,7 @@ t.integer "scan_token" end - create_table "language_groups", force: true do |t| + create_table "language_groups", force: :cascade do |t| t.string "identifier" t.string "name" t.integer "current_language_id" @@ -180,7 +180,7 @@ add_index "language_groups", ["identifier"], name: "index_language_groups_on_identifier", unique: true, using: :btree - create_table "languages", force: true do |t| + create_table "languages", force: :cascade do |t| t.string "identifier" t.string "compiler" t.boolean "interpreted" @@ -201,17 +201,17 @@ add_index "languages", ["identifier"], name: "index_languages_on_identifier", unique: true, using: :btree - create_table "organisations", force: true do |t| + create_table "organisations", force: :cascade do |t| end - create_table "problem_series", force: true do |t| + create_table "problem_series", force: :cascade do |t| t.string "name" t.string "identifier" t.string "importer_type" t.text "index_yaml" end - create_table "problem_set_problems", force: true do |t| + create_table "problem_set_problems", force: :cascade do |t| t.integer "problem_set_id" t.integer "problem_id" t.integer "problem_set_order" @@ -221,7 +221,7 @@ add_index "problem_set_problems", ["problem_id", "problem_set_id"], name: "index_problem_set_problems_on_problem_id_and_problem_set_id", using: :btree add_index "problem_set_problems", ["problem_set_id", "problem_id"], name: "index_problem_set_problems_on_problem_set_id_and_problem_id", using: :btree - create_table "problem_sets", force: true do |t| + create_table "problem_sets", force: :cascade do |t| t.string "name" t.integer "owner_id" t.datetime "created_at" @@ -229,7 +229,7 @@ t.integer "finalized_contests_count", default: 0 end - create_table "problems", force: true do |t| + create_table "problems", force: :cascade do |t| t.string "name" t.text "statement" t.string "input" @@ -246,44 +246,44 @@ t.integer "test_status", default: 0 end - create_table "products", force: true do |t| + create_table "products", force: :cascade do |t| t.string "name" t.integer "gtin", limit: 8 t.text "description" t.string "image" end - create_table "requests", force: true do |t| + create_table "requests", force: :cascade do |t| t.integer "requester_id" t.integer "subject_id" t.string "subject_type" - t.string "verb", null: false - t.integer "target_id", null: false - t.string "target_type", null: false - t.integer "status", default: 0, null: false + t.string "verb", null: false + t.integer "target_id", null: false + t.string "target_type", null: false + t.integer "status", default: 0, null: false t.integer "requestee_id" - t.datetime "expired_at", default: Infinity, null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "expired_at", default: 'Infinity', null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "roles", force: true do |t| + create_table "roles", force: :cascade do |t| t.string "name" end - create_table "roles_users", id: false, force: true do |t| + create_table "roles_users", id: false, force: :cascade do |t| t.integer "role_id" t.integer "user_id" end - create_table "schools", force: true do |t| + create_table "schools", force: :cascade do |t| t.string "name" t.string "country_code", limit: 2 t.integer "users_count" t.integer "synonym_id" end - create_table "sessions", force: true do |t| + create_table "sessions", force: :cascade do |t| t.string "session_id", null: false t.text "data" t.datetime "created_at" @@ -294,14 +294,14 @@ add_index "sessions", ["session_id"], name: "index_sessions_on_session_id", using: :btree add_index "sessions", ["updated_at"], name: "index_sessions_on_updated_at", using: :btree - create_table "settings", force: true do |t| + create_table "settings", force: :cascade do |t| t.string "key" t.string "value" end add_index "settings", ["key"], name: "index_settings_on_key", unique: true, using: :btree - create_table "submissions", force: true do |t| + create_table "submissions", force: :cascade do |t| t.text "source" t.integer "score" t.integer "user_id" @@ -325,7 +325,7 @@ add_index "submissions", ["problem_id", "created_at"], name: "index_submissions_on_problem_id_and_created_at", using: :btree add_index "submissions", ["user_id", "problem_id"], name: "index_submissions_on_user_id_and_problem_id", using: :btree - create_table "test_case_relations", force: true do |t| + create_table "test_case_relations", force: :cascade do |t| t.integer "test_case_id" t.integer "test_set_id" t.datetime "created_at", null: false @@ -335,7 +335,7 @@ add_index "test_case_relations", ["test_case_id"], name: "index_test_case_relations_on_test_case_id", using: :btree add_index "test_case_relations", ["test_set_id"], name: "index_test_case_relations_on_test_set_id", using: :btree - create_table "test_cases", force: true do |t| + create_table "test_cases", force: :cascade do |t| t.text "input" t.text "output" t.string "name" @@ -348,7 +348,7 @@ add_index "test_cases", ["problem_id", "name"], name: "index_test_cases_on_problem_id_and_name", unique: true, using: :btree - create_table "test_sets", force: true do |t| + create_table "test_sets", force: :cascade do |t| t.integer "problem_id" t.integer "points" t.string "name" @@ -360,7 +360,7 @@ add_index "test_sets", ["problem_id", "name"], name: "index_test_sets_on_problem_id_and_name", unique: true, using: :btree - create_table "user_problem_relations", force: true do |t| + create_table "user_problem_relations", force: :cascade do |t| t.integer "problem_id" t.integer "user_id" t.integer "submissions_count" @@ -376,7 +376,7 @@ add_index "user_problem_relations", ["problem_id", "ranked_score"], name: "index_user_problem_relations_on_problem_id_and_ranked_score", using: :btree add_index "user_problem_relations", ["user_id", "problem_id"], name: "index_user_problem_relations_on_user_id_and_problem_id", unique: true, using: :btree - create_table "users", force: true do |t| + create_table "users", force: :cascade do |t| t.string "email", default: "", null: false t.string "encrypted_password", default: "", null: false t.string "reset_password_token" From 57b299d1f4fff094055d335e5a8abee1f6c535d0 Mon Sep 17 00:00:00 2001 From: Tom Levy Date: Sat, 6 Jan 2024 12:45:29 +1300 Subject: [PATCH 03/12] Add CI check that db/schema.rb matches result of migrations (#247) --- .github/workflows/ci.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 909e1650..66d6b355 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,6 +48,9 @@ jobs: ISOLATE_CGROUPS: false ISOLATE_BRANCH: master + - name: Back up db/schema.rb # it will be overwritten when install.bash runs migrate.bash; back up the original so we can check if it's up to date + run: cp db/schema.rb db/schema.rb.git + - run: AUTOCONFIRM=true script/install.bash env: PGHOST: localhost @@ -57,6 +60,11 @@ jobs: #- run: bundle exec rake db:test:load # not required because script/install.bash runs db:migrate - run: bundle exec rspec + - name: Check that db/schema.rb is up to date + run: | + diff -u db/schema.rb.git db/schema.rb >&2 || + { echo "Error: db/schema.rb is out of date" >&2; exit 1; } + - uses: coverallsapp/github-action@v2 lint: From 99b2e7c70c26a6c0cc2b87d2f30a4111c34c6ca9 Mon Sep 17 00:00:00 2001 From: Tom Levy Date: Mon, 8 Jan 2024 23:41:18 +1300 Subject: [PATCH 04/12] Fix crash when adding file attachment to problem (#258) Previously, if there was a validation error when adding a file attachment to a problem (e.g. "Filepath has already been taken", "Filepath extension doesn't match file"), then instead of displaying the validation error message, there would be a 500 Internal Server Error (First argument in form cannot contain nil or be empty). Full trace below. The cause was an incomplete renaming in commit 1e931189 (enable file attachments for problems, with shared code for filelinks of groups and problems, 2013-12-19). The code path that triggers when there is a validation error still used some old variable names, causing the crash. Fix by updating those variable names. Full error trace: ``` Completed 500 Internal Server Error in 764ms (ActiveRecord: 64.1ms) First argument in form cannot contain nil or be empty excluded from capture: DSN not set ActionView::Template::Error (First argument in form cannot contain nil or be empty): 1: <%= form_for @new_filelink, :url => index_path do |f| %> 2: <% if @new_filelink.errors.any? %> 3:
4:

<%= pluralize(@new_filelink.errors.count, "error") %> prohibited this post from being saved:

app/views/filelinks/roots/index.html.erb:1:in `_app_views_filelinks_roots_index_html_erb___4252713757973532291_70289880' app/controllers/filelinks/roots_controller.rb:88:in `create' ``` --- app/controllers/filelinks/roots_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/filelinks/roots_controller.rb b/app/controllers/filelinks/roots_controller.rb index 326333e4..eeb2dc75 100644 --- a/app/controllers/filelinks/roots_controller.rb +++ b/app/controllers/filelinks/roots_controller.rb @@ -80,11 +80,11 @@ def create self.model = load_model authorize model, :update? authorize FileAttachment.find(filelink_params[:file_attachment_id]), :use? - @new_file = model.filelinks.build(filelink_params) - if @new_file.save + @new_filelink = model.filelinks.build(filelink_params) + if @new_filelink.save redirect_to(index_path, :notice => "File attachment added") else - @files = model.filelinks.order(:filepath) + @filelinks = model.filelinks.order(:filepath) render :action => :index end end From 53db70ca87428bd45dcc83186e2ec0aef61bb7db Mon Sep 17 00:00:00 2001 From: Ben Anderson Date: Thu, 25 Jan 2024 10:33:31 +1300 Subject: [PATCH 05/12] Add a tiny spec for the file attachments page (#233) This broke in the rails upgrade, so following the convention of "fix a bug, add a spec" - here's a tiny spec that was failing before the fix in dbe5f381c577ef922ce2edd60e9dbda86ab6304b and is now passing thanks to that commit. --- spec/controllers/file_attachments_controller_spec.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 spec/controllers/file_attachments_controller_spec.rb diff --git a/spec/controllers/file_attachments_controller_spec.rb b/spec/controllers/file_attachments_controller_spec.rb new file mode 100644 index 00000000..80038384 --- /dev/null +++ b/spec/controllers/file_attachments_controller_spec.rb @@ -0,0 +1,11 @@ +require "spec_helper" + +RSpec.describe FileAttachmentsController do + describe "GET /file_attachments" do + before do + sign_in users(:superadmin) + end + + can_index :file_attachments + end +end From 4fc9595f09545893e9824ea07c78909a2a660bd3 Mon Sep 17 00:00:00 2001 From: Ben Anderson Date: Thu, 25 Jan 2024 10:34:06 +1300 Subject: [PATCH 06/12] Update config.serve_static_assets to config.serve_static_files (#240) The configuration option `config.serve_static_assets` has been renamed to `config.serve_static_files in Rails 4.2 [1], and the old name will be removed in Rails 5.0 [2]. [1] https://www.github.com/rails/rails/pull/18100 [2] https://github.com/rails/rails/commit/463b5d7581ee16bfaddf34ca349b7d1b5878097c --- config/environments/production.rb | 2 +- config/environments/test.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index e8b7beea..28ed0955 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -33,7 +33,7 @@ # Disable Rails's static asset server # In production, Apache or nginx will already do this - config.serve_static_assets = true # true so Webrick testing of production mode works + config.serve_static_files = true # true so Webrick testing of production mode works # Enable serving of images, stylesheets, and javascripts from an asset server # config.action_controller.asset_host = "http://assets.example.com" diff --git a/config/environments/test.rb b/config/environments/test.rb index bfd1db47..05fc3f0d 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -34,7 +34,7 @@ config.active_support.deprecation = :stderr # Configure static asset server for tests with Cache-Control for performance - config.serve_static_assets = true + config.serve_static_files = true config.static_cache_control = "public, max-age=3600" # Raise exception on mass assignment protection for Active Record models From 8333127677ac833608ea41abd90ee0208a0edeba Mon Sep 17 00:00:00 2001 From: Jonathan Khoo Date: Mon, 29 Jan 2024 00:16:40 +1300 Subject: [PATCH 07/12] Bump actions/checkout from 3 to 4 (#265) --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 66d6b355..0fd34ad0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,7 +30,7 @@ jobs: DATABASE_URL: "postgresql://postgres:postgres@localhost:5432" steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 with: bundler-cache: true @@ -70,7 +70,7 @@ jobs: lint: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 with: bundler-cache: true From 9600bdc4e1a4c1c44f0110d9b809ef3cfd7d075c Mon Sep 17 00:00:00 2001 From: Jonathan Khoo Date: Wed, 15 May 2024 23:48:39 +1200 Subject: [PATCH 08/12] Pin isolate to 1.10.1 (#266) This is the last version that supports cgroups v1; isolate 2.0 supports only cgroups v2. --- .github/workflows/ci.yml | 2 +- script/install/config.bash | 2 +- script/install/isolate.bash | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0fd34ad0..22562e79 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,7 +46,7 @@ jobs: SCHEDULE_BACKUPS: 0 ISOLATE_ROOT: / ISOLATE_CGROUPS: false - ISOLATE_BRANCH: master + ISOLATE_BRANCH: v1.10.1 - name: Back up db/schema.rb # it will be overwritten when install.bash runs migrate.bash; back up the original so we can check if it's up to date run: cp db/schema.rb db/schema.rb.git diff --git a/script/install/config.bash b/script/install/config.bash index 62d830dd..250231f4 100644 --- a/script/install/config.bash +++ b/script/install/config.bash @@ -203,7 +203,7 @@ declare -p ISOLATE_CGROUPS &> /dev/null || while [ -z "$ISOLATE_CGROUPS" ] ; do else ISOLATE_CGROUPS=false; fi done -declare -p ISOLATE_BRANCH &> /dev/null || ISOLATE_BRANCH=master # no prompt +declare -p ISOLATE_BRANCH &> /dev/null || ISOLATE_BRANCH=v1.10.1 # no prompt shopt -u nocasematch; diff --git a/script/install/isolate.bash b/script/install/isolate.bash index d8d3dc8c..a6ecc154 100644 --- a/script/install/isolate.bash +++ b/script/install/isolate.bash @@ -9,7 +9,7 @@ cd $srclocation if [ -d "isolate" ]; then cd isolate done=true - git pull --force | grep -q -v 'Already up-to-date.' && done=false + # git pull --force | grep -q -v 'Already up-to-date.' && done=false if $done; then exit fi From 2f097d0f16ed2b7530e399da2236eaa5b3321292 Mon Sep 17 00:00:00 2001 From: Tom Levy Date: Wed, 26 Feb 2020 00:21:21 +1300 Subject: [PATCH 09/12] Confirm before installing the J programming language (#248) --- script/install/debootstrap.bash | 36 +++++++++++++++++---------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/script/install/debootstrap.bash b/script/install/debootstrap.bash index 187415dc..f259fb38 100644 --- a/script/install/debootstrap.bash +++ b/script/install/debootstrap.bash @@ -145,20 +145,21 @@ chroot "$ISOLATE_ROOT" apt-get install openjdk-11-jdk # Java chroot "$ISOLATE_ROOT" apt-get install ruby2.2 - ## INSTALL J - chroot "$ISOLATE_ROOT" mkdir /home/j -p - J_TAG="J803" - J_DEB="j803_amd64.deb" - J_SAVE="/home/j/$J_DEB" - [ -f "$ISOLATE_ROOT/$J_SAVE" ] || { - echo "wget -O \"$ISOLATE_ROOT/$J_SAVE\" https://github.com/NZOI/J-install/releases/download/$J_TAG/$J_DEB" - wget -O "$ISOLATE_ROOT/$J_SAVE" "https://github.com/NZOI/J-install/releases/download/$J_TAG/$J_DEB" - } - - echo "$chroot_cmd dpkg -i $J_SAVE" - chroot "$ISOLATE_ROOT" dpkg -i "$J_SAVE" - - cat << EOF > "$ISOLATE_ROOT"/home/j/install.ijs + # install J + bash script/confirm.bash 'Install J' && { + chroot "$ISOLATE_ROOT" mkdir /home/j -p + J_TAG="J803" + J_DEB="j803_amd64.deb" + J_SAVE="/home/j/$J_DEB" + [ -f "$ISOLATE_ROOT/$J_SAVE" ] || { + echo "wget -O \"$ISOLATE_ROOT/$J_SAVE\" https://github.com/NZOI/J-install/releases/download/$J_TAG/$J_DEB" + wget -O "$ISOLATE_ROOT/$J_SAVE" "https://github.com/NZOI/J-install/releases/download/$J_TAG/$J_DEB" + } + + echo "$chroot_cmd dpkg -i $J_SAVE" + chroot "$ISOLATE_ROOT" dpkg -i "$J_SAVE" + + cat << EOF > "$ISOLATE_ROOT"/home/j/install.ijs load 'pacman' 'update' jpkg '' 'install' jpkg 'format/printf' @@ -168,9 +169,10 @@ load 'pacman' exit 0 EOF - echo "$chroot_cmd ijconsole /home/j/install.ijs" - chroot "$ISOLATE_ROOT" ijconsole /home/j/install.ijs - ## END INSTALL J + echo "$chroot_cmd ijconsole /home/j/install.ijs" + chroot "$ISOLATE_ROOT" ijconsole /home/j/install.ijs + } + # end install J } From e3d3b4ef80a609c283dd771540d36366fab491ae Mon Sep 17 00:00:00 2001 From: Tom Levy Date: Wed, 26 Feb 2020 00:29:45 +1300 Subject: [PATCH 10/12] Switch to headless JDK in deboostrap (#248) It is smaller, and we don't need the GUI libraries. --- script/install/debootstrap.bash | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/script/install/debootstrap.bash b/script/install/debootstrap.bash index f259fb38..7324634d 100644 --- a/script/install/debootstrap.bash +++ b/script/install/debootstrap.bash @@ -113,7 +113,7 @@ chroot "$ISOLATE_ROOT" apt-get install ruby # Ruby (ruby) # LD_ORIGIN_PATH.) } -if ! chroot "$ISOLATE_ROOT" apt-cache show openjdk-11-jdk &>/dev/null; then +if ! chroot "$ISOLATE_ROOT" apt-cache show openjdk-11-jdk-headless &>/dev/null; then # add java ppa echo "$chroot_cmd add-apt-repository ppa:openjdk-r/ppa -y" chroot "$ISOLATE_ROOT" add-apt-repository ppa:openjdk-r/ppa -y @@ -122,8 +122,8 @@ if ! chroot "$ISOLATE_ROOT" apt-cache show openjdk-11-jdk &>/dev/null; then chroot "$ISOLATE_ROOT" apt-get update fi -echo "$chroot_install openjdk-11-jdk" -chroot "$ISOLATE_ROOT" apt-get install openjdk-11-jdk # Java +echo "$chroot_install openjdk-11-jdk-headless" +chroot "$ISOLATE_ROOT" apt-get install openjdk-11-jdk-headless # Java [ -z "$CI" ] && { # if not in CI From 07fa028dec10d670ddd9b8125721d9459baebdf5 Mon Sep 17 00:00:00 2001 From: Tom Levy Date: Wed, 26 Feb 2020 00:32:10 +1300 Subject: [PATCH 11/12] Skip installation of JDK in deboostrap during CI (#248) There are no test submissions in Java, so it's not required and only makes CI slower. --- script/install/debootstrap.bash | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/script/install/debootstrap.bash b/script/install/debootstrap.bash index 7324634d..4fa725a3 100644 --- a/script/install/debootstrap.bash +++ b/script/install/debootstrap.bash @@ -113,17 +113,20 @@ chroot "$ISOLATE_ROOT" apt-get install ruby # Ruby (ruby) # LD_ORIGIN_PATH.) } -if ! chroot "$ISOLATE_ROOT" apt-cache show openjdk-11-jdk-headless &>/dev/null; then - # add java ppa - echo "$chroot_cmd add-apt-repository ppa:openjdk-r/ppa -y" - chroot "$ISOLATE_ROOT" add-apt-repository ppa:openjdk-r/ppa -y - - echo "$chroot_cmd apt-get update" - chroot "$ISOLATE_ROOT" apt-get update -fi +[ -z "$CI" ] && { # if not in CI + # Java + if ! chroot "$ISOLATE_ROOT" apt-cache show openjdk-11-jdk-headless &>/dev/null; then + # add java ppa + echo "$chroot_cmd add-apt-repository ppa:openjdk-r/ppa -y" + chroot "$ISOLATE_ROOT" add-apt-repository ppa:openjdk-r/ppa -y + + echo "$chroot_cmd apt-get update" + chroot "$ISOLATE_ROOT" apt-get update + fi -echo "$chroot_install openjdk-11-jdk-headless" -chroot "$ISOLATE_ROOT" apt-get install openjdk-11-jdk-headless # Java + echo "$chroot_install openjdk-11-jdk-headless" + chroot "$ISOLATE_ROOT" apt-get install openjdk-11-jdk-headless # Java +} [ -z "$CI" ] && { # if not in CI From 095d12cd35f63b65c657e41ad6563589644a270e Mon Sep 17 00:00:00 2001 From: Tom Levy Date: Thu, 16 May 2024 00:59:08 +1200 Subject: [PATCH 12/12] Remove nokogiri dependency packages (#249) As of Nokogiri 1.6, libxml2 and libxslt are bundled with Nokogiri [1], so we don't need to install the header files. [1] https://github.com/sparklemotion/nokogiri/blob/v1.6.8.1/CHANGELOG.rdoc#label-1.6.0.rc1+-2F+2013-04-14 --- script/install.bash | 2 -- script/install/nokogiri.bash | 7 ------- 2 files changed, 9 deletions(-) delete mode 100644 script/install/nokogiri.bash diff --git a/script/install.bash b/script/install.bash index 9dedd570..029449dc 100755 --- a/script/install.bash +++ b/script/install.bash @@ -40,8 +40,6 @@ bash script/install/nztrain.bash || exit 1 # fix files & directory structure bash script/install/bundler.bash || exit 1 -bash script/install/nokogiri.bash || exit 1 # nokogiri dependencies - bash script/install/jdk.bash || exit 1 # required by yui-compressor sudo bash script/install/isolate.bash || exit 1 # install isolate diff --git a/script/install/nokogiri.bash b/script/install/nokogiri.bash deleted file mode 100644 index 0934922b..00000000 --- a/script/install/nokogiri.bash +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -cmd="sudo apt-get install libxslt-dev libxml2-dev" - -echo "$ $cmd" -$cmd -