-
Notifications
You must be signed in to change notification settings - Fork 78
/
release.sh
executable file
·115 lines (100 loc) · 2.82 KB
/
release.sh
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/bin/sh
# Release helper for this project
USERNAME=skarg
PROJECT=bacnet
SVN_BASE_URL=https://svn.code.sf.net/p/${PROJECT}/code
SVN_MODULE=bacnet-stack
FRS_URL=${USERNAME},${PROJECT}@frs.sourceforge.net:/home/frs/project/b/ba/bacnet/bacnet-stack
if [ -z "$1" ]
then
echo "Usage: `basename $0` 0.0.0"
echo "Creates the ChangeLog."
echo "Creates the release files."
echo "Tags the current version in subversion."
exit 1
fi
DOTTED_VERSION="$1"
echo "Creating the release files for version ${DOTTED_VERSION}"
CHANGELOG=ChangeLog-${DOTTED_VERSION}
echo "Creating the ${PROJECT} change log ${CHANGELOG}"
if [ -e "${CHANGELOG}" ]
then
rm ${CHANGELOG}
fi
svn update
svn log --xml --verbose | xsltproc svn2cl.xsl - > ${CHANGELOG}
if [ -e "${CHANGELOG}" ]
then
echo "${CHANGELOG} created."
else
echo "Failed to create ${CHANGELOG}"
exit 1
fi
ARCHIVE_NAME=${SVN_MODULE}-${DOTTED_VERSION}
SVN_TRUNK_NAME=${SVN_BASE_URL}/trunk/${SVN_MODULE}
SVN_TAGGED_NAME=${SVN_BASE_URL}/tags/${ARCHIVE_NAME}
echo "Setting a tag on the ${SVN_MODULE} module called ${ARCHIVE_NAME}"
TAG_COMMENT="Created version ${ARCHIVE_NAME}"
svn copy --username=${USERNAME} ${SVN_TRUNK_NAME} ${SVN_TAGGED_NAME} -m "${TAG_COMMENT}"
echo "done."
if [ -d "${ARCHIVE_NAME}" ]
then
echo "removing old ${ARCHIVE_NAME}..."
rm -rf ${ARCHIVE_NAME}
echo "done."
fi
echo "Getting a clean version out of subversion for Linux gzip"
svn export --username=${USERNAME} ${SVN_TAGGED_NAME} ${ARCHIVE_NAME} > /dev/null
echo "done."
GZIP_FILENAME=${ARCHIVE_NAME}.tgz
echo "tar and gzip the clean directory"
if [ -e "${GZIP_FILENAME}" ]
then
echo "removing old ${GZIP_FILENAME}..."
rm ${GZIP_FILENAME}
echo "done."
fi
tar -cvvzf ${GZIP_FILENAME} ${ARCHIVE_NAME}/ > /dev/null
echo "done."
if [ -e "${GZIP_FILENAME}" ]
then
echo "${GZIP_FILENAME} created."
else
echo "Failed to create ${GZIP_FILENAME}"
exit 1
fi
if [ -d "${ARCHIVE_NAME}" ]
then
echo "removing old ${ARCHIVE_NAME}..."
rm -rf ${ARCHIVE_NAME}
echo "done."
fi
echo "Getting another clean version out of subversion for Windows zip"
svn export --username=${USERNAME} --native-eol CRLF ${SVN_TAGGED_NAME} ${ARCHIVE_NAME} > /dev/null
ZIP_FILENAME=${ARCHIVE_NAME}.zip
echo "done."
echo "Zipping the directory exported for Windows."
zip -r ${ZIP_FILENAME} ${ARCHIVE_NAME} > /dev/null
if [ -e "${ZIP_FILENAME}" ]
then
echo "${ZIP_FILENAME} created."
else
echo "Failed to create ${ZIP_FILENAME}"
exit 1
fi
# remove SVN files
if [ -d "${ARCHIVE_NAME}" ]
then
echo "removing ${ARCHIVE_NAME}..."
rm -rf ${ARCHIVE_NAME}
echo "done."
fi
echo "Creating ${ARCHIVE_NAME}"
mkdir ${ARCHIVE_NAME}
mv ${ZIP_FILENAME} ${ARCHIVE_NAME}
mv ${GZIP_FILENAME} ${ARCHIVE_NAME}
mv ${CHANGELOG} ${ARCHIVE_NAME}
cp readme.txt ${ARCHIVE_NAME}
echo "Sending ${ARCHIVE_NAME} to SourceForge using scp..."
scp -r ${ARCHIVE_NAME} ${FRS_URL}
echo "Complete!"