This appendix contains these sections:
By writing effective expressions, you can gather files with different names from anywhere and pull them together into one subsystem, or qualify which files with a particular IDB tag go into a subsystem.
Although you can usually make these changes by changing your product structure and tags using the swpkg worksheets, you might occasionally prefer instead to add mapping expressions directly to the spec file. Mapping expressions are typically used when you have a very complex existing spec file in which you need to change the file-to-subsystem mappings—but you do not want to completely overhaul the spec file.
You can change the file-to-subsystem mappings by typing valid mapping expressions into the Mappings text field in the Complete Product Hierarchy worksheet. This appendix explains the “expressions language” used to create valid mapping expressions.
|Note: Using expressions can cause problems because subsystem names can change, breaking the intended behavior. Silicon Graphics recommends that you introduce expressions carefully, and only when absolutely necessary.|
Values are typed as integer or string—non-zero integers and non-null strings are considered “true” in boolean tests. A reference to an IDB attribute is “true” if the IDB attribute is present in the database record being operated on.
References to IDB attribute arguments are made with a form of subscripting after the argument name, where a list of integers (or integers separated by ``..'' indicating a range) selects specific arguments. The variable argc within brackets refers to the last argument. The selected arguments are concatenated with separating spaces and returned as a string value. (Note that the mechanisms of IDB attribute reference just described are likely to change. They are not terribly useful as is.)
Integer and string variables and constants are available, with single and double quotes being entirely equivalent around string constants.
The primary values may be combined with most of the usual operators, which behave as in C unless otherwise noted:
pattern not match
bitwise exclusive or
bitwise (unary) not
not equal comparison (on integers or strings)
equal comparison (on integers or strings)
less than or equal comparison (on integers or strings)
greater than or equal comparison (on integers or strings)
less than comparison (on integers or strings)
greater than comparison (on integers or strings)
Parenthesis for grouping are also available.
The file type as a one-character string; the first character of file, directory, block device, character device, (symbolic) link, or (named) pipe (that is, FIFO).
Permission bits. The type of this value is integer, but is converted to a string according to context (though it's a decimal integer, which is probably not what you want).
The name of the owner. The UID is mapped through etc/passwd.
The name of the group. The GID is mapped through etc/group.
The relative (to root) pathname of the file in the software product destination tree.
The relative pathname of the file in the source tree.
The integer number of IDB attributes associated with the record being operated on.
(Defined only within IDB attribute argument list references.) The number of arguments for the current IDB attribute.
The pathname of the root of the source tree.
The pathname of the root of the destination tree.
The pathname of the primary IDB file. When files are accessed, the mapping between user and group integer IDs and the owner and group string values in the IDB are based on the etc/passwd and etc/group files, respectively. These are first sought under sbase, then under rbase, then under /.
Returns an absolute pathname for the argument; if the given value is relative, it is concatenated with the value of sbase. This is useful in converting a srcpath value into an absolute pathname.
Returns an absolute destination pathname, concatenated with the value of rbase.
Prints the current record in standard format (that is, on one line, packed).
Formatted print (subset of stdio printf). Recognizes field widths with leading zero pad indicator, types %s, %d, %o.
Unformatted print. Prints values as decimal integers or strings, separated by spaces, terminated with newline.
Returns the size, in bytes, of the given file, or -1 if not found.
Returns the size, in blocks, of the given file, or -1 if not found.
Returns the value of the access(2) system call.
The following statements are implemented as in C: if [ else ], while, for, break, continue, return, grouping with braces, and expressions.
The basic spec file for rfind doesn't follow the recommendation that each software subsystem have a matching reference page system. Instead, a single IDB tag was used for all reference pages. You could use this expression to put the .1 reference pages into one subsystem and the .1m reference pages into another:
exp 'rfind.man.rfind && srcpath =~ "*.1"' exp 'rfind.man.rfind && srcpath =~ "*.1m"'