summaryrefslogtreecommitdiff
path: root/distruby.rb
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-03-20 07:37:34 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-03-20 07:37:34 +0000
commit8ad16ae4d7a747301595d807dfb891b1d634a934 (patch)
treef80ebd2a902e5f3c450f0b1e8bb42de80ba1251f /distruby.rb
parent02edb1e4abc067c60bf1e34846ecc527e98b3876 (diff)
* distruby.rb: Add zip generation.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_6@12109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'distruby.rb')
-rw-r--r--distruby.rb32
1 files changed, 21 insertions, 11 deletions
diff --git a/distruby.rb b/distruby.rb
index dcc3e76..613da0e 100644
--- a/distruby.rb
+++ b/distruby.rb
@@ -7,7 +7,9 @@ else
dirname = sprintf 'ruby-%s-p%u', RUBY_VERSION, RUBY_PATCHLEVEL
tagname = dirname.gsub /ruby-(\d)\.(\d)\.(\d)-p/, 'v\1_\2_\3_'
end
-tarname = dirname + '.tar.gz'
+tgzname = dirname + '.tar.gz'
+tbzname = dirname + '.tar.bz2'
+zipname = dirname + '.zip'
repos = 'http://svn.ruby-lang.org/repos/ruby/tags/' + tagname
STDERR.puts 'exporting sources...'
@@ -21,16 +23,24 @@ Dir.chdir dirname do
system 'bison', '-y', '-o', 'parse.c', 'parse.y'
end
-STDERR.puts 'generating tarball...'
-system 'tar', 'chofzp', tarname, dirname
-
-open tarname, 'rb' do |fp|
- require 'digest/md5'
- require 'digest/sha1'
- str = fp.read
- md5 = Digest::MD5.hexdigest str
- sha = Digest::SHA1.hexdigest str
- printf "MD5(%s)= %s\nSHA1(%s)= %s\n", tarname, md5, tarname, sha
+STDERR.puts 'generating tarballs...'
+ENV['GZIP'] = '-9'
+system 'tar', 'chofzp', tgzname, dirname
+system 'tar', 'chojfp', tbzname, dirname
+system 'zip', '-q9r', zipname, dirname
+
+require 'digest/md5'
+require 'digest/sha2'
+for name in [tgzname, tbzname, zipname] do
+ open name, 'rb' do |fp|
+ str = fp.read
+ md5 = Digest::MD5.hexdigest str
+ sha = Digest::SHA256.hexdigest str
+ printf "MD5(%s)= %s\nSHA256(%s)= %s\nSIZE(%s)= %s\n\n",
+ name, md5,
+ name, sha,
+ name, str.size
+ end
end