0

I'm trying to install linuxbrew on Travis CI, and it fails for a reason I don't understand. Travis CI claims:

default ruby version
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]

but when my .travis.yml file does a:

 sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"

It fails at:

HEAD is now at 851177a29 docs: update gems. (#569)
/usr/lib/ruby/1.9.1/rubygems/version.rb:191:in `strip!': can't modify frozen String (RuntimeError)
    from /usr/lib/ruby/1.9.1/rubygems/version.rb:191:in `initialize'
    from -e:1:in `new'
    from -e:1:in `<main>'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/brew.rb:12:in `<main>': Homebrew must be run under Ruby 2.3! You're running 1.9.3. (RuntimeError)
Failed during: /home/linuxbrew/.linuxbrew/bin/brew update --force

I think this used to work (last year), but all of a sudden its failing. How do I install Linuxbrew on Travis CI on "trusty"?

Edit

Here's my .travis.yml

language: cpp
sudo: required
dist: trusty

before_install:
  - sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"

End Edit

Thanks.

  • Update your question with relevant portions of `.travis.yml` and your `install.sh` file. – Azeem Jan 22 '18 at 09:59
  • Manually ran your [install.sh script](https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh) and there was no error. – Azeem Jan 22 '18 at 10:27
  • I've added a minimal .travis.yml - thanks – Andrew Trotman Jan 22 '18 at 22:25
  • adding group: deprecated-2017Q4 doesn't work either. – Andrew Trotman Jan 22 '18 at 22:31
  • Can you try to put that script in your repo (or test repo) and let it run directly? Why do your Travis CI logs indicate Ruby v1.9.1 (From the logs that you posted in your question: `/usr/lib/ruby/1.9.1/rubygems/version.rb`)? I believe Travis CI uses the latest Ruby v2.4.x. Are you specifying the version somewhere? Check that also in your test repo. – Azeem Jan 23 '18 at 05:26
  • 1
    Weird isn't it. Linuxbrew appears to guess which version of Ruby is installed and gets it wrong. /usr/lib/ruby/1.9.1/ does exist, but is too old to use. See my answer below for the work around. And thanks for your help. – Andrew Trotman Jan 23 '18 at 09:20
  • That's good! No problem at all! :) – Azeem Jan 23 '18 at 09:35

1 Answers1

1

It appears as though Linuxbrew on Travis CI has a problem identifying which version of Ruby is installed. To fix use the alternative install method of:

git clone https://github.com/Linuxbrew/brew.git ~/.linuxbrew
export HOMEBREW_FORCE_VENDOR_RUBY=1

in the before_install section