Reid Spencer | 35d958c | 2006-11-18 18:02:30 +0000 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # This script makes a patch for LLVM ensuring the correct diff options and |
| 4 | # putting the files in a standard review order. |
| 5 | |
| 6 | |
| 7 | function error { |
| 8 | retcode="$?" |
| 9 | echo "mkpatch: error: $1 ($retcode)" |
| 10 | exit 1 |
| 11 | } |
| 12 | |
| 13 | if [ ! -e llvm.spec.in ] ; then |
| 14 | error "Please change directory to the LLVM top source directory" |
| 15 | fi |
| 16 | if [ "$#" -ne 1 ] ; then |
| 17 | error "usage: utils/mkpatch [PATCH_NAME]" |
| 18 | fi |
| 19 | NAME="$1" |
| 20 | echo "mkpatch: Generating differences on top level files" |
| 21 | cvs diff -l -Ntdup -5 . > "$NAME".patch.raw 2>&1 |
| 22 | echo "mkpatch: Generating differences on all directories" |
| 23 | cvs diff -Ntdup -5 >> "$NAME".patch.raw 2>&1 \ |
| 24 | autoconf docs utils include lib/System lib/Support lib/VMCore lib/AsmParser \ |
| 25 | lib/Bytecode lib/Analysis lib/Transforms lib/CodeGen lib/Target \ |
| 26 | lib/ExecutionEngine lib/Debugger lib/Linker \ |
| 27 | tools test runtime projects examples win32 Xcode |
| 28 | |
| 29 | echo "mkpatch: Removing cruft from the patch file" |
| 30 | sed "$NAME".patch.raw -e '/^[?] .*/d' -e '/^cvs diff: Diffing/d' | awk '\ |
| 31 | BEGIN { deleting = 0; } \ |
| 32 | /^Index: .*[.]cvs$/ { deleting = 1; } \ |
| 33 | /^Index:.*/ && !/^Index: .*[.]cvs$/ { deleting = 0; } \ |
| 34 | { if (! deleting) { print; } } \ |
| 35 | ' > "$NAME".patch || error "sed/awk cleanup failed" |
| 36 | |