[DRE-maint] Bug#1052398: Info received (Bug#1052398: marked as pending in gem2deb)

Nicos Gollan nicos.gollan at centralnic.com
Fri Sep 22 13:22:50 BST 2023


Turns out I was looking at the wrong things. Here's another patch 
against current master that should hopefully get all of it now.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-ruby-extras-maintainers/attachments/20230922/64747f44/attachment-0001.htm>
-------------- next part --------------
From 2ad987291e2805e337967f97507bb05400890966 Mon Sep 17 00:00:00 2001
From: Nicos Gollan <nicos.gollan at centralnic.com>
Date: Fri, 22 Sep 2023 14:18:06 +0200
Subject: [PATCH] Change more `::` class method calls

Includes one missed `File::exists?` , but most changes are simply for the
"common" syntax.
---
 bin/dh-make-ruby            |  8 ++++----
 bin/dh_ruby_fixdepends      | 12 ++++++------
 bin/gem2deb                 |  4 ++--
 bin/gem2tgz                 | 10 +++++-----
 lib/gem2deb/dh_make_ruby.rb | 14 +++++++-------
 lib/gem2deb/gem2tgz.rb      | 12 ++++++------
 lib/gem2deb/installer.rb    |  6 +++---
 7 files changed, 33 insertions(+), 33 deletions(-)

diff --git a/bin/dh-make-ruby b/bin/dh-make-ruby
index 9575c98..056cc1b 100755
--- a/bin/dh-make-ruby
+++ b/bin/dh-make-ruby
@@ -1,17 +1,17 @@
 #!/usr/bin/ruby -EUTF-8
 #
 # Copyright © 2011, Lucas Nussbaum <lucas at debian.org>
-# 
+#
 # 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 3 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 program.  If not, see <http://www.gnu.org/licenses/>.
 
@@ -68,7 +68,7 @@ else
   exit(1)
 end
 
-dmr = Gem2Deb::DhMakeRuby::new(input, options)
+dmr = Gem2Deb::DhMakeRuby.new(input, options)
 dmr.build
 
 __END__
diff --git a/bin/dh_ruby_fixdepends b/bin/dh_ruby_fixdepends
index 38a76cb..66f8910 100755
--- a/bin/dh_ruby_fixdepends
+++ b/bin/dh_ruby_fixdepends
@@ -1,17 +1,17 @@
 #!/usr/bin/ruby -EUTF-8
 #
 # Copyright © 2011, Lucas Nussbaum <lucas at debian.org>
-# 
+#
 # 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 3 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 program.  If not, see <http://www.gnu.org/licenses/>.
 
@@ -20,9 +20,9 @@ require 'gem2deb/dh_ruby'
 include Gem2Deb
 
 `dh_listpackages`.split.each do |package|
-  next if not File::exists?("debian/#{package}.substvars")
-  s = IO::read("debian/#{package}.substvars")
-  fd = File::new("debian/#{package}.substvars", "w")
+  next if not File.exist?("debian/#{package}.substvars")
+  s = IO.read("debian/#{package}.substvars")
+  fd = File.new("debian/#{package}.substvars", "w")
   s.each_line do |l|
     if l =~ /^shlibs:Depends=/
       deps = l.chomp.split('=', 2)[1].split(', ')
diff --git a/bin/gem2deb b/bin/gem2deb
index 1d1cf36..b152281 100755
--- a/bin/gem2deb
+++ b/bin/gem2deb
@@ -91,7 +91,7 @@ end
 
 gemfile = ARGV[0]
 # Download gem if not available locally
-if not File::exists?(gemfile) and gemfile !~ /\.gem$/
+if not File.exist?(gemfile) and gemfile !~ /\.gem$/
   puts "#{gemfile} doesn't seem to exist. Let's try to download it with 'gem fetch #{ARGV[0]}'"
 
   tmpdir = Dir.mktmpdir
@@ -131,7 +131,7 @@ exit(0) if $only_tarball
 
 puts
 puts "-- Creating Debian source package from #{tarball} ..."
-dmr = Gem2Deb::DhMakeRuby::new(tarball, dh_make_ruby_options)
+dmr = Gem2Deb::DhMakeRuby.new(tarball, dh_make_ruby_options)
 source = dmr.build
 puts "-- Generated Debian source tree in #{dmr.source_dirname}"
 
diff --git a/bin/gem2tgz b/bin/gem2tgz
index ef55275..39ebd14 100755
--- a/bin/gem2tgz
+++ b/bin/gem2tgz
@@ -1,17 +1,17 @@
 #!/usr/bin/ruby
 #
 # Copyright © 2010, Antonio Terceiro <terceiro at softwarelivre.org>
-# 
+#
 # 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 3 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 program.  If not, see <http://www.gnu.org/licenses/>.
 
@@ -44,14 +44,14 @@ end
 
 gemfile = ARGV[0]
 # Download gem if not available locally
-if not File::exists?(gemfile) and gemfile !~ /.gem$/
+if not File.exist?(gemfile) and gemfile !~ /.gem$/
   puts "#{gemfile} doesn't seem to exist. Let's try to download it with 'gem fetch #{ARGV[0]}'"
   if gemfile =~ /^rails-assets/
     run("gem", "fetch", "--source", "https://rails-assets.org", gemfile)
   else
     run("gem", "fetch", gemfile)
   end
-  versions = Dir::glob("#{gemfile}-*.gem").map do |a|
+  versions = Dir.glob("#{gemfile}-*.gem").map do |a|
     Gem::Version.new(a.sub(/#{gemfile}-(.+)\.gem/, '\1'))
   end
   # and pick the most recent one
diff --git a/lib/gem2deb/dh_make_ruby.rb b/lib/gem2deb/dh_make_ruby.rb
index c3221fa..172331a 100644
--- a/lib/gem2deb/dh_make_ruby.rb
+++ b/lib/gem2deb/dh_make_ruby.rb
@@ -346,7 +346,7 @@ module Gem2Deb
     end
 
     def test_suite_rspec
-      if File::directory?("spec")
+      if File.directory?("spec")
         extra_build_dependencies << 'ruby-rspec' << 'rake'
         maybe_create("debian/ruby-tests.rake") do |f|
           f.puts <<-EOF
@@ -364,7 +364,7 @@ end
     end
 
     def test_suite_testunit_or_minitest
-      if File::directory?("test")
+      if File.directory?("test")
         extra_build_dependencies << 'rake'
         maybe_create("debian/ruby-tests.rake") do |f|
           f.puts <<-EOF
@@ -385,7 +385,7 @@ end
     def other_files
       # docs
       docs = []
-      docs += Dir['doc/*'] if File::directory?('doc')
+      docs += Dir['doc/*'] if File.directory?('doc')
       docs += Dir['{README*,CONTRIBUTORS*}']
       if not docs.empty?
         maybe_create("debian/#{source_package_name}.docs") do |f|
@@ -398,7 +398,7 @@ end
       # examples
       examples = ""
       ['examples', 'sample'].each do |d|
-        if File::directory?(d)
+        if File.directory?(d)
           examples += <<-EOF
 # FIXME: #{d}/ dir found in source. Consider installing the examples.
 # Examples:
@@ -414,14 +414,14 @@ end
 
       # data & conf
       installs = ""
-      if File::directory?('data')
+      if File.directory?('data')
         installs += <<-EOF
 # FIXME: data/ dir found in source. Consider installing it somewhere.
 # Examples:
 # data/* /usr/share/#{source_package_name}/
         EOF
       end
-      if File::directory?('conf')
+      if File.directory?('conf')
         installs += <<-EOF
 # FIXME: conf/ dir found in source. Consider installing it somewhere.
 # Examples:
@@ -435,7 +435,7 @@ end
       end
 
       # manpages
-      if File::directory?('man')
+      if File.directory?('man')
         manpages = Dir.glob("man/**/*.[1-8]")
         manpages_header = "# FIXME: man/ dir found in source. Consider installing manpages"
 
diff --git a/lib/gem2deb/gem2tgz.rb b/lib/gem2deb/gem2tgz.rb
index eb76172..a0ba672 100644
--- a/lib/gem2deb/gem2tgz.rb
+++ b/lib/gem2deb/gem2tgz.rb
@@ -1,15 +1,15 @@
 # Copyright © 2010, Antonio Terceiro <terceiro at softwarelivre.org>
-# 
+#
 # 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 3 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 program.  If not, see <http://www.gnu.org/licenses/>.
 
@@ -56,7 +56,7 @@ module Gem2Deb
           @tarball = File.join(path, filename)
         end
         @tarball_full_path  = File.expand_path(@tarball)
-        @target_dirname     = File::basename(@tarball).gsub('.tar.gz', '')
+        @target_dirname     = File.basename(@tarball).gsub('.tar.gz', '')
       else
         puts "#{gem} does not look like a valid .gem file."
         exit(1)
@@ -75,9 +75,9 @@ module Gem2Deb
     protected
 
     def create_target_dir
-      @tmp_dir = Dir::mktmpdir('gem2tgz')
+      @tmp_dir = Dir.mktmpdir('gem2tgz')
       @target_dir = @tmp_dir + '/' + @target_dirname
-      Dir::mkdir(@target_dir)
+      Dir.mkdir(@target_dir)
     end
 
     def extract_gem_contents
diff --git a/lib/gem2deb/installer.rb b/lib/gem2deb/installer.rb
index 48b8931..74f793e 100644
--- a/lib/gem2deb/installer.rb
+++ b/lib/gem2deb/installer.rb
@@ -47,8 +47,8 @@ module Gem2Deb
     def install_files_and_build_extensions
 
       Gem2Deb::Banner.print "Install files"
-      install_files(bindir, destdir(:bindir), 755, metadata.executables) if File::directory?(bindir)
-      install_files(libdir, destdir(:libdir), 644) if File::directory?(libdir)
+      install_files(bindir, destdir(:bindir), 755, metadata.executables) if File.directory?(bindir)
+      install_files(libdir, destdir(:libdir), 644) if File.directory?(libdir)
 
       if metadata.has_native_extensions?
         ruby_versions.each do |rubyver|
@@ -196,7 +196,7 @@ module Gem2Deb
     end
 
     def remove_duplicate_files(src, dst)
-      candidates = Dir::entries(src) - ['.', '..']
+      candidates = Dir.entries(src) - ['.', '..']
       candidates.each do |cand|
         file1 = File.join(src, cand)
         file2 = File.join(dst, cand)
-- 
2.34.1



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