Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Side by Side Diff: update_google_patch.sh

Issue 306793002: [hunspell] Script to automatically generate google.patch (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/hunspell.git@master
Patch Set: Added license header. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « README.chromium ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/bin/bash
2
3 # Copyright (c) 2014 The Chromium Authors. All rights reserved.
brettw 2014/05/29 17:06:17 Remove the "(c)" (see http://www.chromium.org/dev
groby-ooo-7-16 2014/05/29 17:37:48 Done.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
6
7 # Creates an updated google.patch that reflects all checked-in changes in the
brettw 2014/05/29 17:06:17 Got two spaces after "in" Can this list some more
groby-ooo-7-16 2014/05/29 17:37:48 Done. (Two spaces after in - comment discussion mo
8 # current branch.
9 cvs_dir=""
10
11 tempfiles=( )
12 tmplate="/tmp/`basename $0`.XXXXXX"
13
14 function cleanup() {
15 if [[ $cvs_dir ]]; then
16 rm -r "${cvs_dir}"
17 fi
18
19 if [[ ${tempfiles[@]} ]]; then
20 rm "${tempfiles[@]}"
21 fi
22 cd ${starting_dir}
23 }
24
25 trap cleanup 0
26
27 # Generate a temp file and register it for cleanup
28 function tempfile() {
29 local result=$1
30 local tmpfile=$(mktemp ${tmplate}) || exit 1
31 tempfiles+=( "${tmpfile}" )
32 eval $result="'$tmpfile'"
33 }
34
35 starting_dir=$(pwd)
36 hunspell_dir=$(dirname $(readlink -e $0))
37 tempfile filter_file
38
39 # Temp file with a list of all excluded files
40 cat << EOF > ${filter_file}
41 google.patch
42 update_google_patch.sh
43 README.chromium
44 EOF
45
46 # List of all files changed relative to upstream
47 changed_files=$(git --no-pager diff @{u} --name-status | grep -vf ${filter_file} )
48
49 # Check we don't actually have files that are added or deleted, because
50 # that can't be handled by the read-only CVS checkout.
51 added_files=$( echo "${changed_files}" | grep "^A")
52 if [[ ${added_files} ]] ; then
53 echo "Script cannot handle added files"
54 exit 1
55 fi
56 deleted_files=$( echo "${changed_files}" | grep "^D")
57 if [[ ${deleted_files} ]] ; then
58 echo "Script cannot handle deleted files"
59 exit 1
60 fi
61
62 # Generate patch between branch point and current status.
63 diff_files=$( echo "${changed_files}" | grep "^M" | cut -f1 --complement )
64 tempfile local_patch_file
65 echo "${diff_files}" | xargs -IXX git --no-pager diff --no-prefix @{u} -- XX > $ {local_patch_file}
66
67 # Create copy of google.patch at branch point version.
68 tempfile google_patch_file
69 git show @{u}:google.patch > ${google_patch_file}
70
71 # Create a temporary checkout for hunspell
72 cvs_dir=$(mktemp -d ${tmplate}) || exit 1
73
74 # Get hunspell
75 cd ${cvs_dir}
76 echo Checking out CVS version.
77 cvs -z3 \
78 -qd:pserver:anonymous@hunspell.cvs.sourceforge.net:/cvsroot/hunspell \
79 co -D "23 Mar 2012" -P hunspell
80
81 # Apply both google.patch and changes in the current branch
82 cd hunspell
83 echo Applying google.patch.
84 patch -p0 -i ${google_patch_file}
85 echo Applying local patch.
86 patch -p0 -i ${local_patch_file}
87
88 # And generate a new google.patch
89 echo Updating google.patch.
90 cvs -q diff -u > ${hunspell_dir}/google.patch
91
OLDNEW
« no previous file with comments | « README.chromium ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698