canonifyuniquely

Table of Contents

Prototype: canonifyuniquely(text)

Return type: string

Description: Convert an arbitrary string text into a unique legal class name.

This function turns arbitrary text into class data, appending the SHA-1 hash for uniqueness. It is exactly equivalent to concat(canonify($(string)), "_", hash($(string),"sha1"); for a given $(string) but is much more convenient to write and remember.

A common use case is when you need unique array keys for each file in a list, but files in the list may have the same name when canonify-ed.

Arguments:

  • text: string, in the range: .*

Example:

    commands:

       "/var/cfengine/bin/$(component)"

           ifvarclass => canonifyuniquely("start_$(component)");

See also: canonify()).