forked from yahoojapan/chmpx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make_rev.sh
executable file
·69 lines (59 loc) · 1.52 KB
/
make_rev.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/sh
#
# CHMPX
#
# Copyright 2014 Yahoo! JAPAN corporation.
#
# CHMPX is inprocess data exchange by MQ with consistent hashing.
# CHMPX is made for the purpose of the construction of
# original messaging system and the offer of the client
# library.
# CHMPX transfers messages between the client and the server/
# slave. CHMPX based servers are dispersed by consistent
# hashing and are automatically layouted. As a result, it
# provides a high performance, a high scalability.
#
# For the full copyright and license information, please view
# the LICENSE file that was distributed with this source code.
#
# AUTHOR: Takeshi Nakatani
# CREATE: Tue July 1 2014
# REVISION:
#
#
# This script puts git commit hash string to C header file.
# ex: static const char version[] = "....";
#
# Usage: make_rev.sh <filename> <valuename>
#
PRGNAME=`basename $0`
if [ $# -ne 2 ]; then
echo "${PRGNAME}: Error - parameter is not found."
exit 1
fi
FILEPATH=$1
VALUENAME=$2
REVISION=`git rev-parse --short HEAD`
if [ $? -ne 0 ]; then
echo "${PRGNAME}: Warning - git commit hash code is not found, so set to \"unknown\"."
REVISION="unknown"
fi
#echo ${REVISION}
NEWCODES="char ${VALUENAME}[] = \"${REVISION}\";"
#echo ${NEWCODES}
if [ -f ${FILEPATH} ]; then
FILECODES=`cat ${FILEPATH}`
#echo ${FILECODES}
if [ "X${FILECODES}" = "X${NEWCODES}" ]; then
#echo "${PRGNAME}: ${FILEPATH} is not updated."
exit 0
fi
fi
echo ${NEWCODES} > ${FILEPATH}
echo "${PRGNAME}: ${FILEPATH} is updated."
exit 0
#
# VIM modelines
#
# vim:set ts=4 fenc=utf-8:
#