• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
15function 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
21valgrind_svn_url="svn://svn.valgrind.org/valgrind/trunk"
22vex_svn_url="svn://svn.valgrind.org/vex/trunk"
23
24current_dir=`realpath \`dirname $0\``
25valgrind_dir=$current_dir/main
26vex_dir=$valgrind_dir/VEX
27
28valgrind_revision=`cat $current_dir/upstream.revs.txt | grep "val: " | sed "s/val: //"`
29vex_revision=`cat $current_dir/upstream.revs.txt | grep "vex: " | sed "s/vex: //"`
30
31echo "Current revisions (from upstream.revs.txt): "
32echo "  valgrind: $valgrind_revision"
33echo "  vex     : $vex_revision"
34
35if [ -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
39fi
40
41upstream_valgrind_revision=$(get_remote_revision $valgrind_svn_url)
42upstream_vex_revision=$(get_remote_revision $vex_svn_url)
43
44echo "Upstream revisions: "
45echo "  valgrind: $upstream_valgrind_revision"
46echo "  vex     : $upstream_vex_revision"
47
48if [ $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
52fi
53
54if [ $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
58fi
59
60echo "val: $upstream_valgrind_revision" > $current_dir/upstream.revs.txt
61echo "vex: $upstream_vex_revision" >> $current_dir/upstream.revs.txt
62
63echo "Done: please do not forget to"
64echo " 1. Check $current_dir/merge.log for possible merge issues"
65echo " 2. Test the build and make adjustments to $current_dir/main/Android.mk if neccessary"
66
67