|
| 1 | +#!/bin/bash |
| 2 | +# Copyright (c) 2013, Facebook, Inc. All rights reserved. |
| 3 | +# This source code is licensed under the BSD-style license found in the |
| 4 | +# LICENSE file in the root directory of this source tree. An additional grant |
| 5 | +# of patent rights can be found in the PATENTS file in the same directory. |
| 6 | + |
| 7 | +set -e |
| 8 | +# Print out the colored progress info so that it can be brainlessly |
| 9 | +# distinguished by users. |
| 10 | +function title() { |
| 11 | + echo -e "\033[1;32m$*\033[0m" |
| 12 | +} |
| 13 | + |
| 14 | +usage="Create new rocksdb version and prepare it for the release process\n" |
| 15 | +usage+="USAGE: ./make_new_version.sh <version>" |
| 16 | + |
| 17 | +# -- Pre-check |
| 18 | +if [[ $# < 1 ]]; then |
| 19 | + echo -e $usage |
| 20 | + exit 1 |
| 21 | +fi |
| 22 | + |
| 23 | +ROCKSDB_VERSION=$1 |
| 24 | + |
| 25 | +GIT_BRANCH=`git rev-parse --abbrev-ref HEAD` |
| 26 | +if [ $GIT_BRANCH != "master" ]; then |
| 27 | + echo "Error: Current branch is '$GIT_BRANCH', Please switch to master branch." |
| 28 | +fi |
| 29 | + |
| 30 | +# --Step 1: cutting new tag |
| 31 | +title "Adding new tag for this release ..." |
| 32 | +git tag -a "$ROCKSDB_VERSION.fb" -m "Rocksdb $ROCKSDB_VERSION" |
| 33 | + |
| 34 | +# Setting up the proxy for remote repo access |
| 35 | +export http_proxy=http://172.31.255.99:8080 |
| 36 | +export https_proxy="$http_proxy"; |
| 37 | + |
| 38 | +title "Pushing new tag to remote repo ..." |
| 39 | +proxycmd.sh git push origin --tags |
| 40 | + |
| 41 | +# --Step 2: Update README.fb |
| 42 | +title "Updating the latest version info in README.fb ..." |
| 43 | +sed -i "s/Latest release is [0-9]\+.[0-9]\+.fb/Latest release is $ROCKSDB_VERSION.fb/" README.fb |
| 44 | +git commit README.fb -m "update the latest version in README.fb to $ROCKSDB_VERSION" |
| 45 | +proxycmd.sh git push |
| 46 | + |
| 47 | +# --Step 3: Prepare this repo for 3rd release |
| 48 | +title "Cleaning up repo ..." |
| 49 | +make clean |
| 50 | +git clean -fxd |
| 51 | + |
| 52 | +title "Generating the build info ..." |
| 53 | +# Comment out the call of `build_detection_version` so that the SHA number and build date of this |
| 54 | +# release will remain constant. Otherwise everytime we run "make" util/build_version.cc will be |
| 55 | +# overridden. |
| 56 | +sed -i 's/^\$PWD\/build_tools\/build_detect_version$//' build_tools/build_detect_platform |
| 57 | + |
| 58 | +# Generate util/build_version.cc |
| 59 | +build_tools/build_detect_version |
| 60 | + |
| 61 | +title "Done!" |
0 commit comments