mklabel

Attaches version labels to versions of elements

Applicability

Product

Command type

ClearCase®

cleartool subcommand

ClearCase Remote Client

rcleartool subcommand

Platform

UNIX

Linux

Windows

Synopsis

  • ClearCase: attach label to specified versions
    mklabel [ –rep/lace ] [ –r/ecurse ] [ –fol/low ]
    [ –silent ] [ –ver/sion version-selector ]

    [ –c/omment comment | –cfi/le comment-file-pname | –cq/uery

    | –cqe/ach | –nc/omment ] label-type-selector pname ...

  • ClearCase: attach label to versions listed in configuration record
    mklabel [ –rep/lace ] [ –c/omment comment | –cfi/le comment-file-pname
    | –cq/uery | –cqe/ach | –nc/omment ]

    [ –sel/ect do-leaf-pattern ][ –ci ] [ –typ/e { f | d } ... ]

    [ –nam/e tail-pattern ] –con/fig do-pname ... label-type-selector

  • ClearCase Remote Client: attach label to specified versions
    mklabel [ –rep/lace ] [ –r/ecurse ] [ –fol/low ]
    [ –silent ] [ –ver/sion version-selector ]

    [ –c/omment comment | –cq/uery | –nc/omment ]

    label-type-selector pname ...

Description

The mklabel command attaches a version label to one or more versions. You can attach a label to only one version of a particular element. You can specify the versions themselves on the command line, or you can specify one or more particular derived objects. In the latter case, mklabel labels some or all the versions that were used to build the derived objects.

Restrictions

ACL authorization

If ACLs are enabled, the principal must have the following permissions:
  • read-info on VOB object
  • read-info on element
  • mod-label on element

Non-ACL authorization

You must have one of the following identities:

  • Element owner
  • Element group member
  • VOB owner
  • root (UNIX and Linux)
  • Member of the ClearCase administrators group (ClearCase on Windows)

Locks

If it encounters a VOB lock while trying to write data during an import operation, mklabel pauses and retries the operation every 60 seconds until it succeeds. Because labels are applied in batches, some labeling in a batch may still fail because a lock is placed on the VOB while a batch transaction is in progress; however, the next batch is not applied until the lock is released.

Mastership

(Replicated VOBs only) If the label type is unshared, your current replica must master the label type. If the label's type is shared, the following restrictions apply:

  • If the label type is one per branch, your current replica must master the branch of the version.
  • If the label type is one per element, your current replica must master the element of the version.

If the label's type is global and shared, your current replica must master the branch or element; also, your current replica must contain a local copy of the type, or the administrative VOB at the current site must master the type.

Options and arguments

Moving a version label

Default
An error occurs if a version label of this type is already attached to some other version of the same element.
–rep/lace
Removes an existing label of the same type from another version of the element:
  • From another version on the same branch, if label-type-name was created with mklbtype –pbranch
  • From another version anywhere in the element's version tree, if label-type-name was not created with mklbtype –pbranch

No error occurs if there is no such label to remove, but the label is attached to all versions specified in the command.

Event records and comments

Default
Creates one or more event records, with commenting controlled by your .clearcase_profile file (default: –nc). See the comments reference page. Comments can be edited with chevent.
–c/omment comment | –cfi/le comment-file-pname |–cq/uery | –cqe/ach | –nc/omment
Overrides the default with the option you specify. See the comments reference page.

Specifying the label type

Default
None.
label-type-selector
A label type, previously created with mklbtype. The label type must exist in each VOB containing a version to be labeled, or (if label-type-selector is a global type) in the administrative VOB hierarchy associated with each VOB. Specify label-type-selector in the form [lbtype:]type-name[@vob-selector]

Specifying the label type

type-name

Name of the label type

vob-selector

VOB specifier

Specify vob-selector in the form [vob:]pname-in-vob

pname-in-vob

Pathname of the VOB tag (whether or not the VOB is mounted) or of any file system object within the VOB (if the VOB is mounted)

Note: The mklabel command is disallowed on label types for UCM baselines.

Directly specifying the versions to be labeled

The options and arguments in this section specify elements and their versions directly on the command line. Do not use these options and arguments when using a derived object to provide a list of versions.

pname ...
(Required) One or more path names, indicating versions to be labeled:
  • A standard or view-extended path name to an element specifies the version selected in the view.
  • A version-extended path name specifies a version, independent of view.

Use –version to override these interpretations of pname.

Note: mklabel differs from some other commands in its default handling of directory element pname arguments: it labels the directory element itself; it does not label the elements cataloged in the directory (unless you specify –recurse).
–ver/sion version-selector
For each pname, attaches the label to the version specified by version-selector. This option overrides both version-selection and version-extended naming. For syntax details, see the version_selector reference page.

When you specify this option with –recurse, mklabel recursively descends directories even if there is no version match for a specified directory—the directory version selected by the view's config spec is used for the recursion.

–r/ecurse
Processes the entire subtree of each pname that is a directory element (including pname itself). VOB symbolic links are not traversed during the recursive descent into the subtree.

When you specify this option with –version, mklabel recursively descends directories even if there is no version match for a specified directory—the directory version selected by the view's config spec is used for the recursion.

When you specify this option, a summary is printed at the completion of this command that lists the number of labeling successes, labeling failures, moved labels, and unchanged labels.

–fol/low
For any VOB symbolic link encountered, labels the corresponding target.

Using derived objects to specify the versions to be labeled

The options and arguments in this section specify versions by selecting them from the configuration records associated with one or more particular derived objects. Do not use these options when specifying elements and versions directly on the command line.

Note: Derived objects are created only in dynamic views.
–con/fig do-pname ...
Specifies one or more derived objects. A standard path name or view-extended path name specifies a DO that currently appears in a view. To specify a DO independent of view, use an extended name that includes a DO-ID (for example, hello.obj@@2006-03-24T11:32.412) or a version-extended path name to a DO version.
With the exception of checked-out versions (see Note), mklabel labels all the versions that would be included in a catcr –long –flat –element_only listing of a derived object. Note that this includes the following objects:
  • Any DO created by the build and subsequently checked in as a DO version.
  • Any file in the CR that was view-private at the time of the build, was converted to an element after the creation of the CR, and has at least one checked-in version.

If a DO's configuration includes multiple versions of the same element, only the most recent version is labeled.

When multiple DOs are specified, –con/fig takes all the elements listed in the configuration records for those DOs.

When you specify this option, a summary is printed at the completion of this command that lists the number of labeling successes, labeling failures, moved labels, and unchanged labels.

Use the following options to modify the list of versions to be labeled.

–sel/ect do-leaf-pattern –ci –typ/e { f | d } ... –nam/e tail-pattern
Modify the set of versions to be labeled in the same way that these options modify a catcr listing. For details, see the catcr reference page, and also the Examples section.
Note: In the case of a checked out DO, the label is attached to the predecessor in the view unless you specify the checked out version explicitly; for example, foo.c@@/xxx/yyy/CHECKEDOUT.

Suppressing status information

Default
Status messages on the progress of the operation are not suppressed.
–silent
Suppress status messages. Specifying this option can improve the performance of this command when a large number of versions are specified; for example, mklabel –silent –recurse *.

Examples

The UNIX system and Linux examples in this section are written for use in csh. If you use another shell, you might need to use different quoting and escaping conventions.

The Windows examples that include wildcards or quoting are written for use in cleartool interactive mode. If you use cleartool single-command mode, you might need to change the wildcards and quoting to make your command interpreter process the command appropriately.

In cleartool single-command mode, cmd-context represents the UNIX system and Linux shells or Windows command interpreter prompt, followed by the cleartool command. In cleartool interactive mode, cmd-context represents the interactive cleartool prompt.

  • Create a label type named REL6. Attach that label to the version of the current directory selected by your view, and to the currently selected version of each element in and below the current directory.

    cmd-context  mklbtype –nc REL6
    Created label type "REL6".
    cmd-context  mklabel –recurse REL6 .
    Created label "REL6" on "." version "/main/4".
    Created label "REL6" on "./bin" version "/main/1".
    Created label "REL6" on "./include" version "/main/1".
    Created label "REL6" on "./libs" version "/main/2".
    Created label "REL6" on "./lost+found" version "/main/0".
    Created label "REL6" on "./release" version "/main/1".
    Created label "REL6" on "./src" version "/main/6".
    Created label "REL6" on "./src/Makefile" version "/main/2".
    Created label "REL6" on "./src/cm_add.c" version "/main/1".
    Created label "REL6" on "./src/convolution.c" version "/main/4".
    Created label "REL6" on "./src/edge.sh" version "/main/1".
    .
    .
    .

  • Attach label REL1 to the version of msg.c in the view.

    cmd-context  mklabel REL1 msg.c
    Created label "REL1" on "msg.c" version "\main\1".

  • Attach label REL2 to version 3 on the rel2_bugfix branch of file util.c.

    cmd-context  mklabel –version /main/rel2_bugfix/3 REL2 util.c
    Created label "REL2" on "util.c" version "/main/rel2_bugfix/3".

  • Move label REL2 to a different version of element hello.c, using a version-extended pathname to indicate that version.

    cmd-context mklabel –replace REL2 hello.c@@\main\4
    Moved label "REL2" on "hello.c" from version "\main\3" to "\main\4".

  • Attach label REL3 to each version that was used to build derived object hello.o. Note that both directories and files are labeled.

    cmd-context  mklabel –config hello.o REL3
    Created label "REL3" on "/usr/hw/" version "/main/1".
    Created label "REL3" on "/usr/hw/src" version "/main/2".
    Created label "REL3" on "/usr/hw/src/hello.c" version "/main/3".
    Created label "REL3" on "/usr/hw/src/hello.h" version "/main/1".

  • Attach label REL5 to each C-language source file version that was used to build derived object hello.exe.

    cmd-context mklabel –name '*.c' –config hello.exe REL5
    Created label "REL5" on "\users_hw\src\hello.c" version "\main\3".
    Created label "REL5" on "\users_hw\src\util.c" version "\main\1".

  • Attach label REL5 to all versions in the VOB mounted at /usr/hw that were used to build derived object hello. Use interactive mode to enable use of the ClearCase "..." wildcard.

    cmd-context  mklabel –name ' /usr/hw/...' –config hello REL5
    Created label "REL5" on "/usr/hw/" version "/main/1".
    Created label "REL5" on "/usr/hw/src" version "/main/2".
    Created label "REL5" on "/usr/hw/src/hello.c" version "/main/3".
    Created label "REL5" on "/usr/hw/src/hello.h" version "/main/1".
    Created label "REL5" on "/usr/hw/src/util.c" version "/main/1".