forked from coin-or-tools/BuildTools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
coin-functions
75 lines (58 loc) · 2.25 KB
/
coin-functions
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Copyright (C) 2020 COIN-OR Foundation
# All Rights Reserved.
# This file is distributed under the Eclipse Public License 2.0.
# See LICENSE for details.
#
# Utility function definitions for the various COIN scripts.
# Functions to calculate libtool version numbers.
# Count the total number of stable branches for the project for the specified
# major version number, up to the specified minor version number (libtool age).
# Returns 0 if handed a master url.
# usage: calcLibtoolAge <major> <minor>
# very similar to calcLibtoolCurrent, but look only on stable branches with given major version number
calcLibtoolAge ()
{ cltc_majVer=$1
cltc_minVer=$2
# Get a list of all standard stable branches with this major version (stable/$majVer.)
cltc_rawls=`git branch -r | grep origin/stable/${cltc_majVer}\. | sed -e 's#^ *origin/stable/##' | sort -V`
# echo "Initial list of stable branches: $cltc_rawls"
# Count stable branches to standard version numbers before and
# including the one given
cltc_verPat='[0-9][0-9.]*'
cltc_cnt=0
for cltc_ver in $cltc_rawls ; do
if expr "$cltc_ver" : "$cltc_verPat" >/dev/null 2>&1 ; then
(( cltc_cnt += 1 ))
# echo "included $cltc_ver into count -> $cltc_cnt"
fi
if [ "$cltc_ver" = "${cltc_majVer}.${cltc_minVer}" ] ; then
break
fi
done
echo $cltc_cnt
}
# Count the total number of stable branches for the project up to the
# specified major.minor version number (libtool current). Returns 0 if
# handed a master url, or if the url is BuildTools itself.
# usage: calcLibtoolCurrent <major> <minor>
calcLibtoolCurrent ()
{ cltc_majVer=$1
cltc_minVer=$2
# Get a list of all standard stable branches (stable/)
cltc_rawls=`git branch -r | grep origin/stable/ | sed -e 's#^ *origin/stable/##' | sort -V`
# echo "Initial list of stable branches: $cltc_rawls"
# Count stable branches to standard version numbers before and
# including the one given
cltc_verPat='[0-9][0-9.]*'
cltc_cnt=0
for cltc_ver in $cltc_rawls ; do
if expr "$cltc_ver" : "$cltc_verPat" >/dev/null 2>&1 ; then
(( cltc_cnt += 1 ))
# echo "included $cltc_ver into count -> $cltc_cnt"
fi
if [ "$cltc_ver" = "${cltc_majVer}.${cltc_minVer}" ] ; then
break
fi
done
echo $cltc_cnt
}