octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: pkg.m is busted, gen_doc_cache sematics changed


From: Jaroslav Hajek
Subject: Re: pkg.m is busted, gen_doc_cache sematics changed
Date: Wed, 25 Feb 2009 10:53:07 +0100

On Wed, Feb 25, 2009 at 7:32 AM, John W. Eaton <address@hidden> wrote:
> On 24-Feb-2009, Jason Riedy wrote:
>
> | When you changed gen_doc_cache's semantics, you did not change how pkg.m
> | calls it. Package installation doesn't work in the tip.
> |
> | I have no idea where the cache files for a directory hierarchy
> | are supposed to live, so I'm not sure how to fix it. Should
> | pkg>generate_lookfor_cache iterate over the directories and
> | save to help_cache.mat in each? Such a patch is appended, but
> | lookfor cannot find the relevant functions.
> |
> | Also fixed below, makeinfo should be __makeinfo__ now, but
> | that's pointless until gen_doc_cache is called correctly.
> |
> | Even with this patch, however, the *first* pkg install call
> | dies complaining about an invalid call to mlock. The second
> | succeeds. How long has it been since anyone here installed a
> | package? ;)
> |
> | Jason
> |
> | diff --git a/scripts/help/gen_doc_cache.m b/scripts/help/gen_doc_cache.m
> | index 6d35852..ce0893a 100644
> | --- a/scripts/help/gen_doc_cache.m
> | +++ b/scripts/help/gen_doc_cache.m
> | @@ -60,7 +60,7 @@ function [text, first_sentence, status] = handle_function 
> (f, text, format)
> |      case "plain text"
> |        status = 0;
> |      case "texinfo"
> | -      [text, status] = makeinfo (text, "plain text");
> | +      [text, status] = __makeinfo__ (text, "plain text");
> |      case "html"
> |        [text, status] = strip_html_tags (text);
> |      otherwise
> | diff --git a/scripts/pkg/pkg.m b/scripts/pkg/pkg.m
> | index dc3dfd2..1376bad 100644
> | --- a/scripts/pkg/pkg.m
> | +++ b/scripts/pkg/pkg.m
> | @@ -1585,7 +1585,10 @@ function finish_installation (desc, packdir, 
> global_install)
> |  endfunction
> |
> |  function generate_lookfor_cache (desc)
> | -  gen_doc_cache (genpath (desc.dir));
> | +  dirs = split_by (genpath (desc.dir), pathsep ());
> | +  for i = 1 : length (dirs)
> | +    gen_doc_cache (fullfile (dirs{i}, "help_cache.mat"), dirs{i});
> | +  endfor
> |  endfunction
> |
> |  ## Make sure the package contains the essential files.
>
> I checked in these changes and some more, and I think pkg install
> should work now, and create the DOC files, and lookfor seems to be
> using the DOC files.
>
> jwe
>

Noticing your changes, I simplified and optimized the code by using
setdiff to delete already cached dirs and vectorized string splitting
based on cell2mat:
http://hg.savannah.gnu.org/hgweb/octave/rev/eea0e1b45ec0

Maybe the splitting function, str_split (splits a string into a cell
array using one or more separator chars)
would be useful in general? Octave has "split", which returns a padded
character matrix, and that's inconvenient for unequal length strings
(and also slow). OTOH, we already have a "feature freeze" state, so I
leave it up to you.

cheers

-- 
RNDr. Jaroslav Hajek
computing expert
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz



reply via email to

[Prev in Thread] Current Thread [Next in Thread]