working on it ...


Explore Public Snippets

Sort by

Found 15 snippets

    public by lbottaro  3607  1  7  0

    Bash one-liner to remove clearcase views in parallel

    This bash one liner script allows to remove all the Clearcase views that match some criteria in parallel. In this case views are listed by 'lsview -s' cleartool command, filtering with grep on specific . Note the '-s' option to get view name in short format. Once each view is returned, xargs command executes the cleartool 'rmview' command,
    cleartool lsview -s | grep <WORD> | xargs -I '{}' sh -c 'cleartool rmview -tag {} &'     

    public by lbottaro  14555  56  8  0

    How to list files changed in clearcase ucm stream activities

    This script lists the files changed in all the activities delivered on a specific stream, with no duplicates. The stream is the one currently set on the clearcase view.
    #!/usr/bin/tcsh -f
    # This script lists the activities of a stream and saves on the following file the changed files without duplicates.
    set tmpoutput = "$HOME/.tmp_AllChangedFilesInStream.txt"
    set output = "$HOME/AllChangedFilesInStream.txt"
    rm -rf $tmpoutput
    touch $tmpoutput
    rm -rf $output
    touch $output
    foreach act ( `cleartool lsact -s | grep -v rebase` )	
        set changeset = `cleartool lsact -fmt "%[versions]p" $act`
        echo $changeset | tr ' ' '\n' >> $tmpoutput
    foreach line ( "`cat $tmpoutput`" )	
        set file=`echo $line | sed -e "s|\(.*\)@@.*|\1|"`
        set isPresent = `grep "$file" "$output"`
        if ("$isPresent" == "") then
          echo $file >> $output
    rm -rf $tmpoutput
    exit 0

    public by lbottaro  7262  4  7  0

    Make UCM clearcase activity using cleartool command

    Here are some examples on how to make, create and set activity in IBM Clearcase UCM environment, using cleartool mkact command. Source:
    # Create an activity, but do not set it to be the current activity for the view.
    # User is prompted to proceed 
    cleartool mkact –nset 
    Create activity with automatically generated name?  [yes] yes
    Created activity "activity990917.133218".
    # Create and set an activity attached to the current view.
    cleartool mkact new_activity 
    Created activity "new_activity".
    Set activity "new_activity" in view "java_int".
    # Create and set an activity whose name is generated automatically. 
    # User is not prompted for confirmation.
    cleartool mkact -f 
    Created activity "activity990917.134751".
    Set activity "activity990917.134751" in view "java_int".
    # Create and set an activity with the headline “Create directories”.
    cleartool mkactivity -headline "Create directories" create_directories 
    Created activity "create_directories". 
    Set activity "create_directories" in view "webo_integ".

    public by lbottaro  5530  12  8  0

    How to force remove an element in Clearcase

    This cleartool command will forcibly remove a version of an element, removing any reference, link, attribute, label or branch present for that version. The command can be executed when facing the "Removal of interesting versions" error when trying to delete a clearcase object. Options: –xbranch - Deletes a version even if one or more branch
    cleartool rmver -xhlink –xbranch –xlabel –xattr test.txt@@\main\3

    public by lbottaro  529749  10  8  0

    How to get the list of all the activities comparing two UCM streams in python

    This script shows how to get the list of all the activities comparing two ucm streams. The command returns a list object you can easily loop and print.
    import os
    myView = "MyView"
    diff_act=os.popen("cleartool setview -exec \"cleartool diffbl -nmerge -activities "+bl_old+" "+ bl_new+" \" " +myView).readlines()
    for act in diff_act:
      print ("ACTIVITY: "+str(act))

    public by lbottaro  3674  1  7  1

    How to get the baselines from UCM stream in python

    This simple python script will detect the baselines configured on a given UCM Clearcase stream. At the end it will print the latest baseline found.
    import os
    stream = "myStream@/myVobs"
    latest_bl=os.popen("for a in `cleartool lsstream -fmt \"%[latest_bls]p\" " + 
                       stream + "`; do echo $a; done").readlines()
       print "Latest baseline found = " + str(latest_bl)

    public by lbottaro  4158  4  6  0

    How to get the foundation baseline of a given UCM stream

    This python script will detect the foundation baseline of a given Clearcase UCM stream.
    import os
    working_stream = "myStream"
    pvob = "MyVobs"
    foundation_bl = os.popen("cleartool descr -fmt \"%[found_bls]CXp\" stream:"
            + working_stream + "@" + pvob).readlines()[0].split(":")[1].split("@")[0]
    print "Found Foundation baseline = " + str(foundation_bl)

    public by lbottaro  7230  31  8  0

    Custom diff tool for clearcase object

    This simple tcsh script allows to run a custom diff tool to view differences between file versions. The diff tool to be used can be easily configured. In this example I use kdiff3. The script will detect if one or two file paths are passed on the command line. In case of two files, the diff will be done on them. In case of one file, th
    #!/bin/tcsh -e
    set _CLEARCASE_VIEW = `cleartool pwv -short -setview`
    echo Set view: "$_CLEARCASE_VIEW"
    set my_firstversion = ""
    set my_secondversion = ""
    set my_difftool = kdiff3
    # check clearcase view
    if ( "$_CLEARCASE_VIEW" == "** NONE **" ) then
      echo "Error: ClearCase view not set, aborted."
      exit -1
    if ( "$1" == "" ) then
      echo "Error: missing 1st file argument!"
      echo "Eg: `basename $0` file1.txt -> This will diff file1.txt with its previous version"
      echo "Eg: `basename $0` file1.txt file2.txt -> This will diff file1.txt and file2.txt"
      exit -1
    set my_firstversion = "$1"
    echo "my_firstversion=$my_firstversion"
    if ( "$2" == "" ) then
      echo "No 2nd file passed, calculating previous version of $my_firstversion"
      set my_secondversion = $my_firstversion@@`cleartool descr -pred -short $my_firstversion`
      echo "Setting 2nd file to $2"
      set my_secondversion = "$2"
    echo "my_secondversion=$my_secondversion"
    ${my_difftool} ${my_firstversion} ${my_secondversion} &

    public by lbottaro  3348  4  7  0

    Remote execution of command on clearcase view via ssh

    This bash script allows to execute a dynamic command on a remote machine, using ssh authentication within a Clearcase dynamic view. Note that the command to run in generated by some variables and it's passed to ssh via a file. The cat command will input the command into remote shell to be executed on another machine. You can find also th
    # This return current directory
    # This return the CLearcase view name
    currentView=`cleartool pwv -s`
    echo "Setting view: ${currentView} on remote machine"
    # This is the command to execute
    cmd="cleartool setview -exec \"echo currentDir=${currentDir}; echo my_dest_path=${my_dest_path}; cd ${currentDir}; cp -an data/* ${my_dest_path}; hostname\" ${currentView}"
    echo "cmd=${cmd}"
    # This is a tmp file where to save the command
    rm -f ${file}
    # Create a tmp file to save the command to execute
    echo ${cmd} > ${file}
    # This run the command on <remoteMachine>
    /usr/bin/time -f "%E" -o ${my_platform_label}.time ssh -Y <remoteMachine> 'bash -s' < ${file}

    public by lbottaro  7883  32  8  0

    How to checkin all checked out files in linux clearcase

    This simple csh script loops for any checked out file in the current directory tree and check it in. Command option: -cvi: list file for current view only -rec: search for files recursively from current directory -s: return file in short name format -c: add comment to checkin
    foreach name (`cleartool lsco -rec -cvi -s .`)
       echo $name
       cleartool ci -c "Comment for file" $name
    • Public Snippets
    • Channels Snippets