Google Groupes n'accepte plus les nouveaux posts ni abonnements Usenet. Les contenus de l'historique resteront visibles.

Merge several `info/dir' files.

0 vue
Accéder directement au premier message non lu

Kai.Gro...@cs.uni-dortmund.de

non lue,
6 nov. 1998, 03:00:0006/11/1998
à
Suppose I wanted to merge the contents of several `dir' files for
Info. Apparently, a simple `cat' won't work, not even if one cuts off
the header from each but the first file. Judging from the code in
info.el which does this, the algorithm is more complicated. I want to
do it from the shell or from Perl, though.

How would I go about this? Is there already a program which does
this?

I have a directory, populated with symlinks to info files in several
other directories. Now, I want to generate a `dir' file for the link
farm. Obviously, there are two ways to go about it:

(1) Merge all the constituent `dir' files, as mentioned above.
(2) Look at all the files in the link farm and extract the relevant
information for the `dir' file from them.

If you think the second method is better, please say so.

Any other comments?

tia,
kai
--
Life is hard and then you die.

Piet van Oostrum

non lue,
7 nov. 1998, 03:00:0007/11/1998
à
>>>>> Kai.Gro...@CS.Uni-Dortmund.DE (KG) writes:

KG> Suppose I wanted to merge the contents of several `dir' files for
KG> Info. Apparently, a simple `cat' won't work, not even if one cuts off
KG> the header from each but the first file. Judging from the code in
KG> info.el which does this, the algorithm is more complicated. I want to
KG> do it from the shell or from Perl, though.

KG> How would I go about this? Is there already a program which does
KG> this?

KG> I have a directory, populated with symlinks to info files in several
KG> other directories. Now, I want to generate a `dir' file for the link
KG> farm. Obviously, there are two ways to go about it:

KG> (1) Merge all the constituent `dir' files, as mentioned above.
KG> (2) Look at all the files in the link farm and extract the relevant
KG> information for the `dir' file from them.

I have the same problem, not yet solved. But I am thinking of just adding
all the links to Info-directory-list (or maybe only those that have a dir
inside) using the directory-files function.
--
Piet van Oostrum <pi...@cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP]
Private email: Piet.van...@gironet.nl

Kai.Gro...@cs.uni-dortmund.de

non lue,
7 nov. 1998, 03:00:0007/11/1998
à
>>>>> Piet van Oostrum <pi...@cs.uu.nl> writes:

> I have the same problem, not yet solved. But I am thinking of just
> adding all the links to Info-directory-list (or maybe only those
> that have a dir inside) using the directory-files function.

We have decided to use INFOPATH not Info-directory-list. Sure, I
could just add all directories to INFOPATH, but the reason for doing
all this is to prevent the environment from becoming too large. (Lots
of people here use a ridiculous shell which restricts an environment
variable to be no longer than 1024 characters.)

Stefan Monnier

non lue,
7 nov. 1998, 03:00:0007/11/1998
à
>>>>> "Kai" == Kai Grossjohann <Kai.Gro...@CS.Uni-Dortmund.DE> writes:
> I have a directory, populated with symlinks to info files in several
> other directories. Now, I want to generate a `dir' file for the link
> farm. Obviously, there are two ways to go about it:

We're all in the same boat :-(

> (1) Merge all the constituent `dir' files, as mentioned above.

Indeed, it should be possible. I don't think it's as hard as you believe.
If you look at those files you'll see that a pretty dumb heuristic should work.
The output might not be as pretty as it gets, tho.

> (2) Look at all the files in the link farm and extract the relevant

> information for the `dir' file from them.

This alternative is not necessarily incompatible with the previous one.
I use depot to make the symlinks and some of the symlinks come from things like
emacs (with a dir file) while other come from software that only comes with
info files but no dir files.
So I'd recommend in such a case to `smart_cat' the dir files and then extract
the other entries directly from the info files themselves. There is a somewhat
standard way to include a dir entry in an info file. If you look in the elisp
info file, for instance, you'll find:

INFO-DIR-SECTION Editors
START-INFO-DIR-ENTRY
* Elisp: (elisp). The Emacs Lisp Reference Manual.
END-INFO-DIR-ENTRY

So you should be able to make something up this way. I've been thinking of
hacking up something, but depot has very poor support for calling such scripts
so I've temporarily given up (until I write a depot++ or find such a
thing. `stow' is not my idea of depot++, if you ask me).


Stefan

Eli Zaretskii

non lue,
8 nov. 1998, 03:00:0008/11/1998
à

On 6 Nov 1998 Kai.Gro...@CS.Uni-Dortmund.DE wrote:

> Suppose I wanted to merge the contents of several `dir' files for

> Info. Apparently, a simple `cat' won't work, not even if one cuts off

> the header from each but the first file. Judging from the code in

> info.el which does this, the algorithm is more complicated. I want to

> do it from the shell or from Perl, though.
>

> How would I go about this?

You don't need all that complexity. Just mention all the directories
where Info files are kept in the INFOPATH environment variable, and
put each DIR file in the directory where the files it describes are
kept. Info readers automatically scan all the directories in INFOPATH
and concatenate all DIR files found there in a single DIR node.

Eli Zaretskii

non lue,
8 nov. 1998, 03:00:0008/11/1998
à

On 7 Nov 1998, Stefan Monnier wrote:

> > (2) Look at all the files in the link farm and extract the relevant
> > information for the `dir' file from them.
>
> This alternative is not necessarily incompatible with the previous one.
> I use depot to make the symlinks and some of the symlinks come from
> things like emacs (with a dir file) while other come from software
> that only comes with info files but no dir files.

Recent versions of the GNU Texinfo distribution include a program
called `install-info' which gathers the stuff from the DIR-ENTRY
sections and puts them into a DIR file.

Kai.Gro...@cs.uni-dortmund.de

non lue,
8 nov. 1998, 03:00:0008/11/1998
à
>>>>> Eli Zaretskii <el...@is.elta.co.il> writes:

> You don't need all that complexity. Just mention all the
> directories where Info files are kept in the INFOPATH environment

> variable, [...]

I don't want INFOPATH to become too long. (We are using a braindead
shell which barfs for environment variables longer than 1K.) And I
don't want to use Info-default-directory-list, either (because other
things in the environment tell me I must use INFOPATH, lest I become
incompatible with the rest of our setup).

Eli Zaretskii

non lue,
8 nov. 1998, 03:00:0008/11/1998
à

On 8 Nov 1998 Kai.Gro...@CS.Uni-Dortmund.DE wrote:

> >>>>> Eli Zaretskii <el...@is.elta.co.il> writes:
>
> > You don't need all that complexity. Just mention all the
> > directories where Info files are kept in the INFOPATH environment
> > variable, [...]
>
> I don't want INFOPATH to become too long.

You still could run install-info in every directory which holds the Info
files and instruct it to put the entries in the single DIR file you
maintain in the single directory which you do put on
INFOPATH/Info-default-directory-list. Does that solve the problem?

Kai.Gro...@cs.uni-dortmund.de

non lue,
8 nov. 1998, 03:00:0008/11/1998
à
>>>>> Eli Zaretskii <el...@is.elta.co.il> writes:

Sadly, no. Here's some information on our environment.

Each program is installed in its own directory. We use the Modules
package to manage the environment variables and stuff.

Thus, Emacs is installed in /sw/emacs/20.3, say, and I use the
following command to add /sw/emacs/20.3/bin to $PATH and stuff:

module add emacs/20.3

This creates *long* environment variables, of course, if one uses lots
of programs. Thus, the powers that be have decided to create a
certain `virtual software package', called `stdenv', which is really a
link farm populated with symlinks to the rest of the packages, in
order to keep the environment variables short.

Installing the way you describe would mean that all programs have to
be in stdenv, and it is not possible to add/remove a program to/from
stdenv unless one reinstalls. Neither the former nor the latter can
be assumed, though.

Eli Zaretskii

non lue,
8 nov. 1998, 03:00:0008/11/1998
à

On 8 Nov 1998 Kai.Gro...@CS.Uni-Dortmund.DE wrote:

> Installing the way you describe would mean that all programs have to
> be in stdenv, and it is not possible to add/remove a program to/from
> stdenv unless one reinstalls.

Sorry, I must be dense today, because I don't understand how this could
make any problems.

A command like this:

install-info --dir-file=/usr/local/info/DIR \
--info-file=/sw/emacs/20.3/info/emacs

should add the stuff from DIR-ENTRY of /sw/emacs/20.3/info/emacs to the
DIR file in /usr/local/info. You could run this command as part of your
"module add emacs/20.3".

You could even run this command using a link to /sw/emacs/20.3, if you
want the command be independent of the details, since you have a link to
/sw/emacs/20.3 inside your ``symlink farm'', if I understand correctly.

Why won't one of these work for you?

Kai.Gro...@cs.uni-dortmund.de

non lue,
8 nov. 1998, 03:00:0008/11/1998
à
>>>>> Eli Zaretskii <el...@is.elta.co.il> writes:

> On 8 Nov 1998 Kai.Gro...@CS.Uni-Dortmund.DE wrote:
>
> > Installing the way you describe would mean that all programs have to
> > be in stdenv, and it is not possible to add/remove a program to/from
> > stdenv unless one reinstalls.
>
> Sorry, I must be dense today, because I don't understand how this could
> make any problems.
>
> A command like this:
>
> install-info --dir-file=/usr/local/info/DIR \
> --info-file=/sw/emacs/20.3/info/emacs
>
> should add the stuff from DIR-ENTRY of /sw/emacs/20.3/info/emacs to the
> DIR file in /usr/local/info. You could run this command as part of your
> "module add emacs/20.3".

`module add emacs/20.3' is quite similar to executing the following
bash code:

,-----
| PATH=/sw/emacs/20.3/bin:${PATH}
| MANPATH=/sw/emacs/20.3/man:${MANPATH}
| INFOPATH=/sw/emacs/20.3/info:${INFOPATH}
`-----

(Of course, module is a shell function so it can alter the environment
of the enclosing shell.)

Now, consider `module add stdenv'. It should set up the environment
such that users can run a number of useful programs. This currently
does the following:

,-----
| PATH=/sw/stdenv/bin:${PATH}
| MANPATH=/sw/stdenv/man:${MANPATH}
| INFOPATH=/sw/stdenv/info:${INFOPATH}
`-----

Alternatively, one could add many directories to $PATH and $MANPATH
and so on. We have chosen not to do this because of environment
variable length restrictions. Instead, we put symlinks in
/sw/stdenv/bin/, /sw/stdenv/man/*/ and /sw/stdenv/info/, pointing to
the real files. By adding or removing symlinks, one can tune what
happens when users type `module add stdenv'.

You're suggesting that `module add emacs/20.3' adds an entry to
/sw/stdenv/info/dir. But that means that user John typing this
effects the environment of user Paul. We don't want this.

Clearly, /sw/stdenv/info/dir must contain entries for all info files
symlinked from the directory /sw/stdenv/info/. My question was how to
do that. Either, one looks at each file and adds the entry, or one
merges the corresponding `dir' files.

Of course, it is easy to add the left part of a `dir' entry -- the
following will do nicely:

,-----
| emacs: (emacs).
`-----

But what about the right hand part?

,-----
| emacs: (emacs). The standard text editor for our group.
`-----

I hope I could make this clear.

Kai.Gro...@cs.uni-dortmund.de

non lue,
8 nov. 1998, 03:00:0008/11/1998
à
>>>>> Stefan Monnier <monnier+gnu/emacs/help/news/@tequila.cs.yale.edu> writes:

> INFO-DIR-SECTION Editors
> START-INFO-DIR-ENTRY
> * Elisp: (elisp). The Emacs Lisp Reference Manual.
> END-INFO-DIR-ENTRY

If our info files had this section, I'd be a happy camper. Sadly, I
have little influence on our info files :-(

But maybe I could make the people make pretty info files, with this
section. Yeah, that would be nice :-)

Kai.Gro...@cs.uni-dortmund.de

non lue,
8 nov. 1998, 03:00:0008/11/1998
à
>>>>> el...@is.elta.co.il (Eli Zaretskii) writes:

> You still could run install-info in every directory which holds
> the Info files and instruct it to put the entries in the single
> DIR file you maintain in the single directory which you do put on
> INFOPATH/Info-default-directory-list. Does that solve the
> problem?

Hm. That sounds nice. And it would find these nifty sections about
the dir entry, if they are there, right? Hmm... Yes, thanks a lot.
I think I've been pretty dense in the previous discussion.

Eli Zaretskii

non lue,
9 nov. 1998, 03:00:0009/11/1998
à

On 8 Nov 1998 Kai.Gro...@CS.Uni-Dortmund.DE wrote:

> You're suggesting that `module add emacs/20.3' adds an entry to
> /sw/stdenv/info/dir. But that means that user John typing this
> effects the environment of user Paul. We don't want this.

You could have a private DIR file for each user in their home
directory, if you wanted to avoid polluting other users' views of the
Info docs. Then `module add emacs/20.3' would only change the private
DIR file of the user who invoked it. (You will have to eliminate the
central DIR file for this to work, so that the private one is the only
DIR file seen by a user's Info reader.)

> Clearly, /sw/stdenv/info/dir must contain entries for all info files
> symlinked from the directory /sw/stdenv/info/.

This is another possibility I was talking about. If you don't mind
letting users to see all the possible entries for all Info files
installed anywhere on your system (and the symlink gork seems to
suggest you indeed don't mind), you can arrange for the single central
DIR to have all those entries, by running `install-info' (once, by a
sysadmin) on every Info file you have installed and directing
`install-info' to put the entries it gleans on that single DIR file.

Eli Zaretskii

non lue,
9 nov. 1998, 03:00:0009/11/1998
à

On 8 Nov 1998 Kai.Gro...@CS.Uni-Dortmund.DE wrote:

> > INFO-DIR-SECTION Editors
> > START-INFO-DIR-ENTRY
> > * Elisp: (elisp). The Emacs Lisp Reference Manual.
> > END-INFO-DIR-ENTRY
>
> If our info files had this section, I'd be a happy camper. Sadly, I
> have little influence on our info files :-(

Most packages distributed lately do have this section.

But if they don't, you can use the --entry=TEXT option of
`install-info' to tell it explicitly what text to use as the entry for
this particular Info file.

Eli Zaretskii

non lue,
9 nov. 1998, 03:00:0009/11/1998
à

On 8 Nov 1998 Kai.Gro...@CS.Uni-Dortmund.DE wrote:

> > You still could run install-info in every directory which holds
> > the Info files and instruct it to put the entries in the single
> > DIR file you maintain in the single directory which you do put on
> > INFOPATH/Info-default-directory-list. Does that solve the
> > problem?
>
> Hm. That sounds nice. And it would find these nifty sections about
> the dir entry, if they are there, right?

Yes, it will. That is what `install-info' is all about.

Stefan Monnier

non lue,
9 nov. 1998, 03:00:0009/11/1998
à
>>>>> "Kai" == Kai Grossjohann <Kai.Gro...@CS.Uni-Dortmund.DE> writes:
> ,-----
> | emacs: (emacs).
> `-----
> But what about the right hand part?

I wouldn't worry too much: try to find the right-hand in the info file
and if it's not there, try to find it somewhere else (you decide of some way to
specify those things manually and externally) and if it still fails fall back
on a stupid and uninformative `Emacs'.


Stefan

Hugh Lawson

non lue,
9 nov. 1998, 03:00:0009/11/1998
à
Kai.Gro...@CS.Uni-Dortmund.DE wrote:

>
> >>>>> el...@is.elta.co.il (Eli Zaretskii) writes:
>
> > You still could run install-info in every directory which holds
> > the Info files and instruct it to put the entries in the single
> > DIR file you maintain in the single directory which you do put on
> > INFOPATH/Info-default-directory-list. Does that solve the
> > problem?
>
> Hm. That sounds nice. And it would find these nifty sections about
> the dir entry, if they are there, right? Hmm... Yes, thanks a lot.
> I think I've been pretty dense in the previous discussion.

Ok, I need some help here on getting the command right.

Here's the new info file: /usr/lib/xemacs-20.3/info/dir

Here's the present info dir file: /usr/info/dir

Now, is it possible to use install-info to get the xemacs entry
placed in the /usr/info/dir file? Please quote the exact command
to make this happen. I can't seem to get it right.

Or if I've misunderstood the whole issue, please tell me where I've
gone wrong.

The install-info info file doesn't give any examples. Thanks.

--
Hugh Lawson
Greensboro, North Carolina
hgla...@nr.infi.net

Eli Zaretskii

non lue,
9 nov. 1998, 03:00:0009/11/1998
à

On Mon, 9 Nov 1998, Hugh Lawson wrote:

> Here's the new info file: /usr/lib/xemacs-20.3/info/dir
>
> Here's the present info dir file: /usr/info/dir
>
> Now, is it possible to use install-info to get the xemacs entry
> placed in the /usr/info/dir file? Please quote the exact command
> to make this happen. I can't seem to get it right.

install-info --dir-file=/usr/info/dir \
--info-file=/usr/lib/xemacs-20.3/info/xemacs

Please note:

1) The --info-file option should mention the name of the Info
file, not the name of the DIR file. In the above I assume
that the name of the main Info file for XEmacs is xemacs.
If there are other Info files which come with XEmacs, like
ediff, reftex, cc-mode, etc., you will need to invoke
install-info on each and every one of them.

2) I'm told that XEmacs DIR-ENTRY format is different from the
usual GNU style. If so, it is possible that install-info
won't work with XEmacs (the next version of install-info will
recognize XEmacs entries as well). install-info has an option
--entry=TEXT) that allows you to tell exactly what entry will
be placed on the DIR file, which might come in handy in this
case.

Also, the canonical way to handle the cases of multiple Info trees is to
let the Info reader automatically concatenate all the DIR files it finds
along INFOPATH. Thus, in your example, all you need to do is to add
/usr/lib/xemacs-20.3/info to INFOPATH, and be done with it.

The reason I suggested to use install-info to lump all the entries on a
single centralized DIR is because Kai described an installation where the
sysadmins don't want to have a long INFOPATH because of limitations of the
shell they use.

I presume that such shells (and sysadmins who refuse to replace them ;-)
are rare, and such solution is not what most people would adopt.
Personally, I think lumping all DIR entries on a single DIR file creates a
terrible maintenance problem with multiple Info trees.

Hugh Lawson

non lue,
9 nov. 1998, 03:00:0009/11/1998
à
Eli Zaretskii wrote:

>
> Also, the canonical way to handle the cases of multiple Info trees is to
> let the Info reader automatically concatenate all the DIR files it finds
> along INFOPATH. Thus, in your example, all you need to do is to add
> /usr/lib/xemacs-20.3/info to INFOPATH, and be done with it.
>

Thanks. I think I'll just change the INFOPATH. That looks simpler
in my situation.

Thanks for the free instruction!

0 nouveau message