Show More
@@ -1,110 +1,111 b'' | |||||
1 | #!/bin/sh -e |
|
1 | #!/bin/sh -e | |
2 | # |
|
2 | # | |
3 | # Build a Mercurial RPM from the current repo |
|
3 | # Build a Mercurial RPM from the current repo | |
4 | # |
|
4 | # | |
5 | # Tested on |
|
5 | # Tested on | |
6 | # - Fedora 20 |
|
6 | # - Fedora 20 | |
7 | # - CentOS 5 |
|
7 | # - CentOS 5 | |
8 | # - centOS 6 |
|
8 | # - centOS 6 | |
9 |
|
9 | |||
10 | cd "`dirname $0`/.." |
|
10 | cd "`dirname $0`/.." | |
11 | HG="$PWD/hg" |
|
|||
12 | PYTHONPATH="$PWD/mercurial/pure" |
|
|||
13 | export PYTHONPATH |
|
|||
14 |
|
11 | |||
15 | specfile=contrib/mercurial.spec |
|
12 | specfile=contrib/mercurial.spec | |
16 | if [ ! -f $specfile ]; then |
|
13 | if [ ! -f $specfile ]; then | |
17 | echo "Cannot find $specfile!" 1>&2 |
|
14 | echo "Cannot find $specfile!" 1>&2 | |
18 | exit 1 |
|
15 | exit 1 | |
19 | fi |
|
16 | fi | |
20 |
|
17 | |||
21 | if [ ! -d .hg ]; then |
|
18 | if [ ! -d .hg ]; then | |
22 | echo 'You are not inside a Mercurial repository!' 1>&2 |
|
19 | echo 'You are not inside a Mercurial repository!' 1>&2 | |
23 | exit 1 |
|
20 | exit 1 | |
24 | fi |
|
21 | fi | |
25 |
|
22 | |||
26 | if $HG id -i | grep '+$' > /dev/null 2>&1; then |
|
23 | if $HG id -i | grep '+$' > /dev/null 2>&1; then | |
27 | echo -n "Your local changes will NOT be in the RPM. Continue [y/n] ? " |
|
24 | echo -n "Your local changes will NOT be in the RPM. Continue [y/n] ? " | |
28 | read answer |
|
25 | read answer | |
29 | if echo $answer | grep -iv '^y'; then |
|
26 | if echo $answer | grep -iv '^y'; then | |
30 | exit |
|
27 | exit | |
31 | fi |
|
28 | fi | |
32 | fi |
|
29 | fi | |
33 |
|
30 | |||
|
31 | # build local hg and use it | |||
|
32 | python setup.py build_py -c -d . | |||
|
33 | HG="$PWD/hg" | |||
|
34 | PYTHONPATH="$PWD/mercurial/pure" | |||
|
35 | export PYTHONPATH | |||
|
36 | ||||
34 | rpmdir="$PWD/rpmbuild" |
|
37 | rpmdir="$PWD/rpmbuild" | |
35 |
|
38 | |||
36 | rm -rf $rpmdir |
|
39 | rm -rf $rpmdir | |
37 | mkdir -p $rpmdir/SOURCES $rpmdir/SPECS $rpmdir/RPMS $rpmdir/SRPMS $rpmdir/BUILD |
|
40 | mkdir -p $rpmdir/SOURCES $rpmdir/SPECS $rpmdir/RPMS $rpmdir/SRPMS $rpmdir/BUILD | |
38 |
|
41 | |||
39 | # make setup.py build the version string |
|
|||
40 | python setup.py build_py -c -d . |
|
|||
41 | hgversion=`$HG version | sed -ne 's/.*(version \(.*\))$/\1/p'` |
|
42 | hgversion=`$HG version | sed -ne 's/.*(version \(.*\))$/\1/p'` | |
42 |
|
43 | |||
43 | if echo $hgversion | grep -- '-' > /dev/null 2>&1; then |
|
44 | if echo $hgversion | grep -- '-' > /dev/null 2>&1; then | |
44 | # nightly build case, version is like 1.3.1+250-20b91f91f9ca |
|
45 | # nightly build case, version is like 1.3.1+250-20b91f91f9ca | |
45 | version=`echo $hgversion | cut -d- -f1` |
|
46 | version=`echo $hgversion | cut -d- -f1` | |
46 | release=`echo $hgversion | cut -d- -f2 | sed -e 's/+.*//'` |
|
47 | release=`echo $hgversion | cut -d- -f2 | sed -e 's/+.*//'` | |
47 | else |
|
48 | else | |
48 | # official tag, version is like 1.3.1 |
|
49 | # official tag, version is like 1.3.1 | |
49 | version=`echo $hgversion | sed -e 's/+.*//'` |
|
50 | version=`echo $hgversion | sed -e 's/+.*//'` | |
50 | release='0' |
|
51 | release='0' | |
51 | fi |
|
52 | fi | |
52 |
|
53 | |||
53 | $HG archive -t tgz $rpmdir/SOURCES/mercurial-$version.tar.gz |
|
54 | $HG archive -t tgz $rpmdir/SOURCES/mercurial-$version.tar.gz | |
54 | rpmspec=$rpmdir/SPECS/mercurial-$version.spec |
|
55 | rpmspec=$rpmdir/SPECS/mercurial-$version.spec | |
55 |
|
56 | |||
56 | sed -e "s,^Version:.*,Version: $version," \ |
|
57 | sed -e "s,^Version:.*,Version: $version," \ | |
57 | -e "s,^Release:.*,Release: $release," \ |
|
58 | -e "s,^Release:.*,Release: $release," \ | |
58 | $specfile > $rpmspec |
|
59 | $specfile > $rpmspec | |
59 |
|
60 | |||
60 | echo >> $rpmspec |
|
61 | echo >> $rpmspec | |
61 | echo "%changelog" >> $rpmspec |
|
62 | echo "%changelog" >> $rpmspec | |
62 |
|
63 | |||
63 | if echo $version | grep '+' > /dev/null 2>&1; then |
|
64 | if echo $version | grep '+' > /dev/null 2>&1; then | |
64 | latesttag="`echo $version | sed -e 's/+.*//'`" |
|
65 | latesttag="`echo $version | sed -e 's/+.*//'`" | |
65 | $HG log -r .:"$latesttag" -fM \ |
|
66 | $HG log -r .:"$latesttag" -fM \ | |
66 | --template '{date|hgdate}\t{author}\t{desc|firstline}\n' | python -c ' |
|
67 | --template '{date|hgdate}\t{author}\t{desc|firstline}\n' | python -c ' | |
67 | import sys, time |
|
68 | import sys, time | |
68 |
|
69 | |||
69 | def datestr(date, format): |
|
70 | def datestr(date, format): | |
70 | return time.strftime(format, time.gmtime(float(date[0]) - date[1])) |
|
71 | return time.strftime(format, time.gmtime(float(date[0]) - date[1])) | |
71 |
|
72 | |||
72 | changelog = [] |
|
73 | changelog = [] | |
73 | for l in sys.stdin.readlines(): |
|
74 | for l in sys.stdin.readlines(): | |
74 | tok = l.split("\t") |
|
75 | tok = l.split("\t") | |
75 | hgdate = tuple(int(v) for v in tok[0].split()) |
|
76 | hgdate = tuple(int(v) for v in tok[0].split()) | |
76 | changelog.append((datestr(hgdate, "%F"), tok[1], hgdate, tok[2])) |
|
77 | changelog.append((datestr(hgdate, "%F"), tok[1], hgdate, tok[2])) | |
77 | prevtitle = "" |
|
78 | prevtitle = "" | |
78 | for l in sorted(changelog, reverse=True): |
|
79 | for l in sorted(changelog, reverse=True): | |
79 | title = "* %s %s" % (datestr(l[2], "%a %b %d %Y"), l[1]) |
|
80 | title = "* %s %s" % (datestr(l[2], "%a %b %d %Y"), l[1]) | |
80 | if prevtitle != title: |
|
81 | if prevtitle != title: | |
81 | prevtitle = title |
|
82 | prevtitle = title | |
82 |
|
83 | |||
83 | print title |
|
84 | print title | |
84 | print "- %s" % l[3].strip() |
|
85 | print "- %s" % l[3].strip() | |
85 | ' >> $rpmspec |
|
86 | ' >> $rpmspec | |
86 |
|
87 | |||
87 | else |
|
88 | else | |
88 |
|
89 | |||
89 | $HG log \ |
|
90 | $HG log \ | |
90 | --template '{date|hgdate}\t{author}\t{desc|firstline}\n' \ |
|
91 | --template '{date|hgdate}\t{author}\t{desc|firstline}\n' \ | |
91 | .hgtags | python -c ' |
|
92 | .hgtags | python -c ' | |
92 | import sys, time |
|
93 | import sys, time | |
93 |
|
94 | |||
94 | def datestr(date, format): |
|
95 | def datestr(date, format): | |
95 | return time.strftime(format, time.gmtime(float(date[0]) - date[1])) |
|
96 | return time.strftime(format, time.gmtime(float(date[0]) - date[1])) | |
96 |
|
97 | |||
97 | for l in sys.stdin.readlines(): |
|
98 | for l in sys.stdin.readlines(): | |
98 | tok = l.split("\t") |
|
99 | tok = l.split("\t") | |
99 | hgdate = tuple(int(v) for v in tok[0].split()) |
|
100 | 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 | print "* %s %s\n- %s" % (datestr(hgdate, "%a %b %d %Y"), tok[1], tok[2]) | |
101 | ' >> $rpmspec |
|
102 | ' >> $rpmspec | |
102 |
|
103 | |||
103 | fi |
|
104 | fi | |
104 |
|
105 | |||
105 | rpmbuild --define "_topdir $rpmdir" -ba $rpmspec --clean |
|
106 | rpmbuild --define "_topdir $rpmdir" -ba $rpmspec --clean | |
106 | if [ $? = 0 ]; then |
|
107 | if [ $? = 0 ]; then | |
107 | echo |
|
108 | echo | |
108 | echo "Packages are in $rpmdir:" |
|
109 | echo "Packages are in $rpmdir:" | |
109 | ls -l $rpmdir/*RPMS/* |
|
110 | ls -l $rpmdir/*RPMS/* | |
110 | fi |
|
111 | fi |
@@ -1,78 +1,78 b'' | |||||
|
1 | %global emacs_lispdir %{_datadir}/emacs/site-lisp | |||
|
2 | %global pythonver %(python -c 'import sys;print ".".join(map(str, sys.version_info[:2]))') | |||
|
3 | ||||
1 | Summary: A fast, lightweight Source Control Management system |
|
4 | Summary: A fast, lightweight Source Control Management system | |
2 | Name: mercurial |
|
5 | Name: mercurial | |
3 | Version: snapshot |
|
6 | Version: snapshot | |
4 | Release: 0 |
|
7 | Release: 0 | |
5 | License: GPLv2+ |
|
8 | License: GPLv2+ | |
6 | Group: Development/Tools |
|
9 | Group: Development/Tools | |
7 | URL: http://mercurial.selenic.com/ |
|
10 | URL: http://mercurial.selenic.com/ | |
8 | Source0: http://mercurial.selenic.com/release/%{name}-%{version}.tar.gz |
|
11 | Source0: http://mercurial.selenic.com/release/%{name}-%{version}.tar.gz | |
9 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root |
|
12 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root | |
10 |
|
13 | |||
11 | BuildRequires: python >= 2.4, python-devel, make, gcc, python-docutils >= 0.5, gettext |
|
14 | BuildRequires: python >= 2.4, python-devel, make, gcc, python-docutils >= 0.5, gettext | |
12 | Provides: hg = %{version}-%{release} |
|
15 | Provides: hg = %{version}-%{release} | |
13 | Requires: python >= 2.4 |
|
16 | Requires: python >= 2.4 | |
14 | # The hgk extension uses the wish tcl interpreter, but we don't enforce it |
|
17 | # The hgk extension uses the wish tcl interpreter, but we don't enforce it | |
15 | #Requires: tk |
|
18 | #Requires: tk | |
16 |
|
19 | |||
17 | %define pythonver %(python -c 'import sys;print ".".join(map(str, sys.version_info[:2]))') |
|
|||
18 | %define emacs_lispdir %{_datadir}/emacs/site-lisp |
|
|||
19 |
|
||||
20 | %description |
|
20 | %description | |
21 | Mercurial is a fast, lightweight source control management system designed |
|
21 | Mercurial is a fast, lightweight source control management system designed | |
22 | for efficient handling of very large distributed projects. |
|
22 | for efficient handling of very large distributed projects. | |
23 |
|
23 | |||
24 | %prep |
|
24 | %prep | |
25 | %setup -q |
|
25 | %setup -q | |
26 |
|
26 | |||
27 | %build |
|
27 | %build | |
28 | make all |
|
28 | make all | |
29 |
|
29 | |||
30 | %install |
|
30 | %install | |
31 | rm -rf $RPM_BUILD_ROOT |
|
31 | rm -rf $RPM_BUILD_ROOT | |
32 | make install DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} MANDIR=%{_mandir} |
|
32 | make install DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} MANDIR=%{_mandir} | |
33 |
|
33 | |||
34 | install -m 755 contrib/hgk $RPM_BUILD_ROOT%{_bindir}/ |
|
34 | install -m 755 contrib/hgk $RPM_BUILD_ROOT%{_bindir}/ | |
35 | install -m 755 contrib/hg-ssh $RPM_BUILD_ROOT%{_bindir}/ |
|
35 | install -m 755 contrib/hg-ssh $RPM_BUILD_ROOT%{_bindir}/ | |
36 |
|
36 | |||
37 | bash_completion_dir=$RPM_BUILD_ROOT%{_sysconfdir}/bash_completion.d |
|
37 | bash_completion_dir=$RPM_BUILD_ROOT%{_sysconfdir}/bash_completion.d | |
38 | mkdir -p $bash_completion_dir |
|
38 | mkdir -p $bash_completion_dir | |
39 | install -m 644 contrib/bash_completion $bash_completion_dir/mercurial.sh |
|
39 | install -m 644 contrib/bash_completion $bash_completion_dir/mercurial.sh | |
40 |
|
40 | |||
41 | zsh_completion_dir=$RPM_BUILD_ROOT%{_datadir}/zsh/site-functions |
|
41 | zsh_completion_dir=$RPM_BUILD_ROOT%{_datadir}/zsh/site-functions | |
42 | mkdir -p $zsh_completion_dir |
|
42 | mkdir -p $zsh_completion_dir | |
43 | install -m 644 contrib/zsh_completion $zsh_completion_dir/_mercurial |
|
43 | install -m 644 contrib/zsh_completion $zsh_completion_dir/_mercurial | |
44 |
|
44 | |||
45 | mkdir -p $RPM_BUILD_ROOT%{emacs_lispdir} |
|
45 | mkdir -p $RPM_BUILD_ROOT%{emacs_lispdir} | |
46 | install -m 644 contrib/mercurial.el $RPM_BUILD_ROOT%{emacs_lispdir}/ |
|
46 | install -m 644 contrib/mercurial.el $RPM_BUILD_ROOT%{emacs_lispdir}/ | |
47 | install -m 644 contrib/mq.el $RPM_BUILD_ROOT%{emacs_lispdir}/ |
|
47 | install -m 644 contrib/mq.el $RPM_BUILD_ROOT%{emacs_lispdir}/ | |
48 |
|
48 | |||
49 | mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/mercurial/hgrc.d |
|
49 | mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/mercurial/hgrc.d | |
50 | install -m 644 contrib/mergetools.hgrc $RPM_BUILD_ROOT%{_sysconfdir}/mercurial/hgrc.d/mergetools.rc |
|
50 | install -m 644 contrib/mergetools.hgrc $RPM_BUILD_ROOT%{_sysconfdir}/mercurial/hgrc.d/mergetools.rc | |
51 |
|
51 | |||
52 | %clean |
|
52 | %clean | |
53 | rm -rf $RPM_BUILD_ROOT |
|
53 | rm -rf $RPM_BUILD_ROOT | |
54 |
|
54 | |||
55 | %files |
|
55 | %files | |
56 | %defattr(-,root,root,-) |
|
56 | %defattr(-,root,root,-) | |
57 | %doc CONTRIBUTORS COPYING doc/README doc/hg*.txt doc/hg*.html *.cgi contrib/*.fcgi |
|
57 | %doc CONTRIBUTORS COPYING doc/README doc/hg*.txt doc/hg*.html *.cgi contrib/*.fcgi | |
58 | %doc %attr(644,root,root) %{_mandir}/man?/hg* |
|
58 | %doc %attr(644,root,root) %{_mandir}/man?/hg* | |
59 | %doc %attr(644,root,root) contrib/*.svg contrib/sample.hgrc |
|
59 | %doc %attr(644,root,root) contrib/*.svg contrib/sample.hgrc | |
60 | %dir %{_datadir}/zsh/ |
|
60 | %dir %{_datadir}/zsh/ | |
61 | %dir %{_datadir}/zsh/site-functions/ |
|
61 | %dir %{_datadir}/zsh/site-functions/ | |
62 | %{_datadir}/zsh/site-functions/_mercurial |
|
62 | %{_datadir}/zsh/site-functions/_mercurial | |
63 | %dir %{_datadir}/emacs/site-lisp/ |
|
63 | %dir %{_datadir}/emacs/site-lisp/ | |
64 | %{_datadir}/emacs/site-lisp/mercurial.el |
|
64 | %{_datadir}/emacs/site-lisp/mercurial.el | |
65 | %{_datadir}/emacs/site-lisp/mq.el |
|
65 | %{_datadir}/emacs/site-lisp/mq.el | |
66 | %{_bindir}/hg |
|
66 | %{_bindir}/hg | |
67 | %{_bindir}/hgk |
|
67 | %{_bindir}/hgk | |
68 | %{_bindir}/hg-ssh |
|
68 | %{_bindir}/hg-ssh | |
69 | %dir %{_sysconfdir}/bash_completion.d/ |
|
69 | %dir %{_sysconfdir}/bash_completion.d/ | |
70 | %config(noreplace) %{_sysconfdir}/bash_completion.d/mercurial.sh |
|
70 | %config(noreplace) %{_sysconfdir}/bash_completion.d/mercurial.sh | |
71 | %dir %{_sysconfdir}/mercurial |
|
71 | %dir %{_sysconfdir}/mercurial | |
72 | %dir %{_sysconfdir}/mercurial/hgrc.d |
|
72 | %dir %{_sysconfdir}/mercurial/hgrc.d | |
73 | %config(noreplace) %{_sysconfdir}/mercurial/hgrc.d/mergetools.rc |
|
73 | %config(noreplace) %{_sysconfdir}/mercurial/hgrc.d/mergetools.rc | |
74 | %if "%{?pythonver}" != "2.4" |
|
74 | %if "%{?pythonver}" != "2.4" | |
75 | %{_libdir}/python%{pythonver}/site-packages/%{name}-*-py%{pythonver}.egg-info |
|
75 | %{_libdir}/python%{pythonver}/site-packages/%{name}-*-py%{pythonver}.egg-info | |
76 | %endif |
|
76 | %endif | |
77 | %{_libdir}/python%{pythonver}/site-packages/%{name} |
|
77 | %{_libdir}/python%{pythonver}/site-packages/%{name} | |
78 | %{_libdir}/python%{pythonver}/site-packages/hgext |
|
78 | %{_libdir}/python%{pythonver}/site-packages/hgext |
General Comments 0
You need to be logged in to leave comments.
Login now