[DRE-commits] [SCM] gem2deb.git branch, master, updated. 0.2.6-2-g2c95973

Antonio Terceiro terceiro at softwarelivre.org
Thu Aug 11 19:12:50 UTC 2011


The following commit has been merged in the master branch:
commit ed70dbed294447f07fa6b92467ab490f594c90a2
Author: Antonio Terceiro <terceiro at softwarelivre.org>
Date:   Thu Aug 11 12:04:11 2011 -0700

    Fix name clash resolution with multiple packages

diff --git a/lib/gem2deb/dh_ruby.rb b/lib/gem2deb/dh_ruby.rb
index c6e684d..1eee19a 100644
--- a/lib/gem2deb/dh_ruby.rb
+++ b/lib/gem2deb/dh_ruby.rb
@@ -152,7 +152,7 @@ module Gem2Deb
     def install_symlinks(package, supported_versions)
       supported_versions.select { |v| v == 'ruby1.8' }.each do |rubyver|
         archdir = destdir(package, :archdir, rubyver)
-        vendordir = destdir(packages, :libdir, rubyver)
+        vendordir = destdir(package, :libdir, rubyver)
         vendorlibdir = File.dirname(archdir)
         Dir.glob(File.join(archdir, '*.so')).each do |so|
           rb = File.basename(so).gsub(/\.so$/, '.rb')
diff --git a/test/sample/name_clash_multiple/debian/changelog b/test/sample/name_clash_multiple/debian/changelog
new file mode 100644
index 0000000..553c95c
--- /dev/null
+++ b/test/sample/name_clash_multiple/debian/changelog
@@ -0,0 +1,5 @@
+ruby-name-clash (1.0) UNRELEASED; urgency=low
+
+  * Initial release (Closes: #nnnn)
+
+ -- Antonio Terceiro <terceiro at debian.org>  Thu, 11 Aug 2011 11:11:27 -0700
diff --git a/debian/compat b/test/sample/name_clash_multiple/debian/compat
similarity index 100%
copy from debian/compat
copy to test/sample/name_clash_multiple/debian/compat
diff --git a/test/sample/name_clash_multiple/debian/control b/test/sample/name_clash_multiple/debian/control
new file mode 100644
index 0000000..73e30d4
--- /dev/null
+++ b/test/sample/name_clash_multiple/debian/control
@@ -0,0 +1,26 @@
+Source: ruby-name-clash
+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>
+DM-Upload-Allowed: yes
+Build-Depends: debhelper (>= 7.0.50~), gem2deb (>= 0.2.6~)
+Standards-Version: 3.9.2
+#Vcs-Git: git://git.debian.org/pkg-ruby-extras/ruby-simpleextension-with-name-clash.git
+#Vcs-Browser: http://git.debian.org/?p=pkg-ruby-extras/ruby-simpleextension-with-name-clash.git;a=summary
+Homepage: FIXME
+XS-Ruby-Versions: all
+
+Package: ruby-name-clash
+Architecture: any
+XB-Ruby-Versions: ${ruby:Versions}
+Depends: ${shlibs:Depends}, ${misc:Depends}, ruby | ruby-interpreter
+Description: Simple native extension with .rb/.so name clash used to test dh_ruby
+ simpleextension_with_name_clash is a simple native extension that is used to test dh_ruby.
+
+Package: libname-clash-ruby
+Architecture: any
+Depends: ruby-name-clash
+Description: transitional package for ruby-name-clash
+ This packages is a transitional package for ruby-name-clash and can be safely
+ removed.
diff --git a/test/sample/name_clash_multiple/debian/copyright b/test/sample/name_clash_multiple/debian/copyright
new file mode 100644
index 0000000..c42574a
--- /dev/null
+++ b/test/sample/name_clash_multiple/debian/copyright
@@ -0,0 +1,33 @@
+FIXME. fill-in with DEP5 copyright file. http://dep.debian.net/deps/dep5/
+Format: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?op=file&rev=173
+Upstream-Name: simpleextension-with-name-clash
+Source: FIXME (URL where source can be downloaded)
+
+Files: *
+Copyright: Copyright 1998 John Doe <jdoe at example.com>
+License: GPL-2+
+ This program is free software; you can redistribute it
+ and/or modify it under the terms of the GNU General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later
+ version.
+ .
+ This program is distributed in the hope that it will be
+ useful, but WITHOUT ANY WARRANTY; without even the implied
+ warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE.  See the GNU General Public License for more
+ details.
+ .
+ You should have received a copy of the GNU General Public
+ License along with this package; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ Boston, MA  02110-1301 USA
+ .
+ On Debian systems, the full text of the GNU General Public
+ License version 2 can be found in the file
+ `/usr/share/common-licenses/GPL-2'.
+
+Files: debian/*
+Copyright: Copyright 1998 Jane Smith <jsmith at example.net>
+License:
+ [LICENSE TEXT]
diff --git a/test/sample/name_clash_multiple/debian/rules b/test/sample/name_clash_multiple/debian/rules
new file mode 100755
index 0000000..a5e7dc8
--- /dev/null
+++ b/test/sample/name_clash_multiple/debian/rules
@@ -0,0 +1,15 @@
+#!/usr/bin/make -f
+#export DH_VERBOSE=1
+#
+# Uncomment to ignore all test failures (but the tests will run anyway)
+#export DH_RUBY_IGNORE_TESTS=all
+#
+# Uncomment to ignore some test failures (but the tests will run anyway).
+# Valid values:
+#export DH_RUBY_IGNORE_TESTS=ruby1.8 ruby1.9.1 require-rubygems
+#
+# If you need to specify the .gemspec (eg there is more than one)
+#export DH_RUBY_GEMSPEC=gem.gemspec
+
+%:
+	dh $@ --buildsystem=ruby --with ruby
diff --git a/debian/source/format b/test/sample/name_clash_multiple/debian/source/format
similarity index 100%
copy from debian/source/format
copy to test/sample/name_clash_multiple/debian/source/format
diff --git a/test/sample/name_clash_multiple/ext/extconf.rb b/test/sample/name_clash_multiple/ext/extconf.rb
new file mode 100644
index 0000000..56981a3
--- /dev/null
+++ b/test/sample/name_clash_multiple/ext/extconf.rb
@@ -0,0 +1,2 @@
+require 'mkmf'
+create_makefile('name_clash')
diff --git a/test/sample/name_clash_multiple/ext/name_clash.c b/test/sample/name_clash_multiple/ext/name_clash.c
new file mode 100644
index 0000000..f42f44b
--- /dev/null
+++ b/test/sample/name_clash_multiple/ext/name_clash.c
@@ -0,0 +1,14 @@
+#include "ruby.h"
+
+VALUE method_answer42(VALUE module, VALUE self);
+
+void Init_name_clash() {
+  VALUE NameClash= rb_define_module("NameClash");
+  rb_define_module_function(NameClash, "answer42", method_answer42, 0);
+  rb_define_const(NameClash, "Hello_world", rb_str_new2("Hello World"));
+}
+
+VALUE method_answer42(VALUE module, VALUE self) {
+  VALUE answer = rb_const_get(module, rb_intern("ANSWER_42"));
+	return answer;
+}
diff --git a/test/sample/name_clash_multiple/lib/name_clash.rb b/test/sample/name_clash_multiple/lib/name_clash.rb
new file mode 100644
index 0000000..3e1016a
--- /dev/null
+++ b/test/sample/name_clash_multiple/lib/name_clash.rb
@@ -0,0 +1,5 @@
+require 'name_clash.so'
+
+module NameClash
+  ANSWER_42 = 42
+end
diff --git a/test/unit/dh_ruby_test.rb b/test/unit/dh_ruby_test.rb
index 18c92cd..b95967a 100644
--- a/test/unit/dh_ruby_test.rb
+++ b/test/unit/dh_ruby_test.rb
@@ -178,6 +178,18 @@ class DhRubyTest < Gem2DebTestCase
     end
   end
 
+  context 'name clash with multiple binary packages' do
+    setup do
+      FileUtils.cp_r('test/sample/name_clash_multiple/', tmpdir)
+      @target_dir = File.join(tmpdir, 'name_clash_multiple')
+      self.class.build_package(@target_dir)
+    end
+    should 'work' do
+      symlink = File.join(@target_dir, 'debian/ruby-name-clash/usr/lib/ruby/vendor_ruby/1.8/name_clash.rb')
+      assert File.exist?(symlink), 'symlink not installed at %s!' % symlink
+    end
+  end
+
   context 'using DESTDIR supplied by dh_auto_install' do
     setup do
       @dh_ruby = Gem2Deb::DhRuby.new
@@ -208,16 +220,21 @@ class DhRubyTest < Gem2DebTestCase
     Gem2Deb::Gem2Tgz.convert!(gem, tarball)
     Gem2Deb::DhMakeRuby.new(tarball).build
 
-    dh_ruby = Gem2Deb::DhRuby.new
-    dh_ruby.verbose = false
+    build_package(package_path)
+  end
+
+  def self.build_package(directory)
+    Dir.chdir(directory) do
+
+      dh_ruby = Gem2Deb::DhRuby.new
+      dh_ruby.verbose = false
 
-    silence_stream(STDOUT) do
-      Dir.chdir(package_path) do
+      silence_stream(STDOUT) do
         # This sequence tries to imitate what dh will actually do
         dh_ruby.clean
         dh_ruby.configure
         dh_ruby.build
-        dh_ruby.install File.join(package_path, 'debian', 'tmp')
+        dh_ruby.install File.join(directory, 'debian', 'tmp')
       end
     end
   end

-- 
gem2deb.git



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