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
10 # Make sure you run this in a git checkout of deps/third_party/libvpx!
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:
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"
35 elif [[ $1 = http
* ]]; then
40 prev_hash
="$(egrep "^Commit
: [[:alnum
:]]" README.chromium | awk '{ print $2 }')"
41 echo "prev_hash:$prev_hash"
43 rm -rf $LIBVPX_SRC_DIR
47 # Start a local 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")
62 echo "Update README.chromium:"
63 echo "==============="
64 echo "Date: $(date +"%A
%B
%d
%Y
")"
67 echo "==============="
70 # Commit message header.
71 echo "Commit message:"
72 echo "==============="
73 echo "libvpx: Pull from upstream"
76 # Output the current commit hash.
77 echo "Current HEAD: $hash"
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 \
89 if [ -z "$pretty_git_log" ]; then
90 echo "No log found. Checking for reverts."
91 pretty_git_log
="$(git log \
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
105 # Commit message footer.
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.
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
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