* io.c (rb_open_file): encoding in mode string was ignored if perm is
[ruby-svn.git] / distruby.rb
blob613da0eb9cb6ce934e869b13ecf1159dfc62e1a7
1 #!./miniruby
3 if RUBY_PATCHLEVEL.zero?
4         dirname = sprintf 'ruby-%s', RUBY_VERSION
5         tagname = dirname.gsub /ruby-(\d)\.(\d)\.(\d)/, 'v\1_\2_\3'
6 else
7         dirname = sprintf 'ruby-%s-p%u', RUBY_VERSION, RUBY_PATCHLEVEL
8         tagname = dirname.gsub /ruby-(\d)\.(\d)\.(\d)-p/, 'v\1_\2_\3_'
9 end
10 tgzname = dirname + '.tar.gz'
11 tbzname = dirname + '.tar.bz2'
12 zipname = dirname + '.zip'
13 repos   = 'http://svn.ruby-lang.org/repos/ruby/tags/' + tagname
15 STDERR.puts 'exporting sources...'
16 system 'svn',  'export',  '-q', repos, dirname
17 Dir.chdir dirname do
18         STDERR.puts 'generating configure...'
19         system 'autoconf'
20         system 'rm', '-rf', 'autom4te.cache'
22         STDERR.puts 'generating parse.c...'
23         system 'bison', '-y', '-o', 'parse.c', 'parse.y'
24 end
26 STDERR.puts 'generating tarballs...'
27 ENV['GZIP'] = '-9'
28 system 'tar', 'chofzp', tgzname, dirname
29 system 'tar', 'chojfp', tbzname, dirname
30 system 'zip', '-q9r', zipname, dirname
32 require 'digest/md5'
33 require 'digest/sha2'
34 for name in [tgzname, tbzname, zipname] do
35         open name, 'rb' do |fp|
36                 str = fp.read
37                 md5 = Digest::MD5.hexdigest str
38                 sha = Digest::SHA256.hexdigest str
39                 printf "MD5(%s)= %s\nSHA256(%s)= %s\nSIZE(%s)= %s\n\n",
40                                  name, md5,
41                                  name, sha,
42                                  name, str.size
43         end
44 end
48 \f
49 # Local Variables:
50 # mode: ruby
51 # code: utf-8
52 # indent-tabs-mode: t
53 # tab-width: 3
54 # ruby-indent-level: 3
55 # fill-column: 79
56 # default-justification: full
57 # End:
58 # vi: ts=3 sw=3