Debian Codegraph @

3rdparty/vboot/scripts/getversion.sh

raw symbols SCIP
1 #!/usr/bin/env bash
2 #
3 # Copyright 2014 The ChromiumOS Authors
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
6 #
7 # Generate version information
8
9 if ghash=$(git rev-parse --short=12 --verify HEAD 2>/dev/null); then
10 if gdesc=$(git describe --dirty --match='v*' 2>/dev/null); then
11 IFS="-" fields=($gdesc)
12 tag="${fields[0]}"
13 IFS="." vernum=($tag)
14 numcommits=$((${vernum[2]}+${fields[1]:-0}))
15 ver_major="${vernum[0]}"
16 ver_branch="${vernum[1]}"
17 else
18 numcommits=$(git rev-list HEAD | wc -l)
19 ver_major="v0"
20 ver_branch="0"
21 fi
22 # avoid putting the -dirty attribute if only the timestamp
23 # changed
24 dirty=$(sh -c "[ '$(git diff-index --name-only HEAD)' ] \
25 && echo '-dirty'")
26 ver="${ver_major}.${ver_branch}.${numcommits}-${ghash}${dirty}"
27 else
28 ver="unknown"
29 fi
30
31 echo "const char futility_version[] = \"${ver}\";";