##// END OF EJS Templates
packaging: be explicit about Python version in rpm spec...
Mads Kiilerich -
r43649:92a51a45 stable
parent child Browse files
Show More
@@ -1,164 +1,167 b''
1 1 %global emacs_lispdir %{_datadir}/emacs/site-lisp
2 2
3 3 %define withpython %{nil}
4 4
5 5 %if "%{?withpython}"
6 6
7 7 %global pythonver %{withpython}
8 8 %global pythonname Python-%{withpython}
9 9 %global docutilsname docutils-0.14
10 10 %global docutilsmd5 c53768d63db3873b7d452833553469de
11 11 %global pythonhg python-hg
12 12 %global hgpyprefix /opt/%{pythonhg}
13 13 # byte compilation will fail on some some Python /test/ files
14 14 %global _python_bytecompile_errors_terminate_build 0
15 15
16 16 %else
17 17
18 %global pythonver %(python -c 'import sys;print(".".join(map(str, sys.version_info[:2])))')
18 %global pythonexe python2
19 %global pythonver %(%{pythonexe} -c 'import sys;print(".".join(map(str, sys.version_info[:2])))')
19 20
20 21 %endif
21 22
22 23 Summary: A fast, lightweight Source Control Management system
23 24 Name: mercurial
24 25 Version: snapshot
25 26 Release: 0
26 27 License: GPLv2+
27 28 Group: Development/Tools
28 29 URL: https://mercurial-scm.org/
29 30 Source0: %{name}-%{version}-%{release}.tar.gz
30 31 %if "%{?withpython}"
31 32 Source1: %{pythonname}.tgz
32 33 Source2: %{docutilsname}.tar.gz
33 34 %endif
34 35 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
35 36
36 37 BuildRequires: make, gcc, gettext
37 38 %if "%{?withpython}"
38 39 BuildRequires: readline-devel, openssl-devel, ncurses-devel, zlib-devel, bzip2-devel
39 40 %else
40 41 BuildRequires: python >= 2.7, python-devel, python-docutils >= 0.5
41 42 Requires: python >= 2.7
42 43 %endif
43 44 # The hgk extension uses the wish tcl interpreter, but we don't enforce it
44 45 #Requires: tk
45 46
46 47 %description
47 48 Mercurial is a fast, lightweight source control management system designed
48 49 for efficient handling of very large distributed projects.
49 50
50 51 %prep
51 52
52 53 %if "%{?withpython}"
53 54 %setup -q -n mercurial-%{version}-%{release} -a1 -a2
54 55 # despite the comments in cgi.py, we do this to prevent rpmdeps from picking /usr/local/bin/python up
55 sed -i '1c#! /usr/bin/env python' %{pythonname}/Lib/cgi.py
56 sed -i '1c#! /usr/bin/env %{pythonexe}' %{pythonname}/Lib/cgi.py
56 57 %else
57 58 %setup -q -n mercurial-%{version}-%{release}
58 59 %endif
59 60
60 61 %build
61 62
62 63 %if "%{?withpython}"
63 64
64 65 PYPATH=$PWD/%{pythonname}
65 66 cd $PYPATH
66 67 ./configure --prefix=%{hgpyprefix}
67 68 make all %{?_smp_mflags}
68 69 cd -
69 70
70 71 cd %{docutilsname}
71 72 LD_LIBRARY_PATH=$PYPATH $PYPATH/python setup.py build
72 73 cd -
73 74
74 75 # verify Python environment
75 76 LD_LIBRARY_PATH=$PYPATH PYTHONPATH=$PWD/%{docutilsname} $PYPATH/python -c 'import sys, zlib, bz2, ssl, curses, readline'
76 77
77 78 # set environment for make
78 79 export PATH=$PYPATH:$PATH
79 80 export LD_LIBRARY_PATH=$PYPATH
80 81 export CFLAGS="-L $PYPATH"
81 82 export PYTHONPATH=$PWD/%{docutilsname}
82 83
83 84 %endif
84 85
85 make all
86 make all PYTHON=%{pythonexe}
86 87 make -C contrib/chg
87 88
89 sed -i -e '1s|#!/usr/bin/env python$|#!/usr/bin/env %{pythonexe}|' contrib/hg-ssh
90
88 91 %install
89 92 rm -rf $RPM_BUILD_ROOT
90 93
91 94 %if "%{?withpython}"
92 95
93 96 PYPATH=$PWD/%{pythonname}
94 97 cd $PYPATH
95 98 make install DESTDIR=$RPM_BUILD_ROOT
96 99 # these .a are not necessary and they are readonly and strip fails - kill them!
97 100 rm -f %{buildroot}%{hgpyprefix}/lib/{,python2.*/config}/libpython2.*.a
98 101 cd -
99 102
100 103 cd %{docutilsname}
101 104 LD_LIBRARY_PATH=$PYPATH $PYPATH/python setup.py install --root="$RPM_BUILD_ROOT"
102 105 cd -
103 106
104 PATH=$PYPATH:$PATH LD_LIBRARY_PATH=$PYPATH make install DESTDIR=$RPM_BUILD_ROOT PREFIX=%{hgpyprefix} MANDIR=%{_mandir}
107 PATH=$PYPATH:$PATH LD_LIBRARY_PATH=$PYPATH make install PYTHON=%{pythonexe} DESTDIR=$RPM_BUILD_ROOT PREFIX=%{hgpyprefix} MANDIR=%{_mandir}
105 108 mkdir -p $RPM_BUILD_ROOT%{_bindir}
106 109 ( cd $RPM_BUILD_ROOT%{_bindir}/ && ln -s ../..%{hgpyprefix}/bin/hg . )
107 110 ( cd $RPM_BUILD_ROOT%{_bindir}/ && ln -s ../..%{hgpyprefix}/bin/python2.? %{pythonhg} )
108 111
109 112 %else
110 113
111 make install DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} MANDIR=%{_mandir}
114 make install PYTHON=%{pythonexe} DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} MANDIR=%{_mandir}
112 115
113 116 %endif
114 117
115 118 install -m 755 contrib/chg/chg $RPM_BUILD_ROOT%{_bindir}/
116 119 install -m 755 contrib/hgk $RPM_BUILD_ROOT%{_bindir}/
117 120 install -m 755 contrib/hg-ssh $RPM_BUILD_ROOT%{_bindir}/
118 121
119 122 bash_completion_dir=$RPM_BUILD_ROOT%{_sysconfdir}/bash_completion.d
120 123 mkdir -p $bash_completion_dir
121 124 install -m 644 contrib/bash_completion $bash_completion_dir/mercurial.sh
122 125
123 126 zsh_completion_dir=$RPM_BUILD_ROOT%{_datadir}/zsh/site-functions
124 127 mkdir -p $zsh_completion_dir
125 128 install -m 644 contrib/zsh_completion $zsh_completion_dir/_mercurial
126 129
127 130 mkdir -p $RPM_BUILD_ROOT%{emacs_lispdir}
128 131 install -m 644 contrib/mercurial.el $RPM_BUILD_ROOT%{emacs_lispdir}/
129 132 install -m 644 contrib/mq.el $RPM_BUILD_ROOT%{emacs_lispdir}/
130 133
131 134 mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/mercurial/hgrc.d
132 135
133 136 %clean
134 137 rm -rf $RPM_BUILD_ROOT
135 138
136 139 %files
137 140 %defattr(-,root,root,-)
138 141 %doc CONTRIBUTORS COPYING doc/README doc/hg*.txt doc/hg*.html *.cgi contrib/*.fcgi
139 142 %doc %attr(644,root,root) %{_mandir}/man?/hg*
140 143 %doc %attr(644,root,root) contrib/*.svg
141 144 %dir %{_datadir}/zsh/
142 145 %dir %{_datadir}/zsh/site-functions/
143 146 %{_datadir}/zsh/site-functions/_mercurial
144 147 %dir %{_datadir}/emacs/site-lisp/
145 148 %{_datadir}/emacs/site-lisp/mercurial.el
146 149 %{_datadir}/emacs/site-lisp/mq.el
147 150 %{_bindir}/hg
148 151 %{_bindir}/chg
149 152 %{_bindir}/hgk
150 153 %{_bindir}/hg-ssh
151 154 %dir %{_sysconfdir}/bash_completion.d/
152 155 %config(noreplace) %{_sysconfdir}/bash_completion.d/mercurial.sh
153 156 %dir %{_sysconfdir}/mercurial
154 157 %dir %{_sysconfdir}/mercurial/hgrc.d
155 158 %if "%{?withpython}"
156 159 %{_bindir}/%{pythonhg}
157 160 %{hgpyprefix}
158 161 %else
159 162 %{_libdir}/python%{pythonver}/site-packages/%{name}-*-py%{pythonver}.egg-info
160 163 %{_libdir}/python%{pythonver}/site-packages/%{name}
161 164 %{_libdir}/python%{pythonver}/site-packages/hgext
162 165 %{_libdir}/python%{pythonver}/site-packages/hgext3rd
163 166 %{_libdir}/python%{pythonver}/site-packages/hgdemandimport
164 167 %endif
General Comments 0
You need to be logged in to leave comments. Login now