⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mrclean.pl

📁 CMVC是IBM和许多跨国公司的缺陷管理工具。这里给出了很多在Linux下用KSH编写的使用CMVC命令的例子。这些例子来自于IBM内部的CMVC培训。
💻 PL
📖 第 1 页 / 共 2 页
字号:
#!/bin/perl## SAMPLE NAME: mrClean#              This is a PERL script.## FUNCTIONS:   Clean up "dead" releases.#              Remove work associated with uncommitted tracks,  #              the tracks themselves and any empty levels.#              Return defect/feature if track cancelled and#              there are no others (in other releases).#              The user running the script must have sufficient    #              authority (superuser, projectLead ?) for the CMVC#              commands.  Otherwise, mrClean will miss a few spots.##              Output is logged in mrClean.log in the working directory.## USAGE:       mrClean  releaseName(s)## ENVIRONMENT# VARIABLE(S): CMVC_FAMILY CMVC_RELEASE [CMVC_BECOME]## ORIGINS:     27## 5765-039 (C) COPYRIGHT International Business Machines Corp. 1991,1998# 5765-207 (C) COPYRIGHT International Business Machines Corp. 1994,1998# 5765-202 (C) COPYRIGHT International Business Machines Corp. 1994,1998# 5622-063 (C) COPYRIGHT International Business Machines Corp. 1994,1998# 5765-069 (C) COPYRIGHT International Business Machines Corp. 1991,1998# All Rights Reserved# Licensed Materials - Property of IBM## US Government Users Restricted Rights - Use, duplication or# disclosure restricted by GSA ADP Schedule Contract with IBM Corp.###           NOTICE TO USERS OF THE SOURCE CODE EXAMPLES## INTERNATIONAL BUSINESS MACHINES CORPORATION PROVIDES THE SOURCE CODE# EXAMPLES, BOTH INDIVIDUALLY AND AS ONE OR MORE GROUPS, "AS IS" WITHOUT# WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT# LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A# PARTICULAR PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE# OF THE SOURCE CODE EXAMPLES, BOTH INDIVIDUALLY AND AS ONE OR MORE GROUPS,# IS WITH YOU.  SHOULD ANY PART OF THE SOURCE CODE EXAMPLES PROVE# DEFECTIVE, YOU (AND NOT IBM OR AN AUTHORIZED RISC System/6000* WORKSTATION# DEALER) ASSUME THE ENTIRE COST OF ALL NECESSARY SERVICING, REPAIR OR# CORRECTION.## * RISC System/6000 is a trademark of International Business Machines#   Corporation.### glw  07/12/93## may need to issue Track cmd for individual if the number of them gets too big.## glw  04/04/94   add File unlocks# glw  04/04/94   quote pathname in cmd in case it has contains metacharacter# glw  04/04/94   add prolog# glw  04/14/94   update usage# glw  04/12/95   move defect with all complete tracks to verify state.# glw  08/19/98   multi-line queries fail.#-----------------------------------------------------# SCCS keyword             @(#)43 1.2 1/8/03#-----------------------------------------------------push(@INC,split(/:/,$ENV{"PATH"})); # define search pathif ($#ARGV < 0) {    print ("Specify release name(s) as argument, please.\n");    print ("USAGE:       mrClean  releaseName(s) \n\n");    print ("Clean up \"dead\" releases.\n");    print ("Remove work associated with uncommitted tracks,\n");    print ("the tracks themselves and any empty levels.\n");    print ("Return defect/feature if track cancelled and\n");    print ("there are no others (in other releases).\n");    print ("The user running the script must have sufficient\n");    print ("authority (superuser, projectLead ?) for the CMVC\n");    print ("commands.  Otherwise, mrClean will miss a few spots.\n");    print ("Output is logged in mrClean.log in the working directory.\n");    exit 2}open (LOG,">>mrClean.log") ||        print "cannot open logfile ($!)";        foreach $rel (@ARGV) {    print LOG "\n*****  Processing release $rel *****.\n";    print     "\n*****  Processing release $rel *****.\n";    #  Check that the release exists        open (REP,    "Report -vi releaseview -raw -where \"name='$rel' and dropDate is null\"|");             undef $found_rel;        while ($relline=<REP>) {        chop $levline;        ($lname) = split(/\|/, $levline);        $found_rel = 1;        last;    }        close (REP);        if ($found_rel eq undef) {        print LOG "    Release $rel not found.\n";        print     "    Release $rel not found.\n";        next;    }    #  Unlock any locked files in $rel    print LOG "  Unlocking any locked files.\n";    print     "  Unlocking any locked files.\n";        open (REP,    "Report -vi filesoutview -raw -where \"releasename='$rel'\"|");             while ($outline=<REP>) {        chop $outline;        ($path,$junk) = split(/\|/, $outline);        print LOG "File -unlock $path -release $rel\n";        print     "File -unlock $path -release $rel\n";                  `File -unlock "$path" -release $rel`;    }        $any_rel = 1;    #  Find all levels in $rel having an uncommitted track    #                         state in ('fix', 'integrate')    $rptcmd = "Report -vi levelview -raw -where \"releasename='$rel' and commitDate is null";    $rptcmd = $rptcmd . " and exists (select trackId from levelMembers M where";    $rptcmd = $rptcmd . " levelId=levelview.id and exists (select id from Tracks";    $rptcmd = $rptcmd . " where id=M.trackId and state in ('fix','integrate','build')))\"";        open (REP, "$rptcmd|");        undef $level_names;        while ($levline=<REP>) {        chop $levline;        ($lname) = split(/\|/, $levline);        $level_names .= $lname . " ";    }        close (REP);             foreach $level (split(/ /,$level_names)) {        print LOG "  Processing level $level.\n";        print     "  Processing level $level.\n";        #  Delete the tracks from the level        $rptcmd = "Report -vi levelmemberview -raw -where \"releasename='$rel' and";        $rptcmd = $rptcmd . " levelName='$level' and exists (select id from Tracks where";        $rptcmd = $rptcmd . " id=levelmemberview.trackId and state in ('fix','integrate','build'))\"";        open (REP, "$rptcmd|");        undef $defect_names;        while ($memline=<REP>) {            chop $memline;            ($lev,$rels,$defect) = split(/\|/, $memline);            $defect_names .= $defect . " ";        }        close (REP);                print LOG "    Defects for level $level are $defect_names.\n";        print     "    Defects for level $level are $defect_names.\n";                `LevelMember -delete -level $level -release $rel -defect $defect_names`;    }        #  Delete any "working" state levels.    #  i.e. those with no tracks.    print LOG "  Getting rid of any levels with no tracks.\n";    print     "  Getting rid of any levels with no tracks.\n";    open (REP,    "Report -vi levelview -raw -where \"releasename='$rel' and state='working'\"|");             while ($levline=<REP>) {        chop $levline;        ($lname) = split(/\|/, $levline);        `Level -delete $lname -release $rel`;    }        close (REP);        #  Find all integrate state tracks and move back to fix state    print LOG "  Finding integrate tracks to move to fix state.\n";    print     "  Finding integrate tracks to move to fix state.\n";    open (REP,    "Report -vi trackview -raw -where \"releasename='$rel' and state='integrate'\"|");    undef $defect_names;    while ($trkline=<REP>) {        chop $trkline;        ($rels,$defect) = split(/\|/, $trkline);        $defect_names .= $defect . " ";    }    close (REP);    if ($defect_names ne undef) {        print LOG "    The tracks are $defect_names.\n";        print     "    The tracks are $defect_names.\n";        `Track -fix -release $rel -defect $defect_names`;    }    else {        print LOG "    No such tracks were found.\n";        print     "    No such tracks were found.\n";    }        #  Find all complete state fixes for fix state tracks and re-activate    print LOG "  Finding complete fixes to re-activate.\n";    print     "  Finding complete fixes to re-activate.\n";    $rptcmd = "Report -vi fixview -raw -where \"releasename='$rel'";    $rptcmd = $rptcmd . " and state='complete' and exists";    $rptcmd = $rptcmd . " (select id from tracks where id=fixview.trackid and state='fix')\"";    open (REP, "$rptcmd|");    while ($fixline=<REP>) {        chop $fixline;        ($defect,$rels,$comp) = split(/\|/, $fixline);        $d_for_comp{$comp} .= $defect . " ";    }    close (REP);        foreach $comp (keys %d_for_comp) {      print LOG "    For component $comp the tracks are $d_for_comp{$comp}.\n";      print     "    For component $comp the tracks are $d_for_comp{$comp}.\n";            `Fix -activate -release $rel -component $comp -defect $d_for_comp{$comp}`;      delete $d_for_comp{$comp};    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -