##// END OF EJS Templates
contrib/buildrpm: Don't require installed hg, use local hg with pure extensions
Mads Kiilerich -
r8869:d244ee52 default
parent child Browse files
Show More
@@ -9,13 +9,11 b''
9 # - Fedora 11
9 # - Fedora 11
10 # - Centos 5.3 (with Fedora EPEL repo for asciidoc)
10 # - Centos 5.3 (with Fedora EPEL repo for asciidoc)
11
11
12 if hg --version > /dev/null 2>&1; then :
12 HG="`dirname $0`/../hg"
13 else
13 PYTHONPATH="`dirname $0`/../mercurial/pure"
14 echo 'hg command not available!' 1>&2
14 export PYTHONPATH
15 exit 1
16 fi
17
15
18 root="`hg root 2>/dev/null`"
16 root="`$HG root 2>/dev/null`"
19 specfile=contrib/mercurial.spec
17 specfile=contrib/mercurial.spec
20
18
21 if [ -z "$root" ]; then
19 if [ -z "$root" ]; then
@@ -28,7 +26,7 b' rpmdir=/tmp/"`basename $root | sed \'s/ /'
28 cd "$root"
26 cd "$root"
29 rm -rf $rpmdir
27 rm -rf $rpmdir
30 mkdir -p $rpmdir/RPMS
28 mkdir -p $rpmdir/RPMS
31 hg clone "$root" $rpmdir/BUILD
29 $HG clone "$root" $rpmdir/BUILD
32
30
33 if [ ! -f $specfile ]; then
31 if [ ! -f $specfile ]; then
34 echo "Cannot find $specfile!" 1>&2
32 echo "Cannot find $specfile!" 1>&2
@@ -37,11 +35,11 b' fi'
37
35
38 tmpspec=/tmp/`basename "$specfile"`.$$ # FIXME: Insecure /tmp handling
36 tmpspec=/tmp/`basename "$specfile"`.$$ # FIXME: Insecure /tmp handling
39 # Use the most recent tag as the version.
37 # Use the most recent tag as the version.
40 version=`hg tags | python -c 'import sys; print [l for l in sys.stdin.readlines() if l[0].isdigit()][0].split()[0]'`
38 version=`$HG tags | python -c 'import sys; print [l for l in sys.stdin.readlines() if l[0].isdigit()][0].split()[0]'`
41 # Compute the release number as the difference in revision numbers
39 # Compute the release number as the difference in revision numbers
42 # between the tip and the most recent tag.
40 # between the tip and the most recent tag.
43 release=`hg tags | python -c 'import sys; l = sys.stdin.readlines(); print int(l[0].split()[1].split(":")[0]) - int([x for x in l if x[0].isdigit()][0].split()[1].split(":")[0])'`
41 release=`$HG tags | python -c 'import sys; l = sys.stdin.readlines(); print int(l[0].split()[1].split(":")[0]) - int([x for x in l if x[0].isdigit()][0].split()[1].split(":")[0])'`
44 tip=`hg -q tip`
42 tip=`$HG -q tip`
45
43
46 # Beat up the spec file
44 # Beat up the spec file
47 sed -e 's,^Source:.*,Source: /dev/null,' \
45 sed -e 's,^Source:.*,Source: /dev/null,' \
@@ -53,11 +51,11 b" sed -e 's,^Source:.*,Source: /dev/null,'"
53
51
54 cat <<EOF >> $tmpspec
52 cat <<EOF >> $tmpspec
55 %changelog
53 %changelog
56 * `date +'%a %b %d %Y'` `hg showconfig ui.username` $version-$release
54 * `date +'%a %b %d %Y'` `$HG showconfig ui.username` $version-$release
57 - Automatically built via $0
55 - Automatically built via $0
58
56
59 EOF
57 EOF
60 hg log \
58 $HG log \
61 --template '* {date|rfc822date} {author}\n- {desc|firstline}\n\n' \
59 --template '* {date|rfc822date} {author}\n- {desc|firstline}\n\n' \
62 .hgtags \
60 .hgtags \
63 | sed -e 's/^\(\* [MTWFS][a-z][a-z]\), \([0-3][0-9]\) \([A-Z][a-z][a-z]\) /\1 \3 \2 /' \
61 | sed -e 's/^\(\* [MTWFS][a-z][a-z]\), \([0-3][0-9]\) \([A-Z][a-z][a-z]\) /\1 \3 \2 /' \
General Comments 0
You need to be logged in to leave comments. Login now