ruby-changes:11535
From: nobu <ko1@a...>
Date: Fri, 10 Apr 2009 03:01:38 +0900 (JST)
Subject: [ruby-changes:11535] Ruby:r23165 (trunk): * instruby.rb, mkconfig.rb: deal with --program-transform-name
nobu 2009-04-10 03:01:26 +0900 (Fri, 10 Apr 2009) New Revision: 23165 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=23165 Log: * instruby.rb, mkconfig.rb: deal with --program-transform-name better. now supports s, y commands and single addressing. Modified files: trunk/ChangeLog trunk/instruby.rb trunk/mkconfig.rb trunk/version.h Index: ChangeLog =================================================================== --- ChangeLog (revision 23164) +++ ChangeLog (revision 23165) @@ -1,3 +1,8 @@ +Fri Apr 10 03:01:24 2009 Nobuyoshi Nakada <nobu@r...> + + * instruby.rb, mkconfig.rb: deal with --program-transform-name + better. now supports s, y commands and single addressing. + Thu Apr 9 23:59:11 2009 Tanaka Akira <akr@f...> * configure.in: don't override the rule for ruby. Index: mkconfig.rb =================================================================== --- mkconfig.rb (revision 23164) +++ mkconfig.rb (revision 23165) @@ -83,12 +83,33 @@ when /^\$\{ac_\w+\}$/; next when /^\$ac_\w+$/; next end - if /^program_transform_name$/ =~ name and /^s(\\?.)(.*)\1$/ =~ val - next if $install_name - sep = %r"#{Regexp.quote($1)}" - ptn = $2.gsub(/\$\$/, '$').split(sep, 2) - name = "ruby_install_name" - val = "ruby".sub(/#{ptn[0]}/, ptn[1]) + if /^program_transform_name$/ =~ name + val.sub!(/\As(\W)(?:\^|\$\$)\1\1(;|\z)/, '') + if val.empty? + $install_name ||= "ruby" + next + end + unless $install_name + $install_name = "ruby" + val.gsub!(/\$\$/, '$') + val.scan(%r[\G[\s;]*(/(?:\\.|[^/])*/)?([sy])(\W)((?:\\.|(?!\3).)*)\3((?:\\.|(?!\3).)*)\3([gi]*)]) do + |addr, cmd, sep, pat, rep, opt| + if addr + Regexp.new(addr[/\A\/(.*)\/\z/, 1]) =~ $install_name or next + end + case cmd + when 's' + pat = Regexp.new(pat, opt.include?('i')) + if opt.include?('g') + $install_name.gsub!(pat, rep) + else + $install_name.sub!(pat, rep) + end + when 'y' + $install_name.tr!(Regexp.quote(pat), rep) + end + end + end end val.gsub!(/ +(?!-)/, "=") if name == "configure_args" && /mswin32/ =~ RUBY_PLATFORM val = val.gsub(/\$(?:\$|\{?(\w+)\}?)/) {$1 ? "$(#{$1})" : $&}.dump Index: version.h =================================================================== --- version.h (revision 23164) +++ version.h (revision 23165) @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.2" -#define RUBY_RELEASE_DATE "2009-04-09" +#define RUBY_RELEASE_DATE "2009-04-10" #define RUBY_PATCHLEVEL -1 #define RUBY_BRANCH_NAME "trunk" @@ -8,7 +8,7 @@ #define RUBY_VERSION_TEENY 1 #define RUBY_RELEASE_YEAR 2009 #define RUBY_RELEASE_MONTH 4 -#define RUBY_RELEASE_DAY 9 +#define RUBY_RELEASE_DAY 10 #ifdef RUBY_EXTERN RUBY_EXTERN const char ruby_version[]; Index: instruby.rb =================================================================== --- instruby.rb (revision 23164) +++ instruby.rb (revision 23165) @@ -381,11 +381,35 @@ if File::ALT_SEPARATOR ruby_bin = ruby_shebang.tr(File::SEPARATOR, File::ALT_SEPARATOR) end + if trans = CONFIG["program_transform_name"] + exp = [] + trans.gsub!(/\$\$/, '$') + trans.scan(%r[\G[\s;]*(/(?:\\.|[^/])*/)?([sy])(\W)((?:\\.|(?!\3).)*)\3((?:\\.|(?!\3).)*)\3([gi]*)]) do + |addr, cmd, sep, pat, rep, opt| + addr &&= Regexp.new(addr[/\A\/(.*)\/\z/, 1]) + case cmd + when 's' + next if pat == '^' and rep.empty? + exp << [addr, (opt.include?('g') ? :gsub! : :sub!), + Regexp.new(pat, opt.include?('i')), rep] + when 'y' + exp << [addr, :tr!, Regexp.quote(pat), rep] + end + end + trans = proc do |base| + exp.each {|addr, opt, pat, rep| base.__send__(opt, pat, rep) if !addr or addr =~ base} + base + end + elsif /ruby/ =~ ruby_install_name + trans = proc {|base| ruby_install_name.sub(/ruby/, base)} + else + trans = proc {|base| base} + end for src in Dir[File.join(srcdir, "bin/*")] next unless File.file?(src) next if /\/[.#]|(\.(old|bak|orig|rej|diff|patch|core)|~|\/core)$/i =~ src - name = ruby_install_name.sub(/ruby/, File.basename(src)) + name = trans[File.basename(src)] shebang = '' body = '' -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/