[DRE-commits] [gem2deb] 04/04: dh-make-ruby: include dependencies uncommented

Antonio Terceiro terceiro at moszumanska.debian.org
Fri Feb 6 16:26:10 UTC 2015


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

terceiro pushed a commit to branch master
in repository gem2deb.

commit 13e79bed9c3976be560f1c795386a035c2789d0a
Author: Antonio Terceiro <terceiro at debian.org>
Date:   Fri Feb 6 14:25:34 2015 -0200

    dh-make-ruby: include dependencies uncommented
---
 debian/changelog                                 |  3 +++
 lib/gem2deb/dh_make_ruby.rb                      | 25 ++++++++++++++++++------
 lib/gem2deb/dh_make_ruby/template/debian/control |  3 ---
 3 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 5a8d773..bc96bcb 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -11,6 +11,9 @@ gem2deb (0.11) UNRELEASED; urgency=medium
     logs much more detailed, what is a good thing.
   * dh-make-ruby: look for test files recursively in generated
     debian/ruby-tests.rake for both test/unit and rspec style tests.
+  * dh-make-ruby: gem dependencies will now be included in debian/control
+    uncommented and transformed to Debian package names, i.e. foo → ruby-foo,
+    except for known exceptions (such as rake and rails initially).
 
  -- Antonio Terceiro <terceiro at debian.org>  Wed, 15 Oct 2014 16:16:04 -0300
 
diff --git a/lib/gem2deb/dh_make_ruby.rb b/lib/gem2deb/dh_make_ruby.rb
index cc842ab..75c0e17 100644
--- a/lib/gem2deb/dh_make_ruby.rb
+++ b/lib/gem2deb/dh_make_ruby.rb
@@ -168,12 +168,24 @@ module Gem2Deb
 
     def initialize_binary_package
       self.binary_package = Package.new(source_package_name, metadata.has_native_extensions? ? 'any' : 'all')
-      metadata.dependencies.each do |dependency|
-        binary_package.gem_dependencies << dependency
+      with_each_runtime_dependency do |dependency|
+        binary_package.dependencies << dependency
       end
       binary_package
     end
 
+    def with_each_runtime_dependency
+      (metadata.dependencies).select do |dep|
+        dep.type == :runtime
+      end.each do |dep|
+        dependency = gem_name_to_source_package_name(dep.name)
+        if dep.requirements != '>= 0'
+          dependency << (' (%s)' % dep.requirements.gsub('~>', '>='))
+        end
+        yield(dependency)
+      end
+    end
+
     def buildpackage(source_only = false, check_build_deps = true)
       dpkg_buildpackage_opts = []
       dpkg_buildpackage_opts << '-S' if source_only
@@ -298,10 +310,11 @@ module Gem2Deb
         self.architecture = architecture
       end
       def dependencies
-        ['${shlibs:Depends}', '${misc:Depends}', 'ruby | ruby-interpreter' ]
-      end
-      def gem_dependencies
-        @gem_dependencies ||= []
+        @dependencies ||= [
+          '${shlibs:Depends}',
+          '${misc:Depends}',
+          'ruby | ruby-interpreter',
+        ]
       end
     end
 
diff --git a/lib/gem2deb/dh_make_ruby/template/debian/control b/lib/gem2deb/dh_make_ruby/template/debian/control
index 83d5f45..599fd75 100644
--- a/lib/gem2deb/dh_make_ruby/template/debian/control
+++ b/lib/gem2deb/dh_make_ruby/template/debian/control
@@ -15,9 +15,6 @@ Package: <%= binary_package.name %>
 Architecture: <%= binary_package.architecture %>
 XB-Ruby-Versions: ${ruby:Versions}
 Depends: <%= binary_package.dependencies.join(', ') %>
-<% if binary_package.gem_dependencies.length > 0 %>
-# <%= binary_package.gem_dependencies.join(', ') %>
-<% end %>
 Description: <%= short_description ? short_description : 'FIXME' %>
 <% if long_description %>
 <%= long_description.lines.map { |line| ' ' + (line.strip.empty? ? '.' : line.strip) }.join("\n") + "\n" %>

-- 
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