comparison contrib/packaging/buildrpm @ 45983:97205cf0ee4d

packaging: don't use plain 'python' if another python has been specified Before this change, packaging on CentOS 8 failed because 'python' is used instead of 'python3'. Change was tested with: - make docker-centos7 - make docker-centos8 - make docker-ubuntu-bionic Differential Revision: https://phab.mercurial-scm.org/D9464
author Mathias De Mare <mathias.de_mare@nokia.com>
date Mon, 30 Nov 2020 10:18:36 +0100
parents de1f4c431619
children
comparison
equal deleted inserted replaced
45982:d26497811ed9 45983:97205cf0ee4d
54 if [ ! -d .hg ]; then 54 if [ ! -d .hg ]; then
55 echo 'You are not inside a Mercurial repository!' 1>&2 55 echo 'You are not inside a Mercurial repository!' 1>&2
56 exit 1 56 exit 1
57 fi 57 fi
58 58
59 gethgversion 59 gethgversion $PYTHONEXE
60 60
61 if [ -z "$type" ] ; then 61 if [ -z "$type" ] ; then
62 release=1 62 release=1
63 else 63 else
64 release=0.9_$type 64 release=0.9_$type
74 else 74 else
75 RPMPYTHONVER=%{nil} 75 RPMPYTHONVER=%{nil}
76 fi 76 fi
77 77
78 mkdir -p $RPMBUILDDIR/{SOURCES,BUILD,SRPMS,RPMS} 78 mkdir -p $RPMBUILDDIR/{SOURCES,BUILD,SRPMS,RPMS}
79 $HG archive -t tgz $RPMBUILDDIR/SOURCES/mercurial-$version-$release.tar.gz 79 $PYTHONEXE $HG archive -t tgz $RPMBUILDDIR/SOURCES/mercurial-$version-$release.tar.gz
80 if [ "$PYTHONVER" ]; then 80 if [ "$PYTHONVER" ]; then
81 ( 81 (
82 mkdir -p build 82 mkdir -p build
83 cd build 83 cd build
84 PYTHON_SRCFILE=Python-$PYTHONVER.tgz 84 PYTHON_SRCFILE=Python-$PYTHONVER.tgz
110 echo >> $rpmspec 110 echo >> $rpmspec
111 echo "%changelog" >> $rpmspec 111 echo "%changelog" >> $rpmspec
112 112
113 if echo $version | grep '+' > /dev/null 2>&1; then 113 if echo $version | grep '+' > /dev/null 2>&1; then
114 latesttag="`echo $version | sed -e 's/+.*//'`" 114 latesttag="`echo $version | sed -e 's/+.*//'`"
115 $HG log -r .:"$latesttag" -fM \ 115 $PYTHONEXE $HG log -r .:"$latesttag" -fM \
116 --template '{date|hgdate}\t{author}\t{desc|firstline}\n' | python -c ' 116 --template '{date|hgdate}\t{author}\t{desc|firstline}\n' | python -c '
117 import sys, time 117 import sys, time
118 118
119 def datestr(date, format): 119 def datestr(date, format):
120 return time.strftime(format, time.gmtime(float(date[0]) - date[1])) 120 return time.strftime(format, time.gmtime(float(date[0]) - date[1]))
134 print("- %s" % l[3].strip()) 134 print("- %s" % l[3].strip())
135 ' >> $rpmspec 135 ' >> $rpmspec
136 136
137 else 137 else
138 138
139 $HG log \ 139 $PYTHONEXE $HG log \
140 --template '{date|hgdate}\t{author}\t{desc|firstline}\n' \ 140 --template '{date|hgdate}\t{author}\t{desc|firstline}\n' \
141 .hgtags | python -c ' 141 .hgtags | $PYTHONEXE -c '
142 import sys, time 142 import sys, time
143 143
144 def datestr(date, format): 144 def datestr(date, format):
145 return time.strftime(format, time.gmtime(float(date[0]) - date[1])) 145 return time.strftime(format, time.gmtime(float(date[0]) - date[1]))
146 146