wishlist: Please add update-info-dir to distribution (from Debian)

View: New views
6 Messages — Rating Filter:   Alert me  

wishlist: Please add update-info-dir to distribution (from Debian)

by Jari Aalto-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I'd like to propose that the update-info-dir(8) program would be
accepted to the the official texinfo package. I'm attaching the latest
version[1] and its manual page below.

Thanks,
Jari

[1] Debian wishlist: patch to improve update-info-dir prograam
http://bugs.debian.org/541468


#!/bin/bash
# update-info-dir
# create a dir file from all installed info files
# Copyright 2009 Norbert Preining
# GPLv2

INFODIR=/usr/share/info

set -e

Help ()
{
    echo "\
SYNOPSIS: update-info-dir [-h,--help] [info-directory]

(re-)creates the index of available documentation in info format
(the file /usr/share/info/dir) which is usually presented by info browsers
on startup."

    exit 0
}


if [ "$1" = "-h" ] || [ "$1" == "--help" ]; then
    Help
fi

if [ -n "$1" ] ; then
  INFODIR="$1"
fi

if [ ! -d "$INFODIR" ] ; then
  echo "Not a directory: $INFODIR." >&2
  exit 1
fi

if [ -r "$INFODIR/dir" ] ; then
  rm -f "$INFODIR/dir.old"
  cp $INFODIR/dir $INFODIR/dir.old
fi

# we have to remove the dir file not make ginstall-info being surprised
rm -f "$INFODIR/dir"

errors=0
find "$INFODIR" -type f | while read file ; do
  case $file in
    */dir|*/dir.gz|*/dir.old|*/dir.old.gz|*-[0-9]|*-[0-9].gz|*-[1-9][0-9]|*-[1-9][0-9].gz|*.png)
      # these files are ignored
      continue
      ;;
    *)
      ginstall-info "$file" "$INFODIR/dir" || {
        errors=$[errors+1]
      }
      ;;
  esac
done

if [ $errors -gt 0 ] ; then
  exec >&2
  echo
  echo "Updating the index of info documentation produced $errors errors."
fi

exit 0

# vim:set expandtab tabstop=2: #

.TH UPDATE-INFO-DIR 8
.\" NAME should be all caps, SECTION should be 1-8, maybe w/ subsection
.\" other parms are allowed: see man(7), man(1)
.SH NAME
update-info-dir \- update or create index file
from all installed info files in directory
.SH SYNOPSIS
.B update-info-dir
.I "[options]"
.B [directory]
.br
.SH DESCRIPTION
Update, or create, the index file
.I dir
of available documentation in
/usr/share/info/ (the default) or in given DIRECTORY. The
index file
.I info
is the directory is usually presented by info browsers on startup.
.SH OPTIONS
.TP
.B \-h,--help
Display help and exit.
.PP
.SH SEE ALSO
emacs(1)
info(1)
install-info(1)
.SH AUTHOR
This manual page was written by Norbert Preining <preining@...>,
for the Debian GNU/Linux system (but may be used by others).

This manual page was written for the Debian GNU/Linux distribution
because the original script was designed for Debian packaging system.

Re: wishlist: Please add update-info-dir to distribution (from Debian)

by Karl Berry :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

    I'd like to propose that the update-info-dir(8) program would be
    accepted to the the official texinfo package.

Sorry, I don't want to do so.  I don't want to write the documentation,
I don't want lots of users to run it willy-nilly thinking something
perfect will happen, etc.  Plus the script is hardly in the usual GNU
style or using the best constructs, as Norbert himself would be the
first to admit.  Finally, we'd want to have copyright assigned.

As long as it's just in the source distribution, it won't do any harm
and it may help some people, so that's where I want to keep it unless
and until it becomes a lot more robust.

    the latest version[1] and its manual page below.

Thanks, I'll update the copy in texinfo.



Re: wishlist: Please add update-info-dir to distribution (from Debian)

by Norbert Preining :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Karl,

On Fr, 14 Aug 2009, Karl Berry wrote:
>     I'd like to propose that the update-info-dir(8) program would be
>     accepted to the the official texinfo package.
>
> Sorry, I don't want to do so.  I don't want to write the documentation,
> I don't want lots of users to run it willy-nilly thinking something
> perfect will happen, etc.  Plus the script is hardly in the usual GNU
> style or using the best constructs, as Norbert himself would be the
> first to admit.  Finally, we'd want to have copyright assigned.

Documentation we have in man page, the copyright I think I have
assigned already to FSF AFAIR, for some contributions to makeinfo which
probably extends to that script.

But I agree that it is not perfect style ... I asked several times
for improvements but never got any good suggestions ;-) You know that
my sh code is far from perfect ;-)
 
>     the latest version[1] and its manual page below.
>
> Thanks, I'll update the copy in texinfo.

But it isn't part of texinfo, so do you add it or not?

Best wishes

Norbert

-------------------------------------------------------------------------------
Dr. Norbert Preining <preining@...>        Vienna University of Technology
Debian Developer <preining@...>                         Debian TeX Group
gpg DSA: 0x09C5B094      fp: 14DF 2E6C 0307 BE6D AD76  A9C0 D2BF 4AA3 09C5 B094
-------------------------------------------------------------------------------
NETHER POPPLETON (n. obs.)
A pair of P.J.Proby's trousers.
                        --- Douglas Adams, The Meaning of Liff



Re: wishlist: Please add update-info-dir to distribution (from Debian)

by Karl Berry :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

    But it isn't part of texinfo, so do you add it or not?

Oh, I was thinking it was one of the ones that is already in the util/
dir, but it isn't.  There is only fix-info-dir and gen-dir-node.  I will
add yours too :).

But I'm not going to install it.  Sorry.



Re: wishlist: Please add update-info-dir to distribution (from Debian)

by Jari Aalto-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

karl@... (Karl Berry) writes:

>     I'd like to propose that the update-info-dir(8) program would be
>     accepted to the the official texinfo package.
>
> Plus the script is hardly in the usual GNU
> style or using the best constructs, as Norbert himself would be the
> first to admit. '

Could you point me to the page that explains GNU conventions/guidelines
for shell scripts.

Thanks,
Jari



Re: wishlist: Please add update-info-dir to distribution (from Debian)

by Karl Berry :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

    Could you point me to the page that explains GNU conventions/guidelines
    for shell scripts.

Portable Shell node in the Autoconf manual.

But even if the script was completely cleaned up, there's still the
other problems.  Norbert was correct that he's already assigned changes
for the Texinfo package, so that part is fine, but 1) the man page
documentation is inadequate IMNSHO, and 2) I remain greatly worried
about maintaining such a thing in perpetuity, making it work with all
distros, etc.  The game does not seem worth the candle.  I think it
should just stay uninstalled.