How to see permissions in cleartool - clearcase

I tried ls command, but it doesn't actually show permissions for VOB elements. I cannot understand what command to use in order to see the permissions. Can somebody help me?

Generally, you can use cleartool describe:
cleartool descr -l yourFile
# for the vob itself:
cleartool descr -l vob:\vobtag
The second command is important, as it would list the primary and secondary groups associated to the vob: you must have your CLEARCASE_PRIMARY_GROUP set to one of those groups in order to access the vob.
Using fmt_ccase, you also have access to the filesystem object permission:
%[permissions]p
File system objects: Displays the object's permissions using the standard "rwx" notation.
cleartool desc -fmt "%[permissions]p" .

Related

Not able to checkout elements in stream in ClearCase

I am not able to checkout any element in Dev stream in Clearcase from any user except the admin user. I am getting below error :
No permission to perform operation "checkout".
Must be one of: member of object group, object owner, VOB owner, member of admin group.
I added the user group to the Primary group of clearcase in Windows, but I am still facing same issue.
Assuming a regular ClearCase (not CCRC with automatic or web view), type in your view:
cleartool lsview -l -full -pro -cview
Check if if the primary group is correct.
If not, take note of the global path (which should be like an network UNC path \\<aServer>\path\to\view\storage.
If not, in a regular CMD session:
set CLEARCASE_PRIMARY_GROUP=<aGroup>
doskey fp=c:\Rational\ClearCase\etc\utils\fix_prot.exe -force -chgrp "<aGroup>" -chown <aLogin> $*
fp -rec -chmod 775 \\UNC\Path\to\view.vws
fp -root \\UNC\Path\to\view.vws
Replace \\UNC\Path\to\view.vws by the global path you have seen in the first step (the lsview one), as mentioned above.
Replace <aGroup> by the primary group name, and <aLogin> by your Windows login.
Make sure your user is part of that group.

How to filter the baselines(UCM) alone from describe command?

As we are having many components , I am trying to describe all the baselines using following command
cleartool describe -l baseline:Baseline_2.1.0.13#\My_PVOB
It provides output like follows
"Build 13"
master replica: My_PVOB#\My_PVOB
owner: Admin
group: ABC
stream:Components_Integration#\My_PVOB
component: Baselines#\My_PVOB
label status: No Versions to Label
change sets:
promotion level: INITIAL
depends on:
Baseline_2.1.0.13.8206#\My_PVOB (Comp1#\My_PVOB)
Baseline_2.1.0.13.433#\My_PVOB (Comp2#\My_PVOB)
Baseline_2.1.0.13.423#\My_PVOB (Comp3#\My_PVOB)
Baseline_2.1.0.13.3763#\My_PVOB (Comp4#\My_PVOB)
Actually i want to get contents only below depends on: ( Want to get Just following contents)
Baseline_2.1.0.13.8206#\My_PVOB (Comp1#\My_PVOB)
Baseline_2.1.0.13.433#\My_PVOB (Comp2#\My_PVOB)
Baseline_2.1.0.13.423#\My_PVOB (Comp3#\My_PVOB)
Baseline_2.1.0.13.3763#\My_PVOB (Comp4#\My_PVOB)
How to omit the remaining information?
From the fmt_ccase man page:
%[depends_on]Cp
(UCM baselines) The baselines that the composite baseline directly depends on
So for a composite baseline:
cleartool descr -fmt "%[depends_on]Cp" baseline:aBaseline#\apvob
could do the trick, except it will print only the dependent baselines on one line, each name separated by space, and without their associated component name.
So you need to parse that output, and for each baseline name, do a:
cleartool descr -fmt "%[component]Xp" baseline:aBaseline#\apvob
(Or, if your naming convention for baselines allows for it, a simple:
cleartool describe -l baseline:Baseline_2.1.0.13#\My_PVOB | grep Baseline_
would be easier!)
Actually, the OP samselvaprabu took the last proposition to grep what he needed from the initial output. His grep is better than my proposal, because it doesn't depend on the Baseline naming convention, but on the PVob name of said baselines:
I am using windows so your last(simple) command gave me the idea.
Following command works in Dos
cleartool describe -l baseline:Baseline_2.1.0.13#\My_PVOB | find "#\My_PVOB)"
Read "fmt_ccase" manual, you'll find it over there:
cleartool man fmt_ccase

Cleartool: How to apply label to files which are in my current view only?

I could not find the proper command to apply a label to files which are in my current view. I have tried the following command:
cleartool mklabel -r TEST_LABEL /vob/test/a
However, the problem is that this command will apply the "Test_Label" label to every files in the "vob/test/a" directories regardless of whether the files are in my current view.
Is there any command to apply label only to the files listed in my current view?
cleartool mklabel -r(ecurse) LABEL_NAME <directory name>
This command will apply LABEL_NAME to all files in folder and below of your view, you can just go to that directory,then type following command to create and apply label
> cd /vob/test/a
> cleartool mklbtype –nc TEST_LABEL
> cleartool mklabel -r TEST_LABEL .
The mklabel documentation state states, as to what version is labeled:
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.
One example mentions:
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.
Now, if you want to be really sure of the versions actually labelled, one solution is to use a find command, combined with your mklabel:
cleartool find . -cview -exec "cleartool mklabel TEST_LABEL \"%CLEARCASE_XPN%\""
If you had already that label applied to incorrect version and want to move it:
cleartool find . -cview -exec "cleartool mklabel -replace TEST_LABEL \"%CLEARCASE_XPN%\""
That way, you can first list the versions involved:
cleartool find . -cview -print
And then, if you agree with the output, apply the mklabel through the -exec directive.
The OP user1096966 reports making it work with a cleartool ls, to be sure to select only element visible in the current view:
cleartool ls -r -vis
The is no '-exec' directive, so a pipe might be involved, as in (not tested, but you get the idea):
cleartool ls -r -vis -s -nxn | xargs cleartool mklabel -replace TEST_LABEL
The doco is really clear about what is being labelled, in fact the first example shown in doco states that exactly...current view objects are labelled by default & currently selected versions (i.e. if in your view then label it, else not.)
....extract below from doco below (note: context and command and that label-type-selector pname is the last parameter...left blank below because resident in working dir)...
Example:
•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
Regards
Jim2

ClearCase: Describe of vobroot fails in windows, gives "null meta type" in Linux

Running this command gives an error in Windows:
H:\>cleartool describe -fmt "%[object_kind]p" "M:\\my_cc_view\\"
it gives:
cleartool: Error: Unable to access "M:\\my_cc_view\": Input/output error.
Running the same command on a vob works:
H:\>cleartool describe -fmt "%[object_kind]p" "M:\\my_cc_view\\vob1"
directory version
H:\>cleartool describe -fmt "%[object_kind]p" "M:\\my_cc_view\\vob2"
directory version
In Linux it gives:
; cleartool describe -fmt "%[object_kind]p" /view/my_cc_view/vobs/
; null meta type**
I've been unable to find if this is a bug in clearcase, the closest one I could find was this.
It seems that running a describe on the the vobroot element is is a special case we must handle separately, is there a way to check if the path is the root?
Views, vobs, label types, branch types (etc) are referenced directly as follows. In the docs these are called "object-selector".
cleartool describe view:my_cc_view
cleartool describe vob:vob1
See cleartool describe man page.
Also, try a dot at the end to get the root directory element of a given vob.
cleartool describe /view/my_cc_view/vobs/.
cleartool: Error: Unable to access "M:\my_cc_view\": Input/output error.
Not sure why you get two '\' here: with one, it works on my Windows session, but it won't give you much:
ct descr -fmt "%[object_kind]p" "m:\my_cc_view"
**null meta type**
A view hasn't really an "object type". And it has no "object-selector" like "view:"
To see all characteristic of a view, type:
cleartool lsview -l -full -pro my_cc_view
(using the tag of the view).

Clearcase: List labels matching a particular string

I would like to list the available labels matching a particular string applied in the view.
I confirm a filter in cleartool find is not possible:
ct find . -ele "lbtype_sub(My_LAB*)" -print
would not work (no wildcard in query argument.
If you cannot use a grep in a shell pipe, can you consider using grep in an exec part of a find, like in this example?
ct find . -kind lbtype -exec "echo %CLEARCASE_PN%|grep MY_LAB"
If this is not acceptable, you need to write the result in a file and process it with another tool (sed?)
You have packages for Windows including Unix commands: see this SO question.
Of you have freeware emulating the grep command.
If you must stay with native Windows commands, you must redirect the result in a file, and use FIND (English translation).
Hmm. I'm not entirely sure about this although the following will list all labels used for a given VOB (entered using ClearTool command line application).
lstype -kind lbtype -invob vob_path_and_name -short
for example with a View mapped to drive U: VOB "Some_VOB" would be:
lstype -kind lbtype -invob U:\Some_VOB -short

Resources