contrib/buildrpm
changeset 9814 5070e4d57276
parent 9813 2059795bb5d0
child 21638 5337cb17fa1f
equal deleted inserted replaced
9813:2059795bb5d0 9814:5070e4d57276
    55 
    55 
    56 sed -e "s,^Version:.*,Version: $version," \
    56 sed -e "s,^Version:.*,Version: $version," \
    57     -e "s,^Release:.*,Release: $release," \
    57     -e "s,^Release:.*,Release: $release," \
    58     $specfile > $rpmspec
    58     $specfile > $rpmspec
    59 
    59 
    60 cat <<EOF >> $rpmspec
    60 echo >> $rpmspec
    61 %changelog
    61 echo "%changelog" >> $rpmspec
    62 * `LANG=en_US date +'%a %b %d %Y'` `$HG showconfig ui.username` $version-$release
       
    63 - Automatically built via $0
       
    64 
    62 
    65 EOF
    63 if echo $version | grep '+' > /dev/null 2>&1; then
    66 $HG log \
    64     latesttag="`echo $version | sed -e 's/+.*//'`"
    67      --template '* {date|rfc822date} {author}\n- {desc|firstline}\n\n' \
    65     $HG log -r .:"$latesttag" -fM \
    68      .hgtags \
    66         --template '{date|hgdate}\t{author}\t{desc|firstline}\n' | python -c '
    69   | sed -e 's/^\(\* [MTWFS][a-z][a-z]\), \([0-3][0-9]\) \([A-Z][a-z][a-z]\) /\1 \3 \2 /' \
    67 import sys, time
    70         -e '/^\* [MTWFS][a-z][a-z] /{s/ [012][0-9]:[0-9][0-9]:[0-9][0-9] [+-][0-9]\{4\}//}' \
    68 
    71    >> $rpmspec
    69 def datestr(date, format):
       
    70     return time.strftime(format, time.gmtime(float(date[0]) - date[1]))
       
    71 
       
    72 changelog = []
       
    73 for l in sys.stdin.readlines():
       
    74     tok = l.split("\t")
       
    75     hgdate = tuple(int(v) for v in tok[0].split())
       
    76     changelog.append((datestr(hgdate, "%F"), tok[1], hgdate, tok[2]))
       
    77 prevtitle = ""
       
    78 for l in sorted(changelog, reverse=True):
       
    79     title = "* %s %s" % (datestr(l[2], "%a %b %d %Y"), l[1])
       
    80     if prevtitle != title:
       
    81         prevtitle = title
       
    82         print
       
    83         print title
       
    84     print "- %s" % l[3].strip()
       
    85 ' >> $rpmspec
       
    86 
       
    87 else
       
    88 
       
    89     $HG log \
       
    90          --template '{date|hgdate}\t{author}\t{desc|firstline}\n' \
       
    91          .hgtags | python -c '
       
    92 import sys, time
       
    93 
       
    94 def datestr(date, format):
       
    95     return time.strftime(format, time.gmtime(float(date[0]) - date[1]))
       
    96 
       
    97 for l in sys.stdin.readlines():
       
    98     tok = l.split("\t")
       
    99     hgdate = tuple(int(v) for v in tok[0].split())
       
   100     print "* %s %s\n- %s" % (datestr(hgdate, "%a %b %d %Y"), tok[1], tok[2])
       
   101 ' >> $rpmspec
       
   102 
       
   103 fi
    72 
   104 
    73 rpmbuild --define "_topdir $rpmdir" -ba $rpmspec --clean
   105 rpmbuild --define "_topdir $rpmdir" -ba $rpmspec --clean
    74 if [ $? = 0 ]; then
   106 if [ $? = 0 ]; then
    75     echo
   107     echo
    76     echo "Packages are in $rpmdir:"
   108     echo "Packages are in $rpmdir:"