[DRE-commits] [SCM] gem2deb.git branch, master, updated. 0.2.9-3-gcfcc1b7
Antonio Terceiro
terceiro at softwarelivre.org
Sat Sep 24 19:05:58 UTC 2011
The following commit has been merged in the master branch:
commit cfcc1b7ac9b0a1d21b8c1a5b88804d18a9e66919
Author: Dmitry Borodaenko <angdraug at gmail.com>
Date: Sat Sep 24 12:05:01 2011 -0700
Don't rewrite shebangs of non-Ruby scripts
Signed-off-by: Antonio Terceiro <terceiro at softwarelivre.org>
diff --git a/lib/gem2deb/dh_ruby.rb b/lib/gem2deb/dh_ruby.rb
index 504628a..fb78ed1 100644
--- a/lib/gem2deb/dh_ruby.rb
+++ b/lib/gem2deb/dh_ruby.rb
@@ -340,11 +340,16 @@ module Gem2Deb
def rewrite_shebangs(package, ruby_binary)
Dir.glob(File.join(destdir_for(package), @bindir, '**/*')).each do |path|
next if File.directory?(path)
- puts "Rewriting shebang line of #{path}" if @verbose
atomic_rewrite(path) do |input, output|
- old = input.gets # discard
- output.puts "#!#{ruby_binary}"
- unless old =~ /#!/
+ old = input.gets
+ if old =~ /ruby/ or old !~ /^#!/
+ puts "Rewriting shebang line of #{path}" if @verbose
+ output.puts "#!#{ruby_binary}"
+ unless old =~ /#!/
+ output.puts old
+ end
+ else
+ puts "Not rewriting shebang line of #{path}" if @verbose
output.puts old
end
output.print input.read
--
gem2deb.git
More information about the Pkg-ruby-extras-commits
mailing list