2018-04-03 06:45:39 +00:00
|
|
|
#!/usr/bin/env bash
|
2019-04-18 17:51:19 +00:00
|
|
|
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
2014-10-04 09:17:06 +00:00
|
|
|
if [ "$#" = "0" ]; then
|
2017-01-24 18:48:55 +00:00
|
|
|
echo "Usage: $0 major|minor|patch|full"
|
2014-10-02 21:03:49 +00:00
|
|
|
exit 1
|
2014-10-02 18:59:22 +00:00
|
|
|
fi
|
2017-01-24 18:48:55 +00:00
|
|
|
|
2014-10-04 09:17:06 +00:00
|
|
|
if [ "$1" = "major" ]; then
|
2014-10-02 18:59:22 +00:00
|
|
|
cat include/rocksdb/version.h | grep MAJOR | head -n1 | awk '{print $3}'
|
|
|
|
fi
|
2014-10-04 09:17:06 +00:00
|
|
|
if [ "$1" = "minor" ]; then
|
2014-10-02 18:59:22 +00:00
|
|
|
cat include/rocksdb/version.h | grep MINOR | head -n1 | awk '{print $3}'
|
|
|
|
fi
|
2014-10-04 09:17:06 +00:00
|
|
|
if [ "$1" = "patch" ]; then
|
2014-10-02 18:59:22 +00:00
|
|
|
cat include/rocksdb/version.h | grep PATCH | head -n1 | awk '{print $3}'
|
|
|
|
fi
|
2017-01-24 18:48:55 +00:00
|
|
|
if [ "$1" = "full" ]; then
|
|
|
|
awk '/#define ROCKSDB/ { env[$2] = $3 }
|
|
|
|
END { printf "%s.%s.%s\n", env["ROCKSDB_MAJOR"],
|
|
|
|
env["ROCKSDB_MINOR"],
|
|
|
|
env["ROCKSDB_PATCH"] }' \
|
|
|
|
include/rocksdb/version.h
|
|
|
|
fi
|