From 8f40dc4287eff28fd1fa9bc30f8bd53396b38c38 Mon Sep 17 00:00:00 2001 From: Eddie Rubeiz Date: Thu, 6 Sep 2018 14:32:52 -0400 Subject: [PATCH] Monkey-patching solr_wrapper to get the solr checksum from archive.apache.org to include in what will be committed --- config/solr_wrapper_test.yml | 1 + lib/solr_wrapper_patch.rb | 23 +++++++++++++++++++++++ lib/tasks/dev.rake | 4 ++++ 3 files changed, 28 insertions(+) create mode 100644 lib/solr_wrapper_patch.rb diff --git a/config/solr_wrapper_test.yml b/config/solr_wrapper_test.yml index 35c3d289..27d66d09 100644 --- a/config/solr_wrapper_test.yml +++ b/config/solr_wrapper_test.yml @@ -11,6 +11,7 @@ collection: dir: solr/config name: hydra-test version: 6.3.0 +# validate: false # until solr_wrapper stops hardwiring the checksum URL # Attempt to use mirror url to keep travis tests from being blocked by # apache for too many solr downloads. mirror_url: http://lib-solr-mirror.princeton.edu/dist/ diff --git a/lib/solr_wrapper_patch.rb b/lib/solr_wrapper_patch.rb new file mode 100644 index 00000000..93329e4c --- /dev/null +++ b/lib/solr_wrapper_patch.rb @@ -0,0 +1,23 @@ +# Hack to monkey-patch solr_wrapper to get the checksum +# file from archive.apache.org instead of www.us.apache.org . + +# This monkey patch is based on : +# https://github.com/cbeer/solr_wrapper/pull/119/files +# When the patch is accepted, you can simply remove this file +# as well as the reference to it in /chf-sufia/lib/tasks/dev.rake + +if Gem.loaded_specs["solr_wrapper"].version > Gem::Version.new('2.0.0') + puts(""" The solr_wrapper gem has been upgraded. Time to + remove the monkey-patch in + * lib/tasks/dev.rake + * lib/solr_wrapper_patch.rb . + """) +end + +module SolrWrapper + class ChecksumValidator + def checksumurl(suffix) + "http://archive.apache.org/dist/lucene/solr/#{config.static_config.version}/solr-#{config.static_config.version}.zip.#{suffix}" + end + end +end \ No newline at end of file diff --git a/lib/tasks/dev.rake b/lib/tasks/dev.rake index 8c56e102..cc7c5023 100644 --- a/lib/tasks/dev.rake +++ b/lib/tasks/dev.rake @@ -7,6 +7,10 @@ unless ENV['RAILS_ENV'] == "production" require 'fcrepo_wrapper' require 'active_fedora/rake_support' + # This can be removed when solr_wrapper is upgraded. + # See the patch file for more details. + require "#{Rails.root}/lib/solr_wrapper_patch" + namespace :dev do # Starts Fedora and Solr, per config in `./config/solr_wrapper_test.rb` and # and `./config/fcrepo_wrapper_test.rb`. You can still run individual files