michael@0: #!/bin/bash michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: # file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: # Usage: update-breakpad.sh michael@0: michael@0: if [ $# -lt 1 ]; then michael@0: echo "Usage: update-breakpad.sh /path/to/google-breakpad/" michael@0: exit 1 michael@0: fi michael@0: michael@0: crashreporter_dir=`dirname $0` michael@0: repo=${crashreporter_dir}/../.. michael@0: rm -rf ${crashreporter_dir}/google-breakpad michael@0: svn export $1 ${crashreporter_dir}/google-breakpad michael@0: michael@0: # remove some extraneous bits michael@0: rm -rf ${crashreporter_dir}/google-breakpad/src/third_party/protobuf ${crashreporter_dir}/google-breakpad/src/testing/ ${crashreporter_dir}/google-breakpad/src/tools/gyp/ michael@0: # restore our Makefile.ins michael@0: hg -R ${repo} st -n | grep "Makefile\.in$" | xargs hg revert --no-backup michael@0: # and moz.build files michael@0: hg -R ${repo} st -n | grep "moz\.build$" | xargs hg revert --no-backup michael@0: # and some other makefiles michael@0: hg -R ${repo} st -n | grep "objs\.mk$" | xargs hg revert --no-backup michael@0: michael@0: # Record `svn info` michael@0: svn info $1 > ${crashreporter_dir}/google-breakpad/SVN-INFO michael@0: michael@0: # Apply any local patches michael@0: shopt -s nullglob michael@0: for p in ${crashreporter_dir}/breakpad-patches/*.patch; do michael@0: if grep -q -e "--git" $p; then michael@0: patch_opts="-p1" michael@0: else michael@0: patch_opts="-p0" michael@0: fi michael@0: echo "Applying $p" michael@0: if ! filterdiff -x '*/Makefile*' $p | \ michael@0: patch -d ${crashreporter_dir}/google-breakpad ${patch_opts}; then michael@0: echo "Failed to apply $p" michael@0: exit 1 michael@0: fi michael@0: done michael@0: # remove any .orig files that snuck in michael@0: find ${crashreporter_dir}/google-breakpad -name "*.orig" -print0 | xargs -0 rm michael@0: michael@0: hg addremove ${crashreporter_dir}/google-breakpad/