utils/makerpm: Fix building RPMs again
[skype-call-recorder.git] / utils / makerpm
blob8fb0df77943971a9f029b578df86e7dd4a342863
1 #!/bin/sh
3 v=''
4 scr=skype-call-recorder
6 while test $# != 0; do
7 case "$1" in
8 -*) echo "Unknown option $1" && exit 1 ;;
9 *) v="$1" ;;
10 esac
11 shift
12 done
14 if test -z "$v"; then
15 echo "Usage: $0 <version>"
16 exit 1
19 if git tag -l | grep -q "^$v\$" > /dev/null 2> /dev/null; then
21 else
22 echo "I don't know version $v, here's what I know:"
23 git tag -l | sed -e 's/^/ /'
24 exit 1
27 export BASE=$(pwd)
29 tmp="$BASE/tmp-rpm-build"
30 rm -rf "$tmp" && \
31 mkdir "$tmp" && \
32 mkdir "$tmp"/SOURCES "$tmp"/BUILD "$tmp"/RPMS || exit 1
34 $BASE/utils/snapshot $v "$tmp/SOURCES/$scr-$v.tar.gz" || exit 1
36 git show -p $v:$scr.spec | sed \
37 -e "s+@version@+$v+g" \
38 -e "s+@buildroot@+$tmp/destdir+g" \
39 > "$tmp/spec" || exit 1
41 rpmbuild -bb --define "_topdir $tmp" --define "buildroot $tmp/destdir" "$tmp/spec" || exit 1
43 mv "$tmp"/RPMS/*/* . || exit 1
45 rm -rf "$tmp"