| 1 |
#!/bin/sh |
| 2 |
# determines the core version/release tag (for RPM/debian) of a version and the slot (main(""), cvs or exp) |
| 3 |
# usage: releasetag <full version> |
| 4 |
|
| 5 |
# examples: |
| 6 |
|
| 7 |
# "releasetag 0.2.8_beta1" should give |
| 8 |
# COREVERSION=0.2.8 |
| 9 |
# RELEASETAG=0.6.beta1 |
| 10 |
# SLOT="" |
| 11 |
|
| 12 |
# "releasetag 0.3.0" should give |
| 13 |
# COREVERSION=0.3.0 |
| 14 |
# RELEASETAG=1.final |
| 15 |
# SLOT="exp" |
| 16 |
|
| 17 |
# "releasetag 1.0_alpha20060101" should give |
| 18 |
# COREVERSION=1.0 |
| 19 |
# RELEASETAG=0.3.alpha20060101 |
| 20 |
# SLOT="cvs" |
| 21 |
|
| 22 |
VERSION="$1" |
| 23 |
|
| 24 |
# adapt version and release to RPM/Debian standards: strip trailing _* that signifies |
| 25 |
# the build |
| 26 |
COREVERSION=$(echo $VERSION | sed -e "s,_.*,,") |
| 27 |
|
| 28 |
SLOT="" |
| 29 |
|
| 30 |
# add the stripped part of the version to the release tag, taking |
| 31 |
# care that RPM will sort the versions correctly |
| 32 |
# (alpha < beta < pre < rc < final) |
| 33 |
if echo $VERSION | grep _ -qv; then |
| 34 |
RELEASETAG=1.final |
| 35 |
else |
| 36 |
PRE=`echo $VERSION | sed -e "s,.*_,," | tr A-Z a-z` |
| 37 |
RELEASETAG=0.0 |
| 38 |
|
| 39 |
echo $PRE | grep -q ^rc && RELEASETAG=0.9 |
| 40 |
echo $PRE | grep -q ^pre && RELEASETAG=0.8 |
| 41 |
echo $PRE | grep -q ^pre20 && RELEASETAG=0.7 |
| 42 |
echo $PRE | grep -q ^beta && RELEASETAG=0.6 |
| 43 |
echo $PRE | grep -q ^beta20 && RELEASETAG=0.5 |
| 44 |
echo $PRE | grep -q ^alpha && RELEASETAG=0.4 SLOT=cvs |
| 45 |
echo $PRE | grep -q ^alpha20 && RELEASETAG=0.3 SLOT=cvs |
| 46 |
|
| 47 |
RELEASETAG=${RELEASETAG}.${PRE} |
| 48 |
fi |
| 49 |
|
| 50 |
# determine if minor version is even or odd |
| 51 |
if test -z "$SLOT"; then |
| 52 |
MINOR=`echo $COREVERSION | sed -e "s,[0-9]*\.,," -e "s,\..*,,"` |
| 53 |
#echo MINOR = $MINOR |
| 54 |
test -z "$MINOR" && exit -1 |
| 55 |
if echo $MINOR | grep -q "[13579]$"; then |
| 56 |
SLOT=exp |
| 57 |
fi |
| 58 |
fi |
| 59 |
|
| 60 |
# echo |
| 61 |
echo COREVERSION=$COREVERSION |
| 62 |
echo RELEASETAG=$RELEASETAG |
| 63 |
echo SLOT=\"$SLOT\" |