]> git.ipfire.org Git - thirdparty/gcc.git/blame - libsanitizer/merge.sh
Merge ubsan into trunk.
[thirdparty/gcc.git] / libsanitizer / merge.sh
CommitLineData
36a69f19 1#!/bin/bash
2
3# FIXME: do we need a license (or whatever else) header here?
4
5# This script merges libsanitizer sources from upstream.
6
7get_upstream() {
8 rm -rf upstream
9 #cp -rf orig upstream
10 svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk upstream
11}
12
13get_current_rev() {
14 cd upstream
15 svn info | grep Revision | grep -o '[0-9]*'
16}
17
18list_files() {
4a2c1ffc 19 (cd $1; ls *.{cc,h,inc} 2> /dev/null)
36a69f19 20
21}
22
23change_comment_headers() {
24 for f in $(list_files $1); do
25 changed=$(awk 'NR != 2 && NR != 3' < $1/$f)
26 echo "$changed" > $1/$f
27 done
28}
29
30# ARGUMENTS: upstream_path local_path
31# This function merges changes from the directory upstream_path to
32# the directory local_path.
33merge() {
34 upstream_path=upstream/$1
35 local_path=$2
36 change_comment_headers $upstream_path
37 echo MERGE: $upstream_path
38 all=$( (list_files $upstream_path; list_files $local_path) | sort | uniq)
39 #echo $all
40 for f in $all; do
41 if [ -f $upstream_path/$f -a -f $local_path/$f ]; then
42 echo "FOUND IN BOTH :" $f
43 # diff -u $local_path/$f $upstream_path/$f
44 cp -v $upstream_path/$f $local_path
45 elif [ -f $upstream_path/$f ]; then
46 echo "FOUND IN UPSTREAM :" $f
0d996a11 47 cp -v $upstream_path/$f $local_path
48 svn add $local_path/$f
36a69f19 49 elif [ -f $local_path/$f ]; then
50 echo "FOUND IN LOCAL :" $f
0d996a11 51 svn remove $local_path/$f
36a69f19 52 fi
53 done
54
55}
56
57fatal() {
58 echo "$1"
59 exit 1;
60}
61
62pwd | grep 'libsanitizer$' || \
63 fatal "Run this script from libsanitizer dir"
64get_upstream
65CUR_REV=$(get_current_rev)
66echo Current upstream revision: $CUR_REV
67merge include/sanitizer include/sanitizer
68merge lib/asan asan
0d996a11 69merge lib/tsan/rtl tsan
36a69f19 70merge lib/sanitizer_common sanitizer_common
71merge lib/interception interception
9e46467d 72merge lib/ubsan ubsan
36a69f19 73
74rm -rf upstream
75
76# Update the MERGE file.
77cat << EOF > MERGE
78$CUR_REV
79
80The first line of this file holds the svn revision number of the
81last merge done from the master library sources.
82EOF