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
#!/bin/sh
. `dirname $0`/../share/eterbuild/functions/common
load_mod spec strings
SPECNAME=get_ver.spec
check()
{
[ "$2" != "$3" ] && echo "FATAL with '$1': result '$3' do not match with '$2'" || echo "OK for '$1' with '$2'"
}
fill_spec()
{
cat <<EOF >$SPECNAME
Name: get_version_test
Version: 2.1
Release: $RELEASE
Summary: Test
Group: Other
License: Public License
%description
Get version test
EOF
}
check_prev()
{
# from rpmbh:
# General rule: always alt(N-1).MM.(N)
RELEASE="$2"
fill_spec
RELEASE=$(get_release $SPECNAME)
test -n "$RELEASE" || fatal "release missed"
BASERELEASE=$(get_numrelease $SPECNAME)
test -n "$BASERELEASE" || fatal "baserelease missed"
local RES="$(get_txtrelease $SPECNAME)$(decrement_release $BASERELEASE).$MDISTR.$BASERELEASE"
check "$2" "$1" "$RES"
#[ -z "${RES/*alt[0-9]*.M40.[0-9]*/}" ] || echo "breaks rule, see the code"
rhas "$RES" "alt[0-9]+\.M40\.[0-9]+" || echo "breaks rule 1, see the code"
rhas "$1" "(alt|eter)[0-9]+\.M40\.[0-9]+" || echo "breaks rule 2, see the code"
}
MDISTR=M40
check_prev alt2.M40.3 alt3
check_prev alt2.M40.3.r201.2 alt3.r201.2
check_prev alt0.M40.1 alt1
check_prev alt0.M40.0 alt0
check_prev alt50.M40.51 alt51
check_prev eter50.M40.51 eter51
#rm -f $SPECNAME