Do not allow activities to be created on the integration stream

Anyone who has an integration view attached to the integration stream can create activities on that stream, but the UCM process calls for developers to create activities in their development streams. You may want to implement a policy that prevents developers from creating activities on the integration stream inadvertently. This section shows a Perl script that enforces that policy.

You can also share scripts; see Sharing triggers among different types of platform.

The following mktrtype command creates a preoperation trigger type called block_integration_mkact.

cleartool mktrtype -ucmobject -all -preop mkactivity -execwin "ccperl ^
\\pluto\disk1\triggers\block_integ_mkact.pl" -execunix "Perl ^
/net/jupiter/triggers/block_integ_mkact.pl"
block_integration_mkact@\my_pvob 

The trigger type fires when a developer attempts to make an activity.

The following preoperation trigger script runs when the block_integration_mkact trigger fires.

# Get the integration stream name for this project
my $istream = `cleartool lsproject -fmt "%[istream]p"
$ENV{"CLEARCASE_PROJECT"}`;

# Get the current stream and strip off VOB tag
$_ = $ENV{"CLEARCASE_STREAM"};
s/\@.*//;
my $curstream = $_;
# If it's the same as our stream, then it is the integration stream
if   ($istream eq $curstream) {
   # Only allow this mkact if it is a result of a deliver
   # Determine this by checking the parent op kind
   if ($ENV{"CLEARCASE_POP_KIND"} ne "deliver_start") {
      print "Activity creation is only permitted in integration 
streams for
      delivery.\n";
      exit 1
   }
}

exit 0 

The script uses the cleartool lsproject command and the CLEARCASE_PROJECT environment variable to determine the name of the project's integration stream. An integration activity is created to keep track of changes that occur during a deliver operation. The script uses the CLEARCASE_POP_KIND environment variable to determine whether the activity being created is an integration activity. If the mkactivity operation is the result of a deliver operation, the value of CLEARCASE_POP_KIND, which identifies the parent operation, is deliver_start.

If the value of CLEARCASE_POP_KIND is not deliver_start, the activity is not an integration activity, and the script disallows the mkactivity operation.