[DRE-commits] [gem2deb] 01/02: Avoid crashing with invalid "gem to package" cache

Antonio Terceiro terceiro at moszumanska.debian.org
Fri Jun 12 14:13:19 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 a4c120dd5b24a9f70bc079e7a5bd519cf3023785
Author: Antonio Terceiro <terceiro at debian.org>
Date:   Fri Jun 12 11:07:26 2015 -0300

    Avoid crashing with invalid "gem to package" cache
    
    Closes #786841
---
 lib/gem2deb/dh_make_ruby.rb | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/lib/gem2deb/dh_make_ruby.rb b/lib/gem2deb/dh_make_ruby.rb
index cd67775..8683f02 100644
--- a/lib/gem2deb/dh_make_ruby.rb
+++ b/lib/gem2deb/dh_make_ruby.rb
@@ -153,7 +153,16 @@ module Gem2Deb
         end
       end
 
-      @gem_to_package = YAML.load_file(cache).invert
+      data = YAML.load_file(cache)
+      unless data.respond_to?(:invert)
+        File.unlink(cache)
+        puts 'E: Failed to load "gem name to package name" cache from'
+        puts '   ' +  cache
+        puts 'I: The existing cache was removed and will be rebuilt next time.'
+        puts 'I: please try again.'
+        exit 1
+      end
+      @gem_to_package = data.invert
     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