Roll src/third_party/WebKit a3b4a2e:7441784 (svn 202551:202552)
[chromium-blink-merge.git] / third_party / libvpx_new / update_libvpx.sh
blob56926bc40780114bc0605e26e671ba59b3df4177
1 #!/bin/bash -e
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
7 # This tool is used to update libvpx source code with the latest git
8 # repository.
10 # Make sure you run this in a git checkout of deps/third_party/libvpx!
12 # Usage:
14 # $ ./update_libvpx.sh [branch | revision | file or url containing a revision]
15 # When specifying a branch it may be necessary to prefix with origin/
17 # Tools required for running this tool:
19 # 1. Linux / Mac
20 # 2. git
22 export LC_ALL=C
24 # Location for the remote git repository.
25 GIT_REPO="https://chromium.googlesource.com/webm/libvpx"
27 GIT_BRANCH="origin/master"
28 LIBVPX_SRC_DIR="source/libvpx"
29 BASE_DIR=`pwd`
31 if [ -n "$1" ]; then
32 GIT_BRANCH="$1"
33 if [ -f "$1" ]; then
34 GIT_BRANCH=$(<"$1")
35 elif [[ $1 = http* ]]; then
36 GIT_BRANCH=`curl $1`
40 prev_hash="$(egrep "^Commit: [[:alnum:]]" README.chromium | awk '{ print $2 }')"
41 echo "prev_hash:$prev_hash"
43 rm -rf $LIBVPX_SRC_DIR
44 mkdir $LIBVPX_SRC_DIR
45 cd $LIBVPX_SRC_DIR
47 # Start a local git repo.
48 git clone $GIT_REPO .
50 # Switch the content to the latest git repo.
51 git checkout -b tot $GIT_BRANCH
53 add="$(git diff-index --diff-filter=A $prev_hash | grep -v vp10/ | \
54 tr -s [:blank:] ' ' | cut -f6 -d\ )"
55 delete="$(git diff-index --diff-filter=D $prev_hash | grep -v vp10/ | \
56 tr -s [:blank:] ' ' | cut -f6 -d\ )"
58 # Get the current commit hash.
59 hash=$(git log -1 --format="%H")
61 # README reminder.
62 echo "Update README.chromium:"
63 echo "==============="
64 echo "Date: $(date +"%A %B %d %Y")"
65 echo "Branch: master"
66 echo "Commit: $hash"
67 echo "==============="
68 echo ""
70 # Commit message header.
71 echo "Commit message:"
72 echo "==============="
73 echo "libvpx: Pull from upstream"
74 echo ""
76 # Output the current commit hash.
77 echo "Current HEAD: $hash"
78 echo ""
80 # Output log for upstream from current hash.
81 if [ -n "$prev_hash" ]; then
82 echo "git log from upstream:"
83 pretty_git_log="$(git log \
84 --no-merges \
85 --topo-order \
86 --pretty="%h %s" \
87 --max-count=20 \
88 $prev_hash..$hash)"
89 if [ -z "$pretty_git_log" ]; then
90 echo "No log found. Checking for reverts."
91 pretty_git_log="$(git log \
92 --no-merges \
93 --topo-order \
94 --pretty="%h %s" \
95 --max-count=20 \
96 $hash..$prev_hash)"
98 echo "$pretty_git_log"
99 # If it makes it to 20 then it's probably skipping even more.
100 if [ `echo "$pretty_git_log" | wc -l` -eq 20 ]; then
101 echo "<...>"
105 # Commit message footer.
106 echo ""
107 echo "TBR=tomfinegan@chromium.org"
108 echo "==============="
110 # Git is useless now, remove the local git repo.
111 # Remove vp10 to cut down on code churn since it is not currently built.
112 rm -rf .git vp10
114 # Add and remove files.
115 echo "$add" | xargs -I {} git add {}
116 echo "$delete" | xargs -I {} git rm --ignore-unmatch {}
118 # Find empty directories and remove them.
119 find . -type d -empty -exec git rm {} \;
121 # Mark the scripts as executable so presubmit doesn't complain. The important
122 # ones already have the x bit set but some of the files they include do not.
123 chmod 755 build/make/*.sh build/make/*.pl configure
125 # The build system doesn't support files with the same name. Search vp8, vp9 and vpx_dsp
126 # for such files.
127 duplicate_files=$(find vp8 vp9 vpx_dsp -type f | xargs basename | sort | uniq -d | \
128 egrep -v '(^exports_(dec|enc)|\.h)$' | \
129 xargs -I {} find vp8 vp9 vpx_dsp -name {})
131 if [ -n "$duplicate_files" ]; then
132 echo "WARNING: DUPLICATE FILES FOUND"
133 echo "It would be a good idea to resolve these before attempting to roll"
134 echo $duplicate_files
137 cd $BASE_DIR