-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathbuild_rpm.sh
executable file
·47 lines (34 loc) · 1.06 KB
/
build_rpm.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
#!/bin/bash
NAME=talaria
echo "Adjusting build number..."
taglist=`git tag -l`
tags=($taglist)
release=${tags[${#tags[@]}-1]}
if [ -z "$release" ]; then
echo "Could not find latest release tag!"
else
echo "Most recent release tag: $release"
fi
release=`echo "$release" | sed -e 's/^.*\([0-9]\+\.[0-9]\+\.[0-9]\+\).*\+$/\1/'`
new_release="$release-${BUILD_NUMBER}"
echo "Issuing release $new_release..."
echo "New base version: $release..."
echo "Building the ${NAME} rpm..."
pushd ..
cp -r ${NAME} ${NAME}-$release
tar -czvf ${NAME}-$new_release.tar.gz ${NAME}-$release
mv ${NAME}-$new_release.tar.gz /root/rpmbuild/SOURCES
rm -rf ${NAME}-$release
popd
# Merge the changelog into the spec file so we're consistent
cat ChangeLog >> ${NAME}.spec
yes "" | rpmbuild -ba --sign \
--define "_signature gpg" \
--define "_gpg_name Comcast Xmidt Team <[email protected]>" \
--define "_ver $release" \
--define "_releaseno ${BUILD_NUMBER}" \
--define "_fullver $new_release" \
${NAME}.spec
pushd ..
echo "$new_release" > versionno.txt
popd