Mercurial > hg
comparison contrib/buildrpm @ 22436:96d95b75a63b
buildrpm: introduce --withpython for building rpms that includes Python 2.7
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Thu, 15 May 2014 01:50:11 +0200 |
parents | 4c4385eb26bc |
children | 9e2e4fc524fd |
comparison
equal
deleted
inserted
replaced
22435:4c4385eb26bc | 22436:96d95b75a63b |
---|---|
12 case "$1" in | 12 case "$1" in |
13 --prepare ) | 13 --prepare ) |
14 shift | 14 shift |
15 BUILD= | 15 BUILD= |
16 ;; | 16 ;; |
17 --withpython | --with-python) | |
18 shift | |
19 PYTHONVER=2.7.8 | |
20 ;; | |
17 * ) | 21 * ) |
18 echo "Invalid parameter $1!" 1>&2 | 22 echo "Invalid parameter $1!" 1>&2 |
19 exit 1 | 23 exit 1 |
20 ;; | 24 ;; |
21 esac | 25 esac |
22 done | 26 done |
23 | 27 |
24 cd "`dirname $0`/.." | 28 cd "`dirname $0`/.." |
25 | 29 |
26 specfile=contrib/mercurial.spec | 30 specfile=$PWD/contrib/mercurial.spec |
27 if [ ! -f $specfile ]; then | 31 if [ ! -f $specfile ]; then |
28 echo "Cannot find $specfile!" 1>&2 | 32 echo "Cannot find $specfile!" 1>&2 |
29 exit 1 | 33 exit 1 |
30 fi | 34 fi |
31 | 35 |
54 else | 58 else |
55 # official tag, version is like 1.3.1 | 59 # official tag, version is like 1.3.1 |
56 version=`echo $hgversion | sed -e 's/+.*//'` | 60 version=`echo $hgversion | sed -e 's/+.*//'` |
57 release='0' | 61 release='0' |
58 fi | 62 fi |
63 if [ "$PYTHONVER" ]; then | |
64 release=$release+$PYTHONVER | |
65 RPMPYTHONVER=$PYTHONVER | |
66 else | |
67 RPMPYTHONVER=%{nil} | |
68 fi | |
59 | 69 |
60 $HG archive -t tgz $rpmdir/SOURCES/mercurial-$version-$release.tar.gz | 70 $HG archive -t tgz $rpmdir/SOURCES/mercurial-$version-$release.tar.gz |
71 if [ "$PYTHONVER" ]; then | |
72 ( | |
73 cd build | |
74 PYTHON_SRCFILE=Python-$PYTHONVER.tgz | |
75 [ -f $PYTHON_SRCFILE ] || curl -Lo $PYTHON_SRCFILE http://www.python.org/ftp/python/$PYTHONVER/$PYTHON_SRCFILE | |
76 ln -f $PYTHON_SRCFILE $rpmdir/SOURCES/$PYTHON_SRCFILE | |
77 | |
78 DOCUTILSVER=`sed -ne "s/^%global docutilsname docutils-//p" $specfile` | |
79 DOCUTILS_SRCFILE=docutils-$DOCUTILSVER.tar.gz | |
80 [ -f $DOCUTILS_SRCFILE ] || curl -Lo $DOCUTILS_SRCFILE http://downloads.sourceforge.net/project/docutils/docutils/$DOCUTILSVER/$DOCUTILS_SRCFILE | |
81 ln -f $DOCUTILS_SRCFILE $rpmdir/SOURCES/$DOCUTILS_SRCFILE | |
82 ) | |
83 fi | |
84 | |
61 rpmspec=$rpmdir/SPECS/mercurial.spec | 85 rpmspec=$rpmdir/SPECS/mercurial.spec |
62 | 86 |
63 sed -e "s,^Version:.*,Version: $version," \ | 87 sed -e "s,^Version:.*,Version: $version," \ |
64 -e "s,^Release:.*,Release: $release," \ | 88 -e "s,^Release:.*,Release: $release," \ |
65 $specfile > $rpmspec | 89 $specfile > $rpmspec |
107 print "* %s %s\n- %s" % (datestr(hgdate, "%a %b %d %Y"), tok[1], tok[2]) | 131 print "* %s %s\n- %s" % (datestr(hgdate, "%a %b %d %Y"), tok[1], tok[2]) |
108 ' >> $rpmspec | 132 ' >> $rpmspec |
109 | 133 |
110 fi | 134 fi |
111 | 135 |
136 sed -i \ | |
137 -e "s/^%define withpython.*$/%define withpython $RPMPYTHONVER/" \ | |
138 $rpmspec | |
139 | |
112 if [ "$BUILD" ]; then | 140 if [ "$BUILD" ]; then |
113 rpmbuild --define "_topdir $rpmdir" -ba $rpmspec --clean | 141 rpmbuild --define "_topdir $rpmdir" -ba $rpmspec --clean |
114 if [ $? = 0 ]; then | 142 if [ $? = 0 ]; then |
115 echo | 143 echo |
116 echo "Built packages for $version-$release:" | 144 echo "Built packages for $version-$release:" |