[DRE-commits] [SCM] gem2deb.git branch, master, updated. 0.2.7-4-g97c4bc6

Antonio Terceiro terceiro at softwarelivre.org
Mon Sep 5 05:40:26 UTC 2011


The following commit has been merged in the master branch:
commit 97c4bc68ed31c1aff69cefa0067837d768cc8ea1
Author: Antonio Terceiro <terceiro at softwarelivre.org>
Date:   Sun Sep 4 22:39:07 2011 -0700

    Keep upstream names that are not valid Debian package names

diff --git a/lib/gem2deb/dh_make_ruby.rb b/lib/gem2deb/dh_make_ruby.rb
index 43239e5..4997d82 100644
--- a/lib/gem2deb/dh_make_ruby.rb
+++ b/lib/gem2deb/dh_make_ruby.rb
@@ -129,6 +129,7 @@ module Gem2Deb
         Dir.chdir(orig_tarball_dir) do
           create_orig_tarball
           extract
+          initialize_from_directory(source_dirname)
           build_in_directory(source_dirname)
         end
       end
diff --git a/test/helper/samples.rb b/test/helper/samples.rb
index 18a09bb..b38a100 100644
--- a/test/helper/samples.rb
+++ b/test/helper/samples.rb
@@ -35,5 +35,9 @@ class Gem2DebTestCase
     SIMPLE_EXTENSION_WITH_NAME_CLASH_NAME = 'simpleextension_with_name_clash'
     SIMPLE_EXTENSION_WITH_NAME_CLASH_DIRNAME = SIMPLE_EXTENSION_WITH_NAME_CLASH_NAME.gsub('_', '-') + '-1.2.3'
     SIMPLE_EXTENSION_WITH_NAME_CLASH = File.join(SAMPLE_DIR, SIMPLE_EXTENSION_WITH_NAME_CLASH_NAME, 'pkg', SIMPLE_EXTENSION_WITH_NAME_CLASH_DIRNAME + '.gem')
+
+    FANCY_PACKAGE_NAME      = 'Fancy_Package'
+    FANCY_PACKAGE           = File.join(SAMPLE_DIR, "#{FANCY_PACKAGE_NAME}/pkg/#{FANCY_PACKAGE_NAME}-0.0.1.gem")
+
   end
 end
diff --git a/test/integration/gem2deb_test.rb b/test/integration/gem2deb_test.rb
index 314b369..0881a95 100644
--- a/test/integration/gem2deb_test.rb
+++ b/test/integration/gem2deb_test.rb
@@ -15,7 +15,7 @@ class Gem2DebTest < Gem2DebTestCase
     puts "Building #{gem} ..."
     self.build(gem)
     should "build #{gem} correcly" do
-      package_name = 'ruby-' + File.basename(File.dirname(File.dirname(gem))).gsub('_', '-')
+      package_name = 'ruby-' + File.basename(File.dirname(File.dirname(gem))).gsub('_', '-').downcase
       binary_packages = File.join(self.class.tmpdir, "#{package_name}_*.deb")
       packages = Dir.glob(binary_packages)
       assert !packages.empty?, "building #{gem} produced no binary packages! (expected to find #{binary_packages})"
diff --git a/test/sample/Fancy_Package/Rakefile b/test/sample/Fancy_Package/Rakefile
new file mode 100644
index 0000000..eaedfe2
--- /dev/null
+++ b/test/sample/Fancy_Package/Rakefile
@@ -0,0 +1,23 @@
+require 'rubygems'
+require 'rake/gempackagetask'
+
+spec = Gem::Specification.new do |s|
+  s.platform = Gem::Platform::RUBY
+  s.summary = "Library with a fancy name used to test gem2tgz and dh-make-ruby"
+  s.name = 'Fancy_Package'
+  s.version = '0.0.1'
+  s.requirements << 'none'
+  s.require_path = 'lib'
+  s.files = Dir.glob('lib/**')
+  s.description = <<EOF
+This package contains two elements of ridiculous upstream names: uppercase
+characters and underscores. It is used to make sure gem2tgz and dh-make-ruby
+will keep the upstream name intact to be used e.g. in debian/copyright and
+debian/watch
+EOF
+end
+
+Rake::GemPackageTask.new(spec) do |pkg|
+  pkg.need_zip = false
+  pkg.need_tar = false
+end
diff --git a/test/sample/Fancy_Package/lib/fancy_package.rb b/test/sample/Fancy_Package/lib/fancy_package.rb
new file mode 100644
index 0000000..403162a
--- /dev/null
+++ b/test/sample/Fancy_Package/lib/fancy_package.rb
@@ -0,0 +1,2 @@
+class FancyPackage
+end
diff --git a/test/sample/simpleextension_in_root/pkg/simpleextension_in_root-1.2.3.gem b/test/sample/Fancy_Package/pkg/Fancy_Package-0.0.1.gem
similarity index 60%
copy from test/sample/simpleextension_in_root/pkg/simpleextension_in_root-1.2.3.gem
copy to test/sample/Fancy_Package/pkg/Fancy_Package-0.0.1.gem
index e7b5139..db33b2f 100644
Binary files a/test/sample/simpleextension_in_root/pkg/simpleextension_in_root-1.2.3.gem and b/test/sample/Fancy_Package/pkg/Fancy_Package-0.0.1.gem differ
diff --git a/test/unit/dh_make_ruby_test.rb b/test/unit/dh_make_ruby_test.rb
index 2f61244..688aeb6 100644
--- a/test/unit/dh_make_ruby_test.rb
+++ b/test/unit/dh_make_ruby_test.rb
@@ -94,6 +94,25 @@ class DhMakeRubyTest < Gem2DebTestCase
     end
   end
 
+  FANCY_PACKAGE_TARBALL = File.join(tmpdir, 'fancy-package-0.0.1.tar.gz')
+  one_time_setup do
+    Gem2Deb::Gem2Tgz.convert!(FANCY_PACKAGE, FANCY_PACKAGE_TARBALL)
+    $__fancy_package_dh_make_ruby = Gem2Deb::DhMakeRuby.new(FANCY_PACKAGE_TARBALL)
+    $__fancy_package_dh_make_ruby.build
+  end
+  context 'a package with a fancy name that is not a valid Debian package name' do
+    should 'use upstream name from metadata' do
+      assert_equal 'Fancy_Package', $__fancy_package_dh_make_ruby.gem_name
+    end
+    should 'use actual upstream name in debian/watch' do
+      assert_match /gemwatch\/Fancy_Package/, File.read(File.join(tmpdir, 'ruby-fancy-package-0.0.1/debian/watch'))
+    end
+    should 'use actual upstream name in debian/copyright' do
+      assert_match /Upstream-Name: Fancy_Package/, File.read(File.join(tmpdir, 'ruby-fancy-package-0.0.1/debian/copyright'))
+    end
+  end
+
+
   protected
 
   def packages

-- 
gem2deb.git



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