|
| 1 | +Bruce Momjian <maillist@candle.pha.pa.us> |
| 2 | + |
| 3 | +Here are some of the scripts I use to make development easier. |
| 4 | + |
| 5 | +First, I use 'cpdir' on every file I am about to change. This makes a |
| 6 | +copy with the extension .orig. If an .orig already exists, I am warned. |
| 7 | + |
| 8 | +: |
| 9 | +# cporig |
| 10 | +for FILE |
| 11 | +do |
| 12 | +if [ ! -f "$FILE.orig" ] |
| 13 | +thencp $FILE $FILE.orig |
| 14 | +elseecho "$FILE.orig exists" 1>&2 |
| 15 | +fi |
| 16 | +done |
| 17 | + |
| 18 | +I can get really fancy with this. I can do 'cporig *' and make a .orig |
| 19 | +for every file in the current directory. I can: |
| 20 | + |
| 21 | +cporig `grep -l HeapTuple *` |
| 22 | + |
| 23 | +If I use mkid (from ftp.postgreSQL.org), I can do: |
| 24 | + |
| 25 | +cporig `lid -kn 'fsyncOff'` |
| 26 | + |
| 27 | +and get a copy of every file containing that word. I can then do: |
| 28 | + |
| 29 | +vi `find . -name '*.orig'` |
| 30 | + |
| 31 | +or even better (using mkid): |
| 32 | + |
| 33 | +eid fsyncOff |
| 34 | + |
| 35 | +to edit all those files. |
| 36 | + |
| 37 | +When I am ready to generate a patch, I run this command from the top of |
| 38 | +the source tree: |
| 39 | + |
| 40 | +: |
| 41 | +#difforig |
| 42 | +if [ "$#" -eq 0 ] |
| 43 | +thenAPATH="." |
| 44 | +elseAPATH="$1" |
| 45 | +fi |
| 46 | +find $APATH -name '*.orig' -print | sort | while read FILE |
| 47 | +do |
| 48 | +NEW="`dirname $FILE`/`basename $FILE .orig`" |
| 49 | +echo "$NEW" 1>&2 |
| 50 | +diff -c $FILE $NEW |
| 51 | +done |
| 52 | + |
| 53 | +I pipe the output of this to a file to hold my patch, and the file names |
| 54 | +it processes appear on my screen. It creates a nice patch for me of all |
| 55 | +the files I used with cporig. |
| 56 | + |
| 57 | +Finally, I remove my old copies with: |
| 58 | + |
| 59 | +: |
| 60 | +# rmorig |
| 61 | +if [ "$#" -eq 0 ] |
| 62 | +thenAPATH="." |
| 63 | +elseAPATH="$1" |
| 64 | +fi |
| 65 | +find $APATH -name '*.orig' -exec rm {} \; |
| 66 | + |