comparison contrib/buildrpm @ 24972:56c64c91b429

packaging: extract packagelib for common code from builddeb and buildrpm
author Augie Fackler <augie@google.com>
date Thu, 07 May 2015 10:28:58 -0400
parents aa8e5c6d953b
children f643b6863382
comparison
equal deleted inserted replaced
24971:ab75baaf81d5 24972:56c64c91b429
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 . $(dirname $0)/packagelib.sh
9 11
10 BUILD=1 12 BUILD=1
11 RPMBUILDDIR="$PWD/rpmbuild" 13 RPMBUILDDIR="$PWD/rpmbuild"
12 while [ "$1" ]; do 14 while [ "$1" ]; do
13 case "$1" in 15 case "$1" in
43 if [ ! -d .hg ]; then 45 if [ ! -d .hg ]; then
44 echo 'You are not inside a Mercurial repository!' 1>&2 46 echo 'You are not inside a Mercurial repository!' 1>&2
45 exit 1 47 exit 1
46 fi 48 fi
47 49
48 # build local hg and use it 50 gethgversion
49 python setup.py build_py -c -d .
50 HG="$PWD/hg"
51 PYTHONPATH="$PWD/mercurial/pure"
52 export PYTHONPATH
53 51
54 mkdir -p $RPMBUILDDIR/SOURCES $RPMBUILDDIR/SPECS $RPMBUILDDIR/RPMS $RPMBUILDDIR/SRPMS $RPMBUILDDIR/BUILD
55
56 hgversion=`$HG version | sed -ne 's/.*(version \(.*\))$/\1/p'`
57
58 if echo $hgversion | grep -- '-' > /dev/null 2>&1; then
59 # nightly build case, version is like 1.3.1+250-20b91f91f9ca
60 version=`echo $hgversion | cut -d- -f1`
61 release=`echo $hgversion | cut -d- -f2 | sed -e 's/+.*//'`
62 else
63 # official tag, version is like 1.3.1
64 version=`echo $hgversion | sed -e 's/+.*//'`
65 release='0'
66 fi
67 if [ "$PYTHONVER" ]; then 52 if [ "$PYTHONVER" ]; then
68 release=$release+$PYTHONVER 53 release=$release+$PYTHONVER
69 RPMPYTHONVER=$PYTHONVER 54 RPMPYTHONVER=$PYTHONVER
70 else 55 else
71 RPMPYTHONVER=%{nil} 56 RPMPYTHONVER=%{nil}