3 # Usage: ./update.sh [<git-rev-to-use>]
5 # Copies the needed files from a directory containing the original
6 # double-conversion source that we need. If no revision is specified, the tip
7 # revision is used. See GIT-INFO for the last revision used.
13 LOCAL_PATCHES
="$LOCAL_PATCHES add-mfbt-api-markers.patch"
14 LOCAL_PATCHES
="$LOCAL_PATCHES use-mozilla-assertions.patch"
15 LOCAL_PATCHES
="$LOCAL_PATCHES debug-only-functions.patch"
16 LOCAL_PATCHES
="$LOCAL_PATCHES to-fixed-dbl-max.patch"
19 LOCAL_CLONE
="$TMPDIR/new-double-conversion"
21 git clone https
://github.com
/google
/double-conversion.git
"$LOCAL_CLONE"
23 # If a particular revision was requested, check it out.
24 if [ "$1" != "" ]; then
25 git
-C "$LOCAL_CLONE" checkout
"$1"
28 # First clear out everything already present.
29 DEST
=.
/double-conversion
30 mv "$DEST" "$TMPDIR"/old-double-conversion
33 # Copy over critical files.
34 cp "$LOCAL_CLONE/LICENSE" "$DEST/"
35 cp "$LOCAL_CLONE/README.md" "$DEST/"
38 for header
in "$LOCAL_CLONE/double-conversion/"*.h
; do
43 for ccfile
in "$LOCAL_CLONE/double-conversion/"*.cc
; do
47 # Now apply our local patches.
48 for patch in $LOCAL_PATCHES; do
49 patch --directory "$DEST" --strip 4 < "$patch"
51 # Out-of-date patches may spew *.{orig,rej} when applied. Report an error if
52 # any such file is found, and roll the source directory back to its previous
54 detritus_files
=`find "$DEST" -name '*.orig' -o -name '*.rej'`
55 if [ "$detritus_files" != "" ]; then
56 echo "ERROR: Local patch $patch created these detritus files when applied:"
58 echo " $detritus_files"
60 echo "Please fix $patch before running $0."
63 mv "$TMPDIR"/source "$DEST"
69 # Update Mercurial file status.
72 # Note the revision used in this update.
73 git
-C "$LOCAL_CLONE" show
-s > .
/GIT-INFO