2006-11-18 19:02:30 +01:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# This script makes a patch for LLVM ensuring the correct diff options and
|
|
|
|
# putting the files in a standard review order.
|
|
|
|
|
|
|
|
|
|
|
|
function error {
|
|
|
|
retcode="$?"
|
|
|
|
echo "mkpatch: error: $1 ($retcode)"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ ! -e llvm.spec.in ] ; then
|
|
|
|
error "Please change directory to the LLVM top source directory"
|
|
|
|
fi
|
|
|
|
if [ "$#" -ne 1 ] ; then
|
|
|
|
error "usage: utils/mkpatch [PATCH_NAME]"
|
|
|
|
fi
|
|
|
|
NAME="$1"
|
|
|
|
echo "mkpatch: Generating differences on top level files"
|
2007-07-20 19:21:54 +02:00
|
|
|
svn diff -N -x -u > "$NAME".patch.raw 2>&1
|
2006-11-18 19:02:30 +01:00
|
|
|
echo "mkpatch: Generating differences on all directories"
|
2007-07-09 09:41:11 +02:00
|
|
|
svn diff -x -u >> "$NAME".patch.raw 2>&1 \
|
2006-11-18 19:02:30 +01:00
|
|
|
autoconf docs utils include lib/System lib/Support lib/VMCore lib/AsmParser \
|
2007-07-20 19:21:54 +02:00
|
|
|
lib/Bitcode lib/Analysis lib/Transforms lib/CodeGen lib/Target \
|
2006-11-18 19:02:30 +01:00
|
|
|
lib/ExecutionEngine lib/Debugger lib/Linker \
|
2009-01-01 03:24:48 +01:00
|
|
|
tools test unittests runtime projects examples win32 Xcode
|
2006-11-18 19:02:30 +01:00
|
|
|
|
|
|
|
echo "mkpatch: Removing cruft from the patch file"
|
2007-01-17 04:38:22 +01:00
|
|
|
sed -e '/^[?] .*/d' -e '/^cvs diff: Diffing/d' "$NAME".patch.raw | awk '\
|
2006-11-18 19:02:30 +01:00
|
|
|
BEGIN { deleting = 0; } \
|
2007-01-11 07:51:56 +01:00
|
|
|
/^Index: .*[.]cvs$/ { deleting = 1; fname=substr($0,7); \
|
2006-11-18 19:30:18 +01:00
|
|
|
print "Skipping: ", fname > "/dev/stderr"; } \
|
2006-11-18 19:02:30 +01:00
|
|
|
/^Index:.*/ && !/^Index: .*[.]cvs$/ { deleting = 0; } \
|
2007-01-16 23:41:12 +01:00
|
|
|
{ if (! deleting) { print; } } ' > "$NAME".patch || \
|
|
|
|
error "sed/awk cleanup failed"
|
2006-11-18 19:02:30 +01:00
|
|
|
|