comparison contrib/buildrpm @ 22435:4c4385eb26bc

buildrpm: introduce --prepare for preparing without actually building rpms
author Mads Kiilerich <madski@unity3d.com>
date Sun, 31 Aug 2014 12:51:06 +0200
parents 977e5bd6eb76
children 96d95b75a63b
comparison
equal deleted inserted replaced
22434:40ce05b50148 22435:4c4385eb26bc
4 # 4 #
5 # Tested on 5 # Tested on
6 # - Fedora 20 6 # - Fedora 20
7 # - CentOS 5 7 # - CentOS 5
8 # - centOS 6 8 # - centOS 6
9
10 BUILD=1
11 while [ "$1" ]; do
12 case "$1" in
13 --prepare )
14 shift
15 BUILD=
16 ;;
17 * )
18 echo "Invalid parameter $1!" 1>&2
19 exit 1
20 ;;
21 esac
22 done
9 23
10 cd "`dirname $0`/.." 24 cd "`dirname $0`/.."
11 25
12 specfile=contrib/mercurial.spec 26 specfile=contrib/mercurial.spec
13 if [ ! -f $specfile ]; then 27 if [ ! -f $specfile ]; then
93 print "* %s %s\n- %s" % (datestr(hgdate, "%a %b %d %Y"), tok[1], tok[2]) 107 print "* %s %s\n- %s" % (datestr(hgdate, "%a %b %d %Y"), tok[1], tok[2])
94 ' >> $rpmspec 108 ' >> $rpmspec
95 109
96 fi 110 fi
97 111
98 rpmbuild --define "_topdir $rpmdir" -ba $rpmspec --clean 112 if [ "$BUILD" ]; then
99 if [ $? = 0 ]; then 113 rpmbuild --define "_topdir $rpmdir" -ba $rpmspec --clean
100 echo 114 if [ $? = 0 ]; then
101 echo "Packages are in $rpmdir:" 115 echo
102 ls -l $rpmdir/*RPMS/* 116 echo "Built packages for $version-$release:"
117 find $rpmdir/*RPMS/ -type f -newer $rpmspec
118 fi
119 else
120 echo "Prepared sources for $version-$release $rpmspec are in $rpmdir/SOURCES/ - use like:"
121 echo "rpmbuild --define '_topdir $rpmdir' -ba $rpmspec --clean"
103 fi 122 fi