Created
August 31, 2011 08:01
-
-
Save 3dd13/1183048 to your computer and use it in GitHub Desktop.
the reason of ruby_core_source.rb:57 'initilize': not in gzip format (Zlib::GzipFile::Error)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# the problem was | |
# this file was TAR compressed but not TAR.GZ | |
# | |
uri_path = "http://ftp.ruby-lang.org/pub/ruby/1.9/" + ruby_dir + ".tar.gz" | |
Tempfile.open("ruby-src") { |temp| | |
temp.binmode | |
uri = URI.parse(uri_path) | |
uri.download(temp) | |
tgz = Zlib::GzipReader.new(File.open(temp, "rb")) | |
FileUtils.mkdir_p(dest_dir) | |
Dir.mktmpdir { |dir| | |
inc_dir = dir + "/" + ruby_dir + "/*.inc" | |
hdr_dir = dir + "/" + ruby_dir + "/*.h" | |
Archive::Tar::Minitar.unpack(tgz, dir) | |
FileUtils.cp(Dir.glob([ inc_dir, hdr_dir ]), dest_dir) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# just a temp workaround when the ruby source format is TAR, but not TAR.GZ | |
# | |
# tgz = Zlib::GzipReader.new(File.open(temp, "rb")) | |
tgz = File.open(temp, "rb") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment