Control: owner -1 !
Please don't remove this package. I already work on patch to fix this
bug. I think I can perform migration from a module for Berkley DB to DBM
class from the Ruby standard library. I'm attaching my current draft.
Now I going to write migration scripts and test them.
By the way, can I check a previously installed version of the package in
postinst script?
=== modified file 'debian/changelog'
--- debian/changelog 2014-12-12 22:02:20 +
+++ debian/changelog 2017-04-24 20:23:36 +
@@ -1,3 +1,10 @@
+dhelp (0.6.21+nmu6ubuntu1) UNRELEASED; urgency=medium
+
+ * Migrate to a module from the standard library
+- Remove ruby-bdb dependency
+
+ -- Nicholas Guriev Mon, 24 Apr 2017 23:21:54 +0300
+
dhelp (0.6.21+nmu6) unstable; urgency=medium
* Non-maintainer upload.
=== modified file 'debian/control'
--- debian/control 2014-05-18 13:18:39 +
+++ debian/control 2017-04-24 20:20:58 +
@@ -11,7 +11,7 @@
Package: dhelp
Depends: perl-modules, libtemplate-perl, libhtml-parser-perl,
liburi-perl, liblocale-gettext-perl, libdata-page-perl,
- ruby | ruby-interpreter, ruby-bdb, ruby-debian, ruby-gettext,
+ ruby | ruby-interpreter, ruby-debian, ruby-gettext,
doc-base, swish++, pstotext, poppler-utils, ucf (>= 0.8),
${misc:Depends}
Recommends: www-browser | html2text
=== modified file 'devtools/list-dirs.rb'
--- devtools/list-dirs.rb 2012-06-12 21:50:00 +
+++ devtools/list-dirs.rb 2017-04-24 19:50:51 +
@@ -2,7 +2,7 @@
path = ARGV.shift || Dhelp::DOC_DIR_DATABASE
puts "Opening #{path}"
-ddd = Dhelp::DocDirDatabase.open(BDB::RDONLY, path)
+ddd = Dhelp::DocDirDatabase.open(DBM::READER, path)
ddd.each do |dir, doc_id, title|
puts "#{dir} -> #{doc_id} (#{title})"
end
=== modified file 'lib/dhelp.rb'
--- lib/dhelp.rb 2014-05-18 13:18:39 +
+++ lib/dhelp.rb 2017-04-24 19:57:08 +
@@ -18,7 +18,7 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
=end
-require 'bdb'
+require 'dbm'
require 'pathname'
require 'fileutils'
@@ -239,23 +239,18 @@
# Database for doc-base directories. It contains base directories associated
# with the corresponding doc-base doc id and the document title.
- class DocDirDatabase < BDB::Hash
-def self.open(flags = BDB::RDONLY,
+ class DocDirDatabase < DBM
+def self.open(flags = DBM::READER,
name= DOC_DIR_DATABASE,
options = {},
mode= 0644)
- default_options = {"ffactor" => 8,
- "nelem" => 1,
- "cachesize" => 5000,
- "hash" => nil,
- "lorder"=> 0}
- super(name, nil, flags, mode, default_options.merge(options))
+ super(name, mode, flags)
end
# Traverse entire BD, passing directory, doc_id and title of each item to
# the block
def each
- super do |k,v|
+ each_pair do |k,v|
value = DocDirDatabaseValue.new(v)
yield DocDirDatabaseKey.new(k).dir, value.doc_id, value.title
end
@@ -266,19 +261,19 @@
def add(dir, doc_id, title)
key = DocDirDatabaseKey.new(:dir => dir)
value = DocDirDatabaseValue.new(:doc_id => doc_id, :title => title)
- put(key.to_raw_data, value.to_raw_data)
+ self[key.to_raw_data] = value.to_raw_data
end
def include?(dir)
key = DocDirDatabaseKey.new(:dir => dir)
- return super(key.to_raw_data)
+ return has_key?(key.to_raw_data)
end
# Returns an array with two elements, doc_id and title, for the registered
# doc-base document in the given directory
def info_for_path(dir)
key = DocDirDatabaseKey.new(:dir => dir)
- raw_value = get(key.to_raw_data)
+ raw_value = self[key.to_raw_data]
if raw_value.nil?
raise KeyNotFoundError, "Can't find information for path #{dir}"
end
@@ -448,10 +443,11 @@
# Registers a list of doc-base documents as part of Dhelp
def _register_docs(doc_list, user_opts={})
register_opts = {:regenerate_index => false}.merge(user_opts)
- open_flag = register_opts[:regenerate_index] ? (BDB::CREATE|
- BDB::TRUNCATE) :
- BDB::CREATE
- doc_dir_db = DocDirDatabase.open(open_flag, @doc_dir_database)
+ if register_opts[:regenerate_index]
+doc_dir_db = DocDirDatabase.open(DBM::NEWDB, @doc_dir_database)
+ else
+doc_dir_db = DocDirDatabase.open(DBM::WRCREAT, @doc_dir_database)
+ end
index_paths = []
doc_list.each do |doc|
doc.formats.each do |format|
=== modified file 'test/tc_dhelpdocumentpool.rb'
--- test/tc_dhelpdocumentpool.rb 2014-05-18 13:18:39 +
+++ test/tc_dhelpdocumentpool.rb 2017-04-24 20:19:29 +
@@ -1,6 +1,7 @@
require 'test/unit'
require 'dhelp'
require 'fileutils'
+require 'set'
class TC_Dhelp