[cciug] RE: Trigger is not working when using the GUI

From: Prakash Dhavali (PrakashD@ambernetworks.com)
Date: Mon Jan 10 2000 - 13:12:43 EST


Chandra,

Inside GUI (both NT explorer and CC details), the current directory
context is different as compared to clearcase environment on
command line. Every path reference has to be with reference to
your MVFS drive letter (M:).

By the way, I had sent an e-mail on this topic to the cciug group with
subject "TIPs for writing triggers on NT". I am enclosing that e-mail
again. I hope it will be of help to you.

-Prakash
 <<TIPS for writing triggers on NT>>
> -----Original Message-----
> From: Chandra Ramesh [mailto:Ramesh.Chandra@sisl.co.in
> Sent: Monday, January 10, 2000 12:23 AM
> To: Clearcase User's Group
> Cc: Chandra Ramesh
> Subject: Trigger is not working when using the GUI
>
>
>
> Hello,
>
> We have CC3.1.1 on NT4.0, SP4.0
>
> I have written a trigger which moves a label from the
> Previous version to the new checked-in version.
>
> This trigger is working fine if the files are
> Checked-in from the command prompt. If the
> Files are checked-in using the GUI, this trigger
> Is not applying the label at all !!
>
> Any idea as to why this is happening like this? What is
> The solution such that this trigger applies the label even if the
> Files are checked-in using the GUI?
>
> Thanks and With Best Regards,
> Ramesh Chandra


attached mail follows:



Finally I got my trigger to work in commandline,NT explorer and
Clearcase Details.

I would like to share my experiences with differences in the
trigger context between command line and NT explorer. I hope that
these tips help users in debugging and analysing the NT triggers.

1. When you install the NT trigger, you need NOT include the
   full path to the interpreter or the command shell (like
   perl,cmd.exe,sh.exe) you are using to run your trigger.
   e.g if your trigger is located at \\server\share\trg\script.perl
   then you can install the trigger with
   -execwin "perl \\server\share\trg\script.perl"

2. Note the difference in the values of CLEARCASE_PN trigger env
   variable.

   While using clearcase from command line:
   CLEARCASE_PN = <vob_tag>/<path_to_current_element>

   While using clearcase commands through NT explorer or Clarcase
   Details:
   CLEARCASE_PN = M:/<current_view_tag>/<vob_tag>/<path_to_current_element>
   [Where M: is MVFS drive in our setup]

   CLEARCASE_VOB_PN = <vob_tag> [Notice there is no prefix of M:/<view>]

3. Current directory context in NT explorer is the your Desktop it self,
   i.e it may be C:\WINNT\Profiles\<username>\Desktop and NOT your view
   drive. So if you refer to <vob_tag> or any path while inside your
   trigger code, by default it is mapped to C:\<vob_tag> which does not
   exist.

4. Qualify all your references to directory and path references inside
   your trigger code with "M:/<current_view_tag>", i.e you can run all
   the clearcase commands while being on C:\ BY prefixing
M:\<current_view_tag>
   to all your paths. This works just fine on command line as well as
   NT explorer and Clearcase Details.

5. If you have non-interactive output to STDOUT, this will NOT create
   any problems while the trigger code gets executed.

6. Finally I used a debug routine to display all the debug messages
   using clearprompt. I am using perl-code as an example here.

#--------------------------------------------------------------------
if ( $ENV{"CC_TRG_DBG"} ) { $dbg = "1"; } else { $dbg = "0"; }

#
# Dbg ( )
#
sub Dbg
{
    if ($dbg > 0)
    {
       ($package, $this_fn, $line) = caller;
       $msg = shift(@_); print "<DBG>($line): $msg\n";
       system("clearprompt yes_no -prompt \"<DBG>($line): $msg\"");
    }
}

and inside your trigger code you can use

&Dbg("<some_message_to_display_your_variables_or_debug_output>");
#--------------------------------------------------------------------

to show debug output.

7. And finally use an 'Exit()' function instead of just calling exit(0)
   or exit(1).
#--------------------------------------------------------------------
# Exit ( )
#
sub Exit
{
    my ($ec) = shift;

    &Dbg("Exiting trigger with $ec");
    exit($ec);
}
#--------------------------------------------------------------------

and use ONLY &Exit(${SUCCESS}) or &Exit(${FAILURE}) inside your trigger
code. This helps me identifying the exit code of your trigger script
while debugging.

Hope this helps.
Prakash Dhavali
Amber Networks Inc

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



This archive was generated by hypermail 2b29 : Sun May 06 2001 - 00:22:22 EDT