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