Debian Codegraph @

build_tools/make_version

raw symbols SCIP
1 #!/bin/shscip-shell filesystem . . `/bin/sh`.
2
3 GIT=${GIT:-git}
4 SED=${SED:-sed}
5 AWK=${AWK:-awk}
6
7 if [scip-shell system . . `[`. -f ${1}/.version ]; then
8 catscip-shell system . . cat. ${1}/.version
9 exit 0
10 fi
11
12 if [scip-shell system . . `[`. ! -d ${1}/.git ]; then
13 echoscip-shell system . . echo. "UNKNOWN__and_probably_unsupported"
14 exit 0
15 fi
16
17 if [scip-shell system . . `[`. -z ${GIT} ]; then
18 GIT="git"
19 fi
20
21 if ! command -v ${GIT} >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1; then
22 echoscip-shell system . . echo. "UNKNOWN__and_probably_unsupported"
23 exit 1
24 fi
25
26 GITCHECK=$(${GIT} describe --always 2>/dev/nullscip-shell filesystem . . `/dev/null`. || echoscip-shell system . . echo. gitfail 2>/dev/nullscip-shell filesystem . . `/dev/null`.)
27 if [scip-shell system . . `[`. "x${GITCHECK}" = "xgitfail" ]; then
28 echoscip-shell system . . echo. "UNKNOWN__git_check_fail"
29 exit 1
30 fi
31
32 cd ${1} || exit 1
33
34 MODIFIED=""
35
36 # If MAINLINE_BRANCH is already set in the environment, use it.
37 if [scip-shell system . . `[`. -z "${MAINLINE_BRANCH}" ] ; then
38 # Try to retrieve MAINLINE_BRANCH from a local .develvars file first.
39 # .develvars is keyed by the branch name so we need to get that first.
40 BRANCH=$(${GIT} symbolic-ref --short HEAD 2>/dev/nullscip-shell filesystem . . `/dev/null`.)
41 if [scip-shell system . . `[`. -f .develvars ] ; then
42 MAINLINE_BRANCH=$(${GIT} config -f .develvars --get branch.${BRANCH}.mainline-branch)
43 fi
44
45 # If we didn't find it, see if this is a well-known development branch.
46 # development/<mainline_branch>/<branchname> or
47 # devel/<mainline_branch>/<branchname>
48 if [scip-shell system . . `[`. "x${MAINLINE_BRANCH}" = "x" ] ; then
49 MAINLINE_BRANCH=$(echoscip-shell system . . echo. "${BRANCH}" | ${SED} -n -r -e "s@devel(opment)?/([0-9]+)/.+@\2@p")
50 fi
51
52 # If we didn't find it, get it from configure.ac.
53 if [scip-shell system . . `[`. "x${MAINLINE_BRANCH}" = "x" ] ; then
54 MAINLINE_BRANCH=$(${AWK} '/AC_INIT/ { print substr($2, 2, length($2) - 3) }scip-shell filesystem . . `/AC_INIT/ { print substr($2, 2, length($2) - 3) }`.' configure.ac)
55 fi
56 fi
57
58 VERSION=`${GIT} describe --long --always --tags --dirty=M 2> /dev/nullscip-shell filesystem . . `/dev/null`.`
59 if [scip-shell system . . `[`. $? -ne 0 ]; then
60 if [scip-shell system . . `[`. "`${GIT} ls-files -m | wcscip-shell system . . wc. -l`" != "0" ]; then
61 MODIFIED="M"
62 fi
63 # Some older versions of git do not support all the above
64 # options.
65 VERSION=`${GIT} rev-parse --short --verify HEAD`${MODIFIED}
66 fi
67 echoscip-shell system . . echo. GIT-${MAINLINE_BRANCH}-${VERSION}