postmodern / ruby-install

Installs Ruby, JRuby, TruffleRuby, or mruby
MIT License
1.91k stars 255 forks source link

Default ruby_archive based on ruby_url basename #386

Closed postmodern closed 3 years ago

postmodern commented 3 years ago

If you run ruby-install --url https://../ruby-X.Y.Z.tar.gz ruby X.Y.Z it will download the archive to ruby-X.Y.Z.tar.bz2. ruby_archive should default to the basename of ruby_url to avoid this.

tejasbubane commented 3 years ago

Maybe related: I was trying to install ruby 3.0.0-rc1 today. ruby-install ruby-3.0.0-rc1 defaulted to tar.bz2 URL and looks like the package is not present: https://cache.ruby-lang.org/pub/ruby/3.0/ruby-3.0.0-rc1.tar.bz2 (at least at the moment of writing this comment).

So I tried with tar.gz url and that defaults to bz2 package:

$ ruby-install ruby-3.0.0-rc1 --url https://cache.ruby-lang.org/pub/ruby/3.0/ruby-3.0.0-rc1.tar.gz
>>> Installing ruby 3.0.0-rc1 into /home/tejas/.rubies/ruby-3.0.0-rc1 ...
>>> Installing dependencies for ruby 3.0.0-rc1 ...
>>> Downloading https://cache.ruby-lang.org/pub/ruby/3.0/ruby-3.0.0-rc1.tar.gz into /home/tejas/src ...
--2020-12-21 14:13:52--  https://cache.ruby-lang.org/pub/ruby/3.0/ruby-3.0.0-rc1.tar.gz
Loaded CA certificate '/etc/ssl/certs/ca-certificates.crt'
Resolving cache.ruby-lang.org (cache.ruby-lang.org)... 199.232.253.178, 2a04:4e42:fd3::434
Connecting to cache.ruby-lang.org (cache.ruby-lang.org)|199.232.253.178|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 19488885 (19M) [application/x-tar]
Saving to: ‘/home/tejas/src/ruby-3.0.0-rc1.tar.bz2.part’

/home/tejas/src/ruby-3.0.0-rc1.tar.bz2.part                100%[=======================================================================================================================================>]  18.59M  2.00MB/s    in 9.5s    

2020-12-21 14:14:02 (1.95 MB/s) - ‘/home/tejas/src/ruby-3.0.0-rc1.tar.bz2.part’ saved [19488885/19488885]

>>> Verifying ruby-3.0.0-rc1.tar.bz2 ...
*** No md5 checksum for /home/tejas/src/ruby-3.0.0-rc1.tar.bz2
*** No sha1 checksum for /home/tejas/src/ruby-3.0.0-rc1.tar.bz2
*** No sha256 checksum for /home/tejas/src/ruby-3.0.0-rc1.tar.bz2
*** No sha512 checksum for /home/tejas/src/ruby-3.0.0-rc1.tar.bz2
>>> Extracting ruby-3.0.0-rc1.tar.bz2 to /home/tejas/src/ruby-3.0.0-rc1 ...
bzip2: (stdin) is not a bzip2 file.
tar: Child returned status 2
tar: Error is not recoverable: exiting now
!!! Unpacking of ruby-3.0.0-rc1.tar.bz2 failed!
postmodern commented 3 years ago

Yep, that's how I stumbled across this oversight. Note that ruby-install >= 0.8.0 switched to .tar.xz.