home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: Product / Product.zip / ISPSRC.ZIP / Makepatch < prev    next >
Text File  |  1992-08-14  |  3KB  |  128 lines

  1. : Use /bin/sh
  2. #
  3. # $Id: Makepatch,v 1.4 91/07/27 20:48:10 geoff Exp $
  4. #
  5. # Copyright 1991, by Geoff Kuenning, Manhattan Beach, CA
  6. # Permission for non-profit use is hereby granted.
  7. # All other rights reserved.
  8. # See "version.h" for a more complete copyright notice.
  9. #
  10. # $Log:    Makepatch,v $
  11. # Revision 1.4  91/07/27  20:48:10  geoff
  12. # Add special code so that dictionary patches are distributed as regular
  13. # diffs, rather than context diffs.
  14. # Revision 1.3  91/07/05  17:05:31  geoff
  15. # Quote still less on destdir;  sh is sure dumb!
  16. # Revision 1.2  91/07/05  17:01:28  geoff
  17. # Fix some overeager quoting
  18. # Revision 1.1  91/06/23  22:20:18  geoff
  19. # Initial revision
  20. #
  21. #    Make an ispell patch kit.  This is not a clever script,
  22. #    just a handy one.
  23. #
  24. #    Usage:
  25. #
  26. #    Makepatch [-d destdir] [new-files]
  27. #
  28. #    destdir is the directory in which the kits and patches are kept.
  29. #
  30. #    new-files are any new files to be added to the distribution.
  31. #
  32. destdir=kits
  33. USAGE="Usage:  Makepatch [-d destdir] [new-files]"
  34.  
  35. while [ $# -gt 0 ]
  36. do
  37.     case "$1" in
  38.     -d)
  39.         destdir="$2"
  40.         shift; shift
  41.         ;;
  42.     -*)
  43.         echo "$USAGE" 1>&2
  44.         exit 1
  45.         ;;
  46.     *)
  47.         break
  48.         ;;
  49.     esac
  50. done
  51.  
  52. [ -d "$destdir" ]  ||  mkdir "$destdir"
  53.  
  54. if [ -r "$destdir/Patch1" ]
  55. then
  56.     if [ -r "$destdir/Patch9" ]
  57.     then
  58.     lastpatch=`ls $destdir/Patch?? | tail -1 | sed "s;$destdir/Patch;;"`
  59.     else
  60.     lastpatch=`ls $destdir/Patch? | tail -1 | sed "s;$destdir/Patch;;"`
  61.     fi
  62. else
  63.     lastpatch=0
  64. fi
  65.  
  66. patchno=`expr $lastpatch + 1`
  67. patchfile="$destdir/Patch$patchno"
  68.  
  69. echo 'Index: version.h' > "$patchfile"
  70. prereq=`co -rpatch$lastpatch -p RCS/version.h \
  71.   | sed -n -e 's/ (beta).*$//' -e 's/^.*International Ispell Version //p'`
  72. echo "Prereq: $prereq" >> "$patchfile"
  73. echo "" >> "$patchfile"
  74. lastrev=`rlog -h version.h | sed -n 's/head:[     ]*//p'`
  75. rcs -Npatch$patchno:$lastrev version.h
  76. rcsdiff -rpatch$lastpatch -rpatch$patchno version.h >> "$patchfile"
  77.  
  78. for i in RCS/*,v
  79. do
  80.     lastrev=`rlog -h $i | sed -n 's/head:[     ]*//p'`
  81.     rcs -Npatch$patchno:$lastrev $i
  82.     case "$i" in
  83.     RCS/version.h,v)
  84.         ;;
  85.     *)
  86.         changes=`rcsdiff -rpatch$lastpatch -rpatch$patchno $i 2>Makepatch \
  87.           | sed 1q`
  88.         case "$changes" in
  89.         '')
  90.             ;;
  91.         *)
  92.             case "$i" in
  93.             RCS/english.[012],v|RCS/american.[012],v)
  94.                 context=
  95.                 ;;
  96.             RCS/altamer.[012],v|RCS/british.[012],v)
  97.                 context=
  98.                 ;;
  99.             *)
  100.                 context=-c
  101.                 ;;
  102.             esac
  103.             echo "" >> "$patchfile"
  104.             basefile=`expr $i : 'RCS/\(.*\),v'`
  105.             echo "Index: $basefile" >> "$patchfile"
  106.             echo "" >> "$patchfile"
  107.             rcsdiff $context -rpatch$lastpatch -rpatch$patchno $i \
  108.               >> "$patchfile"
  109.             ;;
  110.         esac
  111.     esac
  112. done
  113.  
  114. #
  115. # Do new files
  116. #
  117. for i
  118. do
  119.     echo "" >> "$patchfile"
  120.     echo "Index: $i" >> "$patchfile"
  121.     echo "" >> "$patchfile"
  122.     diff -c Makepatch $i | sed "s;/dev/null;$i;" >> "$patchfile"
  123. done
  124.