Using cleartool, when you cleartool setview, a subshell is opened apparently (you can exit it and leave the view). I was wondering - how can I get more commands to be executed, or settings made, when this subshell starts? Of course, I don't mean code which executes when any shell starts, just when cleartool starts one.
How can I add commands to be executed when setting a view?
378 Views Asked by einpoklum AtThere are 2 best solutions below
On
According to the man page for setview, it takes an -exec parameter.
That can be used to run a script if you wish. As @Vonc mentioned, setview is a chroot environment, and the root of a view (/view/myview) will show the / filesystem to transparently support the chroot.
If you're scripting things on Unix, and want to follow VonC's advice about not using setview, you would need to set/detect a view in the script. "cleartool pwv -wdview" will tell you the view context of the current working directory. (See https://www.ibm.com/support/knowledgecenter/SSSH27_9.0.1/com.ibm.rational.clearcase.cc_ref.doc/topics/ct_pwv.htm)
From personal experience, it's usually not a good idea to reach between views during audited builds, if that is what your script does. But some people use a common view for trigger scripts under source control...
A
cleartool setviewdoes not source anything (any shrc/bashrc) when spawning its subshell.I have always advised against setview, precisely to avoid the subshell issue.
It would be easier to get a script which would:
/view/AViewName/vobs/aVob/...instead of relying on the/vobssetview chroot trick.Or, use the
-execoption ofsetviewto source settings and execute a script.