[DRE-commits] [gem2deb] 03/08: dh_ruby_fixdepends: inject minimum Ruby dependency

Antonio Terceiro terceiro at moszumanska.debian.org
Tue Aug 12 01:46:27 UTC 2014


This is an automated email from the git hooks/post-receive script.

terceiro pushed a commit to branch master
in repository gem2deb.

commit 441d560db9f4d5ba5a0412ec2c34bb8b775fa6c1
Author: Antonio Terceiro <terceiro at debian.org>
Date:   Sat Aug 9 22:40:26 2014 -0300

    dh_ruby_fixdepends: inject minimum Ruby dependency
---
 bin/dh_ruby_fixdepends                      |  9 ++++--
 debian/changelog                            |  8 +++++
 debian/control                              |  4 +--
 test/integration/dh_ruby_fixdepends_test.rb | 45 +++++++++++++++++++++++++++++
 4 files changed, 62 insertions(+), 4 deletions(-)

diff --git a/bin/dh_ruby_fixdepends b/bin/dh_ruby_fixdepends
index 0502dd2..1dc66da 100755
--- a/bin/dh_ruby_fixdepends
+++ b/bin/dh_ruby_fixdepends
@@ -28,14 +28,19 @@ include Gem2Deb
       deps = l.chomp.split('=', 2)[1].split(', ')
       std_deps = []
       libruby_deps = []
+      ruby_deps = []
       deps.each do |dep|
-        if SUPPORTED_RUBY_SHARED_LIBRARIES.include?(dep.split(' ')[0])
+        if SUPPORTED_RUBY_SHARED_LIBRARIES.include?(dep.split.first)
           libruby_deps << dep
+          rdep = RubyDebianDev.min_ruby_dependency_for(dep.split.first)
+          if rdep
+            ruby_deps << rdep
+          end
         else
           std_deps << dep
         end
       end
-      newdeps = (std_deps + [(libruby_deps.join(' | '))]).join(', ')
+      newdeps = (std_deps + [libruby_deps.join(' | ')] + [ruby_deps.join(' | ')]).join(', ')
       fd.puts "shlibs:Depends=#{newdeps}"
     else
       fd.puts l
diff --git a/debian/changelog b/debian/changelog
index 40fd97b..ac79bb6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+gem2deb (0.8) UNRELEASED; urgency=medium
+
+  * dh_ruby_fixdepends: inject minimum Ruby dependency provided by
+    ruby-all-dev in the shared library dependencies. For that, bump dependency
+    on ruby-all-dev to (>= 1:2.1.0.3~)
+
+ -- Antonio Terceiro <terceiro at debian.org>  Sat, 09 Aug 2014 22:35:16 -0300
+
 gem2deb (0.7.6) unstable; urgency=medium
 
   [ Antonio Terceiro ]
diff --git a/debian/control b/debian/control
index d16d95d..04707c5 100644
--- a/debian/control
+++ b/debian/control
@@ -11,7 +11,7 @@ Build-Depends: debhelper (>= 7.0.50~),
                devscripts,
                lintian,
                rake,
-               ruby-all-dev (>= 1:1.9.3.4),
+               ruby-all-dev (>= 1:2.1.0.3~),
                ruby-mocha (>= 0.14.0),
                ruby-setup,
                ruby-shoulda-context,
@@ -27,7 +27,7 @@ Depends: build-essential,
          debhelper (>= 7.0.50~),
          devscripts,
          ruby | ruby-interpreter,
-         ruby-all-dev (>= 1:1.9.3.4),
+         ruby-all-dev (>= 1:2.1.0.3~),
          ${misc:Depends},
          ${perl:Depends},
          ${shlibs:Depends}
diff --git a/test/integration/dh_ruby_fixdepends_test.rb b/test/integration/dh_ruby_fixdepends_test.rb
new file mode 100644
index 0000000..bd2b8c3
--- /dev/null
+++ b/test/integration/dh_ruby_fixdepends_test.rb
@@ -0,0 +1,45 @@
+require 'test_helper'
+
+class DhRubyFixDependsTest < Gem2DebTestCase
+
+  should 'insert ruby dependency' do
+    deps = prepare('foo') do
+      run_command('dh_ruby_fixdepends')
+
+      File.readlines("debian/foo.substvars").find { |l| l =~ /^shlibs:Depends=/ }.strip.sub('shlibs:Depends=', '').split(/,\s*/)
+    end
+
+    Gem2Deb::SUPPORTED_RUBY_SHARED_LIBRARIES.each do |shlib|
+      assert deps.any? { |dep| dep.split(/\s*\|\s*/).include?(shlib) }, "#{deps.inspect} expected to include '#{shlib.inspect} (>= something)'"
+    end
+    assert deps.any? { |dep| dep =~ /ruby \(>= [^)]*\)/ }, "#{deps.inspect} expected to include 'ruby (>= something)'"
+  end
+
+  def prepare(package)
+    pkgdir = File.join(tmpdir, package)
+    FileUtils.mkdir(pkgdir)
+    Dir.chdir(pkgdir) do
+      FileUtils.mkdir 'debian'
+
+      File.open('debian/control', 'w') do |control|
+        control.puts("Source: #{package}")
+        control.puts('Maintainer: The Maintainer <maintainer at example.com>')
+        control.puts('XS-Ruby-Versions: all')
+        control.puts
+        control.puts("Package: #{package}")
+        control.puts('Architecture: any')
+        control.puts('Depends: ${shlibs:Depends}, ruby | ruby-interpreter')
+        control.puts('Description: example package')
+        control.puts(' Just for testing')
+      end
+
+      File.open("debian/#{package}.substvars", 'w') do |substvars|
+        substvars.puts('shlibs:Depends=' + Gem2Deb::SUPPORTED_RUBY_SHARED_LIBRARIES.join(', '))
+      end
+
+      yield
+    end
+  end
+
+end
+

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/gem2deb.git



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