mkattr

Attaches attributes to objects

APPLICABILITY


Product

Command Type

ClearCase


cleartool subcommand


ClearCase LT


cleartool subcommand


Attache


command


Platform

UNIX


Windows

SYNOPSIS

mkattr [ -rep·lace ] [ -r·ecurse ] [ -ver·sion version-selector ]

[ -pna·me ] [ -c·omment comment | -cfi·le comment-file-pname |-cq·uery
| -cqe·ach | -nc·omment ]
{ attribute-type-selector value | -def·ault attribute-type-selector }
pname ...
mkattr [ -rep·lace ] [ -c·omment comment | -cfi·le comment-file-pname |-cq·uery

| -cqe·ach | -nc·omment ]
{ attribute-type-selector value | -def·ault attribute-type-selector }
object-selector ...
mkattr [ -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
{ attribute-type-selector value | -def·ault attribute-type-selector }

DESCRIPTION

The mkattr command attaches an attribute to one or more objects. You can specify the objects themselves on the command line, or you can specify a particular derived object. In the latter case, mkattr attaches attributes to versions only-some or all the versions that were used to build that derived object.

An attribute is a name/value pair:

BugNum / 455

(integer-valued attribute)

BenchMark / 12.9

(real-valued attribute)

ProjectID / "orange"

(string-valued attribute)

DueOn / 5-Jan

(date-value attribute)

Restrictions on Attribute Use

In several situations, attempting to attach a new attribute causes a collision with an existing attribute:

A collision causes mkattr to fail and report an error, unless you use the -replace option, which first removes the existing attribute.

Referencing Objects by Their Attributes

The find command can locate objects by their attributes. Examples:

More generally, queries written in the query language can access objects using attribute types and attribute values. See the query_language reference page for details.

RESTRICTIONS

Identities: You must have one of the following identities:

Locks: An error occurs if one or more of these objects are locked: VOB, element type, element, branch type, branch, attribute type, object to which the attribute is being attached (for non-file-system objects).

Mastership: (Replicated VOBs only) If the attribute's type is unshared, your current replica must master the type. If the attribute's type is shared, your current replica must master the object to which you are applying the attribute.

OPTIONS AND ARGUMENTS

MOVING AN ATTRIBUTE OR CHANGING ITS VALUE.  Default: An error occurs if an attribute collision occurs (see Restrictions on Attribute Use).

-rep·lace

Removes an existing attribute of the same type before attaching the new one, thus avoiding the collision. (No error occurs if a collision would not have occurred.)

SPECIFYING THE ATTRIBUTE TYPE AND VALUE.  Default: None. You must specify an existing attribute type; you must also indicate a value, either directly or with the -default option.

attribute-type-selector

An attribute type, previously created with mkattype. The attribute type must exist in each VOB containing objects to which you are applying attributes, or (if attribute-type-selector is a global type) in the Admin VOB hierarchy associated with each VOB. Specify attribute-type-selector in the form [attype:]type-name[@vob-selector]

type-name

Name of the attribute type

vob-selector

Object-selector for a VOB, in the form [vob:]pname-in-vob. The pname-in-vob can be the pathname of the VOB-tag (whether or not the VOB is mounted) or of any files-ystem object within the VOB (if the VOB is mounted)

-def·ault

If the attribute type was created with a default value (mkattype -default), you can use -default attribute-type-name to specify the name/value pair. An error occurs if the attribute type was not created with a default value.
value

Specifies the attribute's value. The definition of the attribute type specifies the required form of this argument (for example, to an integer). It may also restrict the permissible values (for example, to values in the range 0-7).

Value Type

Input Format

integer

Any integer that can be parsed by the Windows strtol or UNIX strtol(2) system calls

real

Any real number that can be parsed by the Windows strtod or UNIX strtod(2) system calls

date

A date-time string in one of the following formats:

date.time | date | time | now
where

date

:=

day-of-week | long-date

time

:=

h[h]:m[m][:s[s]] [UTC [ [ + | - ]h[h][:m[m] ] ] ]

day-of-week

:=

today | yesterday | Sunday |...| Saturday | Sun |...| Sat

long-date

:=

d[d]-month[-[yy]yy]

month

:=

January |... |December |Jan |... |Dec

Specify time in 24-hour format, relative to the local time zone. If you omit the time, the default value is 00:00:00. If you omit date, the default is today. If you omit the century, year, or a specific date, the most recent one is used. Specify UTC if you want to resolve the time to the same moment in time regardless of time zone. Use the plus (+) or minus (-) operator to specify a positive or negative offset to the UTC time. If you specify UTC without hour or minute offsets,Greenwich Mean Time (GMT) is used. (Dates before January 1, 1970 UTC are invalid.)

string

Any string in standard C-language string literal format. It can include escape sequences: \n, \t, and so on.

UNIX SYSTEMS NOTE: The string must be enclosed in double quotes. Also note that the double-quote (") character is special to both the cleartool command processor and the UNIX shells. Thus, you must escape or quote this character on the command line. These two commands are equivalent:

cleartool mkattr QAed '"TRUE"' hello.c
cleartool mkattr QAed \"TRUE\" hello.c

WINDOWS SYSTEMS NOTE: The Windows shell removes double quotes, so to pass them through to the cleartool command processor, you must precede them with a backslash character on the command line:

c:\> cleartool mkattr QAed \"TRUE\" hello.c

opaque

A word consisting of an even number of hexadecimal digits (for example, 04a58f or FFFB). The value is stored as a byte sequence in a host-specific format.

DIRECTLY SPECIFYING THE OBJECTS.  The options and arguments in this section specify objects to be assigned attributes directly on the command line. Do not use these options and arguments when using a derived object to provide a list of versions to be assigned attributes.

object-selector ...

(Required) One or more names of objects to be assigned attributes. Specify object-selector in one of the following forms:

vob-selector

vob:pname-in-vob

pname-in-vob can be the 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). It cannot be the pathname of the VOB storage directory.

attribute-type-selector

attype:type-name[@vob-selector]

branch-type-selector

brtype:type-name[@vob-selector]

element-type-selector

eltype:type-name[@vob-selector]

hyperlink-type-selector

hltype:type-name[@vob-selector]

label-type-selector

lbtype:type-name[@vob-selector]

trigger-type-selector

trtype:type-name[@vob-selector]

pool-selector

pool:pool-name[@vob-selector]

hlink-selector

hlink:hlink-id[@vob-selector]

oid-obj-selector

oid:object-oid[@vob-selector]

The following object selector is valid only if you use MultiSite:

replica-selector

replica:replica-name[@vob-selector]

[ -pna·me ] pname ...

(Required) One or more pathnames, indicating objects to be assigned attributes. If pname has the form of an object selector, you must include the -pname option to indicate that pname is a pathname.

  • A standard or view-extended pathname to an element specifies the version in the view.
  • A version-extended pathname specifies an element, branch, or version, independent of view.

Examples:

foo.c

/view/gamma/usr/project/src/foo.c

foo.c@@\main\5

foo.c@@/REL3

foo.c@@

foo.c@@\main

(version of 'foo.c' selected by current view)

(version of 'foo.c' selected by another view)

(version 5 on main branch of 'foo.c')

(version of 'foo.c' with version label 'REL3')

(the element 'foo.c')

(the main branch of element 'foo.c')

Use -version to override these interpretations of pname.
-ver·sion version-selector

For each pname, attaches the attribute to the version specified by version-selector. This option overrides both version-selection by the view and version-extended naming. See the version_selector reference page for syntax details.
-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.
NOTE: mkattr differs from some other commands in its default handling of directory element pname arguments: it assigns an attribute to the directory element itself; it does not assign attributes to the elements cataloged in the directory.

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.

USING A DERIVED OBJECT TO SPECIFY VERSIONS.  The options and arguments in this section specify versions to be assigned attributes by selecting them from the configuration records associated with a particular derived object. Do not use these options when specifying objects to be assigned attributes directly on the command line.

-con·fig do-pname

(Required) Specifies one derived object. A standard pathname or view-extended pathname specifies the 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.o@@24-Mar.11:32.412) or a version-extended pathname to a DO version.
With the exception of checked-out versions, mkattr attaches attributes to all the versions that would be included in a catcr -flat listing of that derived object. Note that this includes any DO created by the build and subsequently checked in as a DO version.
If the DO's configuration includes multiple versions of the same element, the attribute is attached only to the most recent version.

Use the following options to modify the list of versions to which attributes are attached.

-sel·ect do-leaf-pattern
-ci
-nam·e tail-pattern
-typ·e { f | d } ...

Modify the set of versions to be assigned attributes in the same way that these options modify a catcr listing. For details, see the catcr reference page and the EXAMPLES section.

EXAMPLES

The UNIX examples in this section are written for use in csh. If you use another shell, you may 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 may 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 shell or Windows command interpreter prompt, followed by the cleartool command. In cleartool interactive mode, cmd-context represents the interactive cleartool prompt. In Attache, cmd-context represents the workspace prompt.

SEE ALSO

describe, mkattype, query_language, rmattr