[前][次][番号順一覧][スレッド一覧]

ruby-changes:33853

From: nobu <ko1@a...>
Date: Tue, 13 May 2014 19:09:46 +0900 (JST)
Subject: [ruby-changes:33853] nobu:r45934 (trunk): make-snapshot: support xz

nobu	2014-05-13 19:09:41 +0900 (Tue, 13 May 2014)

  New Revision: 45934

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45934

  Log:
    make-snapshot: support xz
    
    * tool/make-snapshot (package): support xz.  no longer runs with
      1.8 or earlier.

  Modified files:
    trunk/tool/make-snapshot
Index: tool/make-snapshot
===================================================================
--- tool/make-snapshot	(revision 45933)
+++ tool/make-snapshot	(revision 45934)
@@ -27,6 +27,13 @@ each versions may be followed by optiona https://github.com/ruby/ruby/blob/trunk/tool/make-snapshot#L27
 USAGE
 end
 
+PACKAGES = {
+  "bzip" => %w".tar.bz2 bzip2 -c",
+  "gzip" => %w".tar.gz  gzip -c",
+  "xz"   => %w".tar.xz  xz -c",
+  "zip"  => %w".zip     zip -qr",
+}
+
 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.]+)"/
@@ -270,13 +277,32 @@ def package(rev, destdir) https://github.com/ruby/ruby/blob/trunk/tool/make-snapshot#L277
     v = File.basename(v)
   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|
+  tarball = nil
+  return PACKAGES.collect do |mesg, (ext, *cmd)|
+    File.directory?(destdir) or FileUtils.mkpath(destdir)
     file = File.join(destdir, "#{$archname||v}#{ext}")
-    print "creating #{mesg}... #{file}"
-    if system(*(cmd + [file, v]))
+    case ext
+    when /\.tar/
+      if tarball
+        next if tarball.empty?
+      else
+        tarball = "#{$archname||v}.tar"
+        print "creating tarball... #{tarball}"
+        if system("tar", "cf", tarball, v)
+          puts " done"
+        else
+          puts " failed"
+          tarball = ""
+          next
+        end
+      end
+      print "creating #{mesg} tarball... #{file}"
+      done = system(*(cmd + [tarball]), out: file)
+    else
+      print "creating #{mesg} archive... #{file}"
+      done = system(*(cmd + [file, v]))
+    end
+    if done
       puts " done"
       file
     else

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]