##// END OF EJS Templates
i18n-da: merged translation with TortoiseHg
i18n-da: merged translation with TortoiseHg

File last commit:

r8906:bb255fe7 default
r8915:c57336de default
Show More
buildrpm
72 lines | 2.0 KiB | text/plain | TextLexer
mpm@selenic.com
[PATCH] Add contrib/buildrpm script...
r564 #!/bin/sh
#
# Build a Mercurial RPM in place.
Mads Kiilerich
Make contrib/buildrpm work on Fedora 9....
r7277 # Known to work on:
# - Fedora 9
Mads Kiilerich
buildrpm: complain when hg command isn't available...
r7431 # - Fedora 10
mpm@selenic.com
[PATCH] Add contrib/buildrpm script...
r564 #
# Bryan O'Sullivan <bos@serpentine.com>
Mads Kiilerich
buildrpm: complain when hg command isn't available...
r7431 if hg --version > /dev/null 2>&1; then :
else
echo 'hg command not available!' 1>&2
exit 1
fi
mpm@selenic.com
[PATCH] Add contrib/buildrpm script...
r564 root="`hg root 2>/dev/null`"
specfile=contrib/mercurial.spec
if [ -z "$root" ]; then
echo 'You are not inside a Mercurial repository!' 1>&2
exit 1
fi
Mads Kiilerich
Make contrib/buildrpm work on Fedora 9....
r7277 rpmdir=/tmp/"`basename $root | sed 's/ /_/'`"-rpm # FIXME: Insecure /tmp handling
mpm@selenic.com
[PATCH] Add contrib/buildrpm script...
r564
cd "$root"
rm -rf $rpmdir
mkdir -p $rpmdir/RPMS
hg clone "$root" $rpmdir/BUILD
if [ ! -f $specfile ]; then
echo "Cannot find $specfile!" 1>&2
exit 1
fi
Mads Kiilerich
Make contrib/buildrpm work on Fedora 9....
r7277 tmpspec=/tmp/`basename "$specfile"`.$$ # FIXME: Insecure /tmp handling
mpm@selenic.com
[PATCH] Add contrib/buildrpm script...
r564 # Use the most recent tag as the version.
version=`hg tags | perl -e 'while(<STDIN>){if(/^(\d\S+)/){print$1;exit}}'`
# Compute the release number as the difference in revision numbers
# between the tip and the most recent tag.
Adam Spiers
buildrpm: fix rpm release number calculation...
r4755 release=`hg tags | perl -e 'while(<STDIN>){($tag,$id)=/^(\S+)\s+(\d+)/;if($tag eq "tip"){$tip = $id}elsif($tag=~/^\d/){print $tip-$id+1;exit}}'`
mpm@selenic.com
[PATCH] Add contrib/buildrpm script...
r564 tip=`hg -q tip`
# Beat up the spec file
sed -e 's,^Source:.*,Source: /dev/null,' \
-e "s,^Version:.*,Version: $version," \
-e "s,^Release:.*,Release: $release," \
-e "s,^%prep.*,Changeset: $tip\n\0," \
-e 's,^%setup.*,,' \
$specfile > $tmpspec
Adam Spiers
buildrpm: auto-generate %changelog in .spec file...
r4754 cat <<EOF >> $tmpspec
%changelog
* `date +'%a %b %d %Y'` `hg showconfig ui.username` $version-$release
- Automatically built via $0
EOF
hg log \
--template '* {date|rfc822date} {author}\n- {desc|firstline}\n\n' \
.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
mpm@selenic.com
[PATCH] Add contrib/buildrpm script...
r564 rpmbuild --define "_topdir $rpmdir" -bb $tmpspec
if [ $? = 0 ]; then
rm -rf $tmpspec $rpmdir/BUILD
mv $rpmdir/RPMS/*/* $rpmdir && rm -r $rpmdir/RPMS
echo
Mads Kiilerich
Make contrib/buildrpm work on Fedora 9....
r7277 echo "Packages are in $rpmdir:"
ls -l $rpmdir/*.rpm
mpm@selenic.com
[PATCH] Add contrib/buildrpm script...
r564 fi