OLD | NEW |
(Empty) | |
| 1 #!/bin/bash -e |
| 2 # |
| 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. |
| 6 |
| 7 # This tool is used to update libvpx source code with the latest git |
| 8 # repository. |
| 9 # |
| 10 # Make sure you run this in a git checkout of deps/third_party/libvpx! |
| 11 |
| 12 # Usage: |
| 13 # |
| 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/ |
| 16 |
| 17 # Tools required for running this tool: |
| 18 # |
| 19 # 1. Linux / Mac |
| 20 # 2. git |
| 21 |
| 22 export LC_ALL=C |
| 23 |
| 24 # Location for the remote git repository. |
| 25 GIT_REPO="https://chromium.googlesource.com/webm/libvpx" |
| 26 |
| 27 GIT_BRANCH="origin/master" |
| 28 LIBVPX_SRC_DIR="source/libvpx" |
| 29 BASE_DIR=`pwd` |
| 30 |
| 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` |
| 37 fi |
| 38 fi |
| 39 |
| 40 prev_hash="$(egrep "^Commit: [[:alnum:]]" README.chromium | awk '{ print $2 }')" |
| 41 echo "prev_hash:$prev_hash" |
| 42 |
| 43 rm -rf $LIBVPX_SRC_DIR |
| 44 mkdir $LIBVPX_SRC_DIR |
| 45 cd $LIBVPX_SRC_DIR |
| 46 |
| 47 # Start a local git repo. |
| 48 git clone $GIT_REPO . |
| 49 |
| 50 # Switch the content to the latest git repo. |
| 51 git checkout -b tot $GIT_BRANCH |
| 52 |
| 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\ )" |
| 57 |
| 58 # Get the current commit hash. |
| 59 hash=$(git log -1 --format="%H") |
| 60 |
| 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 "" |
| 69 |
| 70 # Commit message header. |
| 71 echo "Commit message:" |
| 72 echo "===============" |
| 73 echo "libvpx: Pull from upstream" |
| 74 echo "" |
| 75 |
| 76 # Output the current commit hash. |
| 77 echo "Current HEAD: $hash" |
| 78 echo "" |
| 79 |
| 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)" |
| 97 fi |
| 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 "<...>" |
| 102 fi |
| 103 fi |
| 104 |
| 105 # Commit message footer. |
| 106 echo "" |
| 107 echo "TBR=tomfinegan@chromium.org" |
| 108 echo "===============" |
| 109 |
| 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 |
| 113 |
| 114 # Add and remove files. |
| 115 echo "$add" | xargs -I {} git add {} |
| 116 echo "$delete" | xargs -I {} git rm --ignore-unmatch {} |
| 117 |
| 118 # Find empty directories and remove them. |
| 119 find . -type d -empty -exec git rm {} \; |
| 120 |
| 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 |
| 124 |
| 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 {}) |
| 130 |
| 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 |
| 135 fi |
| 136 |
| 137 cd $BASE_DIR |
OLD | NEW |