tags 429233 patch thanks Hi,
doc-base generates .dhelp files in /usr/share/doc because dhelp expects to find the files there. I agree with Emil, that /usr is not a location for autogenerated files. As a doc-base maintainer I suggest to move the files to some subdirectory of /var, for example /var/lib/doc-base/dhelp. doc-base could create /var/lib/doc-base/dhelp/$package/.dhelp file, than run `dhelp_parse -a /var/lib/doc-base/dhelp/$package/.dhelp', and dhelp_parse could process the file, as if it would be located in /usr/share/doc/$package. The attached patch tries to implement this; I hope, it's correct, though I don't know ruby. (The patch also fixes checking validity of arguments, when there are more than one provided, e.g.: `dhelp_parse -a /usr/share/doc/foo /some/other/dir/bla'). If you think it's a good idea, please upload dhelp with the above changes, after that I will upload new doc-base which move .dhelp files to new dir. Best Regards, robert -- System Information: Debian Release: lenny/sid APT prefers unstable APT policy: (990, 'unstable') Architecture: i386 (i686) Kernel: Linux 2.6.22 Locale: LANG=pl_PL, LC_CTYPE=pl_PL (charmap=ISO-8859-2) Shell: /bin/sh linked to /bin/pdksh Versions of packages dhelp depends on: ii debconf [debconf-2.0] 1.5.16 Debian configuration management sy ii doc-base 0.8.6 utilities to manage online documen ii libcommandline-ruby1.8 0.7.10-7 Ruby library to write command-line ii libdb4.2-ruby1.8 0.5.8-1 Interface to Berkeley DB for Ruby ii libgettext-ruby1.8 1.9.0-1 Gettext for ruby1.8 ii perl-modules 5.8.8-11.1 Core Perl modules ii ruby1.8 1.8.6.111-2 Interpreter of object-oriented scr Versions of packages dhelp recommends: ii elinks [www-browser] 0.11.1-1.5 advanced text-mode WWW browser ii iceape-browser [www-brows 1.1.4-1 Iceape Navigator (Internet browser ii iceweasel [www-browser] 2.0.0.8-1 lightweight web browser based on M ii links [www-browser] 1.00~pre20-0.1 Character mode WWW browser ii links2 [www-browser] 2.1pre31-1 Web browser running in both graphi ii lynx-cur [www-browser] 2.8.7dev7-3 Text-mode WWW Browser with NLS sup ii w3m [www-browser] 0.5.1-5.1+b1 WWW browsable pager with excellent -- debconf information excluded
--- dhelp_parse_old.rb 2007-10-23 00:39:49.000000000 +0200 +++ dhelp_parse.rb 2007-11-01 11:01:15.000000000 +0100 @@ -41,7 +41,9 @@ class DhelpParseApp < CommandLine::Application DOC_DIR = '/usr/share/doc' DOC_DIR_REAL = File.expand_path(DOC_DIR) + DOC_DBASE_DIR_REAL = File.expand_path('/var/lib/doc-base/dhelp') DHELP_FILE_REGEXP = Regexp.new("#{DOC_DIR_REAL}/(.+)/\\.dhelp") + DHELP_DBASE_FILE_REGEXP = Regexp.new("#{DOC_DBASE_DIR_REAL}/(.+)/\\.dhelp") require 'gettext' # Exception for invalid dhelp files (wrong path, wrong name, ...) @@ -81,7 +83,19 @@ def get_items(path) - basePath = path.sub(Regexp.new("#{DOC_DIR_REAL}/(.+)/\\.dhelp"), '\1') + begin + path = Pathname.new(path).realpath.to_s + rescue Errno::ENOENT => e + raise InvalidDhelpFileError, "#{path}: no such file or directory" + end + if path =~ DHELP_DBASE_FILE_REGEXP + basePath = path.sub(Regexp.new("#{DHELP_DBASE_FILE_REGEXP}"), '\1') + elsif path =~ DHELP_FILE_REGEXP + basePath = path.sub(Regexp.new("#{DHELP_FILE_REGEXP}"), '\1') + else + raise InvalidDhelpFileError, "Dhelp files must reside in #{DOC_DIR_REAL} and be named .dhelp" + end + begun, descriptionMode = false, false attrs = {} itemList = [] @@ -139,18 +153,9 @@ # Executes the block for each data item in the specified .dhelp file, # passing an ItemData object def each_item(path) - begin - entry = Pathname.new(path).realpath.to_s - rescue Errno::ENOENT => e - raise InvalidDhelpFileError, "#{path}: no such file or directory" - end - if entry =~ DHELP_FILE_REGEXP - get_items(entry).each do |entryData| + get_items(path).each do |entryData| yield entryData end - else - raise InvalidDhelpFileError, "Dhelp files must reside in #{DOC_DIR_REAL} and be named .dhelp" - end end @@ -268,6 +273,7 @@ # Delete and re-create both databases db = Database.open(BDB::CREATE|BDB::TRUNCATE) titleDb = TitleDatabase.open(BDB::CREATE|BDB::TRUNCATE) + dhelp_add_rec(DOC_DBASE_DIR_REAL, db, titleDb) if FileTest.directory? DOC_DBASE_DIR_REAL dhelp_add_rec(DOC_DIR_REAL, db, titleDb) titleDb.close db.close
signature.asc
Description: Digital signature