1

I found out that labels must be applied starting at the VOB if you want to successfully recreate a specific code (label) release. I thought you wouldn't have to start at the VOB name but you do :-(

My VOB has many programs in it. For example:

VOBname\programs\Java\Program1\files...
VOBname\programs\Java\Program2\files...
VOBname\programs\VB\Program1\files...
VOBname\programs\VB\Program2\files...

What I would like to do is have a script or program that takes two parameters, a path and label, and applies that label to the proper directories and files in that path.

It should not apply the label to other, non related, directories (i.e., if I am labeling Java\Program1 it should not also label Java\Program 2.

I also need the reverse - If someone incorrectly applies the label, then I need to remove the label from the path.

It seems like this feature would have been incorporated into the GUI or a script long ago but I don't see one available. Of course, you can do this manually but this takes longer especially if you have a long path.

I know you can label a directory and all contents underneath that directory but if you start at the VOB, that would label everything (what I don't want).

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
kevin zamora
  • 153
  • 1
  • 7
  • Don't forget to read http://stackoverflow.com/help/accepted-answer for the answers of your past ClearCase questions like this one. – VonC Jul 29 '16 at 13:16

1 Answers1

1

The simplest solution is to:

  • apply recursively a label from the path

    cd /path
    cleartool mklabel -replace -recurse LABEL
    
  • for a given path, extract the parent folders, and label those:

    avob/
    avob/aParentFolder
    avob/aParentFolder/aParentSubFolder
    

Depending on your scripting language, extracting the parent folders can be as easy as perl File::Basename

my($filename, $directories, $suffix) = fileparse($path);
# On Unix returns ("baz", "/foo/bar/", "")
fileparse("/foo/bar/baz");
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Cool, I will look into this further. I guess a larger question is "Do I really care if I apply a label to all files in the VOB? What is the harm?" And after thinking about this a bit, there is no real harm. But I wonder what real ClearCase admins/gurus do if they are using Base Clearcase. Would they take the position I do? That is, labels should only be applied to the files associated with the project....or would they be lazy and apply the label to the whole vob? – kevin zamora Jul 18 '14 at 18:39
  • @kevinzamora the harm? performance when applying the label (it takes time), and identifying too many elements with one label is bad when some developer decides to use the label to start something based on that labelled content: he/she gets back too much. – VonC Jul 18 '14 at 18:44