File: get-release-tag.sh

package info (click to toggle)
snoopy 2.5.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,988 kB
  • sloc: ansic: 7,167; sh: 4,514; makefile: 1,095
file content (49 lines) | stat: -rwxr-xr-x 1,043 bytes parent folder | download | duplicates (3)
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
#!/bin/bash



### Description
#
# Return the git tag representing the state of the working directory.
#
# Expected output variants:
#   - snoopy-2.3.1
#   - snoopy-2.3.1-dirty
#   - snoopy-2.3.1-146-COMMITID
#   - snoopy-2.3.1-146-COMMITID-dirty
#
# The "-dirty" suffix is added whenever there are uncommitted changes in the
# working directory.
#
# The "-xxx-COMMITID" part is added whenever the currently checked out commit
# does not have an associated git tag. "xxx" represents the number of commits
# since the latest tag. "COMMITID" is a hash representing the current commit.



### Shell configuration and error handler
#
set -e
set -u

_fatalError() {
    MSG="$1"
    echo "ERROR($0): $MSG" 1>&2
    exit 1
}



### Check the runtime environment
#
if [ ! -d .git ]; then
    _fatalError "This script must be run from the root of the git repository"
fi



### Generate the data
#
SNOOPY_RELEASE_VERSION=`./dev-tools/libexec/get-release-version.sh ${@:-}`
SNOOPY_RELEASE_TAG="snoopy-$SNOOPY_RELEASE_VERSION"
echo "$SNOOPY_RELEASE_TAG"