File: version.sh

package info (click to toggle)
libapache2-mod-python 3.5.0.6-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,776 kB
  • sloc: python: 7,503; ansic: 7,033; makefile: 296; lex: 246; sh: 212
file content (21 lines) | stat: -rwxr-xr-x 646 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh

MPV_PATH="`dirname $0`/../src/include/mp_version.h"

MAJ=`awk '/MP_VERSION_MAJOR/ {print $3}' $MPV_PATH`
MIN=`awk '/MP_VERSION_MINOR/ {print $3}' $MPV_PATH`
PCH=`awk '/MP_VERSION_PATCH/ {print $3}' $MPV_PATH`

# if git exists in path
if type git >/dev/null 2>&1; then
    # and we are in a checkout
    if git rev-parse 2>/dev/null; then
        # but not on a tag (which means this is a release)
        if test -z "`git log 'HEAD^!' --format=%d 2>/dev/null | grep 'tag: '`"; then
            # append git revision hash to version
            GIT="+`git describe --always --exclude '*'`"
        fi
    fi
fi

echo $MAJ.$MIN.$PCH$GIT