[DRE-commits] [gem2deb] 01/01: debian/requires-rubygems.overrides it not supported anymore

Antonio Terceiro terceiro at moszumanska.debian.org
Sat Apr 11 15:33:36 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 16d17f1c9e571ed2dfa2adaee5df411708433d36
Author: Antonio Terceiro <terceiro at debian.org>
Date:   Sat Apr 11 17:09:45 2015 +0200

    debian/requires-rubygems.overrides it not supported anymore
    
    Patching out instances of `require 'rubygems'` is now considered an
    antipattern.
---
 bin/dh_ruby                                    | 22 ++------------------
 debian/changelog                               |  2 ++
 lib/gem2deb/dh_make_ruby/template/debian/rules |  2 +-
 lib/gem2deb/dh_ruby.rb                         | 19 +++++------------
 lib/gem2deb/installer.rb                       | 25 -----------------------
 test/unit/installer_test.rb                    | 28 --------------------------
 6 files changed, 10 insertions(+), 88 deletions(-)

diff --git a/bin/dh_ruby b/bin/dh_ruby
index 06add65..a0d09ed 100755
--- a/bin/dh_ruby
+++ b/bin/dh_ruby
@@ -225,9 +225,8 @@ first !
 =item I<DH_RUBY_IGNORE_TESTS>
 
 This is a space-separated list of tests that dh_ruby will ignore during package
-build. The available test names are "require-rubygems" plus the names of all
-supported Ruby versions. At the time of writing, only "ruby1.9.1" and ruby2.0
-are supported.
+build. The available test names are the names of all supported Ruby versions
+(you can list them with `dh_ruby --print-supported`).
 
 If set to "all", all tests will be ignored during the package build.
 
@@ -306,23 +305,6 @@ the tests failed. A simple example:
     end
   end
 
-=item debian/I<require-rubygems.overrides>
-
-Fine-tune the "require-rubygems" test. If the package has a very good reason to
-actually `require "rubygems"`, you can use this file as a whitelist of files
-allowed to have `require "rubygems"`.
-
-This file is expected to contain a YAML document with a list of files that must
-be ignored when checking for `require "rubygems"` lines. Example:
-
-  --- 
-  - debian/ruby-foo/usr/lib/ruby/vendor_ruby/foo.rb
-  - debian/ruby-foo/usr/lib/ruby/vendor_ruby/foo/rubygems.rg
-
-As you can see above, you have to list filenames based on their corresponding
-install locations in the package temporary install directory, i.e.
-`debian/${pkg}/..`
-
 =item debian/I<dh_ruby.mk>
 
 If this file is present, dh_ruby will call B<make> passing it as the makefile
diff --git a/debian/changelog b/debian/changelog
index 7d8dc0c..d0ad5c7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,8 @@ gem2deb (0.14) UNRELEASED; urgency=medium
     interpreters while installed system-wide. This avoids extra
     -I/usr/lib/ruby/vendor_ruby in command lines and eases debugging running
     processes for packages that e.g. hang while running their tests.
+  * debian/requires-rubygems.overrides it not supported anymore. Patching out
+    instances of `require 'rubygems'` is now considered an antipattern.
 
  -- Antonio Terceiro <terceiro at debian.org>  Fri, 10 Apr 2015 10:49:34 +0200
 
diff --git a/lib/gem2deb/dh_make_ruby/template/debian/rules b/lib/gem2deb/dh_make_ruby/template/debian/rules
index 5129aeb..e1a043a 100644
--- a/lib/gem2deb/dh_make_ruby/template/debian/rules
+++ b/lib/gem2deb/dh_make_ruby/template/debian/rules
@@ -6,7 +6,7 @@
 #
 # Uncomment to ignore some test failures (but the tests will run anyway).
 # Valid values:
-#export DH_RUBY_IGNORE_TESTS=<%= Gem2Deb::SUPPORTED_RUBY_VERSIONS.keys.join(' ') %> require-rubygems
+#export DH_RUBY_IGNORE_TESTS=<%= Gem2Deb::SUPPORTED_RUBY_VERSIONS.keys.join(' ') %>
 #
 # If you need to specify the .gemspec (eg there is more than one)
 #export DH_RUBY_GEMSPEC=gem.gemspec
diff --git a/lib/gem2deb/dh_ruby.rb b/lib/gem2deb/dh_ruby.rb
index 915e2cd..005b9c9 100644
--- a/lib/gem2deb/dh_ruby.rb
+++ b/lib/gem2deb/dh_ruby.rb
@@ -89,25 +89,16 @@ module Gem2Deb
       installers.each do |installer|
         installer.install_substvars
         installer.install_gemspec
-        check_rubygems(installer)
       end
-    end
-
-    protected # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-
-    def check_rubygems(installer)
-      if skip_checks?
-        return
-      end
-
-      begin
-        installer.check_rubygems
-      rescue Gem2Deb::Installer::RequireRubygemsFound
-        handle_test_failure("require-rubygems")
+      # FIXME remove this message after stretch
+      if File.exists?('debian/require-rubygems.overrides')
+        puts "W: debian/require-rubygems.overrides is obsolete, and is now ignored"
       end
     end
 
+    protected # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
     def handle_test_failure(test)
       if ENV['DH_RUBY_IGNORE_TESTS']
         if ENV['DH_RUBY_IGNORE_TESTS'].split.include?('all')
diff --git a/lib/gem2deb/installer.rb b/lib/gem2deb/installer.rb
index 82a42a1..845e93f 100644
--- a/lib/gem2deb/installer.rb
+++ b/lib/gem2deb/installer.rb
@@ -4,8 +4,6 @@ module Gem2Deb
 
   class Installer
 
-    class RequireRubygemsFound < Exception; end
-
     include Gem2Deb
 
     EXTENSION_BUILDER = File.expand_path(File.join(File.dirname(__FILE__),'extension_builder.rb'))
@@ -89,29 +87,6 @@ module Gem2Deb
       end
     end
 
-    def check_rubygems
-      found = false
-      if File::exists?('debian/require-rubygems.overrides')
-        overrides = YAML::load_file('debian/require-rubygems.overrides')
-      else
-        overrides = []
-      end
-      installed_ruby_files.each do |f|
-        lines = readlines(f)
-        rglines = lines.select { |l| l =~ /require.*rubygems/  && l !~ /^\s*#/ }
-          rglines.each do |l|
-          if not overrides.include?(f)
-            puts "#{f}: #{l}" if verbose
-            found = true
-          end
-          end
-      end
-      if found
-        puts "Found some 'require rubygems' without overrides (see above)." if verbose
-        raise RequireRubygemsFound
-      end
-    end
-
     def run_make_clean_on_extensions
       if metadata.has_native_extensions?
         metadata.native_extensions.each do |extension|
diff --git a/test/unit/installer_test.rb b/test/unit/installer_test.rb
index f92c1e6..66b8c31 100644
--- a/test/unit/installer_test.rb
+++ b/test/unit/installer_test.rb
@@ -115,34 +115,6 @@ class InstallerTest < Gem2DebTestCase
     end
   end
 
-  context 'checking for require "rubygems"' do
-    setup do
-      @installer = Gem2Deb::Installer.new("ruby-foo", FOO)
-      @installer.verbose = false
-    end
-    should 'detect require "rubygems"' do
-      @installer.stubs(:installed_ruby_files).returns(['test/sample/check_rubygems/bad.rb'])
-      assert_raises(Gem2Deb::Installer::RequireRubygemsFound) do
-        @installer.check_rubygems
-      end
-    end
-    should 'not complain about commented require "rubygems"' do
-      @installer.stubs(:installed_ruby_files).returns(['test/sample/check_rubygems/good.rb'])
-      @installer.check_rubygems
-    end
-
-    %w[
-      utf8
-      latin1
-    ].each do |encoding|
-      should "handle #{encoding}" do
-        @installer.stubs(:installed_ruby_files).returns(["test/encondings/#{encoding}.rb"])
-        @installer.check_rubygems
-      end
-    end
-
-  end
-
   context "Ruby versions supported" do
     setup do
       @installer = Gem2Deb::Installer.new('ruby-foo', FOO)

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