summaryrefslogtreecommitdiff
path: root/tool/make-snapshot
diff options
context:
space:
mode:
Diffstat (limited to 'tool/make-snapshot')
-rwxr-xr-xtool/make-snapshot31
1 files changed, 24 insertions, 7 deletions
diff --git a/tool/make-snapshot b/tool/make-snapshot
index f6529d9c25..7ad64bd55d 100755
--- a/tool/make-snapshot
+++ b/tool/make-snapshot
@@ -6,6 +6,9 @@ require 'fileutils'
require 'tmpdir'
STDOUT.sync = true
+$exported = nil if $exported == ""
+$archname = nil if $archname == ""
+
ENV["LC_ALL"] = ENV["LANG"] = "C"
SVNURL = URI.parse("http://svn.ruby-lang.org/repos/ruby/")
RUBY_VERSION_PATTERN = /^\#define\s+RUBY_VERSION\s+"([\d.]+)"/
@@ -22,7 +25,7 @@ path = ENV["PATH"].split(File::PATH_SEPARATOR)
%w[YACC BASERUBY RUBY MV MINIRUBY].each do |var|
cmd = ENV[var]
unless path.any? {|dir|
- file = File.join(dir, cmd)
+ file = File.expand_path(cmd, dir)
File.file?(file) and File.executable?(file)
}
abort "#{File.basename $0}: #{var} command not found - #{cmd}"
@@ -74,9 +77,15 @@ def package(rev, destdir)
end
revision = `svn info #{url}`[/Last Changed Rev: (\d+)/, 1]
end
- unless $exported
+ v = nil
+ if $exported
+ if String === $exported
+ v = $exported
+ end
+ else
+ v = "ruby"
puts "Exporting #{rev}@#{revision}"
- IO.popen("svn export #{url} ruby") do |pipe|
+ IO.popen("svn export #{url} #{v}") do |pipe|
pipe.each {|line| /^A/ =~ line or print line}
end
unless $?.success?
@@ -85,7 +94,7 @@ def package(rev, destdir)
end
end
- if !File.directory?(v = "ruby")
+ if !File.directory?(v)
v = Dir.glob("ruby-*").select(&File.method(:directory?))
v.size == 1 or abort "not exported"
v = v[0]
@@ -100,8 +109,11 @@ def package(rev, destdir)
else
tag ||= "r#{revision}"
end
- v = "ruby-#{version}-#{tag}"
- File.directory?(v) or File.rename "ruby", v
+ unless v == $exported
+ n = "ruby-#{version}-#{tag}"
+ File.directory?(n) or File.rename v, n
+ v = n
+ end
system("patch -d #{v} -p0 -i #{$patch_file}") if $patch_file
def (clean = []).add(n) push(n); n end
Dir.chdir(v) do
@@ -154,11 +166,16 @@ def package(rev, destdir)
puts " done"
end
+ if v == "."
+ v = File.basename(Dir.pwd)
+ Dir.chdir ".."
+ end
+
return [["bzip tarball", ".tar.bz2", %w"tar cjf"],
["gzip tarball", ".tar.gz", %w"tar czf"],
["zip archive", ".zip", %w"zip -qr"]
].collect do |mesg, ext, cmd|
- file = "#{destdir}/#{v}#{ext}"
+ file = "#{destdir}/#{v||$archname}#{ext}"
print "creating #{mesg}... #{file}"
if system(*(cmd + [file, v]))
puts " done"