]>
git.proxmox.com Git - ceph.git/blob - ceph/src/pmdk/utils/version.sh
2 # SPDX-License-Identifier: BSD-3-Clause
3 # Copyright 2017-2020, Intel Corporation
5 # utils/version.sh -- determine project's version
9 if [ -f "$1/VERSION" ]; then
14 if [ -f $1/GIT_VERSION
]; then
15 echo -n "\$Format:%h\$" |
cmp -s $1/GIT_VERSION
- && true
25 LATEST_RELEASE
=$
(cat $1/ChangeLog |
grep "* Version" | cut
-d " " -f 3 |
sort -rd |
head -n1)
27 if [ $PARSE_GIT_VERSION -eq 1 ]; then
28 GIT_VERSION_HASH
=$
(cat $1/GIT_VERSION
)
30 if [ -n "$GIT_VERSION_HASH" ]; then
31 echo "$LATEST_RELEASE+git.$GIT_VERSION_HASH"
38 GIT_DESCRIBE
=$
(git describe
2>/dev
/null
) && true
39 if [ -n "$GIT_DESCRIBE" ]; then
40 # 1.5-19-gb8f78a329 -> 1.5+git19.gb8f78a329
41 # 1.5-rc1-19-gb8f78a329 -> 1.5-rc1+git19.gb8f78a329
42 echo "$GIT_DESCRIBE" |
sed "s/\([0-9.]*\)-rc\([0-9]*\)-\([0-9]*\)-\([0-9a-g]*\)/\1-rc\2+git\3.\4/" |
sed "s/\([0-9.]*\)-\([0-9]*\)-\([0-9a-g]*\)/\1+git\2.\3/"
46 # try commit it, git describe can fail when there are no tags (e.g. with shallow clone, like on Travis)
47 GIT_COMMIT
=$
(git log
-1 --format=%h
) && true
48 if [ -n "$GIT_COMMIT" ]; then
49 echo "$LATEST_RELEASE+git.$GIT_COMMIT"
55 # If nothing works, try to get version from directory name
56 VER
=$
(basename `realpath "$1"` |
sed 's/pmdk[-]*\([0-9a-z.+-]*\).*/\1/')
57 if [ -n "$VER" ]; then