Mercurial > hg
changeset 9813:2059795bb5d0
buildrpm: build full RPM package including sources
author | Gilles Moris <gilles.moris@free.fr> |
---|---|
date | Fri, 06 Nov 2009 09:59:55 +0100 |
parents | dd2c95fc4fe5 |
children | 5070e4d57276 |
files | contrib/buildrpm |
diffstat | 1 files changed, 9 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/buildrpm Fri Nov 06 09:53:23 2009 +0100 +++ b/contrib/buildrpm Fri Nov 06 09:59:55 2009 +0100 @@ -34,10 +34,8 @@ rpmdir="$PWD/rpmbuild" rm -rf $rpmdir -mkdir -p $rpmdir/RPMS -$HG clone -u . . $rpmdir/BUILD +mkdir -p $rpmdir/SOURCES $rpmdir/SPECS $rpmdir/RPMS $rpmdir/SRPMS $rpmdir/BUILD -tmpspec=/tmp/`basename "$specfile"`.$$ # FIXME: Insecure /tmp handling # make setup.py build the version string python setup.py build_py -c -d . hgversion=`$HG version | sed -ne 's/.*(version \(.*\))$/\1/p'` @@ -52,13 +50,14 @@ release='0' fi +$HG archive -t tgz $rpmdir/SOURCES/mercurial-$version.tar.gz +rpmspec=$rpmdir/SPECS/mercurial-$version.spec + sed -e "s,^Version:.*,Version: $version," \ -e "s,^Release:.*,Release: $release," \ - -e "s,^%prep.*,\n\0," \ - -e 's,^%setup.*,,' \ - $specfile > $tmpspec + $specfile > $rpmspec -cat <<EOF >> $tmpspec +cat <<EOF >> $rpmspec %changelog * `LANG=en_US date +'%a %b %d %Y'` `$HG showconfig ui.username` $version-$release - Automatically built via $0 @@ -69,12 +68,11 @@ .hgtags \ | sed -e 's/^\(\* [MTWFS][a-z][a-z]\), \([0-3][0-9]\) \([A-Z][a-z][a-z]\) /\1 \3 \2 /' \ -e '/^\* [MTWFS][a-z][a-z] /{s/ [012][0-9]:[0-9][0-9]:[0-9][0-9] [+-][0-9]\{4\}//}' \ - >> $tmpspec + >> $rpmspec -rpmbuild --define "_topdir $rpmdir" -bb $tmpspec --clean +rpmbuild --define "_topdir $rpmdir" -ba $rpmspec --clean if [ $? = 0 ]; then - mv $rpmdir/RPMS/*/* $rpmdir && rm -r $rpmdir/RPMS echo echo "Packages are in $rpmdir:" - ls -l $rpmdir/*.rpm + ls -l $rpmdir/*RPMS/* fi