[DRE-commits] [gem2deb] 02/05: dh-make-ruby: read name from debian/changelog when it exists
Antonio Terceiro
terceiro at moszumanska.debian.org
Sun May 17 03:05:32 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 cc5bf002d2b24bccf4f43c616f14dd01ccc4bd27
Author: Antonio Terceiro <terceiro at debian.org>
Date: Sat May 16 23:43:08 2015 -0300
dh-make-ruby: read name from debian/changelog when it exists
---
debian/changelog | 2 ++
lib/gem2deb/dh_make_ruby.rb | 11 ++++++++++-
test/sample/killerapp/debian/changelog | 5 +++++
test/sample/killerapp/debian/compat | 1 +
test/sample/killerapp/debian/control | 22 ++++++++++++++++++++++
test/sample/killerapp/debian/rules | 4 ++++
test/test_helper/samples.rb | 2 ++
test/unit/dh_make_ruby_test.rb | 5 +++++
8 files changed, 51 insertions(+), 1 deletion(-)
diff --git a/debian/changelog b/debian/changelog
index fc91643..ae1dfa8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,8 @@ gem2deb (0.17) UNRELEASED; urgency=medium
* dh-make-ruby: add -w/--overwrite option to overwrite files under debian/
* dh-make-ruby: only call wrap-and-sort if either there was no previous
packaging, or -w/--overwrite was passed.
+ * dh-make-ruby: when acting on an existing source package, read the source
+ package name from debian/changelog.
-- Antonio Terceiro <terceiro at debian.org> Sat, 16 May 2015 22:51:18 -0300
diff --git a/lib/gem2deb/dh_make_ruby.rb b/lib/gem2deb/dh_make_ruby.rb
index 6e205d4..3315364 100644
--- a/lib/gem2deb/dh_make_ruby.rb
+++ b/lib/gem2deb/dh_make_ruby.rb
@@ -86,7 +86,16 @@ module Gem2Deb
read_metadata(directory)
self.gem_name = metadata.name
self.gem_version = metadata.version
- self.source_package_name ||= gem_name_to_source_package_name(gem_name)
+ self.source_package_name ||= get_source_package_name(directory)
+ end
+
+ def get_source_package_name(directory)
+ changelog = File.join(directory, 'debian/changelog')
+ if File.exist?(changelog)
+ `dpkg-parsechangelog -l#{changelog} -SSource`.strip
+ else
+ gem_name_to_source_package_name(gem_name)
+ end
end
def initialize_from_tarball(tarball)
diff --git a/test/sample/killerapp/debian/changelog b/test/sample/killerapp/debian/changelog
new file mode 100644
index 0000000..45b3d7b
--- /dev/null
+++ b/test/sample/killerapp/debian/changelog
@@ -0,0 +1,5 @@
+killerapp (0.1.0~FIXME-1) UNRELEASED; urgency=medium
+
+ * Initial release (Closes: #nnnn)
+
+ -- Antonio Terceiro <terceiro at debian.org> Sat, 16 May 2015 23:39:13 -0300
diff --git a/test/sample/killerapp/debian/compat b/test/sample/killerapp/debian/compat
new file mode 100644
index 0000000..7f8f011
--- /dev/null
+++ b/test/sample/killerapp/debian/compat
@@ -0,0 +1 @@
+7
diff --git a/test/sample/killerapp/debian/control b/test/sample/killerapp/debian/control
new file mode 100644
index 0000000..4db5420
--- /dev/null
+++ b/test/sample/killerapp/debian/control
@@ -0,0 +1,22 @@
+Source: killerapp
+Section: ruby
+Priority: optional
+Maintainer: Debian Ruby Extras Maintainers <pkg-ruby-extras-maintainers at lists.alioth.debian.org>
+Uploaders: Antonio Terceiro <terceiro at debian.org>
+Build-Depends: debhelper (>= 7.0.50~),
+ gem2deb
+Standards-Version: 3.9.6
+Vcs-Git: git://anonscm.debian.org/pkg-ruby-extras/killerapp.git
+Vcs-Browser: https://anonscm.debian.org/cgit/pkg-ruby-extras/killerapp.git
+Homepage: FIXME
+Testsuite: autopkgtest-pkg-ruby
+XS-Ruby-Versions: all
+
+Package: killerapp
+Architecture: all
+XB-Ruby-Versions: ${ruby:Versions}
+Depends: ruby | ruby-interpreter,
+ ${misc:Depends},
+ ${shlibs:Depends}
+Description: FIXME
+ <insert long description, indented with spaces>
diff --git a/test/sample/killerapp/debian/rules b/test/sample/killerapp/debian/rules
new file mode 100755
index 0000000..c6142f6
--- /dev/null
+++ b/test/sample/killerapp/debian/rules
@@ -0,0 +1,4 @@
+#!/usr/bin/make -f
+
+%:
+ dh $@ --buildsystem=ruby --with ruby
diff --git a/test/test_helper/samples.rb b/test/test_helper/samples.rb
index b38a100..34e80ed 100644
--- a/test/test_helper/samples.rb
+++ b/test/test_helper/samples.rb
@@ -39,5 +39,7 @@ class Gem2DebTestCase
FANCY_PACKAGE_NAME = 'Fancy_Package'
FANCY_PACKAGE = File.join(SAMPLE_DIR, "#{FANCY_PACKAGE_NAME}/pkg/#{FANCY_PACKAGE_NAME}-0.0.1.gem")
+ KILLERAPP_DIR = File.join(SAMPLE_DIR, 'killerapp')
+
end
end
diff --git a/test/unit/dh_make_ruby_test.rb b/test/unit/dh_make_ruby_test.rb
index a96f358..f70acf6 100644
--- a/test/unit/dh_make_ruby_test.rb
+++ b/test/unit/dh_make_ruby_test.rb
@@ -17,6 +17,11 @@ class DhMakeRubyTest < Gem2DebTestCase
assert_equal 'ruby-simplegem', Gem2Deb::DhMakeRuby.new(SIMPLE_GEM_UPSTREAM_TARBALL).source_package_name
end
+ should 'use existing package name if present' do
+ dmr = Gem2Deb::DhMakeRuby.new(KILLERAPP_DIR)
+ assert_equal 'killerapp', dmr.source_package_name
+ end
+
should 'be able to specify a package name' do
assert_equal 'xyz', Gem2Deb::DhMakeRuby.new(SIMPLE_GEM_UPSTREAM_TARBALL, :source_package_name => 'xyz').source_package_name
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