[DRE-commits] [gem2deb] 05/07: dh-make-ruby: avoid calling wnpp-check twice

Antonio Terceiro terceiro at moszumanska.debian.org
Sat Sep 16 00:50:32 UTC 2017


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

terceiro pushed a commit to branch master
in repository gem2deb.

commit dc7e7bc9dfa7fe8b249614738eb8b77c096a01aa
Author: Antonio Terceiro <terceiro at debian.org>
Date:   Fri Sep 15 21:12:19 2017 -0300

    dh-make-ruby: avoid calling wnpp-check twice
---
 debian/changelog               |  6 ++++--
 lib/gem2deb/dh_make_ruby.rb    | 10 ++++++----
 test/unit/dh_make_ruby_test.rb |  4 ++--
 3 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 7159d34..4cbe017 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,7 +1,9 @@
 gem2deb (0.36) UNRELEASED; urgency=medium
 
-  * dh-make-ruby: use `FIXME` in Section: when package name is not `ruby-*`,
-    to avoid tools being in section `ruby`.
+  * dh-make-ruby:
+    - use `FIXME` in Section: when package name is not `ruby-*`, to avoid
+      tools being in section `ruby`.
+    - avoid calling wnpp-check twice
   * gem2deb-test-runner: drop dependency on dpkg-dev. autopkgtest tests should
     be for installed packages, and pulling development tools is Wrong™.
   * Apply patch by James Clarke to fix crash when handling build failures in C
diff --git a/lib/gem2deb/dh_make_ruby.rb b/lib/gem2deb/dh_make_ruby.rb
index d0c83a2..c2e992c 100644
--- a/lib/gem2deb/dh_make_ruby.rb
+++ b/lib/gem2deb/dh_make_ruby.rb
@@ -291,11 +291,13 @@ module Gem2Deb
     end
 
     def itp_bug
-      if do_wnpp_check && wnpp_check.length > 0
-        wnpp_check.split(" ")[2].chomp(")")
-      else
-        "#nnnn"
+      if do_wnpp_check
+        wnpp = wnpp_check()
+        if wnpp.length > 0
+          return wnpp.split(" ")[2].chomp(")")
+        end
       end
+      "#nnnn"
     end
 
     NEVER_OVERWRITE = %w[
diff --git a/test/unit/dh_make_ruby_test.rb b/test/unit/dh_make_ruby_test.rb
index 6a1676b..3e0cfcb 100644
--- a/test/unit/dh_make_ruby_test.rb
+++ b/test/unit/dh_make_ruby_test.rb
@@ -45,13 +45,13 @@ class DhMakeRubyTest < Gem2DebTestCase
 
   should 'use #nnnn if no ITP bug exists' do
       @dh_make_ruby = Gem2Deb::DhMakeRuby.new('ruby_foo-1.2.3.tar.gz', :do_wnpp_check => true)
-      @dh_make_ruby.stubs(:wnpp_check).returns('')
+      @dh_make_ruby.expects(:wnpp_check).returns('').once
       assert_equal @dh_make_ruby.itp_bug, '#nnnn'
   end
 
   should 'use ITP bug if it exists' do
       @dh_make_ruby = Gem2Deb::DhMakeRuby.new('ruby_foo-1.2.3.tar.gz', :do_wnpp_check => true)
-      @dh_make_ruby.stubs(:wnpp_check).returns('(ITP - #42) http://bugs.debian.org/42 ruby-foo')
+      @dh_make_ruby.expects(:wnpp_check).returns('(ITP - #42) http://bugs.debian.org/42 ruby-foo').once
       assert_equal @dh_make_ruby.itp_bug, '#42'
   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