Mercurial > hg
view contrib/buildrpm @ 22358:198e2da3ee20
osx: create dmg with installer instead of zip
OS X would offer to expand the zip so the (multi file) installer inside it
could be run ... but that would leave the expanded zip folder around.
Instead, use a .dmg file that automatically will be mounted - that seems more
common on OS X.
Still, there is two levels of levels of clicking before actually launching the
installer. Having a single file installer would be better ... but seems to be
hard. A more feasible improvement would be some fancy layout inside the .dmg .
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Sun, 31 Aug 2014 10:24:25 +0200 |
parents | 977e5bd6eb76 |
children | 4c4385eb26bc |
line wrap: on
line source
#!/bin/sh -e # # Build a Mercurial RPM from the current repo # # Tested on # - Fedora 20 # - CentOS 5 # - centOS 6 cd "`dirname $0`/.." specfile=contrib/mercurial.spec if [ ! -f $specfile ]; then echo "Cannot find $specfile!" 1>&2 exit 1 fi if [ ! -d .hg ]; then echo 'You are not inside a Mercurial repository!' 1>&2 exit 1 fi # build local hg and use it python setup.py build_py -c -d . HG="$PWD/hg" PYTHONPATH="$PWD/mercurial/pure" export PYTHONPATH rpmdir="$PWD/rpmbuild" rm -rf $rpmdir mkdir -p $rpmdir/SOURCES $rpmdir/SPECS $rpmdir/RPMS $rpmdir/SRPMS $rpmdir/BUILD hgversion=`$HG version | sed -ne 's/.*(version \(.*\))$/\1/p'` if echo $hgversion | grep -- '-' > /dev/null 2>&1; then # nightly build case, version is like 1.3.1+250-20b91f91f9ca version=`echo $hgversion | cut -d- -f1` release=`echo $hgversion | cut -d- -f2 | sed -e 's/+.*//'` else # official tag, version is like 1.3.1 version=`echo $hgversion | sed -e 's/+.*//'` release='0' fi $HG archive -t tgz $rpmdir/SOURCES/mercurial-$version-$release.tar.gz rpmspec=$rpmdir/SPECS/mercurial.spec sed -e "s,^Version:.*,Version: $version," \ -e "s,^Release:.*,Release: $release," \ $specfile > $rpmspec echo >> $rpmspec echo "%changelog" >> $rpmspec if echo $version | grep '+' > /dev/null 2>&1; then latesttag="`echo $version | sed -e 's/+.*//'`" $HG log -r .:"$latesttag" -fM \ --template '{date|hgdate}\t{author}\t{desc|firstline}\n' | python -c ' import sys, time def datestr(date, format): return time.strftime(format, time.gmtime(float(date[0]) - date[1])) changelog = [] for l in sys.stdin.readlines(): tok = l.split("\t") hgdate = tuple(int(v) for v in tok[0].split()) changelog.append((datestr(hgdate, "%F"), tok[1], hgdate, tok[2])) prevtitle = "" for l in sorted(changelog, reverse=True): title = "* %s %s" % (datestr(l[2], "%a %b %d %Y"), l[1]) if prevtitle != title: prevtitle = title print print title print "- %s" % l[3].strip() ' >> $rpmspec else $HG log \ --template '{date|hgdate}\t{author}\t{desc|firstline}\n' \ .hgtags | python -c ' import sys, time def datestr(date, format): return time.strftime(format, time.gmtime(float(date[0]) - date[1])) for l in sys.stdin.readlines(): tok = l.split("\t") hgdate = tuple(int(v) for v in tok[0].split()) print "* %s %s\n- %s" % (datestr(hgdate, "%a %b %d %Y"), tok[1], tok[2]) ' >> $rpmspec fi rpmbuild --define "_topdir $rpmdir" -ba $rpmspec --clean if [ $? = 0 ]; then echo echo "Packages are in $rpmdir:" ls -l $rpmdir/*RPMS/* fi