[DRE-commits] [gem2deb] 01/01: Fill in ITP number if present (Closes: #704651)

Per Andersson avtobiff-guest at moszumanska.debian.org
Fri Apr 18 22:12:11 UTC 2014


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

avtobiff-guest pushed a commit to branch fill-in-itp-number-if-present
in repository gem2deb.

commit e0a58ec0cbffb784e675bbd4bd8d187381cbc9b7
Author: Per Andersson <avtobiff at gmail.com>
Date:   Sat Apr 19 00:11:33 2014 +0200

    Fill in ITP number if present (Closes: #704651)
---
 lib/gem2deb/dh_make_ruby.rb    | 16 +++++++++++++++-
 test/unit/dh_make_ruby_test.rb | 12 ++++++++++++
 2 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/lib/gem2deb/dh_make_ruby.rb b/lib/gem2deb/dh_make_ruby.rb
index 723c752..f5a1a48 100644
--- a/lib/gem2deb/dh_make_ruby.rb
+++ b/lib/gem2deb/dh_make_ruby.rb
@@ -187,10 +187,24 @@ module Gem2Deb
       end
     end
 
+    def wnpp_check
+      `wnpp-check #{source_package_name}`
+    end
+
+    def itp_bug
+      if wnpp_check.length > 0
+        wnpp_check.split(" ")[2].chomp(")")
+      else
+        "#nnnn"
+      end
+    end
+
     def create_debian_boilerplates
       FileUtils.mkdir_p('debian')
       unless File.exists?('debian/changelog')
-        run('dch', '--create', '--empty', '--package', source_package_name, '--newversion', "#{gem_version}-1", 'Initial release (Closes: #nnnn)')
+        run('dch', '--create', '--empty', '--package', source_package_name,
+            '--newversion', "#{gem_version}-1",
+            "Initial release (Closes: #{itp_bug})")
       end
       templates.each do |template|
         FileUtils.mkdir_p(template.directory)
diff --git a/test/unit/dh_make_ruby_test.rb b/test/unit/dh_make_ruby_test.rb
index 688aeb6..0bdf905 100644
--- a/test/unit/dh_make_ruby_test.rb
+++ b/test/unit/dh_make_ruby_test.rb
@@ -30,6 +30,18 @@ class DhMakeRubyTest < Gem2DebTestCase
     assert_equal 'ruby-foo', Gem2Deb::DhMakeRuby.new('foo_ruby-1.2.3.tar.gz').source_package_name
   end
 
+  should 'not use #nnnn if no ITP bug exists' do
+      @dh_make_ruby = Gem2Deb::DhMakeRuby.new('ruby_foo-1.2.3.tar.gz')
+      @dh_make_ruby.stubs(:wnpp_check).returns('')
+      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')
+      @dh_make_ruby.stubs(:wnpp_check).returns('(ITP - #42) http://bugs.debian.org/42 ruby-foo')
+      assert_equal @dh_make_ruby.itp_bug, '#42'
+  end
+
   context 'simple gem' do
     %w[
       debian/control

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