Setting Up a Work Environment


Usually when you set up a work environment, you establish a separate view for each development project to which you contribute. Setting up a view involves the following tasks:

If your project uses the base ClearCase-ClearQuest integration, you access one RationalClearQuest user database. Accessing a ClearQuest user database involves the following tasks:

Choosing a Snapshot View or a Dynamic View

Decide whether you want to work in a snapshot view or a dynamic view. As described in ClearCase Views, snapshot views load elements onto your computer; dynamic views use the MVFS to arrange VOB data into a directory tree. (Dynamic views may not be available on all platforms. For more information, see Help. To access Help, see To Access Online Information.)

Work in a snapshot view when any of these conditions is true:

Work in a dynamic view when any of these conditions is true:

For more information, see the Administrator’s Guide for Rational ClearCase.

Choosing a Location and Name

Before creating the view, you must choose its location. For a dynamic view, you must also choose a name. This section describes the following tasks:

Snapshot View: Choosing a Directory

When creating a snapshot view, you must specify a directory into which ClearCase loads (copies) files and directories. When choosing a directory for the view, consider these constraints:

Under the Hood: A Snapshot View Storage Directory

Every snapshot view has a view storage directory in addition to the directory tree of source files that it loads from VOBs. ClearCase uses the snapshot view storage directory to keep track of such information as which files are loaded into your view and which versions are checked out to it. The view storage directory is for ClearCase administrative purposes only. Do not modify anything in it.

For every 1,000 elements loaded into the view, ClearCase uses about 400 KB of disk space for the view storage directory.

Locations for Snapshot View Storage Directories

Usually, your ClearCase administrator sets up a storage location, which is a directory on a ClearCase server host on UNIX or Windows. By default, ClearCase locates snapshot view storage directories there. If your ClearCase administrator sets up more than one storage location, ClearCase selects any one of these locations as the default when you create a view.

If your ClearCase administrator does not set up storage locations, by default, ClearCase software locates the view storage directory under the root directory of the snapshot view.

You can override these defaults. If your administrator sets up multiple storage locations, you can select one explicitly. You can place the view storage directory under the root directory of the snapshot view.

If you place the view storage directory under the root directory of the view, be aware of the following recommendations:

Choosing a View Name

Each view must have a descriptive name (called a view tag) that is unique within a network region. Choose a view name that helps you determine the owner and purpose of the view. Names like myview or work do not describe the owner or contents of the view; if you work with more than one view, such generic names can lead to confusion. Here are some suggested names:

pat_v1.4_cropcircle
Personal view for a user named Pat to develop source files for release 1.4 of the Cropcircle product
1.3_fix
Shared view for use in a particular bug-fixing task

The name of a view must be a simple name; that is, it must follow the format of a single file or directory name with no special characters or spaces.

Using the View Tag

The way you use the view tag is different for each type of view:

Dynamic View: Choosing a Location for the View Storage Directory

When creating a dynamic view, you must choose a location for its view storage directory. ClearCase uses this directory to keep track of which versions are checked out to your view and to store view-private objects. The view storage directory is for ClearCase administrative purposes only. Do not modify anything in it.

The size of the view storage directory depends on the following factors:

For more information, see the Administrator’s Guide for Rational ClearCase and the clearmake reference page in the Command Reference.

Choosing Locations for Dynamic View Storage Directories

Consider the following restrictions when choosing a dynamic view storage directory location:

We recommend that you make the view storage directory accessible to any data backup schemes your organization institutes.

Adjusting Your umask

Your umask(1) setting at the time you create a view affects how accessible your view is to others. For example:

Change your umask in the standard way. For example, enter this command from a shell:

umask 022

For more information, see a umask(1) reference page.

The CCASE_BLD_UMASK Environment Variable

You can also use the CCASE_BLD_UMASK environment variable to set the umask(1) value for files created from a clearmake build script. It may be advisable to have this EV be more permissive than your standard umask—for example, CCASE_BLD_UMASK = 2, where umask is 22.

For more information about environment variables for ClearCase, see the env_ccase reference page in the Command Reference.

Creating the View with cleartool mkview

After gathering information on names and locations, open a shell and enter the cleartool mkview command as described in the following sections.

To Create a Snapshot View

Enter the following command:

cleartool mkview –snapshot   path-for-view

Remember the path that you enter; ClearCase creates your directory tree of source files at this path.

For a complete list of mkview options, see the mkview reference page in the Command Reference.

For example, to create the pat_v1.4_cropcircle_sv view located under Pat’s home directory, enter the following command:

cleartool mkview –snapshot ~/pat_v1.4_cropcircle_sv
Selected Server Storage Location "cropcircles_view_storage”.
Created view.
Host-local path: 
BREAD:/storage/cropcircles_view_storage/pat_v1.4_cropcircle_sv.vws
Created snapshot view directory "~/pat_v1.4_cropcircle_sv".

Under the Hood: .ccase_svreg

When you create a snapshot view, ClearCase creates or modifies the file .ccase_svreg in your home directory. Do not remove or relocate this file; some ClearCase operations require it.

If you inadvertently delete or corrupt this file, see To Regenerate .ccase_svreg.

To Create a Dynamic View

Enter the following command:

cleartool mkview –tag  dynamic-view-tag    dynamic-view-storage-path

For a complete list of mkview options, see the mkview reference page in the Command Reference.

For example, create pat_v1.4_cropcircle as a dynamic view with the following command:

cleartool mkview –tag pat_v1.4_cropcircle   ~/pat_v1.4_cropcircle.vws 

Under the Hood: The cleartool Command-Line Interface

cleartool is the command-line interface (CLI) to interact with ClearCase. It has a large set of subcommands, which create, modify, and manage the information in VOBs and views.

You can use cleartool in either single-command mode or interactive mode. To use a single cleartool subcommand from a shell, use this syntax:

cleartool subcommand [ options-and-args ] 

When entering a series of subcommands, you may find it more convenient to type cleartool without any arguments. This places you at the interactive-mode prompt:

cleartool>

You can then issue any number of commands, ending with quit to return to the original shell. cleartool commands can be continued onto additional lines with backslash (\), as with UNIX shells.

Command options may appear in any order, but all options must precede any nonoption arguments (typically, names of files, versions, branches, and so on).

For more information, see the cleartool reference page in the Command Reference. For information about input and output for cleartool commands, see pathnames_ccase and fmt_ccase in the Command Reference.

Adding or Modifying Version-Selection Rules

ClearCase creates a set of default version-selection rules in the initial config spec of your view. However, development projects often require team members to add specific version-selection rules. This manual assumes that someone in your organization creates these rules, and you must either copy them into your config spec or add an inclusion rule so that your config spec includes them from a config spec available over the network. For information about creating version-selection rules, see Managing Software Projects.

You can use the following procedure whenever you need to add, remove, or otherwise modify the version-selection rules of your view.

To Copy or Include Version-Selection Rules

  1. Do one of the following:
    • If you work in a dynamic view, type the following command:
    • cleartool setview view-tag

    • If you work in a snapshot view, change to the root directory of the view.
  2. Type the following command:
  3. cleartool edcs

    ClearCase opens the config spec of the view in your default text editor. For information about changing the default editor, see the env_ccase reference page in the Command Reference.

  4. In your text editor, do any of the following:
    • Copy or insert the rules for your project into the config spec. The rules may be available in a text file accessible over the network, or even through e-mail. Verify with the author of the shared config spec whether you need to include any rules other than the ones you paste.
    • Type on its own line include path-to-shared-config-spec. Verify with the author of the shared config spec whether you need to include any rules other than the include rule.
    • Note: Rather than create your own config spec with an include rule, you can use cleartool setcs to use some other config spec directly. For more information, see the setcs reference page in the Command Reference.

  5. If you work in a snapshot view, create or modify load rules. (For more information, see Snapshot View: Adding or Modifying Load Rules.)
  6. If you work in a dynamic view, do the following:

    1. Save the config spec and exit the text editor.
    2. In your shell, answer Yes at the prompt for setting the config spec.

Snapshot View: Adding or Modifying Load Rules

Load rules determine which elements are copied into the snapshot view. Any projectwide config spec that you include in the config spec for your view may already contain a set of default load rules.

You can modify those rules or add your own by doing the following:

Listing the VOB Namespace

To create load rules, you must know the names of the elements in the VOB namespace. Because ClearCase loads directory elements recursively, you need to know only the names of parent directory elements.

VOB Namespace

In its general sense, a namespace is a set of unique names. The namespace of a file system usually consists of a hierarchical arrangement of files and directories. Each file and directory has a unique name.

In a VOB, a simple file name is not sufficient to select a single, unique object. For example, prog.c is ambiguous: does it refer to version 1 of prog.c or version 42 of prog.c?

A VOB namespace is the set of file and directory versions your config spec selects. For example, the view pat_v1.4_cropcircle_sv sees a VOB namespace of the files and directories that contribute to release 1.4 of a software product; the view pat_v1.3_cropcircle_sv sees a VOB namespace of the files and directories that contribute to release 1.3 of the same product. Because ClearCase tracks versions of directories, the VOB namespace varies depending on the versions of directories you select.

To List the VOB Namespace

  1. Enter cleartool lsvob to see the list of VOBs at your site. For example:
  2. cleartool lsvob –short
    /guivob
    /doc
  3. To see the namespace in a VOB, enter the following command:
  4. cleartool ls snapshot_view_path/VOB-path […]

    To see further down a directory tree in the namespace, use cleartool ls recursively. For example:

cleartool ls pat_v1.4_cropcircle_sv/guivob 
pat_v1.4_cropcircle_sv/guivob/batch@@main/1 [not loaded] Rule: /main/LATEST
pat_v1.4_cropcircle_sv/guivob/src@@main/1 [not loaded] Rule: /main/LATEST
cleartool ls pat_v1.4_cropcircle_sv/guivob/batch
pat_v1.4_cropcircle_sv/guivob/batch/prog.c@@main/1 [not loaded] Rule: 
/main/LATEST
pat_v1.4_cropcircle_sv/guivob/batch/lib.c@@main/1 [not loaded] Rule: 
/main/LATEST

The annotation not loaded indicates that there are no load rules specifying the element or that the version-selection rules do not select any version of the element.

Adding or Modifying Load Rules

You can add or modify load rules in any of the following ways:

To Add or Modify Load Rules When Editing the Config Spec

  1. Open the config spec of a view for editing by doing the following:
    1. Open a shell and change to a directory in the view.
    2. Enter the following command:
    3. cleartool edcs

      ClearCase opens the config spec of the view in your default text editor.

  2. In your text editor, use the following syntax to create load rules:
  3. load vob-tag/element-path […]

    For example, the rule load /guivob loads all files and directories in the VOB named /guivob. The rule load /guivob/batch loads only the batch directory recursively.

  4. Save the config spec and exit the text editor.
  5. In your shell, answer Yes at the prompt for setting the config spec.

To Add Load Rules with update –add_loadrules

Enter the following command:

cleartool updateadd_loadrules element-path […]

The variable element-path names an element in the VOB namespace at a path that is relative to a snapshot view. For example, the following command loads all elements in a VOB named /guivob into the view pat_v1.4_cropcircle_sv:

cleartool update –add_loadrules ~/pat_v1.4_cropcircle_sv/guivob/batch/lib.c 
Loading "guivob/batch/lib.c" (100352 bytes).
Done loading "/guivob/batch/lib.c" (1 objects, copied 98 KB).
Log has been written to 
"/net/triazol/export/home/lsweeney/pat_v1.4_cropcircle_sv/update.27-Ja
n-03.13:23:16.updt".

The load rule is added at the end of the config spec and the new config spec is set.

You can also use a relative path for the element-path argument. For example, these commands load all elements in guivob:

cd ~/pat_v1.4_cropcircle_sv
cleartool update –add_loadrules guivob

These commands load only the batch directory recursively:

cd ~/pat_v1.4_cropcircle_sv
cleartool update –add_loadrules guivob/batch

Excluding Elements from Loading

ClearCase loads all directory elements recursively. To exclude some elements from loading, you can use an element rule in the config spec that selects the initial version of an element. For all ClearCase elements, the initial version contains no data.

To Exclude Elements

  1. Open the config spec of the view for editing:
    1. Open a shell and change to a directory in the view.
    2. Enter this command:
    3. cleartool edcs

  2. In the text editor, create an element rule that specifies the initial version of the element you want to exclude by using the following syntax:
  3. element vob-tag/element-path /main/0

    For example, the element rule element /guivob/interface /main/0 loads the empty version of the interface directory in /guivob, preventing any of its child elements from loading.

  4. Save the config spec and exit the text editor.
  5. In your shell, answer Yes at the prompt for setting the config spec.

Under the Hood: VOB Links

A VOB link makes a file element or directory element accessible from more than one location in the VOB namespace. There are two kinds of VOB links: symbolic links, which are available for file and directory elements, and hard links, which are available for file elements only. We recommend that you use VOB symbolic links instead of VOB hard links whenever possible.

You use the cleartool ln command to create VOB links. For more information, see the ln reference page in the Command Reference.

Symbolic Links and Hard Links in Dynamic Views

In dynamic views (which use the MVFS, or multiversion file system), VOB links behave similarly to symbolic links or hard links in a UNIX file system: symbolic links point to a file or directory element in a different location, and hard links are alternative names for a single file element.

You cannot check out a VOB symbolic link; you must check out the symbolic link target.

When you check out a hard-linked element from a given path, ClearCase considers other paths for the element as “checked out but removed.” That is, to prevent you from modifying the element from multiple paths, ClearCase executes standard checkout behavior at only one path (the one from which you entered the checkout command), but does not create view-private files at other paths. For information about standard checkout behavior, see the checkout reference page in the Command Reference.

Symbolic Links in Snapshot Views

Snapshot views created from a UNIX host maintain standard symbolic link behavior. In the context of loading a snapshot view, links are treated as VOB links (those that point to objects inside the VOB) and non-VOB links (those that point outside the VOB). Hard VOB links are followed; symbolic links are copy-created. If a VOB link cannot be resolved, an error results. Non-VOB links are resolved, if possible, but it is not an error if they cannot be resolved.

Note: When you create a snapshot view from a UNIX host, ClearCase assumes that the file system that contains the view supports symbolic links. If your file system does not support symbolic links, ClearCase reports errors if it encounters VOB links during the update operation.

If a load rule selects a symbolic link, ClearCase copies the link as well as the link target into the snapshot view (regardless of whether a load rule selects the link target). As with dynamic views, you cannot check out a symbolic link; you must check out the symbolic link target.

Hard Links in Snapshot Views

Instead of creating hard links in a snapshot view, each time a load rule selects a hard link, ClearCase loads the element into the view as a standard file.

Caution: Losing Data Because of VOB Hard Links

If you load multiple instances of a hard-linked element into a snapshot view, you must be careful to check out, modify, and check in only one instance of the file. When you check in a hard-linked file, ClearCase updates all other instances in your view, which could result in loss of data if you modified multiple copies of the same file. (Note that, when updating instances of files because of a checkin, ClearCase renames any hijacked file to filename.keep before updating it.)

For example, the following sequence of events will lead to lost data:

  1. You check out the hard-linked file src/util.h.
  2. ClearCase removes the read-only permission from util.h in the src directory only (which is the location from which you issued the checkout command).
  3. You modify src/util.h but do not check it in.
  4. Later, you lose track of which file you checked out. You then remove the read-only permission and modify util.h in the temp directory.
  5. You check in temp/util.h. Even though you checked out and modified src/util.h, ClearCase does not prevent you from checking in temp/util.h; with a VOB hard link, temp/util.h is just another name for src/util.h.
  6. Any changes you made to src/util.h are lost upon checkin because ClearCase updates all copies of duplicated files when you check in an element. Note that ClearCase does not consider any copy of util.h to be hijacked (even if you change permissions), because you checked out the element in the VOB.

Setting Up ClearQuest User Database Defaults

If your project uses the base ClearCase-ClearQuest integration (see The Base ClearCase-ClearQuest Integration), the tasks that you perform can be associated with records in a ClearQuest user database. For each ClearQuest user database that you access, you can set up defaults for the following purposes:

For information about accessing a ClearQuest user database, see Logging On to a ClearQuest User Database.

To Control the Display Appearance

You can control the appearance of the Result set and whether the SQL editor displays. To change the Result set appearance, do the following:

  1. In the ClearQuest client, click Edit > Grid Properties. The Display Settings dialog box appears.
  2. Select or clear an option. The Preview area shows the effect of the option setting.
  3. To save the setting in the ClearQuest user database profile, select Save settings to profile.

  4. Click OK.

To control the display of the SQL editor, click View and select or clear View SQL pane.

The settings take effect immediately.

To Enable EMail Notification

Your project manager can define hooks in the ClearQuest user database to enable mail messages to be sent to users when certain state transitions occur in ClearQuest records. To provide the information for mail to reach you, do the following:

  1. In the ClearQuest client, click View > E-mail Options. The Choose Email Provider page opens.
  2. Select Enable Email notification to have mail messages sent to you and to have others notified of changes that you make.
  3. In Email Provider, select the transport to use. Then click Next. The Configure Mail Server page opens.
  4. Do one of the following:
    • If you selected the SMTP transport, in Outgoing SMTP Server, enter the name of the mail server that your ClearQuest administrator tells you to use.
    • In Your Email Address, enter the user and domain name of your mailbox (this address appears in the From field of messages triggered by your actions on a record and sent to others).

    • If you selected the MAPI transport, in Choose MAPI Profile, select one from the list.
  5. Click Finish. The Configure Mail Server page closes.
  6. In the ClearQuest client, click View > Change User Profile. The User Profile dialog box opens.
  7. In Email, enter the user and domain name of your mailbox.
  8. This e-mail address is used in the Send field of messages directed to you. It differs from the similar field that you enter if you use the SMTP transport. This field is useful to specify the address of a group of users who share a common interest.

  9. Click OK.

Notification is immediately enabled.

To Set Defaults for Printing a Result Set

To support printing, you can associate a report format with a record type, tailor the appearance of the Result set, and determine the location of date and paging information at the top and bottom of report pages.

Click File > Print Preview to see the effects of the settings that are described in this section.

To Associate a Format and Record Type

To associate a report format for printing with the record type of the ClearQuest user database that you have opened, follow these steps:

  1. In the ClearQuest client, click File > Print Record Setup. The Print Record Setup dialog box appears with the name in Record Type inactive, and, if any format association is current, the path to that format.
  2. Click Associate Format. The Select Report Format dialog box appears.
  3. If you have a current association, click Undo Association and select another format.

  4. Navigate to and click the report format entry and click OK.

To Change Result Set Print Appearance

To tailor the appearance of the result set in the print output, follow these steps:

  1. In the ClearQuest client, click File > Page Setup. The Page Setup dialog box appears.
  2. Select and clear the desired settings
  3. To save the setting in the ClearQuest user database profile, select Save settings to profile.

  4. Click OK.

To Set Headers and Footers

To set paging information in the print output, follow these steps:

  1. In the ClearQuest client, click File > Headers/Footers. The Header/Footer dialog box appears.
  2. Use the Header tab to define the alignment of text appearing at the top of each page and the Footer tab to specify the contents at the bottom of each page.
  3. To save the setting in the ClearQuest user database profile, select Save settings to profile.

  4. Click OK.

To Set Start-Up and Operational Defaults

When working in a ClearQuest user database, you can run queries when the database starts or can use optionally use the query wizard.

To Run Queries at Startup

In the ClearQuest client Workspace pane, right-click on a query to run and click Run at Startup. Note that you may run multiple queries at startup, but startup time increases with each query that runs.

To Use the Query Wizard

When you click Query > New Query, the Choose Record Type dialog box appears. You select a record type and click OK. If Use Query Wizard on the Query menu is clear, the Display editor tab in the Query builder pane becomes active so that you can create a query. If Use Query Wizard on the Query menu is selected, the ClearQuest Query Wizard starts.

To use the query wizard, click Query and select Use Query Wizard. The next time you create a new query, the Query Wizard starts.