-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmake_new_release
executable file
·76 lines (54 loc) · 2.32 KB
/
make_new_release
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
#!/bin/bash
ant=/data/RUBICON_2/kei041/usr/bin/ant
OUT_DIR="/nfs/wwwpeople/Michael.Keith/pulsarhunter"
EXT_URI="http://www.atnf.csiro.au/people/Michael.Keith/pulsarhunter"
MAX_FILES=10
echo "make new release"
PREV_VER=`grep 'VERSION = ' ./src/pulsarhunter/PulsarHunter.java | awk '{print $7}' | sed -e 's:[";]::g' `
PREV_DATE=`grep 'DATE = ' ./src/pulsarhunter/PulsarHunter.java | awk '{print $7}' | sed -e 's:[";]::g'`
PREV_MV=`echo $PREV_VER | sed -e 's:[tr]: :g' | awk '{print $1}'`
PREV_REL=`echo $PREV_VER | sed -e 's:[tr]: :g' | awk '{print $2}'`
NEW_REL=`echo $PREV_REL | awk '{print ($0 + 1)}'`
NEW_DATE=`date +%Y-%m-%d`
echo "Current Version: $PREV_MV"
echo "Previous release: $PREV_REL ($PREV_DATE)"
echo ""
echo "New release: ${PREV_MV}?$NEW_REL ($NEW_DATE)"
echo ""
echo "(r)elease or (t)esting:"
read R_TYPE
if [ $R_TYPE != 'r' ] ; then
R_TYPE='t'
echo "TESTING"
else
echo "RELEASE"
fi
echo sed -e "s:$PREV_VER:${PREV_MV}${R_TYPE}$NEW_REL:"
sed -e "s:$PREV_VER:${PREV_MV}${R_TYPE}$NEW_REL:" < ./src/pulsarhunter/PulsarHunter.java > ./src/pulsarhunter/PulsarHunter.java.new
mv ./src/pulsarhunter/PulsarHunter.java ./src/pulsarhunter/PulsarHunter.java.bak
mv ./src/pulsarhunter/PulsarHunter.java.new ./src/pulsarhunter/PulsarHunter.java
sed -e "s:$PREV_DATE:$NEW_DATE:" < ./src/pulsarhunter/PulsarHunter.java > ./src/pulsarhunter/PulsarHunter.java.new
mv ./src/pulsarhunter/PulsarHunter.java.new ./src/pulsarhunter/PulsarHunter.java
$ant clean
$ant jar
if [ $? != 0 ] ; then
echo "ANT error!"
exit 2
fi
NEW_VER="${PREV_MV}${R_TYPE}$NEW_REL"
NEW_FILE="pulsarhunter_v${PREV_MV}${R_TYPE}$NEW_REL.tar.gz"
cp dist/pulsarhunter.jar .
tar --exclude='*CVS*' -chzf $NEW_FILE pulsarhunter.jar scripts/* help/* recipies/* lib/*.jar native/*
rm pulsarhunter.jar
mv $NEW_FILE $OUT_DIR/
cd $OUT_DIR
mv pulsarhunter.update pulsarhunter.update.bak
if [ $R_TYPE == 'r' ] ; then
echo "latest-stable $NEW_DATE $EXT_URI/$NEW_FILE" > pulsarhunter.update
cat pulsarhunter.update.bak | grep "latest-testing" >> pulsarhunter.update
else
cat pulsarhunter.update.bak | grep "latest-stable" > pulsarhunter.update
echo "latest-testing $NEW_DATE $EXT_URI/$NEW_FILE" >> pulsarhunter.update
fi
echo "$NEW_VER $NEW_DATE $EXT_URI/$NEW_FILE" >> pulsarhunter.update
cat pulsarhunter.update.bak | grep -v "latest" | head -n $MAX_FILES >> pulsarhunter.update