You can define triggers that fire correctly on both UNIX and Windows computers. The following sections describe two techniques. With one, you use different pathnames or different scripts; with the other, you use the same script for both platforms.
To define a trigger that fires on UNIX, Windows, or both, and that uses different pathnames to point to the trigger scripts, use the -execunix and -execwin options with the mktrtype command. These options behave the same as -exec when fired on the appropriate platform (UNIX or Windows, respectively). On the other platform, they do nothing. This technique allows a single trigger type to use different paths for the same script or to use completely different scripts on UNIX and Windows computers. For example:
cleartool mktrtype -element -all -nc -preop checkin ^
-execunix /public/scripts/precheckin.sh -execwin \\neon\scripts\precheckin.bat ^
pre_ci_trig
On UNIX, only the script precheckin.sh runs. On Windows, only precheckin.bat runs.
To prevent users on a new platform from bypassing the trigger process, triggers that specify only -execunix always fail on Windows. Likewise, triggers that specify only -execwin fail on UNIX.
To use the same trigger script on both Windows and UNIX platforms, you must use a batch command interpreter that runs on both operating systems. For this purpose, ClearCase includes the ccperl program. On Windows, ccperl is a version of the Perl program available on UNIX.
The following mktrtype command creates sample trigger type pre_ci_trig and names precheckin.pl as the executable trigger script.
cleartool mktrtype -element -all -nc -preop checkin ^
-execunix "Perl /public/scripts/precheckin.pl" ^
-execwin "ccperl \\neon\scripts\precheckin.pl" ^
pre_ci_trig
To conditionalize script execution based on operating system, use environment variables in Perl scripts.
To collect or display information interactively, you can use the clearprompt command.
For more information on using the -execunix and -execwin options, see the mktrtype reference page.
Feedback on the documentation in this site? We welcome any comments!
Copyright © 2001 by Rational Software Corporation. All rights reserved. |