" /> Status for Andrew DeFaria: December 2, 2007 - December 8, 2007 Archives

« November 18, 2007 - November 24, 2007 | Main | January 20, 2008 - January 26, 2008 »

December 6, 2007

  • Documented how to properly source cq_setup

cq_setup

In order for Clearquest to work properly the user must source cq_setup. Rational provides both cq_setup.csh for C style shells and cq_setup.sh for Borne style shells. GD only primarly supports tcsh/csh shells and provides a start up environment for those shells. However, Linux systems then to use bash by default.

bashrc

An effort has been made to tranliterate the GD/RAN tcsh/csh startup environment -> a bash startup environment (this can be found under /prj/muosran/config/bashrc). Further complicating matters is that SWIT and Pat Phelps group have their own, highly customized environment.

Proposed change to ~/.bash_profile

if [ -f /opt/rational/clearquest/bin/clearquest ]; then
  . /prj/muosran/config/cq_setup.sh
  fi

The above should be added to the ~/.bash_profile which (from the bash(1) manpage):

When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable. The --noprofile option may be used when the shell is started to inhibit this behavior.

Since we are only really concerned with executing cq_setup for the purposes or running clearquest, the GUI client, we should only be concerned with interactive login shells.

For the record, also from the bash(1) manpage:

When an interactive shell that is not a login shell is started, bash reads and executes commands from ~/.bashrc, if that file exists. This may be inhibited by using the --norc option. The --rcfile file option will force bash to read and execute commands from file instead of ~/.bashrc.

The /prj/muosran/config versions

As I said Rational supports it's own versions of cq_setup.[csh|sh] stored in /opt/rational/clearquest. Why the private copies under /prj/muosran/config you ask? The main (i.e. only real) difference is that the Rational copies annoyingly echo out "You can now run 'clearquest' to start Rational ClearQuest'.

Platform independence

In order to maintain platform independance the cq_setup.[csh|sh] script resides in /opt/rational/clearquest/bin/clearquest. The Rational installation procedure symlinks this to /opt/rational/clearquest/<arch>/bin/clearquest where <arch> is one of sun5, rhat_x86 or later changed to linux_x86.

What does cq_setup really do?

So what does this cq_setup really do? Glad you asked. Essentially it runs a shell script called clearquest. This shell script does many things related to setting up the proper environment for Clearquest execution then exec's clearquest_main. In fact, many scripts under /opt/rational/clearquest/<arch>/bin are merely symlinks to this clearquest script. Based on the name of the script invoked (i.e. $0) the script will do different things but all essentially set up the environment and exec clearcase_main.

Dumping environment variable settings

It also supports parameters. In particular it supports the special -dumpsh and -dumpcsh parameters. When called with these parameters it essentially dumps out the required shell syntax (sh or csh) for setting environment variables. Here's an example run:

# /opt/rational/clearquest/bin/clearquest -dumpsh
PATH='/opt/rational/clearquest//bin:/home/p6258c/bin/sun:.:/home/p6258c/bin:/home/p6258c/adm/bin:/home/p6258c/adm/cc:/home/p6258c/adm/cq:/home/p6258c/adm/cvsbin:/usr/local/bin:/usr/local/oracle/product/9.2/bin:/prj/muosran/bin:/prj/software/framemaker/bin:/prj/Studio11/SUNWspro/bin:/opt/rational/clearquest/bin:/prj/muosran/bin:/opt/rational/clearcase/bin:/opt/rational/clearcase/etc:/prj/Imagix4D/bin:/usr/local/python-1.5.2/bin:/prj/MathWorksR14sp3/bin:/usr/local/swig/bin:/prj/synplify81/fpga_81/bin:/usr/local/slickedit11/bin:/usr/local/python-1.5.2/bin:/cleartrig/ent/SNSD/muos/ccadm_tools/vobs/ranccadm/scripts/clearcase:/cleartrig/ent/SNSD/muos/ccadm_tools/vobs/ranccadm/scripts/clearquest:/home/p6258c/adm/bin:/bin:/usr/local/bin:/usr/bin:/usr/dt/bin:/usr/openwin/bin:/usr/sbin:/usr/ccs/bin:/usr/ucb';
export PATH; CQ_HOME='/opt/rational/clearquest/'; export CQ_HOME; CQ_ARCH='sun5'; export CQ_ARCH; ODBCINI='/opt/rational/clearquest//sun5/resources/cqodbc.ini'; export ODBCINI; LM_LICENSE_FILE='flex2:flex2:1850@flex2:15280@ranadm2:19353@ranadm2:19355@ranadm2:2468@ranadm2:1717@flex2:1711@bartlett:1711@flex3:27000@ranadm2:28000@ranadm2:5270@flex2';
export LM_LICENSE_FILE; RSU_TEMPLATE2_INI='/opt/rational/clearquest//sun5/resources/templates2.ini';
export RSU_TEMPLATE2_INI; MANPATH='/opt/rational/clearquest//doc/En_US/man:/usr/man:/usr/share/man:/usr/dt/man:/usr/openwin/share/man:/usr/local/man:/usr/local/share/man';
export MANPATH; CQ_HELP_BROWSER='netscape'; export CQ_HELP_BROWSER; CQ_PERLLIB='/opt/rational/clearquest//../common/lib/perl5/5.6.1/sun4-solaris-multi:/opt/rational/clearquest//../common/lib/perl5/5.6.1:/opt/rational/clearquest//../common/lib/perl5/site_perl/5.6.1/sun4-solaris-multi:/opt/rational/clearquest//../common/lib/perl5/site_perl/5.6.1:/opt/rational/clearquest//../common/lib/perl5/site_perl';
export CQ_PERLLIB; LD_LIBRARY_PATH='/usr/lib:/usr/ucblib:/usr/local/lib:/usr/local/oracle/product/9.2/lib:/usr/local/python-1.5.2/lib:/opt/rational/clearcase/shlib:/opt/rational/clearquest//sun5/shlib:/opt/rational/clearquest//sun5/odbc/lib';
export LD_LIBRARY_PATH; EVAL_STATUS=0;
export EVAL_STATUS;

Eval

As such this execution is meant to passed to eval(1) so that these environment variable setting statement are evaluated and the environment is modified. Finally one should source (csh or "." in sh) this to effect the current shell. Hence we boil all this down to:

if [ -f /opt/rational/clearquest/bin/clearquest ]; then
  . /prj/muosran/config/cq_setup.sh
fi