Re: R-beta: updating the library index / overriding compile options

Douglas Bates (bates@stat.wisc.edu)
19 Jan 1998 09:19:49 -0600


To: Albrecht Gebhardt <agebhard@zidsrv.sci.uni-klu.ac.at>
Subject: Re: R-beta: updating the library index / overriding compile options
From: Douglas Bates <bates@stat.wisc.edu>
Date: 19 Jan 1998 09:19:49 -0600
In-Reply-To: Albrecht Gebhardt's message of Mon, 19 Jan 1998 14:37:35 +0100 (MET)

Albrecht Gebhardt <agebhard@zidsrv.sci.uni-klu.ac.at> writes:

> Would it be possible to include a new command in the ${RHOME}/etc path, which
> updates the Library index (Rd and html) via  "R LIBINDEX".
> 
> I need it because I use RPM to manage three different R installations (at home,
> at the institute and in the seminar rooms). I put all libraries into several
> packages, so it is easy for me to update a single library at all these
> different places. 
> 
> But after installation or removal of a library via rpm the help indices have to
> be updated.  A call like "R INSTALL +help" in the post/pre install/uninstall
> script calls also "make" in the library source trees, which is unnecessary (and
> may even fail, e.g. because of a missing Fortran compiler). 
> 
> The following script does exactly what I want (I don't know if it will work
> for library directories other then $RHOME/library):
> ##############################################################################
> #! /bin/sh
> 
> # ${RHOME}/etc/LIBINDEX for updating the library index
> # Usage:
> #       R LIBINDEX [lib]
> #                
> 
> 
> 
> lib=${1:-${RHOME}/library}
> test -d ${lib} || exit 1;
> lib=`cd ${lib}; pwd`
> 
> rm -f ${lib}/LibIndex 
> 
> echo updating LibIndex ...
> for pkg in `ls -d ${lib}/*`; do
>     if test -d ${pkg}; then
>         if test -f ${pkg}/TITLE; then
> #          echo " adding entry for library" ${pkg##*/}
>            cat ${pkg}/TITLE >> ${lib}/LibIndex 2> /dev/null
>         fi
>     fi
> done
> 
> echo updating HTML index ...
> 
> ${RHOME}/etc/build-htmlpkglist
> 
> echo "DONE"
> ##############################################################################

I'm not sure if the facility is available in RPM but the Debian
packages for R include "post-install", "pre-remove", and "post-remove"
scripts (thanks to Kurt Hornig).  They are similar to your script
above

 #!/bin/sh
 #
 # postinst script for the Debian GNU/Linux r-cran package
 # This version written by Douglas Bates <bates@stat.wisc.edu>

 set -e

 case "$1" in
     configure)     
       (cd /usr/lib/R/library; cat */TITLE > LibIndex; ../etc/build-htmlpkglist)
	 #
	;;
     abort-upgrade|abort-remove|abort-deconfigure)
	 ;;
     *)
	 echo "postinst called with unknown argument \`$1'" >&2
	 ;;
 esac

If, as you suggest, a LIBINDEX script was created, these could be
shortened.  Can you incorporate this type of code into your RPM packages?

-- 
Douglas Bates                            bates@stat.wisc.edu
Statistics Department                    608/262-2598
University of Wisconsin - Madison        http://www.stat.wisc.edu/~bates/
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._