changeset 4754:e5e6dd8ba6bb

buildrpm: auto-generate %changelog in .spec file Top entry is tip; subsequent entries are the version tags from .hgtags.
author Adam Spiers <hg@adamspiers.org>
date Sun, 03 Jun 2007 14:42:39 +0100
parents 620cea146b19
children 6def53be19fb
files contrib/buildrpm
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/buildrpm	Sat Jun 30 01:21:22 2007 +0100
+++ b/contrib/buildrpm	Sun Jun 03 14:42:39 2007 +0100
@@ -40,6 +40,19 @@
     -e 's,^%setup.*,,' \
     $specfile > $tmpspec
 
+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
+
 rpmbuild --define "_topdir $rpmdir" -bb $tmpspec
 if [ $? = 0 ]; then
     rm -rf $tmpspec $rpmdir/BUILD