1 #!/bin/bash 2 # 3 # Copyright 2012 Google Inc. All Rights Reserved. 4 # Author: keir (at] google.com (Keir Mierle) 5 # 6 # Import the latest version of Ceres into google3. 7 8 set -e 9 set -x 10 11 if [[ "google3" != "$(basename $(pwd))" ]] ; then 12 echo "ERROR: Not in toplevel google3 directory. Bailing." 13 exit 1 14 fi 15 16 declare -r google3_dir="$(pwd)" 17 18 declare -r temp_repo="/tmp/ceres-solver" 19 rm -rf $temp_repo 20 git clone \ 21 https://ceres-solver.googlesource.com/ceres-solver \ 22 $temp_repo 23 24 cd $temp_repo 25 declare -r commit="$(git log | head -1 | cut -d ' ' -f2)" 26 rm -rf .git 27 28 # Get rid of the internal gtest and gmock code until the upstream 29 # version moves it around appropriately. 30 rm -rf internal/ceres/gtest* 31 rm -rf internal/ceres/gmock* 32 rm -rf internal/ceres/mock_log.h 33 34 cd $google3_dir 35 cp -R $temp_repo/* third_party/ceres 36 37 cd third_party/ceres 38 39 declare -r temp_readme="/tmp/README.google" 40 rm -f $temp_readme 41 42 echo "URL: https://ceres-solver.googlesource.com/ceres-solver/+archive/$commit.tar.gz" >> $temp_readme 43 echo "Version: $commit" >> $temp_readme 44 tail -n +3 README.google >> $temp_readme 45 cp $temp_readme README.google 46