Commit 8afd661f436b27e28d7026e35eb6bdd54c622598

Authored by Jacob Vosmaer
2 parents cee3b23a cd109510

Merge branch 'ruby_2_0' into 'master'

Ruby 2.0
CHANGELOG
... ... @@ -4,6 +4,7 @@
4 4 - Add migration instructions coming from an existing GitLab installation (Goni Zahavy)
5 5 - Add a gitlab.yml conversion support script
6 6 - Correct default gravatar configuration (#112) (Julien Pivotto)
  7 +- Update Ruby to 2.0.0p451
7 8  
8 9 6.8.1
9 10 - Use gitlab-rails 6.8.1
... ...
config/projects/gitlab.rb
... ... @@ -25,6 +25,9 @@ install_path "/opt/gitlab"
25 25 build_version Omnibus::BuildVersion.new.semver
26 26 build_iteration 1
27 27  
  28 +override :ruby, version: '2.0.0-p451'
  29 +override :rubygems, version: '2.2.1'
  30 +
28 31 # creates required build directories
29 32 dependency "preparation"
30 33  
... ...
config/software/gitlab-rails.rb
... ... @@ -55,22 +55,32 @@ build do
55 55 # load the Rails environment.
56 56 command "cp config/gitlab.yml.example config/gitlab.yml"
57 57 command "cp config/database.yml.postgresql config/database.yml"
  58 +
58 59 # There is a bug in the acts-as-taggable-on gem that makes
59 60 # rake assets:precompile check for a database connection. We do not have a
60 61 # database at this point so that is a problem. This bug is fixed in
61 62 # acts-as-taggable-on 3.0.0 by
62 63 # https://github.com/mbleigh/acts-as-taggable-on/commit/ad02dc9bb24ec8e1e79e7e35e2d4bb5910a66d8e
63 64 aato_patch = "#{Omnibus.project_root}/config/patches/acts-as-taggable-on-ad02dc9bb24ec8e1e79e7e35e2d4bb5910a66d8e.diff"
  65 +
64 66 # To make this idempotent, we apply the patch (in case this is a first run) or
65 67 # we revert and re-apply the patch (if this is a second or later run).
66 68 command "git apply #{aato_patch} || (git apply -R #{aato_patch} && git apply #{aato_patch})",
67   - :cwd => "#{install_dir}/embedded/service/gem/ruby/1.9.1/gems/acts-as-taggable-on-2.4.1"
68   - rake "assets:precompile", :env => {"RAILS_ENV" => "production"}
  69 + :cwd => "#{install_dir}/embedded/service/gem/ruby/2.0.0/gems/acts-as-taggable-on-2.4.1"
  70 +
  71 + assets_precompile_env = {
  72 + "RAILS_ENV" => "production",
  73 + "PATH" => "#{install_dir}/embedded/bin:#{ENV['PATH']}"
  74 + }
  75 + bundle "exec rake assets:precompile", :env => assets_precompile_env
  76 +
69 77 # Tear down now that the assets:precompile is done.
70 78 command "rm config/gitlab.yml config/database.yml"
71 79  
72   - command "mkdir -p #{install_dir}/embedded/service/gitlab-rails"
  80 + # Remove directories that will be created by `gitlab-ctl reconfigure`
73 81 command "rm -rf log tmp public/uploads"
  82 +
  83 + command "mkdir -p #{install_dir}/embedded/service/gitlab-rails"
74 84 command "#{install_dir}/embedded/bin/rsync -a --delete --exclude=.git/*** --exclude=.gitignore ./ #{install_dir}/embedded/service/gitlab-rails/"
75 85  
76 86 # Create a wrapper for the rake tasks of the Rails app
... ...
config/software/ruby.rb 0 → 100644
... ... @@ -0,0 +1,167 @@
  1 +#
  2 +# Copyright:: Copyright (c) 2012-2014 Chef Software, Inc.
  3 +# Copyright:: Copyright (c) 2014 GitLab B.V.
  4 +# License:: Apache License, Version 2.0
  5 +#
  6 +# Licensed under the Apache License, Version 2.0 (the "License");
  7 +# you may not use this file except in compliance with the License.
  8 +# You may obtain a copy of the License at
  9 +#
  10 +# http://www.apache.org/licenses/LICENSE-2.0
  11 +#
  12 +# Unless required by applicable law or agreed to in writing, software
  13 +# distributed under the License is distributed on an "AS IS" BASIS,
  14 +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15 +# See the License for the specific language governing permissions and
  16 +# limitations under the License.
  17 +#
  18 +
  19 +name "ruby"
  20 +default_version "1.9.3-p484"
  21 +
  22 +dependency "zlib"
  23 +dependency "ncurses"
  24 +dependency "libedit"
  25 +dependency "openssl"
  26 +dependency "libyaml"
  27 +dependency "libiconv"
  28 +dependency "gdbm"
  29 +dependency "libgcc" if (platform == "solaris2" and Omnibus.config.solaris_compiler == "gcc")
  30 +
  31 +version "1.9.3-p484" do
  32 + source md5: '8ac0dee72fe12d75c8b2d0ef5d0c2968'
  33 +end
  34 +
  35 +version "2.0.0-p451" do
  36 + source md5: '9227787a9636551f1749ee8394b5ffe5'
  37 +end
  38 +
  39 +version "2.1.1" do
  40 + source md5: 'e57fdbb8ed56e70c43f39c79da1654b2'
  41 +end
  42 +
  43 +source url: "http://cache.ruby-lang.org/pub/ruby/#{version.match(/^(\d+\.\d+)/)[0]}/ruby-#{version}.tar.gz"
  44 +
  45 +relative_path "ruby-#{version}"
  46 +
  47 +env =
  48 + case platform
  49 + when "mac_os_x"
  50 + {
  51 + # -Qunused-arguments suppresses "argument unused during compilation"
  52 + # warnings. These can be produced if you compile a program that doesn't
  53 + # link to anything in a path given with -Lextra-libs. Normally these
  54 + # would be harmless, except that autoconf treats any output to stderr as
  55 + # a failure when it makes a test program to check your CFLAGS (regardless
  56 + # of the actual exit code from the compiler).
  57 + "CFLAGS" => "-arch x86_64 -m64 -L#{install_dir}/embedded/lib -I#{install_dir}/embedded/include -I#{install_dir}/embedded/include/ncurses -O3 -g -pipe -Qunused-arguments",
  58 + "LDFLAGS" => "-arch x86_64 -L#{install_dir}/embedded/lib -I#{install_dir}/embedded/include -I#{install_dir}/embedded/include/ncurses"
  59 + }
  60 + when "solaris2"
  61 + {
  62 + "CFLAGS" => "-L#{install_dir}/embedded/lib -I#{install_dir}/embedded/include -O3 -g -pipe",
  63 + "LDFLAGS" => "-R#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib -I#{install_dir}/embedded/include -static-libgcc",
  64 + "LD_OPTIONS" => "-R#{install_dir}/embedded/lib"
  65 + }
  66 + when "aix"
  67 + {
  68 + # see http://www.ibm.com/developerworks/aix/library/au-gnu.html
  69 + #
  70 + # specifically:
  71 + #
  72 + # "To use AIX run-time linking, you should create the shared object
  73 + # using gcc -shared -Wl,-G and create executables using the library
  74 + # by adding the -Wl,-brtl option to the link line. Technically, you
  75 + # can leave off the -shared option, but it does no harm and reduces
  76 + # confusion."
  77 + #
  78 + # AIX also uses -Wl,-blibpath instead of -R or LD_RUN_PATH, but the
  79 + # option is not additive, so requires /usr/lib and /lib as well (there
  80 + # is a -bsvr4 option to allow ld to take an -R flag in addition
  81 + # to turning on -brtl, but it had other side effects I couldn't fix).
  82 + #
  83 + # If libraries linked with gcc -shared have symbol resolution failures
  84 + # then it may be useful to add -bexpfull to export all symbols.
  85 + #
  86 + # -O2 optimized away some configure test which caused ext libs to fail
  87 + #
  88 + # We also need prezl's M4 instead of picking up /usr/bin/m4 which
  89 + # barfs on ruby.
  90 + #
  91 + "CC" => "xlc -q64",
  92 + "CXX" => "xlC -q64",
  93 + "LD" => "ld -b64",
  94 + "CFLAGS" => "-q64 -O -qhot -I#{install_dir}/embedded/include",
  95 + "CXXFLAGS" => "-q64 -O -qhot -I#{install_dir}/embedded/include",
  96 + "LDFLAGS" => "-q64 -L#{install_dir}/embedded/lib -Wl,-brtl -Wl,-blibpath:#{install_dir}/embedded/lib:/usr/lib:/lib",
  97 + "OBJECT_MODE" => "64",
  98 + "ARFLAGS" => "-X64 cru",
  99 + "M4" => "/opt/freeware/bin/m4",
  100 + "warnflags" => "-qinfo=por"
  101 + }
  102 + else
  103 + {
  104 + "CFLAGS" => "-I#{install_dir}/embedded/include -O3 -g -pipe",
  105 + "LDFLAGS" => "-Wl,-rpath,#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib"
  106 + }
  107 + end
  108 +
  109 +build do
  110 + configure_command = ["./configure",
  111 + "--prefix=#{install_dir}/embedded",
  112 + "--with-out-ext=fiddle,dbm",
  113 + "--enable-shared",
  114 + "--enable-libedit",
  115 + "--with-ext=psych",
  116 + "--disable-install-doc"]
  117 +
  118 + case platform
  119 + when "aix"
  120 + patch :source => "ruby-aix-configure.patch", :plevel => 1
  121 + patch :source => "ruby_aix_1_9_3_448_ssl_EAGAIN.patch", :plevel => 1
  122 + # --with-opt-dir causes ruby to send bogus commands to the AIX linker
  123 + when "freebsd"
  124 + configure_command << "--without-execinfo"
  125 + configure_command << "--with-opt-dir=#{install_dir}/embedded"
  126 + when "smartos"
  127 + # Opscode patch - someara@opscode.com
  128 + # GCC 4.7.0 chokes on mismatched function types between OpenSSL 1.0.1c and Ruby 1.9.3-p286
  129 + patch :source => "ruby-openssl-1.0.1c.patch", :plevel => 1
  130 +
  131 + # Patches taken from RVM.
  132 + # http://bugs.ruby-lang.org/issues/5384
  133 + # https://www.illumos.org/issues/1587
  134 + # https://github.com/wayneeseguin/rvm/issues/719
  135 + patch :source => "rvm-cflags.patch", :plevel => 1
  136 +
  137 + # From RVM forum
  138 + # https://github.com/wayneeseguin/rvm/commit/86766534fcc26f4582f23842a4d3789707ce6b96
  139 + configure_command << "ac_cv_func_dl_iterate_phdr=no"
  140 + configure_command << "--with-opt-dir=#{install_dir}/embedded"
  141 + else
  142 + configure_command << "--with-opt-dir=#{install_dir}/embedded"
  143 + end
  144 +
  145 + # @todo expose bundle_bust() in the DSL
  146 + env.merge!({
  147 + "RUBYOPT" => nil,
  148 + "BUNDLE_BIN_PATH" => nil,
  149 + "BUNDLE_GEMFILE" => nil,
  150 + "GEM_PATH" => nil,
  151 + "GEM_HOME" => nil
  152 + })
  153 +
  154 + # @todo: move into omnibus-ruby
  155 + has_gmake = system("gmake --version")
  156 +
  157 + if has_gmake
  158 + env.merge!({'MAKE' => 'gmake'})
  159 + make_binary = 'gmake'
  160 + else
  161 + make_binary = 'make'
  162 + end
  163 +
  164 + command configure_command.join(" "), :env => env
  165 + command "#{make_binary} -j #{max_build_jobs}", :env => env
  166 + command "#{make_binary} -j #{max_build_jobs} install", :env => env
  167 +end
... ...