[DRE-commits] [SCM] gem2deb.git branch, master, updated. debian/0.2.3-35-g72c44bc

Antonio Terceiro terceiro at softwarelivre.org
Sun Jun 19 02:35:47 UTC 2011


The following commit has been merged in the master branch:
commit beecb5ad94d3685e940ba24b887ea854331bbfc4
Author: Antonio Terceiro <terceiro at softwarelivre.org>
Date:   Sat Jun 18 19:16:22 2011 -0700

    Always create installation dirs (Closes: #630738)
    
    First, do not include directories explicitly in the list of files to be
    installed. Second, always create the destination directory before
    installing the files (i.e. pass -D to `install`)

diff --git a/lib/gem2deb/dh_ruby.rb b/lib/gem2deb/dh_ruby.rb
index 7ac2bf4..1cb221d 100644
--- a/lib/gem2deb/dh_ruby.rb
+++ b/lib/gem2deb/dh_ruby.rb
@@ -305,15 +305,13 @@ module Gem2Deb
       files_to_install = Dir.chdir(src) do
         Dir.glob('**/*').reject do |file|
           filename = File.basename(file)
-          DO_NOT_INSTALL.any? { |pattern| filename =~ pattern }
+          File.directory?(file) || DO_NOT_INSTALL.any? { |pattern| filename =~ pattern }
         end
       end
-      files_to_install.each do |fname|
-        if File::directory?(src + '/' + fname)
-          run "install -d #{dest + '/' + fname}"
-        else
-          run "install -m#{mode} #{src + '/' + fname} #{dest + '/' + fname}"
-        end
+      files_to_install.each do |file|
+        from = File.join(src, file)
+        to = File.join(dest, file)
+        run "install -D -m#{mode} #{from} #{to}"
       end
     end
 
diff --git a/test/sample/simplegem/lib/simplegem.rb b/test/sample/install_files/lib/mylib.rb
similarity index 100%
copy from test/sample/simplegem/lib/simplegem.rb
copy to test/sample/install_files/lib/mylib.rb
diff --git a/test/sample/simplegem/lib/simplegem.rb b/test/sample/install_files/lib/mylib/tags/base.rb
similarity index 100%
copy from test/sample/simplegem/lib/simplegem.rb
copy to test/sample/install_files/lib/mylib/tags/base.rb
diff --git a/test/unit/dh_ruby_test.rb b/test/unit/dh_ruby_test.rb
index e7498f7..b13728a 100644
--- a/test/unit/dh_ruby_test.rb
+++ b/test/unit/dh_ruby_test.rb
@@ -59,6 +59,15 @@ class DhRubyTest < Gem2DebTestCase
     end
   end
 
+  context 'installing Ruby files' do
+    should 'not crash when directories to be installed have names in the exclusion list' do
+      Dir.chdir('test/sample/install_files/') do
+        dh_ruby = Gem2Deb::DhRuby.new
+        dh_ruby.send(:install_files, 'lib', File.join(tmpdir, 'install_files_destdir'), 644)
+      end
+    end
+  end
+
   context 'skipping checks' do
     setup do
       @dh_ruby = Gem2Deb::DhRuby.new

-- 
gem2deb.git



More information about the Pkg-ruby-extras-commits mailing list