On Sun, May 28, 2000 at 05:53:34PM +0200, Christian Holm Christensen wrote:
> Hi all,
>
> It seems that there are a few problems with the environments on the
> pii<x>, so let me offer a possible solution:
>
> Here at NBI, we've set up a set of scripts that let people choose what
> version of the software they want to use. The idea is a follows:
>
You misunderstand:
I do not want choice.
I do not want multiple versions.
I do not want 100 setup scripts to run.
The STAR environment is close to what you suggest, and ask anybody,
their environment is extremely unproductive. Everything is always broken.
I do not wish us moving into the same direction.
Please keep things simple.
- 1 (one) production version of ROOT, with a fixed path (~brahmlib/root/pro).
- any number of experimental ROOT versions, but they should become
production versions as soon as possible. Ideally, our production
version should always be the current ROOT release.
K.O.
>
> Each user in the group has a "~/.hehirc" file, where they are free to
> choose the versions needed. If one want's to use another version, then
> all one has to do, is to edit this file. The "~/.hehirc" file can look
> like:
>
> #
> # Lines beginning with '#' are comments.
> #
> use-brat-new
> use-gbrahms
> use-cern-2000
>
> In addition, each user must have the line
>
> if ( -f /home/hehi/hehi/etc/hehi.cshrc ) then
> source /home/hehi/hehi/etc/hehi.cshrc
> endif
>
> in "~/.login" (in case of C-shells)
>
> if test -f /home/hehi/hehi/etc/hehi.shrc ) then
> source /home/hehi/hehi/etc/hehi.shrc
> fi
>
> in "~/.profile" (in case of Korn-shells).
>
> These configuration scripts does all the work needed. Basically, they
> parse the "~/.hehirc" for lines like "use-<feature>[-<version>]",
> using "grep" and "sed":
>
> setenv HEHI_TOP <out top directory for software>
>
> # re-configuartin file
> set rcfile=${HOME}/.hehirc
> # defined features
> set options=( brat root objy gbrahms na44 qt cern TeXLive msql mysql )
>
> # Loop over defined features
> foreach opt ($options)
> # Find the line macthing the current feature. Notice, some people
> # like to make "grep" an alias, so we escape it.
> set version=`\grep ^use-$opt $rcfile | sed -n "s/use-$opt-*\(.*\)/\1_/p"`
> if ($version != "") then
> # if the line matched contain a version number, we go on
> if ($version == "_") then
> # if the version is '_', inserted above, then we default to
> # "pro" version, which is asymbolic link to a specific version.
> set ${opt}Vers=pro
> else
> # otherwise we extract the version number form the matched line
> set ${opt}Vers=`echo $version| sed -n "s/\(.*\)_/\1/p"`
> endif
> endif
> # Remove temp variables
> unset opt
> unset version
> end
> # Remove temp variables
> unset options
> unset rcfile
>
> Having defined variables <opt>Vers=<version>, we can now do the checks
> for the proper directories, set the environment and so on:
>
> ### echo %%% Setup for BRAT
> if ( $?bratVers ) then
> # if variable "bratVers" is defined, then, we check to see if
> # wanted directory exist.
> if ( -d ${HEHI_TOP}/brat/${bratVers} ) then
> setenv BRATSYS ${HEHI_TOP}/brat/${bratVers}
> setenv BRATHOME ${BRATSYS}
> setenv LD_LIBRARY_PATH ${BRATSYS}/lib/${BRAHMS_ARCH}:${LD_LIBRARY_PATH}
> setenv PATH ${BRATSYS}/bin/${BRAHMS_ARCH}:${PATH}
> # If "use-root[-<x>]" wasn't found, enable the default ROOT
> # version, since BRAT needs it.
> if (! $?rootVers) set rootVers=pro
> else
> echo "Requested BRAT version doesn't exist"
> endif
> # remove temp variable.
> unset bratVers
> endif
> ### echo %%% Setup for ROOT
> if ($?rootVers) then
> if ( -d ${HEHI_TOP}/root/${rootVers} ) then
> setenv ROOTSYS ${HEHI_TOP}/root/${rootVers}
> setenv LD_LIBRARY_PATH ${ROOTSYS}/lib:${LD_LIBRARY_PATH}
> setenv PATH ${ROOTSYS}/bin:${PATH}
> endif
> else
> echo "Requested ROOT version doesn't exist"
> unset rootVers
> endif
> ### echo %%% Setup for CERNLIB
> if ($?cernVers) then
> # system may define CERN and CERN_LEVEL, so check those first.
> if (! $?CERN) setenv CERN /cern
> if (! $?CERN_LEVEL) setenv CERN_LEVEL $cernVers
> if (! $?CERN_ROOT) setenv CERN_ROOT ${CERN}/${CERN_LEVEL}
> # if the CERNLIB bin directory already is in the PATH, we shouldn't
> # add it again.
> if ( ! `echo $PATH | sed -n "s|.*cern.*|1|p"` ) \
> setenv PATH ${CERN_ROOT}/bin:${PATH}
> unset cernVers
> endif
>
> And a simil;ar script should exist for Korn-shells.
>
> On the pii<x>, we are fortunate to be the only users, so this kind of
> script could be put directly into /etc/csh.cshrc and /etc/profile, if
> so wanted.
>
> Now, $HEHITOP has a directory layout somewhat like:
>
> $HEHITOP-+-brat-+-1.5.4
> | +-1.5.5
> | +-1.5.pre6
> | +-1.6
> | +-1.6.1
> | +-pro => 1.5.pre6 (1.5.5 is buggy)
> | +-new => 1.6.1
> | +-old => 1.5.4
> +-root-+-2.23.11
> | +-2.23.12
> | +-2.24.02
> | +-2.24.04
> | +-pro => 2.23.12 (This is what ROOT calls pro)
> | +-new => 2.24.04
> | +-old => 2.23.11
> ...
>
> Now a user having a "~/.hehirc" file with the lines:
>
> use-root-2.24.02
> use-brat-new
>
> while have a (parial) environemnt like
>
> ROOTSYS $HEHI_TOP/root/2.24.02
> BRATSYS $HEHI_TOP/brat/1.6.1
> BRATHOME $HEHI_TOP/brat/1.6.1
> PATH $ROOTSYS/bin;$BRATSYS/bin;...
> LD_LIBRARY_PATH $ROOTSYS/lib;$BRATSYS/lib/$BRAHMS_ARCH;...
>
> I think this scheme works rather good. At least we're pretty sure what
> version of BRAT/ROOT we're using, and everything is coherent. Also,
> the user is completly free to everride any environment settings they
> may see fit; however, then they can not expect the same level of
> support as if they had used the "~/.hehirc" mechanism.
>
> I hope this will be useful,
>
> Christian -----------------------------------------------------------
> Holm Christensen Phone: (+45) 35 35 96 91
> Sankt Hansgade 23, 1. th. Office: (+45) 353 25 305
> DK-2200 Copenhagen N Web: www.nbi.dk/~cholm
> Denmark Email: cholm@nbi.dk
--
Konstantin Olchanski
Physics Department, Brookhaven National Laboratory, Long Island, New York
olchansk@bnl.gov
This archive was generated by hypermail 2b29 : Sun May 28 2000 - 12:50:48 EDT