Show More
@@ -2,22 +2,23 b'' | |||
|
2 | 2 | # |
|
3 | 3 | # Build a Mercurial RPM in place. |
|
4 | 4 | # |
|
5 | # Bryan O'Sullivan <bos@serpentine.com> | |
|
6 | # | |
|
7 | 5 | # Tested on |
|
8 | # - Fedora 10 | |
|
6 | # - Fedora 8 (with docutils 0.5) | |
|
9 | 7 | # - Fedora 11 |
|
10 | # - Centos 5.3 (with Fedora EPEL repo for asciidoc) | |
|
8 | # - OpenSuse 11.2 | |
|
11 | 9 | |
|
12 | 10 | cd "`dirname $0`/.." |
|
13 | 11 | HG="$PWD/hg" |
|
14 | 12 | PYTHONPATH="$PWD/mercurial/pure" |
|
15 | 13 | export PYTHONPATH |
|
16 | 14 | |
|
17 | root="`$HG root 2>/dev/null`" | |
|
18 | 15 | specfile=contrib/mercurial.spec |
|
16 | if [ ! -f $specfile ]; then | |
|
17 | echo "Cannot find $specfile!" 1>&2 | |
|
18 | exit 1 | |
|
19 | fi | |
|
19 | 20 | |
|
20 |
if [ |
|
|
21 | if [ ! -d .hg ]; then | |
|
21 | 22 | echo 'You are not inside a Mercurial repository!' 1>&2 |
|
22 | 23 | exit 1 |
|
23 | 24 | fi |
@@ -30,17 +31,11 b" if $HG id -i | grep '+$' > /dev/null 2>&" | |||
|
30 | 31 | fi |
|
31 | 32 | fi |
|
32 | 33 | |
|
33 | rpmdir=/tmp/"`basename $root | sed 's/ /_/'`"-rpm # FIXME: Insecure /tmp handling | |
|
34 | rpmdir="$PWD/rpmbuild" | |
|
34 | 35 | |
|
35 | cd "$root" | |
|
36 | 36 | rm -rf $rpmdir |
|
37 | 37 | mkdir -p $rpmdir/RPMS |
|
38 |
$HG clone -u . |
|
|
39 | ||
|
40 | if [ ! -f $specfile ]; then | |
|
41 | echo "Cannot find $specfile!" 1>&2 | |
|
42 | exit 1 | |
|
43 | fi | |
|
38 | $HG clone -u . . $rpmdir/BUILD | |
|
44 | 39 | |
|
45 | 40 | tmpspec=/tmp/`basename "$specfile"`.$$ # FIXME: Insecure /tmp handling |
|
46 | 41 | # make setup.py build the version string |
@@ -56,13 +51,10 b' else' | |||
|
56 | 51 | version=`echo $hgversion | sed -e 's/+.*//'` |
|
57 | 52 | release='0' |
|
58 | 53 | fi |
|
59 | tip=`$HG -q tip` | |
|
60 | 54 | |
|
61 | # Beat up the spec file | |
|
62 | sed -e 's,^Source:.*,Source: /dev/null,' \ | |
|
63 | -e "s,^Version:.*,Version: $version," \ | |
|
55 | sed -e "s,^Version:.*,Version: $version," \ | |
|
64 | 56 | -e "s,^Release:.*,Release: $release," \ |
|
65 |
-e "s,^%prep.*, |
|
|
57 | -e "s,^%prep.*,\n\0," \ | |
|
66 | 58 | -e 's,^%setup.*,,' \ |
|
67 | 59 | $specfile > $tmpspec |
|
68 | 60 | |
@@ -79,9 +71,8 b' EOF' | |||
|
79 | 71 | -e '/^\* [MTWFS][a-z][a-z] /{s/ [012][0-9]:[0-9][0-9]:[0-9][0-9] [+-][0-9]\{4\}//}' \ |
|
80 | 72 | >> $tmpspec |
|
81 | 73 | |
|
82 | rpmbuild --define "_topdir $rpmdir" -bb $tmpspec | |
|
74 | rpmbuild --define "_topdir $rpmdir" -bb $tmpspec --clean | |
|
83 | 75 | if [ $? = 0 ]; then |
|
84 | rm -rf $tmpspec $rpmdir/BUILD | |
|
85 | 76 | mv $rpmdir/RPMS/*/* $rpmdir && rm -r $rpmdir/RPMS |
|
86 | 77 | echo |
|
87 | 78 | echo "Packages are in $rpmdir:" |
General Comments 0
You need to be logged in to leave comments.
Login now