Clearcase trigger Guide (4)-What can a trigger do?

Source: Internet
Author: User

Disclaimer: This article welcomes reprinting for non-commercial purposes. If some websites charge users, the reprinting will not be declined. If the reprinting is required, please mark the reprinting. The original author and source should not be like some of my previous articles, some people directly use their own publications to make money.

What can trigger do?

All users who are new to clearcase generally think that trigger is executing a program, but this is not the case. Here we provide an example. Trigger can also execute some clearcase operations, such as mklabel, mkattr and so on:

Cleartool mktrtype-element-postop checkin-mklabel release $ rel_num/-c "check in make label" checkin_mklabel

This trigger is used to add a label when a new version of the element is generated after the checkin operation. Note that the value of rel_num must be included in the environment change. If the value of rel_num is 11, the label type: release11 is defined in vob; otherwise, the label is not added.

One set of cleartool mktrtype parameters defines the trigger action:

1. -ExecCommandRun the specified command. If the command contains parameters, enclose the entire command in single quotes. The commands defined here are valid on all operating system platforms, to avoid trigger failure due to incompatibility of the operating system, we recommend that you use only the commands provided by clearcase and the subcommands of cleartool In the commands defined by-exec command, do not use Unix or Windows commands, such as LS and Dir. If you want to write some application scripts on your own, ensure that they can be executed on both Windows and UNIX platforms.

2. -ExecunixCommandThe commands defined here can only be valid in Unix systems. Apart from the clearcase commands and sub-commands, we recommend using shell scripts or Perl scripts.

3. -ExecwinCommandThe operations defined by the application execwin are only valid in windows. In addition to the clearcase commands and sub-commands, we recommend that you use Perl scripts or vB scripts. Please note that, if Windows built-in commands such as Dir and Cd are used in commands or scripts, run CMD/C as follows:

Cleartool mktrtype-element-postop checkin-execwin "CMD/C copy % clearcase_pn % // bakckup/."-NC

4. -MklabelLabelLabel the current element or type, but the label must be defined. Therefore, we recommend that you predefine some labels before.

5. -MkattrAttributeAssociate the current element, stream, or component with the corresponding attribute and assign a value.

6. MkhlinkHLINKExecute the mkhlink operation on the element corresponding to the trigger operation. You can apply the to or from option to select the link direction.

When discussing the advantages and disadvantages of a trigger in section 2, we mentioned that multiple triggers can be defined for the same element, ucmobject, or type operation. Generally, you can take a look at the attributes of this element, trigger is executed in the order of attributes in windows, but the execution sequence cannot be ensured in the clearcase document. Therefore, try to avoid associating multiple triggers on the same type of operations of an element. We recommend that you add all the triggers to a single trigger.

The preceding six operations are not mutually exclusive. However, you must note that mklabel, mkattr, and mkhlink only support trigger triggers, that is, only the-postop trigger can perform these operations.

Finally, there is a tip: When only-execunix or-execwin is defined, if the current operating system is not UNIX or windows, trigger fails by default, therefore, you can set a trigger that only executes Unix or Windows commands for checkin and checkout operations to restrict developers' development platforms. This prevents compilation errors on different development platforms.

After the trigger type is created, you generally need to execute cleartool mktrigger for association.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.