【问题标题】:Delete ClearCase Views Script删除 ClearCase 视图脚本
【发布时间】:2011-05-18 03:00:31
【问题描述】:

(这是对已删除问题的重新发布)(根据要求)

最好的 ClearCase 视图删除脚本是什么?我在下面的 Yossi Sidi 写的 http://www.cmcrossroads.com/forums?func=view&id=44045&catid=31 上找到了以下内容

此脚本遗漏的两件事是删除 session.dat 文件中用于 CCRC 视图的条目以及清理服务器视图存储和缓存文件目录。

可在此处找到手动步骤:http://www-01.ibm.com/support/docview.wss?uid=swg21172246

rmview.pl
==============
#
# rmview.pl
#
# This script is used to delete a view..
# ---------------------------------------------------
#   Fetching the UUID of the view :
# Cleartool describe -long vob:vob_name (lists all views)
#    -or-
# cleartool lsview -long <View_name>
# ------------------------------------------------------------------------
# Remove sequence:-
#   Cleartool rmview -force -uuid <uuid> (from a VIEW contents directory)
#   Cleartool unreg -view -uuid <uuid>
#   Cleartool rmtag -view VIEW_NAME
#
# Arguments:
# view tag name :
#
# ASSUMED: You must be in a VOB with a view set when this tool
# is used.
#
# Author: Yossi Sidi
# email: yossis@corrigent.com
# URL: [url=http://www.corrigent.com" target="_blank]http://www.corrigent.com[/url]
# Date: Sep. 14, 2003
############################################################
# History: 14/10/03 : Created for Corrigent
############################################################


########################
######## MAIN ########----------------------------------------------------------------
########################


$DIV1="*************************************************************n";


$USAGE=""USAGE ccperl.exe $0 view tag name \n EXAMPLE: ccperl.exe $0 ""My_view"" "";

if ($#ARGV == 0)
{
$view_name = $ARGV[0];
}
else
{
`clearprompt yes_no -mask abort -default abort -pre -prompt $USAGE`;
exit 1;
}
select STDOUT;
$| = 1; # Do not buffer the STDOUT file so ccperl prog.pl >out.txt
# will have the correct sequence of report lines
printf ($DIV1);
printf ("View Propertiesn");
printf (" View Tag: $view_namen");
printf ($DIV1);
printf ("n");

$COMMAND = "cleartool lsview -l $view_name";
@dl = `"$COMMAND"`;
$view_uuid = "";
foreach $dl (@dl) {
chomp ($dl);
printf ("$dln");
if ( $dl =~ /^View uuid: / ) {
$view_uuid = $'; #' reset syntax highlighter
}
}
if ( $#dl > 0 ) {
#   Cleartool rmview -force -all -uuid <uuid> (from a VIEW contents directory)
#   Cleartool unreg -view -uuid <uuid>
#   Cleartool rmtag -view VIEW_NAME
$rmview = "cleartool rmview -force -all -uuid $view_uuid";
$unreg = "cleartool unreg -view -uuid $view_uuid";
$rmtag = "cleartool rmtag -view $view_name";
printf ($DIV1);
printf ("Removing commandsn");
printf ($DIV1);
printf ("n");
printf ("n$rmview n");
@dl = `"$rmview"`;
printf ("n$unreg n");
@dl = `"$unreg"`;
printf ("n$rmtag n");
@dl = `"$rmtag"`;
}
exit 0;

(嗯……有趣的是,在 Perl 的 $' 之后,stackoverflow 颜色编码变得狂野……迷你错误)

【问题讨论】:

    标签: perl clearcase


    【解决方案1】:

    我提到了一个有点冗长的脚本,但它不会删除任何本地存储,也不会清理 CCRC session.dat:

    nuke_view.pl:您可以使用它来删除工作站中的所有视图(可能不再可用)

    cleartool lsview -host myHostname -quick | xargs ccperl nuke_view.pl
    

    -quick 选项对于快速获取给定工作站的视图列表非常重要。

    ## This script should be used to cleanup a view when 'ct rmview' will not
    ## work (such as when the viewstore directory has been deleted.
    ##
    ## Note: The view storage directory will have to manually deleted if it still exists.
    
    use strict;
    
    #sub NukeView();
    #sub DoIt();
    
    foreach(@ARGV) {
            NukeView($_);
    }
    
    
    ##############################################################
    sub NukeView {
    
            my $view2del = $_[0];
    
            print "Processing $view2del...\n";
    
            my @lines = `cleartool lsview -l $view2del`;
    
            my $tag;
            my $uuid;
            foreach(@lines) {
                    chomp;
                    $tag = $1 if /^Tag: (\S+)/;
                    $uuid = $1 if /^View uuid: (\S+)/;
    
                    s/^/\t/;
    
                    print "$_\n";
            }
    
            if ( $tag eq '' or $uuid eq '' ) {
                    print "Error! $view2del: unable to get tag and/or uuid\n";
                    return 0;
            }
    
            my $err_count = 0;
    
            print "\tremoving tag...\n";
            my $cmd = "cleartool rmtag -view $tag";
            $err_count += 1 if DoIt($cmd);
    
            print "\tunregistering view storage...\n";
            $cmd = "cleartool unreg -view -uuid $uuid";
            $err_count += 1 if DoIt($cmd);
    
            print "\tremoving view references...\n";
            $cmd = "cleartool rmview -force -avobs -uuid $uuid";
            $err_count += 1 if DoIt($cmd);
    
            if ( $err_count == 0 ) {
                    print "Success! removed view $view2del\n";
            }
            else {
                    print "Error! errors occured while removing $view2del\n";
            }
    }
    
    #############################################
    sub DoIt {
            my $ret = system($_[0]) / 256;
            print "Error! cmd failed: $_[0]\n" if $ret != 0;
            return $ret;
    }
    

    IBM technote 中描述了删除 CCWeb 视图所需的额外步骤:

    注意:对于 ClearCase 7.1.1.1 或 7.1.1.2,由于APAR PM03334,不再从 ClearCase 7.1.1.1 生成 session.dat 文件:不再需要清理 session.dat。

    删除存储在 CCWeb 服务器上的视图存储和缓存文件。

    默认情况下,view.stg(CCRC / CCWeb 视图存储)、view.dat 和 VOB 的缓存文件存储在以下位置:

    • Windows®C:\Program Files\Rational\ClearCase\var\ccweb\&lt;user&gt;\&lt;view_tag&gt;
    • UNIX® / Linux®/var/adm/rational/clearcase/ccweb/&lt;user&gt;/&lt;view_tag&gt;

    删除位于上述位置的&lt;view_tag&gt; 文件夹。这将删除视图的存储文件、view.dat 和 VOB 的缓存文件,并允许用户使用相同/原始视图的名称创建新视图。

    注意:如果视图仍然存在于 CCRC 客户端上,则可能还需要手动删除视图工作区。这可以通过导航到客户端系统上定义的工作区(默认为C:\Documents and Settings\&lt;user-name&gt;\view_tag)并删除视图工作区来完成。
    此工作区路径列在会话.dat 文件中。条目如下所示:-workroot "c:/web_dev2"。这在用户没有使用默认位置的情况下可能会变得有用。

    CCRC 视图根也缓存在用户配置文件中客户端上的一个文件中。
    检查以下文件并从该列表中删除已删除的视图。

    C:\Documents and Settings\<user-name>\.ccase_wvreg
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多