1 # Copyright (C) 2014 The Android Open Source Project 2 # 3 # Licensed under the Apache License, Version 2.0 (the 'License'); 4 # you may not use this file except in compliance with the License. 5 # You may obtain a copy of the License at 6 # 7 # http://www.apache.org/licenses/LICENSE-2.0 8 # 9 # Unless required by applicable law or agreed to in writing, software 10 # distributed under the License is distributed on an 'AS IS' BASIS, 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 # See the License for the specific language governing permissions and 13 # limitations under the License. 14 15 function get_remote_revision() { 16 local repo_url=$1 17 # echo "svn info $repo_url | grep \"Revision: \" | sed \"s/Revision: //\"" 18 echo `svn info $repo_url | grep "Revision: " | sed "s/Revision: //"` 19 } 20 21 valgrind_svn_url="svn://svn.valgrind.org/valgrind/trunk" 22 vex_svn_url="svn://svn.valgrind.org/vex/trunk" 23 24 current_dir=`realpath \`dirname $0\`` 25 valgrind_dir=$current_dir/main 26 vex_dir=$valgrind_dir/VEX 27 28 valgrind_revision=`cat $current_dir/upstream.revs.txt | grep "val: " | sed "s/val: //"` 29 vex_revision=`cat $current_dir/upstream.revs.txt | grep "vex: " | sed "s/vex: //"` 30 31 echo "Current revisions (from upstream.revs.txt): " 32 echo " valgrind: $valgrind_revision" 33 echo " vex : $vex_revision" 34 35 if [ -z valgrind_revision -o -z vex_revision ]; then 36 echo "Error: File upstream.revs.txt file does not exist or has invalid format" 37 echo "Expecting 'val: <revision number>' and 'vex: <revision number>'" 38 exit -1 39 fi 40 41 upstream_valgrind_revision=$(get_remote_revision $valgrind_svn_url) 42 upstream_vex_revision=$(get_remote_revision $vex_svn_url) 43 44 echo "Upstream revisions: " 45 echo " valgrind: $upstream_valgrind_revision" 46 echo " vex : $upstream_vex_revision" 47 48 if [ $upstream_valgrind_revision -gt $valgrind_revision ]; then 49 echo "Merging valgrind... (in $valgrind_dir)" | tee $current_dir/merge.log 50 cd $valgrind_dir 51 svn diff -r$valgrind_revision:$upstream_valgrind_revision $valgrind_svn_url | patch -Ep0 | tee -a $current_dir/merge.log 52 fi 53 54 if [ $upstream_vex_revision -gt $vex_revision ]; then 55 echo "Merging vex... (in $vex_dir)" | tee -a $current_dir/merge.log 56 cd $vex_dir 57 svn diff -r$vex_revision:$upstream_vex_revision $vex_svn_url | patch -Ep0 | tee -a $current_dir/merge.log 58 fi 59 60 echo "val: $upstream_valgrind_revision" > $current_dir/upstream.revs.txt 61 echo "vex: $upstream_vex_revision" >> $current_dir/upstream.revs.txt 62 63 echo "Done: please do not forget to" 64 echo " 1. Check $current_dir/merge.log for possible merge issues" 65 echo " 2. Test the build and make adjustments to $current_dir/main/Android.mk if neccessary" 66 67