]>
Commit | Line | Data |
---|---|---|
83e18d77 | 1 | # TODO |
d254aee3 | 2 | # - move %{_datadir}/pootle/mo/* to system localedir as pootle.mo |
83e18d77 ER |
3 | %define fullname Pootle |
4 | Summary: Localization and translation management web application | |
5 | Name: pootle | |
c9d9939e | 6 | Version: 2.1.6 |
04b20369 | 7 | Release: 5 |
6a03db66 | 8 | License: GPL v2 |
83e18d77 | 9 | Group: Development/Tools |
05a1e280 | 10 | Source0: http://downloads.sourceforge.net/translate/%{fullname}-%{version}.tar.bz2 |
c9d9939e | 11 | # Source0-md5: 1dc69e42cd93f9174443af350df57491 |
4f752939 | 12 | Source1: apache.conf |
710cf04b ER |
13 | Patch0: settings.patch |
14 | Patch1: paths.patch | |
098c6911 | 15 | Patch2: homedir.patch |
22a51b49 | 16 | Patch3: iso-codes-message.patch |
6a03db66 | 17 | Patch4: bug-2005.patch |
b042bedc | 18 | URL: http://translate.sourceforge.net/wiki/pootle/index |
83e18d77 | 19 | BuildRequires: python-devel |
631c177e | 20 | BuildRequires: python-modules |
21 | BuildRequires: rpm-pythonprov | |
83e18d77 | 22 | BuildRequires: rpmbuild(macros) >= 1.228 |
d254aee3 | 23 | BuildRequires: sed >= 4.0 |
83e18d77 | 24 | BuildRequires: translate-toolkit >= 1.4.1 |
60d8d4b5 ER |
25 | Requires: apache-mod_alias |
26 | Requires: apache-mod_authz_host | |
3712e06b | 27 | Requires: apache-mod_mime |
04b20369 | 28 | Requires: apache(mod_wsgi) |
83e18d77 ER |
29 | Requires: group(http) |
30 | Requires: iso-codes | |
83e18d77 ER |
31 | Requires: python-Levenshtein |
32 | Requires: python-django >= 1.0 | |
264704ca | 33 | Requires: python-django-south |
83e18d77 ER |
34 | Requires: python-djblets |
35 | Requires: python-lxml | |
264704ca | 36 | Requires: translate-toolkit >= 1.8.0 |
83e18d77 | 37 | Requires: zip |
d254aee3 | 38 | Suggests: memcached |
098c6911 | 39 | Suggests: python(sqlite) |
d254aee3 | 40 | Suggests: python-memcached |
710cf04b ER |
41 | Suggests: python-xapian |
42 | Conflicts: python-xapian < 1.0.13 | |
83e18d77 ER |
43 | BuildArch: noarch |
44 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
45 | ||
46 | %define _webapps /etc/webapps | |
47 | %define _webapp %{name} | |
d254aee3 | 48 | %define _sysconfdir %{_webapps}/%{_webapp} |
83e18d77 ER |
49 | |
50 | %description | |
51 | Pootle is web application for managing distributed or crowdsourced | |
52 | translation. | |
53 | ||
54 | It's features include:: | |
55 | - Translation of Gettext PO and XLIFF files. | |
56 | - Submitting to remote version control systems (VCS). | |
57 | - Managing groups of translators | |
58 | - Online webbased or offline translation | |
59 | - Quality checks | |
60 | ||
61 | %prep | |
62 | %setup -q -n %{fullname}-%{version} | |
63 | %patch0 -p1 | |
710cf04b | 64 | %patch1 -p1 |
098c6911 | 65 | %patch2 -p1 |
22a51b49 | 66 | %patch3 -p1 |
6a03db66 | 67 | %patch4 -p1 |
83e18d77 | 68 | |
710cf04b | 69 | %{__sed} -i -e '1s,#!.*env python,#!%{__python},' wsgi.py |
d254aee3 | 70 | |
83e18d77 ER |
71 | %build |
72 | %{__python} setup.py build | |
73 | ||
74 | %install | |
75 | rm -rf $RPM_BUILD_ROOT | |
710cf04b ER |
76 | install -d $RPM_BUILD_ROOT{%{_sbindir},%{_datadir}/pootle,%{_sharedstatedir}/pootle/po/.tmp,%{_sysconfdir}} |
77 | ||
83e18d77 ER |
78 | %{__python} setup.py install \ |
79 | --skip-build \ | |
80 | --optimize=2 \ | |
81 | --root=$RPM_BUILD_ROOT | |
82 | ||
5a25dfdc ER |
83 | # install_dirs.py was modified _after_ install completed, so compile again |
84 | # before py_postclean | |
85 | # TODO. compile only install_dirs.py | |
86 | %py_ocomp $RPM_BUILD_ROOT%{py_sitescriptdir} | |
87 | %py_comp $RPM_BUILD_ROOT%{py_sitescriptdir} | |
d254aee3 ER |
88 | %py_postclean |
89 | ||
83e18d77 ER |
90 | # Create the manpages |
91 | install -d $RPM_BUILD_ROOT%{_mandir}/man1 | |
92 | for program in $RPM_BUILD_ROOT%{_bindir}/*; do | |
93 | case $(basename $program) in | |
94 | PootleServer|import_pootle_prefs) | |
95 | ;; | |
96 | *) | |
97 | LC_ALL=C PYTHONPATH=. $program --manpage \ | |
d254aee3 | 98 | > $RPM_BUILD_ROOT%{_mandir}/man1/$(basename $program).1 \ |
83e18d77 ER |
99 | || rm -f $RPM_BUILD_ROOT%{_mandir}/man1/$(basename $program).1 |
100 | ;; | |
101 | esac | |
102 | done | |
103 | ||
f69840c8 ER |
104 | > %{name}.lang |
105 | # application language | |
106 | for a in $RPM_BUILD_ROOT%{_datadir}/pootle/mo/[a-z]*; do | |
107 | # path file and lang | |
108 | p=${a#$RPM_BUILD_ROOT} l=${a##*/} | |
109 | echo "%lang($l) $p" >> %{name}.lang | |
110 | done | |
111 | ||
112 | # such recursive magic is because we need to have different permissions for | |
113 | # directories and files and we want to language tag both of them | |
114 | scan_mo() { | |
115 | for obj in "$@"; do | |
116 | # skip bad globs (happens when we recurse) | |
117 | [ -e "$obj" ] || continue | |
118 | # path file and lang | |
119 | path=${obj#$RPM_BUILD_ROOT} lang=${MO_LANG:-${obj##*/}} | |
120 | ||
121 | if [ -d $obj ]; then | |
122 | attr='%dir %attr(770,root,http)' | |
123 | else | |
d5c71442 | 124 | attr='%attr(660,root,http) %config(noreplace) %verify(not md5 mtime size)' |
f69840c8 ER |
125 | fi |
126 | case $lang in | |
127 | templates) | |
128 | echo "$attr $path" >> %{name}.lang | |
129 | ;; | |
130 | *) | |
131 | echo "%lang($lang) $attr $path" >> %{name}.lang | |
132 | ;; | |
133 | esac | |
134 | if [ -d $obj ]; then | |
135 | MO_LANG=$lang scan_mo $obj/* | |
136 | unset MO_LANG | |
137 | fi | |
138 | done | |
139 | } | |
264704ca | 140 | scan_mo $RPM_BUILD_ROOT%{_sharedstatedir}/pootle/po/{pootle,terminology,tutorial}/* >> %{name}.lang |
f69840c8 | 141 | |
710cf04b | 142 | # don't clobber user $PATH |
d254aee3 | 143 | mv $RPM_BUILD_ROOT{%{_bindir},%{_sbindir}}/PootleServer |
6a03db66 | 144 | install -p manage.py $RPM_BUILD_ROOT%{_sbindir}/pootle-manage |
83e18d77 ER |
145 | install -p wsgi.py $RPM_BUILD_ROOT%{_datadir}/pootle |
146 | ||
d254aee3 ER |
147 | install -d $RPM_BUILD_ROOT%{_sysconfdir} |
148 | cp -a %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/httpd.conf | |
83e18d77 | 149 | |
710cf04b | 150 | # we do doc in rpm |
b042bedc | 151 | rm -rf $RPM_BUILD_ROOT%{_docdir}/%{name} |
710cf04b ER |
152 | |
153 | # external pkg | |
154 | rm -r $RPM_BUILD_ROOT%{py_sitescriptdir}/djblets | |
155 | ||
83e18d77 ER |
156 | %clean |
157 | rm -rf $RPM_BUILD_ROOT | |
158 | ||
4f752939 | 159 | %triggerin -- apache < 2.2.0, apache-base |
83e18d77 ER |
160 | %webapp_register httpd %{_webapp} |
161 | ||
4f752939 | 162 | %triggerun -- apache < 2.2.0, apache-base |
83e18d77 ER |
163 | %webapp_unregister httpd %{_webapp} |
164 | ||
f69840c8 | 165 | %files -f %{name}.lang |
83e18d77 | 166 | %defattr(644,root,root,755) |
6a03db66 | 167 | %doc ChangeLog CREDITS README |
d254aee3 ER |
168 | %dir %attr(750,root,http) %{_sysconfdir} |
169 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/httpd.conf | |
170 | %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/localsettings.py | |
171 | %attr(755,root,root) %{_bindir}/import_pootle_prefs | |
172 | %attr(755,root,root) %{_bindir}/updatetm | |
173 | %attr(755,root,root) %{_sbindir}/PootleServer | |
174 | %{_mandir}/man1/updatetm.1* | |
175 | ||
176 | %dir %{_datadir}/pootle | |
177 | %{_datadir}/pootle/mo/README | |
178 | %attr(755,root,root) %{_datadir}/pootle/wsgi.py | |
179 | %{_datadir}/pootle/html | |
180 | %{_datadir}/pootle/templates | |
181 | %dir %{_datadir}/pootle/mo | |
d254aee3 | 182 | |
264704ca | 183 | %{py_sitescriptdir}/contact_form_i18n |
d254aee3 ER |
184 | %{py_sitescriptdir}/pootle |
185 | %{py_sitescriptdir}/pootle_app | |
186 | %{py_sitescriptdir}/pootle_autonotices | |
264704ca | 187 | %{py_sitescriptdir}/pootle_language |
d254aee3 ER |
188 | %{py_sitescriptdir}/pootle_misc |
189 | %{py_sitescriptdir}/pootle_notifications | |
264704ca ER |
190 | %{py_sitescriptdir}/pootle_profile |
191 | %{py_sitescriptdir}/pootle_project | |
192 | %{py_sitescriptdir}/pootle_statistics | |
d254aee3 | 193 | %{py_sitescriptdir}/pootle_store |
264704ca ER |
194 | %{py_sitescriptdir}/pootle_terminology |
195 | %{py_sitescriptdir}/pootle_translationproject | |
d254aee3 ER |
196 | %{py_sitescriptdir}/profiles |
197 | %{py_sitescriptdir}/registration | |
198 | %if "%{py_ver}" > "2.4" | |
199 | %{py_sitescriptdir}/Pootle-*.egg-info | |
200 | %endif | |
201 | ||
202 | %dir %{_sharedstatedir}/pootle | |
203 | %dir %attr(770,root,http) %{_sharedstatedir}/pootle/dbs | |
204 | %dir %attr(770,root,http) %{_sharedstatedir}/pootle/po | |
710cf04b ER |
205 | # setup a tempdir inside the PODIRECTORY heirarchy, this way we have |
206 | # reasonable guarantee that temp files will be created on the same | |
207 | # filesystem as translation files (required for save operations). | |
208 | %dir %attr(770,root,http) %{_sharedstatedir}/pootle/po/.tmp | |
209 | ||
f69840c8 | 210 | # base translations from pootle itself |
d254aee3 | 211 | %dir %attr(770,root,http) %{_sharedstatedir}/pootle/po/pootle |
d254aee3 ER |
212 | %dir %attr(770,root,http) %{_sharedstatedir}/pootle/po/terminology |
213 | %dir %attr(770,root,http) %{_sharedstatedir}/pootle/po/tutorial |