[DRE-commits] [gem2deb] 01/01: dh-make-ruby: handle apt-file succeeding with no output

Antonio Terceiro terceiro at moszumanska.debian.org
Mon Sep 28 13:25:41 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 5ab0e691b1388a3c80fa569f792720f78c2c8a6b
Author: Antonio Terceiro <terceiro at debian.org>
Date:   Mon Sep 28 10:24:19 2015 -0300

    dh-make-ruby: handle apt-file succeeding with no output
    
    Closes: #800108
---
 debian/changelog            |  6 ++++++
 lib/gem2deb/dh_make_ruby.rb | 15 ++++++++++++---
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index e1749a7..104c67b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,7 +1,13 @@
 gem2deb (0.21.2) UNRELEASED; urgency=medium
 
+  [ Pirate Praveen ]
   * use --source https://rails-assets.org for rails-assets-* (Closes: #771212)
 
+  [ Antonio Terceiro ]
+  * dh-make-ruby:
+    - handle the case where apt-file exits successfully but still does not
+      find anything (Closes: #800108)
+
  -- Pirate Praveen <praveen at debian.org>  Fri, 04 Sep 2015 12:34:00 +0530
 
 gem2deb (0.21.1) unstable; urgency=medium
diff --git a/lib/gem2deb/dh_make_ruby.rb b/lib/gem2deb/dh_make_ruby.rb
index 60cb811..5a01409 100644
--- a/lib/gem2deb/dh_make_ruby.rb
+++ b/lib/gem2deb/dh_make_ruby.rb
@@ -144,11 +144,20 @@ module Gem2Deb
       end
 
       if update
-        if system('apt-file search /usr/share/rubygems-integration/ > ' + cache + '.new')
-          system('sed', '-i', '-e', 's#/.*/##; s/-[0-9.]\+.gemspec//', cache + '.new')
-          FileUtils.mv(cache + '.new', cache)
+        new_cache = cache + '.new'
+        if system('apt-file search /usr/share/rubygems-integration/ > ' + new_cache)
+          if File.stat(new_cache).size > 0
+            system('sed', '-i', '-e', 's#/.*/##; s/-[0-9.]\+.gemspec//', new_cache)
+            FileUtils.mv(cache + '.new', cache)
+          else
+            puts 'E: dh-make-ruby needs an up-to-date apt-file cache in order to map gem names'
+            puts 'E: to package names but apt-file has an invalid cache. Please run '
+            puts 'E: `apt-file update` and make sure that `apt-file search` works.'
+            exit 1
+          end
         else
           puts 'E: dh-make-ruby needs an up-to-date apt-file cache in order to map gem names to package names'
+          puts 'E: make sure that apt-file has an updated cache (run `apt-file update`)'
           exit $?.exitstatus
         end
       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