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

📄 filelkafterrellk.sh

📁 CMVC是IBM和许多跨国公司的缺陷管理工具。这里给出了很多在Linux下用KSH编写的使用CMVC命令的例子。这些例子来自于IBM内部的CMVC培训。
💻 SH
字号:
#!/usr/bin/ksh## SAMPLE NAME: fileLkAfterRelLk## USAGE:       fileLkAfterRelLk [-committed] [-defect <defect name>] \#                               <old release> <new release> [-?] [-help]## PURPOSES:   #   a) To continue a release link that did not complete successfully:##   b) To bypass completely the Release -link command, and perform a#      complete link of the files between releases.## FUNCTION:#      This sample shell script gets the list of all the files related #      to the specified releases which were linked from the #      <old release> either committed or current (default),#      to <new release>, finds out what files are missing#      during the Release -link operation, then does File -link#      on all those missing files.## NOTES:#  * The parameter "-defect" really is the track number (defect/feature).##  * This shell script does not check if the new release is using a subprocess#    that requires a defect/feature (track).#    Thus, in case that this new release needs a track and you do not provide#    one, then the following error will be shown:## Loop through the missing files and do File -link, one-by-one# Running: File -link T6.CMD  -release testlevel -to testlevel2# 0010-258 The requested action requires that you specify one or more#          defects or features.### ENVIRONMENT# VARIABLE(S): CMVC_FAMILY [CMVC_BECOME]## 5765-207 (C) COPYRIGHT International Business Machines Corp. 1993,1997# 5765-202 (C) COPYRIGHT International Business Machines Corp. 1993,1997# 5622-063 (C) COPYRIGHT International Business Machines Corp. 1993,1997# 5765-397 (C) COPYRIGHT International Business Machines Corp. 1994,1997# 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.## /usr/lpp/cmvc/samples/fileLkAfterRelLk## Just in case, removing aliases (in this process only) for the following:unalias rmunalias awkunalias sortunalias uniqunalias diffunalias printunalias printf# Initializing variablesFROMRELEASE=""TORELEASE=""COMMITTED=""DEFECT=""FAMILY=""RELEASES=""function usage{  print -u2 "$*"  print -u2 " "  print -u2 "Usage: $0 [-committed] [-defect <defect name>] <oldReleaseName> "  print -u2 "<newReleaseName> [-?] [-help]\n"  print -u2 "  -committed: Optional, default to current"  print -u2 "  -defect <defect name>: a defect used to do the Release -link."  print -u2 "  <oldReleaseName>: Old release name"  print -u2 "  <newReleaseName>: New release name"  print -u2 "  -?:    Help information"  print -u2 "  -help: Help information"  exit 1}# MAIN# Finding the input parameterswhile [[ $1 = \-* ]]do  case $1 in     -committed)     COMMITTED="y"; shift ;;     -defect)        DEFECT=$2; shift 2 ;;     -?)             usage "Help Information:" ;;     -help)          usage "Help Information:" ;;     -*)             usage "Unknown Option $1" ;;  esacdoneif [[ -z $1 || -z $2 ]]then  usage "Missing release parameters"fiif [[ -z "$DEFECT" ]]then  defectString=""else  defectString="-defect $DEFECT"fiif [[ -z "$CMVC_FAMILY" ]]then  print "The CMVC family must be specified with the environment variable."  print "   CMVC_FAMILY"  exit 1fiprint "Performing a file link after an incomplete release link from"print "the old release $1 to the new release $2"print ""print "Getting the list of all the active files in the old release: $1"if [[ $COMMITTED = "y" ]]then# Getting the raw list of files with committed versions (includes also current)  Report -view fileview -where "releaseName='$1' and dropDate is null" -raw |  sort -t"|" +11 -12 -u |  # The committed version SID is necessary for File -link  awk -F"|" '  {     printf "%s %s\n", $4, $12  }' |  tee /tmp/$1.SID.flist.$$ |  cut -d' ' -f 2- |  uniq > /tmp/$1.flist.$$else# Getting the raw list raw list of files with current versions."  Report -view fileview -where "releaseName='$1' and dropDate is null" -raw |  sort -t"|" +11 -12 -u |  awk -F"|" '  {     printf "%s\n", $12  }' |  uniq > /tmp/$1.flist.$$fiprint "Getting the list of all the active files in the new release: $2"Report -view fileview -where "releaseName='$2' and dropDate is null" -raw |sort -t"|" +11 -12 -u |awk -F"|" '{   printf "%s\n", $12}' |uniq > /tmp/$2.flist.$$print ""print "Getting the list of the files that were missed in the new release"print "after the original Release -link, and which still need to be linked."diff /tmp/$1.flist.$$ /tmp/$2.flist.$$ |sed -e "s/[<>] //" >/tmp/missing.flist.$$exec 3> /tmp/$1.failure.flist.$$print ""print "Looping through the missing files and do File -link, one-by-one:"print ""while read linedo  # Is the $line one of those special lines that resemble ed subcommands  # for conversion?  if [[ $line = *([0-9])?(,)*([0-9])[acd]*([0-9])?(,)*([0-9]) ]]  then     continue     # Ignore those special lines.  else     if [[ $COMMITTED = "y" ]]     then        # Get the committed versionSID for the missing file        while read versionSID filename        do           if [[ $line = $filename ]]           then              if [[ ! -z $versionSID ]]              then                 print "Running: File -link  $line  $defectString -release $1 -to $2 -version $versionSID"                                 File -link "$line" $defectString -release $1 -to $2 -version $versionSID              fi              break           fi        done < /tmp/$1.SID.flist.$$     else        print "Running: File -link  $line  $defectString -release $1 -to $2"                        File -link "$line" $defectString -release $1 -to $2     fi     # Was File -link OK?     if [ $? -ne 0 ]     then        print "File -link failed on file: $line"        print -u3 -r - "$line $versionSID"     fi  fidone < /tmp/missing.flist.$$# Clear the tmp files.rm -f /tmp/$1.flist.$$ /tmp/$2.flist.$$ /tmp/missing.flist.$$ /tmp/$1.SID.flist.$$exec 3<&-mv /tmp/$1.failure.flist.$$ /tmp/$1.failure.flist.$$.bakprint ""print "Done!"exit 0# end of sample

⌨️ 快捷键说明

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