2 # - move %{_datadir}/pootle/mo/* to system localedir as pootle.mo
3 %define fullname Pootle
4 Summary: Localization and translation management web application
9 Group: Development/Tools
10 Source0: http://downloads.sourceforge.net/translate/%{fullname}-%{version}.tar.bz2
11 # Source0-md5: 1dc69e42cd93f9174443af350df57491
13 Patch0: settings.patch
16 Patch3: iso-codes-message.patch
17 Patch4: bug-2005.patch
18 URL: http://translate.sourceforge.net/wiki/pootle/index
19 BuildRequires: python-devel
20 BuildRequires: python-modules
21 BuildRequires: rpm-pythonprov
22 BuildRequires: rpmbuild(macros) >= 1.228
23 BuildRequires: sed >= 4.0
24 BuildRequires: translate-toolkit >= 1.4.1
25 Requires: apache-mod_alias
26 Requires: apache-mod_authz_host
27 Requires: apache-mod_mime
28 Requires: apache(mod_wsgi)
31 Requires: python-Levenshtein
32 Requires: python-django >= 1.0
33 Requires: python-django-south
34 Requires: python-djblets
36 Requires: translate-toolkit >= 1.8.0
39 Suggests: python(sqlite)
40 Suggests: python-memcached
41 Suggests: python-xapian
42 Conflicts: python-xapian < 1.0.13
44 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
46 %define _webapps /etc/webapps
47 %define _webapp %{name}
48 %define _sysconfdir %{_webapps}/%{_webapp}
51 Pootle is web application for managing distributed or crowdsourced
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
62 %setup -q -n %{fullname}-%{version}
69 %{__sed} -i -e '1s,#!.*env python,#!%{__python},' wsgi.py
75 rm -rf $RPM_BUILD_ROOT
76 install -d $RPM_BUILD_ROOT{%{_sbindir},%{_datadir}/pootle,%{_sharedstatedir}/pootle/po/.tmp,%{_sysconfdir}}
80 # install_dirs.py was modified _after_ install completed, so compile again
82 # TODO. compile only install_dirs.py
83 %py_ocomp $RPM_BUILD_ROOT%{py_sitescriptdir}
84 %py_comp $RPM_BUILD_ROOT%{py_sitescriptdir}
88 install -d $RPM_BUILD_ROOT%{_mandir}/man1
89 for program in $RPM_BUILD_ROOT%{_bindir}/*; do
90 case $(basename $program) in
91 PootleServer|import_pootle_prefs)
94 LC_ALL=C PYTHONPATH=. $program --manpage \
95 > $RPM_BUILD_ROOT%{_mandir}/man1/$(basename $program).1 \
96 || rm -f $RPM_BUILD_ROOT%{_mandir}/man1/$(basename $program).1
102 # application language
103 for a in $RPM_BUILD_ROOT%{_datadir}/pootle/mo/[a-z]*; do
105 p=${a#$RPM_BUILD_ROOT} l=${a##*/}
106 echo "%lang($l) $p" >> %{name}.lang
109 # such recursive magic is because we need to have different permissions for
110 # directories and files and we want to language tag both of them
113 # skip bad globs (happens when we recurse)
114 [ -e "$obj" ] || continue
116 path=${obj#$RPM_BUILD_ROOT} lang=${MO_LANG:-${obj##*/}}
119 attr='%dir %attr(770,root,http)'
121 attr='%attr(660,root,http) %config(noreplace) %verify(not md5 mtime size)'
125 echo "$attr $path" >> %{name}.lang
128 echo "%lang($lang) $attr $path" >> %{name}.lang
132 MO_LANG=$lang scan_mo $obj/*
137 scan_mo $RPM_BUILD_ROOT%{_sharedstatedir}/pootle/po/{pootle,terminology,tutorial}/* >> %{name}.lang
139 # don't clobber user $PATH
140 mv $RPM_BUILD_ROOT{%{_bindir},%{_sbindir}}/PootleServer
141 install -p manage.py $RPM_BUILD_ROOT%{_sbindir}/pootle-manage
142 install -p wsgi.py $RPM_BUILD_ROOT%{_datadir}/pootle
144 install -d $RPM_BUILD_ROOT%{_sysconfdir}
145 cp -a %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/httpd.conf
148 rm -rf $RPM_BUILD_ROOT%{_docdir}/%{name}
151 rm -r $RPM_BUILD_ROOT%{py_sitescriptdir}/djblets
154 rm -rf $RPM_BUILD_ROOT
156 %triggerin -- apache < 2.2.0, apache-base
157 %webapp_register httpd %{_webapp}
159 %triggerun -- apache < 2.2.0, apache-base
160 %webapp_unregister httpd %{_webapp}
162 %files -f %{name}.lang
163 %defattr(644,root,root,755)
164 %doc ChangeLog CREDITS README
165 %dir %attr(750,root,http) %{_sysconfdir}
166 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/httpd.conf
167 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/localsettings.py
168 %attr(755,root,root) %{_bindir}/import_pootle_prefs
169 %attr(755,root,root) %{_bindir}/updatetm
170 %attr(755,root,root) %{_sbindir}/PootleServer
171 %{_mandir}/man1/updatetm.1*
173 %dir %{_datadir}/pootle
174 %{_datadir}/pootle/mo/README
175 %attr(755,root,root) %{_datadir}/pootle/wsgi.py
176 %{_datadir}/pootle/html
177 %{_datadir}/pootle/templates
178 %dir %{_datadir}/pootle/mo
180 %{py_sitescriptdir}/contact_form_i18n
181 %{py_sitescriptdir}/pootle
182 %{py_sitescriptdir}/pootle_app
183 %{py_sitescriptdir}/pootle_autonotices
184 %{py_sitescriptdir}/pootle_language
185 %{py_sitescriptdir}/pootle_misc
186 %{py_sitescriptdir}/pootle_notifications
187 %{py_sitescriptdir}/pootle_profile
188 %{py_sitescriptdir}/pootle_project
189 %{py_sitescriptdir}/pootle_statistics
190 %{py_sitescriptdir}/pootle_store
191 %{py_sitescriptdir}/pootle_terminology
192 %{py_sitescriptdir}/pootle_translationproject
193 %{py_sitescriptdir}/profiles
194 %{py_sitescriptdir}/registration
195 %if "%{py_ver}" > "2.4"
196 %{py_sitescriptdir}/Pootle-*.egg-info
199 %dir %{_sharedstatedir}/pootle
200 %dir %attr(770,root,http) %{_sharedstatedir}/pootle/dbs
201 %dir %attr(770,root,http) %{_sharedstatedir}/pootle/po
202 # setup a tempdir inside the PODIRECTORY heirarchy, this way we have
203 # reasonable guarantee that temp files will be created on the same
204 # filesystem as translation files (required for save operations).
205 %dir %attr(770,root,http) %{_sharedstatedir}/pootle/po/.tmp
207 # base translations from pootle itself
208 %dir %attr(770,root,http) %{_sharedstatedir}/pootle/po/pootle
209 %dir %attr(770,root,http) %{_sharedstatedir}/pootle/po/terminology
210 %dir %attr(770,root,http) %{_sharedstatedir}/pootle/po/tutorial