Somebody recommended a baseline in my stream. How do I know how recommend it? I can only see who created it but didn't get any info who recommend it. Is there any specific command to see the history of the baseline/stream/view etc?
I don't think that meta-data is recorded.
You can check for the policies attached to the UCM project though
POLICY_CHSTREAM_UNRESTRICTED
If it is not set, that means only the owner of the UCM project can change the recommended baseline on a stream.
Otherwise, as suggested below, you would need to catch and record that event yourself through trigger.
At the area of ClearCase 7.x (thos could have changed with CC8), this was done with a pre-op trigger on chstream, but it had to deal with two kind of interactions:
CLI (cleartool chstream -recommended)
GUI (through the "recommend baseline" contextual menu)
See for instance this thread:
recommend_bls trigger, with an early out check if chstream was not for a recommend baseline:
if ($ENV{CLEARCASE_CMDLINE}) {
# chstream run from the command line, check for a "-recommended" option
if ($ENV{CLEARCASE_CMDLINE} =~ /-recommend /) {
$msg->D( "this is a chstream to recommend a baseline",
"CLEARCASE_CMDLINE is: <$ENV{CLEARCASE_CMDLINE}>",
"trigger proceeding...",
);
}
else {
$msg->D( "EARLY OUT - this chstream command does not include a
baseline recommend:",
"CLEARCASE_CMDLINE is: <$ENV{CLEARCASE_CMDLINE}>",
);
exit 1;
}
}
else {
# chstream was run from the gui, must look at event records to
# determine if the command was a baseline recommend or
# some other change to the stream
my $lshist_rc = qx($CT lshist -minor -last 1 -me stream:$ENV{CLEARCASE_STREAM});
if ($?) {
# error in the lshist command, report trigger error
my #args = ("$CP proceed -type error -default abort -mask abort -newline -prompt \"***RECOMMEND_BL Trigger Version: $VERSION***\n\n<lshist> cmd failed on
stream:$ENV{CLEARCASE_STREAM}.\nResults:\n$lshist_rc\nPlease send a
screen print of this error to your ClearCase admin.\" -prefer_gui");
system (#args);
$msg->D( "Processing aborted - lshist command failed!",
"$lshist_rc"
);
exit 11;
}
chomp($lshist_rc);
# check latest stream event record to see if the chstream was
# a baseline recommend or some other change to the stream.
# a baseline recommend will have an event record of the form:
# "Set activity process variable named "UCM_STREAM_RECBLS".
if ($lshist_rc =~ /UCM_STREAM_RECBLS/) {
$msg->D( "this is a chstream to recommend a baseline",
"latest event record on stream is:",
"$lshist_rc",
"trigger proceeding...",
);
}
else {
$msg->D( "EARLY OUT - this chstream command did not include a baseline recommend:",
"latest event record on stream is:",
"$lshist_rc",
);
exit 1;
}
}
Related
How can I select an element with a specific baseline in a UCM ClearCase snapshot view config spec from a script?
I'm writing a script which will create a snapshot view of a given stream and should select a specific baseline version of the stream contents. I would prefer to set the element baseline in the same manner I'm setting the load rules but can't find a way to do that.
Here's what I'm doing so far:
...
cleartool mkview -snapshot -tag ${cc_view} -ptime -stream ${cc_stream}#\\myVob -vws ${cc_dir}/${cc_view}.vws ${cc_dir}/${cc_view} || die "Failed to create view. Exiting."
cd ${cc_dir}/${cc_view}
# Set the element baselines
cleartool edcs -overwrite
cleartool update -overwrite -add_loadrules ${components} || die "Failed to update view. Exiting."
...
Another issue might be that I can't set the element version in the config spec in the custom block - I have to do it in the component selection rules instead! Overwriting UCM's "Component selection rules" section feels a bit dangerous. I do this in the edcs phase:
ucm
identity UCM.Stream <...id...>
# ONLY EDIT THIS CONFIG SPEC IN THE INDICATED "CUSTOM" AREAS
# This config spec was automatically generated by the UCM stream
# "myStream" at 2017-06-01T07:43:33+02:00.
# Select checked out versions
element * CHECKEDOUT
# Component selection rules...
element "[ee5a<...id...>=\MYCOMPONENT]/..." my-component-1.0 -nocheckout
end ucm
#UCMCustomElemBegin - DO NOT REMOVE - ADD CUSTOM ELEMENT RULES AFTER THIS LINE
#UCMCustomElemEnd - DO NOT REMOVE - END CUSTOM ELEMENT RULES
# Non-included component backstop rule: no checkouts
element * /main/0 -ucm -nocheckout
#UCMCustomLoadBegin - DO NOT REMOVE - ADD CUSTOM LOAD RULES AFTER THIS LINE
load \MYCOMPONENT
Related questions:
UCM: How to create dynamic view (base clearcase) on arbitrary incremental baseline
Snapshot from old baseline
As VonC suggested I moved to base CC:
...
cleartool mkview -snapshot -tag ${cc_view} -ptime -vws ${cc_dir}/${cc_view}.vws ${cc_dir}/${cc_view} || die "Failed to create view. Exiting."
cd ${cc_dir}/${cc_view}
cat << EOF > config_spec
element * CHECKEDOUT
element * ${baseline} -nocheckout
element * /main/LATEST
EOF
cleartool setcs -force -overwrite config_spec || die "Failed to set config spec. Exiting."
cleartool update -overwrite -add_loadrules ${components} || die "Failed to update view. Exiting."
...
First, that will only work if the baseline is full.
If it is an incremental one, you have the risk of selecting an element with a label (associated to the baseline) which is not set on the parent folder, making that element inaccessible.
Second, that kind of custom selection is best done with a non-UCM base ClearCase snapshot view into which you have:
the same load rules as your UCM snapshot view
but a simpler set of selection rules:
element * yourBaselineId
element * /main/LATEST
$ cleartool rmstream stream:tiger#/vobs/forest
Remove stream
"stream:tiger#/vobs/forest"? [no] yes
cleartool: Error: No tag in region for view "d6ca911d.229a41bb.942b.fd:ed:f2:bb:5c:f8".
cleartool: Error: Unable to remove stream "stream:tiger#/vobs/forest".
how to find out which site has clearcase view uuid d6ca911d.229a41bb.942b.fd:ed:f2:bb:5c:f8?
The IBM technote swg21127922 does list a MultiSite environment and the view existing at a different replica site as a possible cause for this error message.
It might not be mandatory to switch to the site referencing that view to move forward though.
The steps described to resolve the issue involve removing the view by its uuid in the pvob of the stream.
I used that technique (rmview --uuid) before in "Removal of clearcase views involves any housekeeping?".
For instance:
cleartool lsstream -l stream_name#\pvob.
The output will include:
views:
98573bec.d7e34570.a71c.e8:ab:7c:50:d4:02
Then:
ct desc -l vob:\ford_pvob
The output include:
VOB holds objects from the following views:
f15eagle:d:\ClearCase_Storage\views\RATIONAL\evchan\evchan_proj1_2.vws [uuid 98573bec.d7e34570.a71c.e8:ab:7c:50:d4:02]
You will need change directory (cd) into the PVOB
Example:
W:\>cd ford_pvob
W:\ford_pvob>
Remove the view reference from the PVOB using, cleartool rmview -uuid uuid_number
Note: By adding the -all switch, you will ensure to remove the view reference from the PVOB and any UCM Component VOBs that may also have a reference from this view; cleartool rmview -all -uuid uuid_number.
In this particular example, the -all was not required since we are only removing the view reference from the PVOB.
Example:
W:\ford_pvob>ct rmview -uuid 98573bec.d7e34570.a71c.e8:ab:7c:50:d4:02
Removed references to view "f15eagle:d:\ClearCase_Storage\views\RATIONAL\evchan\evchan_proj1_2.vws" from VOB "\ford_pvob".
Now the stream can be removed, using cleartool rmstream stream_name#\pvob
Example:
W:\ford_pvob>ct rmstream evchan_proj1_2#\ford_pvob
Remove stream "evchan_proj1_2#\ford_pvob"? [no] y
Removed stream "evchan_proj1_2#\ford_pvob" .
I'm trying to write a script to get the vob with the help of cleartool.
I have the activity id, the stream name and the stream location as input. From this I need to get the vob.
cleartool lsvob -short is pretty much what I need, but I only need the vob of the activity and stream.
cleartool describe -cview view-location did also not help.
Does anyone have an idea how to achieve this?
EDIT:
cleartool descr -cact leads to the following:
activity "ActivityID"
created 2014-12-15T13:53:49+01:00 by User
master replica: HES#\vob
owner: dom\owner
group: group
stream: stream#\vob
current view: view name
title: Title
change set versions:
...changes
Attributes:
activity_ok = "yes"
Delivered = "no"
Finished = "no"
Type_Activity = "User"
If you execute a cleartool describe from within the view, it should pick up on the "vob of the activity" (meaning the PVob which is an admin vob of the current UCM root-based component vob that the view is accessing)
cd /path/to/my/view/vobs/MyVob
cleartool descr -cact
cleartool descr -fmt "%Xn" -cact
That should return the name of the currently set activity followed by #/vobs/ThePVob.
ThePVob is the tag you are looking for: it will be the same for all activities in that stream.
Using fmt_ccase, you can limit the output to the fully qualified name of the current activity: activty#\.
I have tried to get the full history of a clearcase vob to parse it and use it with gource to get a visual representation of the changes, but I do not find the right commands to get an easy log history to parse with clearcase2gource python script. I do not use UCM, there are no streams, just plain cleacase.
With this command I get elements with ## in the middle of a path:
cleartool lshistory -fmt "Element: %n| Date: %d| User:%u| Operation: %e| Object:%[type]p| SimpleType: %m| OperationKind: %o\n" -all /vobs/vob_name
With this command I get elements like this (deleted at some point):
Element: /vobs/vob_name/dir1##/main/branch_dev/2/dir2/main/branch_pilot/1/file##/main/branch_pilot/1| Date: 2008-04-15T16:58:28+02:00| User:reeasjp| Operation: create version| Object:compressed_file| SimpleType: version| OperationKind: checkin
That makes more difficult to parse for gource because of several branch names in the middle.
Is there any way to get a full history of all the elements with just plain directories and file names?
Thanks in advance.
NOTE: In the config Spec I have just "/main/LATEST".
The issues are:
clearcase2gource.py processed the extended paths (see "About the version-extended path") found by cleartool lshistory with some hard-coded assumptions.
e = d['Element']
splitElement = e.split("##")
d['FileName'] = splitElement[0]
d['StreamName'] = splitElement[1]
# StreamName starts with /main/ which we aren't interested in.
# Remove the /main/ (slice on 5 because there are 5 chars in /main/)
d['StreamName'] = d['StreamName'][5:]
the cleartool lshistory --all will list history of deleted elements (non-visible anymore in the current ClearCase view), hence the multiple branch names.
The easiest solution would be to:
redirect the cleartool lshistory output to a file, and
then filter out all the extended paths which don't conform to clearcase2gource.py expectation: for instance, just for testing, keep only the ones in a specific branch or in /main only, just to see if that works better.
finally feed that file as input to clearcase2gource.py
I want to receive an e-mail notification on completion of every CPM. I am using IBM rational Clearcase(UCM).Please let me know if there is any script to do this?
Thanks
Sooraj
What is CPM? The Core Protection Module of Tivoli?
Anyway, you can setup post-operation trigger for email notification, as commented in the Ten Best Script page.
A complete example can be seen in ClearCase Help pages "E-mail notification postoperation trigger script".
It setup includes, for an UCM deliver operation:
creates a postoperation trigger type that fires when a developer finishes a deliver operation, as represented by the deliver_complete opkind.
The mktrtype command uses the -stream option to indicate that the trigger type applies only to deliver operations that target the specified integration stream.
# This is a Perl script to set up the triggertype
# for e-mail notification on deliver.
use Config;
# define platform-dependent arguments.
my $PVOBTAG;
if ($Config{'osname'} eq 'MSWin32') {
$PVOBTAG = '\cyclone_pvob';
$WCMD = '-execwin "ccperl \\\\pluto\disk1\ucmtrig_examples\ex2\ex2_postop.pl"';
}
else {
$PVOBTAG = '/pvobs/cyclone_pvob';
$WCMD = '-execwin "ccperl \\\\\\pluto\disk1\ucmtrig_examples\ex2\ex2_postop.pl"';
}
my $STREAM = "stream:P1_int\#$PVOBTAG";
my $TRTYPE = "trtype:ex2_postop\#$PVOBTAG";
my $UCMD = '-execunix "Perl /net/pluto/disk1/ucmtrig_examples/ex2/ex2_postop.pl"';
print 'cleartool mktrtype -ucmobject -all -postop deliver_complete $WCMD $UCMD -stream $STREAM -nc $TRTYPE';
The key part is:
cleartool mktrtype -ucmobject -all -postop deliver_complete