Hi Cédric, El Domingo, 18 de mayo de 2014 09:25:29 Cédric Boutillier escribió: > > - Maybe don't bump the standards-version. Let's keep the diff minimal. > No changes is required except changing this number. That's the role of > the maintainer that the packages complies to some specific standards > version.
Ok, unbumped :) > - Instead of forcing the encoding of lib/dhelp/exporter/html.rb, > wouldn't it be better to change the encoding to utf-8, by fixing the > name of Esteban Manchado Velázquez? > (test/tc_docbasedocument.rb is also affected) > Text files in the system should be encoded in utf-8. The name was incorrect in the diff but correct in the deb. Anyway I just changed the enconding to UTF8, better this way. Mostly all '*.rb' files have 'ISO-8859' encoding (and some others) so I change them too. > I got also two warnings with your dhelp, that probably should be fixed: > > /usr/lib/ruby/vendor_ruby/dhelp/exporter/html.rb:87: warning: assigned but unused variable - e > /usr/sbin/dhelp_parse:119: warning: File.exists? is a deprecated name, use File.exist? instead > > (or the -w should be removed) Just fix them, better this way. > Also, /usr/sbin/dhelp_parse when called without argument ends with: > > NameError: undefined local variable or method `usage' for #<DhelpParseApp:0x0000000153c4a0 @action=nil, @verbose=false> (/usr/sbin/dhelp_parse:201:in `main' > /usr/sbin/dhelp_parse:214:in `<main>') > > whereas it tries to show the same as with the -h option, I guess. Ops, I was unaware. Now should work. > This should be something like: > Cache 'Dpkg.status' calls to not affect performance on every system Changed. I added the correct test target to the rules file and fix the makefile, so now them are executed. Thanks for the review mate ! I reuploaded the package to mentors, dsc here: http://mentors.debian.net/debian/pool/main/d/dhelp/dhelp_0.6.21+nmu4.dsc David
diff -ru dhelp-0.6.21+nmu3/debian/changelog dhelp-0.6.21+nmu4/debian/changelog --- dhelp-0.6.21+nmu3/debian/changelog 2013-09-22 12:07:33.000000000 +0200 +++ dhelp-0.6.21+nmu4/debian/changelog 2014-05-18 14:22:54.000000000 +0200 @@ -1,3 +1,17 @@ +dhelp (0.6.21+nmu4) unstable; urgency=low + + * Non-maintainer upload. + * Add support for newer ruby versions (Closes: #734523, #732916) + * Cache 'Dpkg.status' calls to not affect performance on every system + upgrade (Closes: #712621) + * Handle correctly arguments passed to '-a' and '-d' options + * Fix error when 'dhelp_parse' is called without arguments + * Run Ruby tests + * Fix Ruby warnings + * Change the encoding of Ruby files to UTF-8 + + -- David Suárez <david.sephi...@gmail.com> Sun, 18 May 2014 13:18:39 +0200 + dhelp (0.6.21+nmu3) unstable; urgency=low * Non-maintainer upload. diff -ru dhelp-0.6.21+nmu3/debian/control dhelp-0.6.21+nmu4/debian/control --- dhelp-0.6.21+nmu3/debian/control 2013-05-10 11:46:54.000000000 +0200 +++ dhelp-0.6.21+nmu4/debian/control 2014-05-18 13:09:49.000000000 +0200 @@ -10,9 +10,10 @@ Package: dhelp Depends: perl-modules, libtemplate-perl, libhtml-parser-perl, - liburi-perl, liblocale-gettext-perl, libdata-page-perl, ruby1.8, - ruby-bdb | libdb-ruby1.8, ruby-debian, ruby-gettext, doc-base, - swish++, pstotext, poppler-utils, ucf (>= 0.8), ${misc:Depends} + liburi-perl, liblocale-gettext-perl, libdata-page-perl, + ruby | ruby-interpreter, ruby-bdb, ruby-debian, ruby-gettext, + doc-base, swish++, pstotext, poppler-utils, ucf (>= 0.8), + ${misc:Depends} Recommends: www-browser | html2text Suggests: httpd-cgi, info2www, man2html, catdvi Architecture: all diff -ru dhelp-0.6.21+nmu3/debian/rules dhelp-0.6.21+nmu4/debian/rules --- dhelp-0.6.21+nmu3/debian/rules 2012-06-12 20:59:55.000000000 +0200 +++ dhelp-0.6.21+nmu4/debian/rules 2014-05-18 14:03:09.000000000 +0200 @@ -13,6 +13,8 @@ DEB_INSTALL_MANPAGES_dhelp = man/dhelp* DEB_INSTALL_EXAMPLES_dhelp = examples/* +DEB_MAKE_CHECK_TARGET = test + include /usr/share/cdbs/1/rules/debhelper.mk include /usr/share/cdbs/1/class/makefile.mk diff -ru dhelp-0.6.21+nmu3/examples/index_package_doc.rb dhelp-0.6.21+nmu4/examples/index_package_doc.rb --- dhelp-0.6.21+nmu3/examples/index_package_doc.rb 2011-10-22 15:08:12.000000000 +0200 +++ dhelp-0.6.21+nmu4/examples/index_package_doc.rb 2014-05-18 14:09:06.000000000 +0200 @@ -37,10 +37,10 @@ # If the index doesn't exist, we have to force non-incremental indexing options = {} index_file = '/var/lib/dhelp/documents.index' -if File.exists? index_file and File.size(index_file) == 0 +if File.exist? index_file and File.size(index_file) == 0 FileUtils.rm_f index_file end -unless File.exists? index_file +unless File.exist? index_file options[:incremental] = false end diff -ru dhelp-0.6.21+nmu3/lib/dhelp/exporter/cgimap.rb dhelp-0.6.21+nmu4/lib/dhelp/exporter/cgimap.rb --- dhelp-0.6.21+nmu3/lib/dhelp/exporter/cgimap.rb 2012-06-12 20:59:55.000000000 +0200 +++ dhelp-0.6.21+nmu4/lib/dhelp/exporter/cgimap.rb 2014-05-18 14:09:06.000000000 +0200 @@ -62,9 +62,14 @@ } end + @@pkgs_status = {} + # Return true if the package associated to this item is installed. def installed?(item) - return package_status(item) == "installed" + return @@pkgs_status[item] if @@pkgs_status[item] != nil + + @@pkgs_status[item] = package_status(item) == "installed" + return @@pkgs_status[item] end end # class BaseMap @@ -93,7 +98,7 @@ # From debian wheezy's man2html and onwards # the script is inside a 'man' subdirectory. - if File.exists?("/usr/lib/cgi-bin/man/man2html") + if File.exist?("/usr/lib/cgi-bin/man/man2html") return "<a href=\"/cgi-bin/man/man2html\">" + _(MAN2HTML) + "</a>" else return "<a href=\"/cgi-bin/man2html\">" + _(MAN2HTML) + "</a>" diff -ru dhelp-0.6.21+nmu3/lib/dhelp/exporter/html.rb dhelp-0.6.21+nmu4/lib/dhelp/exporter/html.rb --- dhelp-0.6.21+nmu3/lib/dhelp/exporter/html.rb 2012-06-12 20:59:55.000000000 +0200 +++ dhelp-0.6.21+nmu4/lib/dhelp/exporter/html.rb 2014-05-18 14:05:16.000000000 +0200 @@ -33,7 +33,7 @@ Don't put files in this directory! dhelp will delete *all* files in this directory when creating a new index. -Esteban Manchado Vel zquez (z...@debian.org) +Esteban Manchado Velázquez (z...@debian.org) EOREADME end end @@ -81,7 +81,7 @@ make_page(index_template, export_dir, "index.html") - rescue Errno::EACCES => e + rescue Errno::EACCES # => e $stderr.puts "Don't have permissions to regenerate the HTML help" exit 1 end diff -ru dhelp-0.6.21+nmu3/lib/dhelp.rb dhelp-0.6.21+nmu4/lib/dhelp.rb --- dhelp-0.6.21+nmu3/lib/dhelp.rb 2012-06-12 20:59:55.000000000 +0200 +++ dhelp-0.6.21+nmu4/lib/dhelp.rb 2014-05-18 14:13:33.000000000 +0200 @@ -1,7 +1,7 @@ =begin Ruby support library for dhelp database access - Copyright (C) 2005 Esteban Manchado Vel zquez + Copyright (C) 2005 Esteban Manchado Velázquez 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 @@ -544,7 +544,7 @@ # Returns the pending-documents-list-for-indexing contents as an array def read_pending_file - # Don't use File.exists? to avoid races; use exceptions instead + # Don't use File.exist? to avoid races; use exceptions instead begin IO.readlines(pending_file) rescue Errno::ENOENT @@ -572,7 +572,7 @@ # Returns true if already indexing def is_indexing? i_file = (incremental ? "#{index_file}.new" : index_file) - File.exists?(i_file) and File.size(i_file) == 0 + File.exist?(i_file) and File.size(i_file) == 0 end # Index the list of given dirs/files with index++. Directories are indexed @@ -588,7 +588,7 @@ # If the index doesn't exist yet and we're doing incremental, # switch to non-incremental mode and create it. That way we will # have at least a partial index until the next rebuild cron job. - if incremental and not File.exists?(index_file) + if incremental and not File.exist?(index_file) @opts[:incremental] = false cmd = "#{indexpp_cmd} #{indexpp_options} -" end diff -ru dhelp-0.6.21+nmu3/Makefile dhelp-0.6.21+nmu4/Makefile --- dhelp-0.6.21+nmu3/Makefile 2013-09-22 12:03:54.000000000 +0200 +++ dhelp-0.6.21+nmu4/Makefile 2014-05-18 14:01:45.000000000 +0200 @@ -33,13 +33,17 @@ docdir = $(DESTDIR_)/share/doc/$(PACKAGE) # The caller should define VENDOR_RUBY to use the new location for ruby -# libraries from wheezy and onwards. Undefine it to backport the package -# to previous Debian releases. +# libraries from squeeze and onwards; OLD_VENDOR_RUBY for wheezy and onwards. +# Undefine it to backport the package to previous Debian releases. ifdef VENDOR_RUBY -rubydir = $(DESTDIR_)/lib/ruby/vendor_ruby/1.8 +rubydir = $(DESTDIR_)/lib/ruby/vendor_ruby/ else + ifdef OLD_VENDOR_RUBY +rubydir = $(DESTDIR_)/lib/ruby/vendor_ruby/1.8 + else rubydir = $(DESTDIR_)/lib/ruby/1.8 + endif endif # Templates and Perl-related variables @@ -113,7 +117,7 @@ # Note that we use a specific ruby version. This line # must change in sync with $(rubydir) definition, above. test: - RUBYLIB=lib:test ruby1.8 -w test/ts_dhelp.rb + ruby -I . -I lib/ -w test/ts_dhelp.rb updatepo: po/*.po diff -ru dhelp-0.6.21+nmu3/src/dhelp_fetcher.rb dhelp-0.6.21+nmu4/src/dhelp_fetcher.rb --- dhelp-0.6.21+nmu3/src/dhelp_fetcher.rb 2012-06-12 20:59:55.000000000 +0200 +++ dhelp-0.6.21+nmu4/src/dhelp_fetcher.rb 2014-05-18 14:05:22.000000000 +0200 @@ -1,4 +1,4 @@ -#!/usr/bin/ruby1.8 -w +#!/usr/bin/ruby -w require 'cgi' require 'erb' diff -ru dhelp-0.6.21+nmu3/src/dhelp_parse.rb dhelp-0.6.21+nmu4/src/dhelp_parse.rb --- dhelp-0.6.21+nmu3/src/dhelp_parse.rb 2012-06-21 21:47:38.000000000 +0200 +++ dhelp-0.6.21+nmu4/src/dhelp_parse.rb 2014-05-18 14:09:06.000000000 +0200 @@ -1,4 +1,4 @@ -#!/usr/bin/ruby1.8 -w +#!/usr/bin/ruby -w =begin Documentation generator for dhelp @@ -89,10 +89,12 @@ opts.on('-a FILE[...]', MSG_DOC_ADD) { |files| @action = :add + files = [files] if files.is_a? String @doc_base_files = files } opts.on('-d FILE[...]', MSG_DOC_RMV) { |files| @action = :delete + files = [files] if files.is_a? String @doc_base_files = files } opts.on('-i', MSG_INDEX) { @action = :index } @@ -111,10 +113,15 @@ end optparse.summary_width = 16 optparse.parse! + + if @action == nil + $stderr.puts optparse + exit 1 + end end def packaged_configured? - File.exists? '/var/lib/dhelp/configured' + File.exist? '/var/lib/dhelp/configured' end # Adds the documents supplied in command-line to the pool. @@ -195,9 +202,6 @@ when :reindex # Recreate the pool, without doing a full indexing. pool.rebuild(false) - else - $stderr.puts usage - return 1 end # Always executed diff -ru dhelp-0.6.21+nmu3/test/doc-base/pica-manual dhelp-0.6.21+nmu4/test/doc-base/pica-manual --- dhelp-0.6.21+nmu3/test/doc-base/pica-manual 2011-10-22 15:08:12.000000000 +0200 +++ dhelp-0.6.21+nmu4/test/doc-base/pica-manual 2014-05-18 13:59:45.000000000 +0200 @@ -1,6 +1,6 @@ Document: pica-manual Title: PICA Manual -Author: Esteban Manchado Vel zquez +Author: Esteban Manchado Velázquez Abstract: This manual describes what PICA is and how it can be used to administer your machines and keep them up-to-date and secure. diff -ru dhelp-0.6.21+nmu3/test/tc_dhelpdocumentpool.rb dhelp-0.6.21+nmu4/test/tc_dhelpdocumentpool.rb --- dhelp-0.6.21+nmu3/test/tc_dhelpdocumentpool.rb 2012-06-12 20:59:55.000000000 +0200 +++ dhelp-0.6.21+nmu4/test/tc_dhelpdocumentpool.rb 2014-05-18 14:09:06.000000000 +0200 @@ -64,12 +64,13 @@ def test_section_tree expected_section_tree = { - 'Apps' => {:documents => [], - :subsections => { - 'Text' => {:documents => [doc_base_document('docbook-xsl-doc-html')], :subsections => {}}}}, 'Admin' => {:documents => [doc_base_document('pica-manual'), doc_base_document('pica-manual-2')], - :subsections => {}}} + :subsections => {}}, + 'Apps' => {:documents => [], + :subsections => { + 'Text' => {:documents => [doc_base_document('docbook-xsl-doc-html')], :subsections => {}}}} + } actual_section_tree = @pool.section_tree # Can't compare the whole thing because the memory addresses for the # DocBaseDocument objects are different :-( @@ -106,7 +107,7 @@ # Now, once everything is indexed, force a reindexing (like the cron job) FileUtils.rm_f TEST_INDEX_FILE @pool.rebuild - assert File.exists?(TEST_INDEX_FILE), + assert File.exist?(TEST_INDEX_FILE), "Index file should exist after rebuilding" assert(File.size(TEST_INDEX_FILE) > 0, "Index file should have non-zero size after rebuilding") diff -ru dhelp-0.6.21+nmu3/test/tc_docbasedocument.rb dhelp-0.6.21+nmu4/test/tc_docbasedocument.rb --- dhelp-0.6.21+nmu3/test/tc_docbasedocument.rb 2012-05-31 06:35:55.000000000 +0200 +++ dhelp-0.6.21+nmu4/test/tc_docbasedocument.rb 2014-05-18 13:57:52.000000000 +0200 @@ -12,7 +12,7 @@ assert_equal 'pica-manual', file.document assert_equal 'PICA Manual', file.title - assert_equal 'Esteban Manchado Vel zquez', file.author + assert_equal 'Esteban Manchado Velázquez', file.author assert_equal 'Admin', file.section assert_equal "This manual describes what PICA is and how it can be used to administer your machines and keep them up-to-date and secure.", file.abstract diff -ru dhelp-0.6.21+nmu3/test/ts_dhelp.rb dhelp-0.6.21+nmu4/test/ts_dhelp.rb --- dhelp-0.6.21+nmu3/test/ts_dhelp.rb 2012-05-31 06:35:55.000000000 +0200 +++ dhelp-0.6.21+nmu4/test/ts_dhelp.rb 2014-05-18 14:16:46.000000000 +0200 @@ -1,7 +1,7 @@ =begin Testsuite for the Ruby parts of dhelp - Copyright (C) 2005 Esteban Manchado Vel zquez + Copyright (C) 2005 Esteban Manchado Velázquez 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