comparison contrib/buildrpm @ 21639:57e0f053e529

buildrpm: collect code for building local hg and using it in one place
author Mads Kiilerich <madski@unity3d.com>
date Thu, 15 May 2014 01:48:37 +0200
parents 5337cb17fa1f
children 4bfb721de6dd
comparison
equal deleted inserted replaced
21638:5337cb17fa1f 21639:57e0f053e529
6 # - Fedora 20 6 # - Fedora 20
7 # - CentOS 5 7 # - CentOS 5
8 # - centOS 6 8 # - centOS 6
9 9
10 cd "`dirname $0`/.." 10 cd "`dirname $0`/.."
11 HG="$PWD/hg"
12 PYTHONPATH="$PWD/mercurial/pure"
13 export PYTHONPATH
14 11
15 specfile=contrib/mercurial.spec 12 specfile=contrib/mercurial.spec
16 if [ ! -f $specfile ]; then 13 if [ ! -f $specfile ]; then
17 echo "Cannot find $specfile!" 1>&2 14 echo "Cannot find $specfile!" 1>&2
18 exit 1 15 exit 1
29 if echo $answer | grep -iv '^y'; then 26 if echo $answer | grep -iv '^y'; then
30 exit 27 exit
31 fi 28 fi
32 fi 29 fi
33 30
31 # build local hg and use it
32 python setup.py build_py -c -d .
33 HG="$PWD/hg"
34 PYTHONPATH="$PWD/mercurial/pure"
35 export PYTHONPATH
36
34 rpmdir="$PWD/rpmbuild" 37 rpmdir="$PWD/rpmbuild"
35 38
36 rm -rf $rpmdir 39 rm -rf $rpmdir
37 mkdir -p $rpmdir/SOURCES $rpmdir/SPECS $rpmdir/RPMS $rpmdir/SRPMS $rpmdir/BUILD 40 mkdir -p $rpmdir/SOURCES $rpmdir/SPECS $rpmdir/RPMS $rpmdir/SRPMS $rpmdir/BUILD
38 41
39 # make setup.py build the version string
40 python setup.py build_py -c -d .
41 hgversion=`$HG version | sed -ne 's/.*(version \(.*\))$/\1/p'` 42 hgversion=`$HG version | sed -ne 's/.*(version \(.*\))$/\1/p'`
42 43
43 if echo $hgversion | grep -- '-' > /dev/null 2>&1; then 44 if echo $hgversion | grep -- '-' > /dev/null 2>&1; then
44 # nightly build case, version is like 1.3.1+250-20b91f91f9ca 45 # nightly build case, version is like 1.3.1+250-20b91f91f9ca
45 version=`echo $hgversion | cut -d- -f1` 46 version=`echo $hgversion | cut -d- -f1`