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