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