Whamcloud - gitweb
LU-2928 build: update updatecw.sh script
authorKeith Mannthey <keith.mannthey@intel.com>
Fri, 8 Mar 2013 02:58:00 +0000 (18:58 -0800)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 15 Mar 2013 15:04:57 +0000 (11:04 -0400)
Sync this tool with the curren master version.
There were some minor improvments since the last
2.1.X release.

Signed-off-by: Keith Mannthey <keith.mannthey@intel.com>
Change-Id: Iba98883d8b1f76712b349dd40f7974272445529c
Reviewed-on: http://review.whamcloud.com/5649
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
build/updatecw.sh

index 45dd4f0..286a796 100755 (executable)
@@ -13,13 +13,19 @@ DIRS=${DIRS:-"build ldiskfs libcfs lnet lustre snmp lustre-iokit"}
 #Commits to exclude
 EXCLUDE=${EXCLUDE:-'e3a7c58aebafce40323db54bf6056029e5af4a70\n
 65701b4a30efdb695776bcf690a2b3cabc928da1\n
-f2a9374170e4522b9d2ac3b7096cf2912339d480'}
+f2a9374170e4522b9d2ac3b7096cf2912339d480\n
+3f90f344ae059b30e7d23e4fe554a985eb827b02\n
+32a9102457a1f4fdf838c5fa2014632e3a1a3636\n
+320e014a2c93cb905637d178269b80847cb8d277\n
+cd8c65642f1c36b56ae74a0414a1f1f27337a662'}
 
+XYRACOPY="Copyright.*Xyratex Technology Limited"
 ORACOPY1="Copyright.*Oracle.*"
 ORACOPY2="Use is subject to license terms."
 #Copyright we rewrite to the current version
-WHAMCOPY=${WHAMCOPY:-"Copyright.*Whamcloud, Inc."}
-INTREPCOPY=${INTREPCOPY:-"Copyright.*Intel, Inc"}
+WHAMCOPY=${WHAMCOPY:-"Copyright.*Whamcloud,* Inc."}
+INTREPCOPY=${INTREPCOPY:-"Copyright.*Intel, Inc."}
+INTREPCOPY2=${INTREPCOPY2:-"Copyright.*Intel Corporation$"}
 #The current copyright
 INTCOPY=${INTCOPY:-"Copyright.*Intel Corporation."}
 
@@ -35,6 +41,13 @@ ECHOE=${ECHOE:-"echo -e"}
 echo -e $EXCLUDE > $EXCFILE
 
 git ls-files $DIRS | grep -v ${0##*/} | while read FILE; do
+#FILE=lustre/mdt/mdt_hsm.c
+#FILE=lustre/include/lustre_quota.h
+       if [ "$FILE" == 'build/updatecw.sh' ]; then
+               echo $FILE": *** EDIT MANUALLY ***"
+               continue
+       fi
+
        NEEDCOPY=false
        # Pick only files that have changed since START
        git log --follow --since=$START --author=$AUTH_WHAM --author=$AUTH_INT\
@@ -43,22 +56,25 @@ git ls-files $DIRS | grep -v ${0##*/} | while read FILE; do
        # Skip files not modified by $AUTHOR
        [ -s "$TMPFILE" ] || continue
 
-       OLDCOPY="$(egrep "$ORACOPY1|$ORACOPY2|$WHAMCOPY|$INTCOPY|$INTREPCOPY"\
-                                                $FILE|tail -n1|tr / .)"
+       OLDCOPY="$(egrep -e "$XYRACOPY|$ORACOPY1|$ORACOPY2|$WHAMCOPY|$INTCOPY"\
+                       -e "$INTREPCOPY|$INTREPCOPY2" $FILE|tail -n1 | tr / .)"
+
        if [ -z "$OLDCOPY" ]; then
                case $FILE in
-                       *.[ch]) echo "$FILE: ** NO COPYRIGHT **" && continue ;;
+                       *.[ch]) echo "$FILE: ** INSPECT  **" && continue ;;
                        *) continue ;;
                esac
        fi
+       OLDCOPY=$(egrep "$WHAMCOPY|$INTCOPY|$INTREPCOPY|$INTREPCOPY2"\
+                                                       $FILE|tail -n1|tr / .)
 
-       OLDCOPY=$(egrep "$WHAMCOPY|$INTCOPY|$INTREPCOPY" $FILE|tail -n1|tr / .)
-
-       if [ -z "$(egrep "$INTCOPY|$INTREPCOPY|$WHAMCOPY" <<<"$OLDCOPY")" ];
+       if [ -z "$(egrep "$INTCOPY|$INTREPCOPY|$INTERCOPY2|$WHAMCOPY"\
+                                                       <<<"$OLDCOPY")" ];
        then
                NEEDCOPY=true
-               OLDCOPY="$(egrep "$ORACOPY1|$ORACOPY2" $FILE| tail -n1| tr / .)"
-       elif [ ! -z "$(grep -e "$INTCOPY" <<<"$OLDCOPY")" ]; then
+               OLDCOPY="$(egrep "$XYRACOPY|$ORACOPY1|$ORACOPY2" $FILE |
+                                                       tail -n1 | tr / .)"
+       elif [ -n "$(grep -e "$INTCOPY" <<<"$OLDCOPY")" ]; then
                # Skip files that already have a copyright for this year
                echo "$OLDCOPY" | grep -q "$NOW" && continue
        fi
@@ -67,6 +83,11 @@ git ls-files $DIRS | grep -v ${0##*/} | while read FILE; do
        NEWYEAR=$(head -1 $TMPFILE)
        OLDYEAR=$(tail -1 $TMPFILE)
 
+       if [ "$NEWYEAR" -lt "$OLDYEAR" ]; then
+               echo "$FILE: ** YEAR INVERSION: INSPECT  **"
+               continue;
+       fi
+
        [ $NEWYEAR == $OLDYEAR ] && YEAR="$NEWYEAR" || YEAR="$OLDYEAR, $NEWYEAR"
        COMMENT=$(echo "$OLDCOPY" | sed -e "s/^\( *[^A-Z]*\) [A-Z].*/\1/")
        NEWCOPY=$(sed -e "s/^/$COMMENT /" -e "s/\.\*/ (c) $YEAR, /" <<<$INTCOPY)
@@ -76,6 +97,7 @@ git ls-files $DIRS | grep -v ${0##*/} | while read FILE; do
                echo "$FILE: *** EDIT MANUALLY ***"
                continue
        fi
+
        # If copyright is unchanged (excluding whitespace), we're done
        [ "$OLDCOPY" == "$NEWCOPY" ] && continue
 
@@ -93,9 +115,11 @@ git ls-files $DIRS | grep -v ${0##*/} | while read FILE; do
                echo "$FILE: Copyright $YEAR"
                # Replace the old copyright line with a new copyright
                sed -e "s/.*$INTREPCOPY/$NEWCOPY/" -e "s/.*$INTCOPY/$NEWCOPY/"\
-                        -e "s/.*$WHAMCOPY/$NEWCOPY/" $FILE > $FILE.tmp
+                  -e "s/.*$INTREPCOPY2/$NEWCOPY/" -e "s/.*$WHAMCOPY/$NEWCOPY/"\
+                                                       $FILE > $FILE.tmp
        fi
        [ -s $FILE.tmp ] && cp $FILE.tmp $FILE
        rm $FILE.tmp
+#exit
 done
 rm $TMPFILE