From df750702724a0eb204551f5e99267557b5c0e055 Mon Sep 17 00:00:00 2001 From: Christian Bruckmayer Date: Mon, 5 Feb 2018 15:20:10 +0100 Subject: [PATCH 1/7] [dist][frontend] Update Ruby to version 2.5 --- .travis.yml | 2 +- Dockerfile.frontend-base | 2 +- Dockerfile.old-test-suite | 2 +- contrib/docker-bootstrap.sh | 6 +++--- dist/find-requires.sh | 4 ++-- dist/obs-api-deps.spec | 6 +++--- dist/obs-server.spec | 4 ++-- dist/obs_api_delayed_jobs_monitor.cron | 2 +- dist/obsapidelayed | 12 +++++------ dist/setup-appliance.sh | 20 +++++++++---------- docs/api/restility/bin/rest_doc | 2 +- docs/api/restility/bin/rest_test | 2 +- src/api/Makefile | 6 +++--- src/api/Rakefile | 2 +- src/api/bin/bundle | 2 +- src/api/bin/pry | 2 +- src/api/bin/rails | 2 +- src/api/bin/rake | 2 +- src/api/bin/rdoc | 2 +- src/api/bin/ri | 2 +- src/api/bin/rspec | 2 +- src/api/bin/rubocop | 2 +- .../20150623063641_reindex_sphinx_db.rb | 1 + src/api/script/api_test_in_spec.sh | 12 +++++------ src/api/script/check_database | 2 +- src/api/script/delayed_job.api.rb | 2 +- src/api/script/delayed_job_monitor.rb | 2 +- src/api/script/import | 2 +- src/api/script/plugin | 2 +- src/api/script/reformat_memprof | 2 +- src/api/script/rubygem_package_names.rb | 2 +- src/api/script/start_test_backend | 2 +- 32 files changed, 59 insertions(+), 58 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9af05e78184..84bb7108e1e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,7 @@ services: language: ruby cache: bundler gemfile: src/api/Gemfile -rvm: 2.4.1 +rvm: 2.5.0 # Github config branches: diff --git a/Dockerfile.frontend-base b/Dockerfile.frontend-base index 5e35f245abf..1f6219db25b 100644 --- a/Dockerfile.frontend-base +++ b/Dockerfile.frontend-base @@ -18,7 +18,7 @@ USER frontend WORKDIR /obs/src/api # Set up some convenience ruby binaries... -RUN for i in ruby gem irb; do ln -s /usr/bin/$i.ruby2.4 ~/bin/$i; done +RUN for i in ruby gem irb; do ln -s /usr/bin/$i.ruby2.5 ~/bin/$i; done # Install our bundle # FIXME: Retrying bundler if it fails is a workaround for https://github.com/moby/moby/issues/783 diff --git a/Dockerfile.old-test-suite b/Dockerfile.old-test-suite index 438c589e10f..e73bfb3995d 100644 --- a/Dockerfile.old-test-suite +++ b/Dockerfile.old-test-suite @@ -16,7 +16,7 @@ USER frontend WORKDIR /obs/src/api # Set up some convenience ruby binaries... -RUN for i in ruby gem irb; do ln -s /usr/bin/$i.ruby2.4 ~/bin/$i; done +RUN for i in ruby gem irb; do ln -s /usr/bin/$i.ruby2.5 ~/bin/$i; done # Install our bundle # FIXME: Retrying bundler if it fails is a workaround for https://github.com/moby/moby/issues/783 diff --git a/contrib/docker-bootstrap.sh b/contrib/docker-bootstrap.sh index a671ce65e9a..80e51aba626 100755 --- a/contrib/docker-bootstrap.sh +++ b/contrib/docker-bootstrap.sh @@ -10,10 +10,10 @@ do nodejs6 npm6 \ mariadb-client \ git-core \ - ruby2.4-devel cyrus-sasl-devel openldap2-devel libxml2-devel zlib-devel libxslt-devel \ + ruby2.5-devel cyrus-sasl-devel openldap2-devel libxml2-devel zlib-devel libxslt-devel \ perl-XML-Parser \ - ruby2.4-rubygem-mysql2 \ - ruby2.4-rubygem-bundler ruby2.4-rubygem-thor-0_19 ruby2.4-rubygem-foreman + ruby2.5-rubygem-mysql2 \ + ruby2.5-rubygem-bundler ruby2.5-rubygem-thor-0_19 ruby2.5-rubygem-foreman ;; backend) diff --git a/dist/find-requires.sh b/dist/find-requires.sh index efec44bc253..a508553d2ab 100644 --- a/dist/find-requires.sh +++ b/dist/find-requires.sh @@ -13,14 +13,14 @@ tdir=`mktemp -d` tar xJf $sourcearchive -C $tdir >&/dev/null pushd $tdir/open-build-service*/src/api >& /dev/null -ruby.ruby2.4 -rbundler -e 'exit' || echo "___ERROR_BUNDLER_NOT_INSTALLED___" +ruby.ruby2.5 -rbundler -e 'exit' || echo "___ERROR_BUNDLER_NOT_INSTALLED___" mode="resolve" if [ "$limit" == "production" ]; then mode="specs_for([:default, :production, :assets])" fi -ruby.ruby2.4 -rbundler -e 'Bundler.definition.'"$mode"'.any? { |s| puts "rubygem('$prefix':#{s.name}) = #{s.version}" }' | while read i; do echo -n $i", "; done +ruby.ruby2.5 -rbundler -e 'Bundler.definition.'"$mode"'.any? { |s| puts "rubygem('$prefix':#{s.name}) = #{s.version}" }' | while read i; do echo -n $i", "; done popd >& /dev/null #cleanup diff --git a/dist/obs-api-deps.spec b/dist/obs-api-deps.spec index 567b23a0772..56e2528d5ef 100644 --- a/dist/obs-api-deps.spec +++ b/dist/obs-api-deps.spec @@ -26,8 +26,8 @@ Url: http://en.opensuse.org/Build_Service BuildRoot: %{_tmppath}/%{name}-%{version}-build Source0: open-build-service-%version.tar.xz Source1: find-requires.sh -BuildRequires: ruby2.4 -BuildRequires: ruby2.4-rubygem-bundler +BuildRequires: ruby2.5 +BuildRequires: ruby2.5-rubygem-bundler %if 0%{?suse_version} < 1210 BuildRequires: xz %endif @@ -72,7 +72,7 @@ Requires: perl(GD) Requires: sphinx >= 2.1.8 %description -n obs-api-testsuite-deps -This is the API server instance, and the web client for the +This is the API server instance, and the web client for the OBS. %prep diff --git a/dist/obs-server.spec b/dist/obs-server.spec index 03ee094e469..4cd3368c81d 100644 --- a/dist/obs-server.spec +++ b/dist/obs-server.spec @@ -204,7 +204,7 @@ Requires(pre): group(www) %endif #For apache -Requires: apache2 apache2-mod_xforward rubygem-passenger-apache2 ruby2.4-rubygem-passenger +Requires: apache2 apache2-mod_xforward rubygem-passenger-apache2 ruby2.5-rubygem-passenger # memcache is required for session data Requires: memcached @@ -466,7 +466,7 @@ done if [ ! -e %{secret_key_file} ]; then pushd . cd /srv/www/obs/api/config - ( umask 0077; RAILS_ENV=production bundle.ruby2.4 exec rails.ruby2.4 secret > %{secret_key_file} ) || exit 1 + ( umask 0077; RAILS_ENV=production bundle.ruby2.5 exec rails.ruby2.5 secret > %{secret_key_file} ) || exit 1 popd fi chmod 0640 %{secret_key_file} diff --git a/dist/obs_api_delayed_jobs_monitor.cron b/dist/obs_api_delayed_jobs_monitor.cron index 02719c1b273..6fd0575b72a 100755 --- a/dist/obs_api_delayed_jobs_monitor.cron +++ b/dist/obs_api_delayed_jobs_monitor.cron @@ -1 +1 @@ -*/10 * * * * /usr/bin/bundle.ruby2.4 exec /srv/www/obs/api/script/delayed_job_monitor.rb > /dev/null +*/10 * * * * /usr/bin/bundle.ruby2.5 exec /srv/www/obs/api/script/delayed_job_monitor.rb > /dev/null diff --git a/dist/obsapidelayed b/dist/obsapidelayed index 68a52e87d06..57b8e1375f6 100755 --- a/dist/obsapidelayed +++ b/dist/obsapidelayed @@ -38,7 +38,7 @@ . /etc/rc.status API_ROOT=/srv/www/obs/api -CLOCKWORKD=/usr/bin/clockworkd.ruby2.4 +CLOCKWORKD=/usr/bin/clockworkd.ruby2.5 # If you are using newrelic_rpm you need this # to fix detection of our delay_job.api daemons @@ -48,7 +48,7 @@ function run_in_api { export RAILS_ENV="production" # startproc only works for classical daemons - chroot --userspec=wwwrun:www / /bin/bash -c "cd $API_ROOT && /usr/bin/bundle.ruby2.4 exec $*" + chroot --userspec=wwwrun:www / /bin/bash -c "cd $API_ROOT && /usr/bin/bundle.ruby2.5 exec $*" } # number of parallel delayed jobs @@ -72,9 +72,9 @@ case "$1" in echo -n "Starting OBS searchd daemon " FILE_SIZE=`stat -c '%s' /srv/www/obs/api/config/production.sphinx.conf` if [ $FILE_SIZE -eq 0 ];then - run_in_api rails.ruby2.4 ts:rebuild + run_in_api rails.ruby2.5 ts:rebuild else - run_in_api rails.ruby2.4 ts:start + run_in_api rails.ruby2.5 ts:start fi rc_status -v echo -n "Starting OBS api clock daemon " @@ -95,7 +95,7 @@ case "$1" in run_in_api $CLOCKWORKD -l -c config/clock.rb stop rc_status -v echo -n "Shutting down OBS searchd daemon " - run_in_api rails.ruby2.4 ts:stop + run_in_api rails.ruby2.5 ts:stop rc_status -v ;; try-restart|condrestart) @@ -114,7 +114,7 @@ case "$1" in $0 stop rm -f $API_ROOT/db/sphinx/production/* $0 start - run_in_api rails.ruby2.4 ts:index + run_in_api rails.ruby2.5 ts:index rc_status ;; diff --git a/dist/setup-appliance.sh b/dist/setup-appliance.sh index 77af37d7657..f59eb84f492 100755 --- a/dist/setup-appliance.sh +++ b/dist/setup-appliance.sh @@ -34,7 +34,7 @@ function check_service { echo "$srv daemon not started. Trying to start" execute_silently systemctl start $srv\.service if [[ $? -gt 0 ]];then - echo -n "Starting $srv daemon failed." + echo -n "Starting $srv daemon failed." if [[ $service_critical == 1 ]];then echo " Exiting ..." exit 1 @@ -55,15 +55,15 @@ function check_server_cert { DETECTED_CERT_CHANGE=1 # hostname specific certs - survive intermediate hostname changes if [ ! -e $backenddir/certs/server.${FQHOSTNAME}.crt ] ; then - # This is just a dummy SSL certificate, but it has a valid hostname. + # This is just a dummy SSL certificate, but it has a valid hostname. # Admin can replace it with his version. create_selfsigned_certificate echo "$OPENSSL_CONFIG" | openssl req -new -nodes -config /dev/stdin \ -x509 -days 365 -batch \ -key $backenddir/certs/server.key \ -out $backenddir/certs/server.${FQHOSTNAME}.crt - - if [[ $? == 0 ]];then + + if [[ $? == 0 ]];then echo "Do not remove this file or new SSL CAs will get created." > $backenddir/certs/server.${FQHOSTNAME}.created fi else @@ -227,9 +227,9 @@ function adapt_worker_jobs { } ############################################################################### function prepare_database_setup { - - cd /srv/www/obs/api - RAILS_ENV=production rails.ruby2.4 db:migrate:status > /dev/null + + cd /srv/www/obs/api + RAILS_ENV=production rails.ruby2.5 db:migrate:status > /dev/null if [[ $? > 0 ]];then echo "Initialize MySQL databases (first time only)" @@ -270,8 +270,8 @@ function prepare_database_setup { logline "Setting up rails environment" for cmd in $RAKE_COMMANDS do - logline " - Doing 'rails.ruby2.4 $cmd'" - RAILS_ENV=production bundle exec rails.ruby2.4 $cmd >> $apidir/log/db_migrate.log + logline " - Doing 'rails.ruby2.5 $cmd'" + RAILS_ENV=production bundle exec rails.ruby2.5 $cmd >> $apidir/log/db_migrate.log if [[ $? > 0 ]];then (>&2 echo "Command $cmd FAILED") exit 1 @@ -509,7 +509,7 @@ function prepare_apache2 { function prepare_passenger { perl -p -i -e \ - 's#^(\s*)PassengerRuby "/usr/bin/ruby"#$1\PassengerRuby "/usr/bin/ruby.ruby2.4"#' \ + 's#^(\s*)PassengerRuby "/usr/bin/ruby"#$1\PassengerRuby "/usr/bin/ruby.ruby2.5"#' \ /etc/apache2/conf.d/mod_passenger.conf diff --git a/docs/api/restility/bin/rest_doc b/docs/api/restility/bin/rest_doc index 1319a185b81..295ebcbb957 100755 --- a/docs/api/restility/bin/rest_doc +++ b/docs/api/restility/bin/rest_doc @@ -1,4 +1,4 @@ -#!/usr/bin/env ruby.ruby2.4 +#!/usr/bin/env ruby.ruby2.5 require 'optparse' require 'rubygems' diff --git a/docs/api/restility/bin/rest_test b/docs/api/restility/bin/rest_test index f56631eb6f7..6ce93e86a4b 100755 --- a/docs/api/restility/bin/rest_test +++ b/docs/api/restility/bin/rest_test @@ -1,4 +1,4 @@ -#!/usr/bin/ruby.ruby2.4 +#!/usr/bin/ruby.ruby2.5 require 'optparse' require 'rubygems' diff --git a/src/api/Makefile b/src/api/Makefile index 29674c0e7e1..c404a5eae67 100644 --- a/src/api/Makefile +++ b/src/api/Makefile @@ -52,10 +52,10 @@ build: config # we need to have *something* as secret key echo "" | sha256sum| cut -d\ -f 1 > $(DESTDIR)/srv/www/obs/api/config/secret.key cd $(DESTDIR)/srv/www/obs/api ;\ - bundle.ruby2.4 exec rake.ruby2.4 assets:precompile RAILS_ENV=production RAILS_GROUPS=assets || exit 1 ;\ + bundle.ruby2.5 exec rake.ruby2.5 assets:precompile RAILS_ENV=production RAILS_GROUPS=assets || exit 1 ;\ rm -rf tmp/cache/sass tmp/cache/assets config/secret.key ;\ - bundle.ruby2.4 config --local frozen 1 || exit 1 ;\ - bundle.ruby2.4 config --local without development:test:assets || exit 1 ;\ + bundle.ruby2.5 config --local frozen 1 || exit 1 ;\ + bundle.ruby2.5 config --local without development:test:assets || exit 1 ;\ # reinstall $(INSTALL) config/database.yml.example $(DESTDIR)$(OBS_API_PREFIX)/config/database.yml # patch our version inside diff --git a/src/api/Rakefile b/src/api/Rakefile index afbb3ef1122..2c7f709e5e5 100755 --- a/src/api/Rakefile +++ b/src/api/Rakefile @@ -1,4 +1,4 @@ -#!/usr/bin/env rake.ruby2.4 +#!/usr/bin/env rake.ruby2.5 # Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. diff --git a/src/api/bin/bundle b/src/api/bin/bundle index 9ca6ce2b28f..ffaec640e5d 100755 --- a/src/api/bin/bundle +++ b/src/api/bin/bundle @@ -1,3 +1,3 @@ -#!/usr/bin/env ruby.ruby2.4 +#!/usr/bin/env ruby.ruby2.5 ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) load Gem.bin_path('bundler', 'bundle') diff --git a/src/api/bin/pry b/src/api/bin/pry index bc66840571c..dbf557cdd31 100755 --- a/src/api/bin/pry +++ b/src/api/bin/pry @@ -1,4 +1,4 @@ -#!/usr/bin/ruby.ruby2.4 +#!/usr/bin/ruby.ruby2.5 # frozen_string_literal: true # diff --git a/src/api/bin/rails b/src/api/bin/rails index ed81c8d0bcb..328a16b102f 100755 --- a/src/api/bin/rails +++ b/src/api/bin/rails @@ -1,4 +1,4 @@ -#!/usr/bin/env ruby.ruby2.4 +#!/usr/bin/env ruby.ruby2.5 APP_PATH = File.expand_path('../config/application', __dir__) require_relative '../config/boot' require 'rails/commands' diff --git a/src/api/bin/rake b/src/api/bin/rake index c5376b0f005..2a0d765b73d 100755 --- a/src/api/bin/rake +++ b/src/api/bin/rake @@ -1,4 +1,4 @@ -#!/usr/bin/env ruby.ruby2.4 +#!/usr/bin/env ruby.ruby2.5 require_relative '../config/boot' require 'rake' Rake.application.run diff --git a/src/api/bin/rdoc b/src/api/bin/rdoc index 6ab227d2210..3db8f06b34b 100755 --- a/src/api/bin/rdoc +++ b/src/api/bin/rdoc @@ -1,4 +1,4 @@ -#!/usr/bin/ruby.ruby2.4 +#!/usr/bin/ruby.ruby2.5 # frozen_string_literal: true # diff --git a/src/api/bin/ri b/src/api/bin/ri index 545a9a7cebb..499ff95348b 100755 --- a/src/api/bin/ri +++ b/src/api/bin/ri @@ -1,4 +1,4 @@ -#!/usr/bin/ruby.ruby2.4 +#!/usr/bin/ruby.ruby2.5 # frozen_string_literal: true # diff --git a/src/api/bin/rspec b/src/api/bin/rspec index 404201bdca9..6fde8975436 100755 --- a/src/api/bin/rspec +++ b/src/api/bin/rspec @@ -1,4 +1,4 @@ -#!/usr/bin/ruby.ruby2.4 +#!/usr/bin/ruby.ruby2.5 # frozen_string_literal: true # diff --git a/src/api/bin/rubocop b/src/api/bin/rubocop index 050ab1c3474..2794b3dd8b0 100755 --- a/src/api/bin/rubocop +++ b/src/api/bin/rubocop @@ -1,4 +1,4 @@ -#!/usr/bin/ruby.ruby2.4 +#!/usr/bin/ruby.ruby2.5 # frozen_string_literal: true # diff --git a/src/api/db/migrate/20150623063641_reindex_sphinx_db.rb b/src/api/db/migrate/20150623063641_reindex_sphinx_db.rb index dcb2cc6e6ec..2e2d83683b0 100644 --- a/src/api/db/migrate/20150623063641_reindex_sphinx_db.rb +++ b/src/api/db/migrate/20150623063641_reindex_sphinx_db.rb @@ -2,6 +2,7 @@ class ReindexSphinxDb < ActiveRecord::Migration[4.2] def self.up rake = 'rake' rake = 'rake.ruby2.4' if File.exist?('/usr/bin/rake.ruby2.4') + rake = 'rake.ruby2.5' if File.exist?('/usr/bin/rake.ruby2.5') # we do not use ThinkingSphinx class, since searchd might not be able to startup system("cd #{Rails.root}; rm -rf tmp/binlog; exec #{rake} ts:index") end diff --git a/src/api/script/api_test_in_spec.sh b/src/api/script/api_test_in_spec.sh index 3938b97157a..ed0a157f68c 100755 --- a/src/api/script/api_test_in_spec.sh +++ b/src/api/script/api_test_in_spec.sh @@ -64,19 +64,19 @@ EOF # migration test export RAILS_ENV=development -bundle.ruby2.4 exec rake.ruby2.4 db:create || exit 1 +bundle.ruby2.5 exec rake.ruby2.5 db:create || exit 1 mv db/structure.sql db/structure.sql.git xzcat test/dump_2.5.sql.xz | mysql -u root --socket=$MYSQL_SOCKET -bundle.ruby2.4 exec rake.ruby2.4 db:migrate:with_data db:structure:dump db:drop || exit 1 +bundle.ruby2.5 exec rake.ruby2.5 db:migrate:with_data db:structure:dump db:drop || exit 1 ./script/compare_structure_sql.sh db/structure.sql.git db/structure.sql || exit 1 # entire test suite export RAILS_ENV=test -bundle.ruby2.4 exec rake.ruby2.4 db:create db:setup || exit 1 +bundle.ruby2.5 exec rake.ruby2.5 db:create db:setup || exit 1 -for suite in "rake.ruby2.4 test:api" "rake.ruby2.4 test:spider" "rspec"; do +for suite in "rake.ruby2.5 test:api" "rake.ruby2.5 test:spider" "rspec"; do rm -f log/test.log - bundle.ruby2.4 exec rails assets:precompile + bundle.ruby2.5 exec rails assets:precompile # Configure the frontend<->backend connection settings if [ "$suite" = "rspec" ]; then @@ -86,7 +86,7 @@ for suite in "rake.ruby2.4 test:api" "rake.ruby2.4 test:spider" "rspec"; do perl -pi -e 's/source_host: backend/source_host: localhost/' config/options.yml perl -pi -e 's/source_port: 5352/source_port: 3200/' config/options.yml fi - if ! (set -x; bundle.ruby2.4 exec $suite); then + if ! (set -x; bundle.ruby2.5 exec $suite); then # dump log only in package builds [[ -n "$RPM_BUILD_ROOT" ]] && cat log/test.log kill_memcached diff --git a/src/api/script/check_database b/src/api/script/check_database index 3bdd02b663d..f213bd30258 100755 --- a/src/api/script/check_database +++ b/src/api/script/check_database @@ -1,4 +1,4 @@ -#!/usr/bin/env ruby.ruby2.4 +#!/usr/bin/env ruby.ruby2.5 require File.dirname(__FILE__) + '/../config/boot' require File.expand_path(File.join(File.dirname(__FILE__), '..', 'config', 'environment')) require File.expand_path(File.join(Rails.root, 'db', 'checker')) diff --git a/src/api/script/delayed_job.api.rb b/src/api/script/delayed_job.api.rb index 5bdd8674ce0..e3f6faacd9d 100755 --- a/src/api/script/delayed_job.api.rb +++ b/src/api/script/delayed_job.api.rb @@ -1,4 +1,4 @@ -#!/usr/bin/env ruby.ruby2.4 +#!/usr/bin/env ruby.ruby2.5 require File.expand_path(File.join(File.dirname(__FILE__), '..', 'config', 'environment')) require 'delayed/command' diff --git a/src/api/script/delayed_job_monitor.rb b/src/api/script/delayed_job_monitor.rb index 16b16b6f67c..ef0d5e79ea7 100755 --- a/src/api/script/delayed_job_monitor.rb +++ b/src/api/script/delayed_job_monitor.rb @@ -1,4 +1,4 @@ -#!/usr/bin/env ruby.ruby2.4 +#!/usr/bin/env ruby.ruby2.5 require File.expand_path(File.join(File.dirname(__FILE__), '..', 'config', 'environment')) output = %x(service obsapidelayed status | grep "active") diff --git a/src/api/script/import b/src/api/script/import index 01b6b756d80..3f98b0c3151 100755 --- a/src/api/script/import +++ b/src/api/script/import @@ -1,4 +1,4 @@ -#!/usr/bin/env ruby.ruby2.4 +#!/usr/bin/env ruby.ruby2.5 require File.dirname(__FILE__) + '/../config/boot' # set this to true if you want to create users that appear in metafiles diff --git a/src/api/script/plugin b/src/api/script/plugin index 8d01d4f9932..97cb7edab5c 100755 --- a/src/api/script/plugin +++ b/src/api/script/plugin @@ -1,3 +1,3 @@ -#!/usr/bin/env ruby.ruby2.4 +#!/usr/bin/env ruby.ruby2.5 require File.dirname(__FILE__) + '/../config/boot' require 'commands/plugin' diff --git a/src/api/script/reformat_memprof b/src/api/script/reformat_memprof index dc09e9ba400..24a031fd53b 100755 --- a/src/api/script/reformat_memprof +++ b/src/api/script/reformat_memprof @@ -1,4 +1,4 @@ -#! /usr/bin/ruby.ruby2.4 +#! /usr/bin/ruby.ruby2.5 require 'rubygems' require 'json' diff --git a/src/api/script/rubygem_package_names.rb b/src/api/script/rubygem_package_names.rb index ffef75814ab..297c42746a1 100755 --- a/src/api/script/rubygem_package_names.rb +++ b/src/api/script/rubygem_package_names.rb @@ -1,4 +1,4 @@ -#!/usr/bin/env ruby.ruby2.4 +#!/usr/bin/env ruby.ruby2.5 require 'bundler' diff --git a/src/api/script/start_test_backend b/src/api/script/start_test_backend index 45758b78d07..ac64d32320c 100755 --- a/src/api/script/start_test_backend +++ b/src/api/script/start_test_backend @@ -1,4 +1,4 @@ -#!/usr/bin/env ruby.ruby2.4 +#!/usr/bin/env ruby.ruby2.5 ENV['RAILS_ENV'] ||= 'test' ENV['origin_RAILS_ENV'] ||= ENV['RAILS_ENV'] ENV['LC_ALL'] = 'C' From 5e35f2458b01fd9962eef57f80cd1d7bdb708348 Mon Sep 17 00:00:00 2001 From: Christian Bruckmayer Date: Mon, 5 Feb 2018 16:26:24 +0100 Subject: [PATCH 2/7] [dist][frontend] Update delayed job https://github.com/rails/rails/issues/30522 --- src/api/Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/Gemfile.lock b/src/api/Gemfile.lock index e25de4a01fa..ab5631ea569 100644 --- a/src/api/Gemfile.lock +++ b/src/api/Gemfile.lock @@ -108,7 +108,7 @@ GEM data_migrate (3.2.2) rails (>= 4.0) database_cleaner (1.6.2) - delayed_job (4.1.3) + delayed_job (4.1.4) activesupport (>= 3.0, < 5.2) delayed_job_active_record (4.1.2) activerecord (>= 3.0, < 5.2) From ffb4418e332e903c44e8514a286cb0ed51e342e7 Mon Sep 17 00:00:00 2001 From: Christian Bruckmayer Date: Mon, 5 Feb 2018 17:08:21 +0100 Subject: [PATCH 3/7] [dist] Fix travis ruby version links --- dist/ci/travis_before_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/ci/travis_before_script.sh b/dist/ci/travis_before_script.sh index 75513dd8bbb..983a7bab7e3 100755 --- a/dist/ci/travis_before_script.sh +++ b/dist/ci/travis_before_script.sh @@ -34,4 +34,4 @@ rm -rf log/* tmp/cache tmp/sessions tmp/sockets popd # travis rvm can not deal with our extended executable names -sed -i 1,1s,\.ruby2\.4,, src/api/{script,bin}/* docs/api/restility/bin/* +sed -i 1,1s,\.ruby2\.5,, src/api/{script,bin}/* docs/api/restility/bin/* From 932632a1b380ca19bd5d6f8f3a6a1ba9e8455047 Mon Sep 17 00:00:00 2001 From: Christian Bruckmayer Date: Mon, 5 Feb 2018 17:39:37 +0100 Subject: [PATCH 4/7] [dist] Update parser and ast gems to get rid of deprecation warnings. This needs to get updated manually as it is an indirect dependency depfu currently does not pick up. --- src/api/Gemfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/api/Gemfile.lock b/src/api/Gemfile.lock index ab5631ea569..88b19da44bc 100644 --- a/src/api/Gemfile.lock +++ b/src/api/Gemfile.lock @@ -57,7 +57,7 @@ GEM rake (>= 10.4, < 13.0) ansi (1.5.0) arel (8.0.0) - ast (2.3.0) + ast (2.4.0) bcrypt (3.1.11) builder (3.2.3) bullet (5.7.0) @@ -219,8 +219,8 @@ GEM nyan-cat-formatter (0.12.0) rspec (>= 2.99, >= 2.14.2, < 4) parallel (1.12.0) - parser (2.4.0.0) - ast (~> 2.2) + parser (2.4.0.2) + ast (~> 2.3) pastel (0.7.2) equatable (~> 0.5.0) tty-color (~> 0.4.0) From 2f972137f1103cf7fef1012835b4cfbcec7d5a21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Schr=C3=B6ter?= Date: Wed, 7 Feb 2018 18:17:40 +0100 Subject: [PATCH 5/7] [dist] one more place with ruby 2.4 to get stuff building --- dist/obs-api-deps.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/obs-api-deps.spec b/dist/obs-api-deps.spec index 56e2528d5ef..ea597bcf483 100644 --- a/dist/obs-api-deps.spec +++ b/dist/obs-api-deps.spec @@ -39,7 +39,7 @@ This package serves one purpose only: to list the dependencies in Gemfile.lock Summary: The Open Build Service -- The Testsuite dependencies Group: Productivity/Networking/Web/Utilities # dependencies not needed in production -Requires: %(echo `bash %{S:1} %{S:0} "ruby:2.4.0"`) +Requires: %(echo `bash %{S:1} %{S:0} "ruby:2.5.0"`) Requires: perl-BSSolv >= 0.18.0 # Required by source server From b1c469be021b1eb1800db29f72bc47776b713ee6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Schr=C3=B6ter?= Date: Thu, 8 Feb 2018 08:59:06 +0100 Subject: [PATCH 6/7] [dist] and yet another place for ruby 2.4->2.5 --- dist/obs-server.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/obs-server.spec b/dist/obs-server.spec index 4cd3368c81d..e5588f2f026 100644 --- a/dist/obs-server.spec +++ b/dist/obs-server.spec @@ -230,7 +230,7 @@ BuildRequires: xorg-x11-server BuildRequires: xorg-x11-server-extra # write down dependencies for production BuildRequires: rubygem(bundler) -Requires: %(echo `bash %{S:1} %{S:0} "ruby:2.4.0" "production"`) +Requires: %(echo `bash %{S:1} %{S:0} "ruby:2.5.0" "production"`) # for rebuild_time Requires: perl(GD) From caac1fa5c60cdd26eaf0d6163128825e22671c2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Geuken?= Date: Wed, 7 Feb 2018 22:31:37 +0100 Subject: [PATCH 7/7] [dist] Adapt binary names to ruby2.5 Since we are not using the ruby version defined by the base system, but the one OBS uses, we have to adjust the call of the binaries that were installed via gem command. --- Dockerfile | 8 +++++++- Dockerfile.frontend-base | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 80bcb2a22a8..9749c160763 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,9 +18,15 @@ RUN chown -R frontend /obs/src/api USER frontend WORKDIR /obs/src/api +# foreman, which we only run in docker, needs a different thor version than OBS. +# Installing the gem directly spares us from having to rpm package two different thor versions. +RUN sudo gem.ruby2.5 install thor:0.19 foreman +# Ensure there is a foreman command without ruby suffix +RUN sudo ln -s /usr/bin/foreman.ruby2.5 /usr/bin/foreman + # FIXME: Retrying bundler if it fails is a workaround for https://github.com/moby/moby/issues/783 # which seems to happen on openSUSE (< Tumbleweed 20171001)... RUN export NOKOGIRI_USE_SYSTEM_LIBRARIES=1; bundle install --jobs=3 --retry=3 || bundle install --jobs=3 --retry=3 # Run our command -CMD ["foreman", "start", "-f", "Procfile"] +CMD ["foreman", "start", "-f", "Procfile"] diff --git a/Dockerfile.frontend-base b/Dockerfile.frontend-base index 1f6219db25b..9a30792c7b4 100644 --- a/Dockerfile.frontend-base +++ b/Dockerfile.frontend-base @@ -17,7 +17,7 @@ RUN chown -R frontend /obs/src/api USER frontend WORKDIR /obs/src/api -# Set up some convenience ruby binaries... +# Ensure there are ruby, gem and irb commands without ruby suffix RUN for i in ruby gem irb; do ln -s /usr/bin/$i.ruby2.5 ~/bin/$i; done # Install our bundle