]> git.pld-linux.org Git - packages/pootle.git/blob - pootle.spec
use new python macros; partial files update
[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-modules
18 BuildRequires:  rpm-pythonprov
19 BuildRequires:  rpmbuild(macros) >= 1.714
20 BuildRequires:  sed >= 4.0
21 BuildRequires:  translate-toolkit >= 1.4.1
22 Requires:       apache-mod_alias
23 Requires:       apache-mod_authz_host
24 Requires:       apache-mod_mime
25 Requires:       apache-mod_wsgi
26 Requires:       group(http)
27 Requires:       iso-codes
28 Requires:       python-Levenshtein
29 Requires:       python-django >= 1.0
30 Requires:       python-django-south
31 Requires:       python-djblets
32 Requires:       python-lxml
33 Requires:       translate-toolkit >= 1.8.0
34 Requires:       zip
35 Suggests:       memcached
36 Suggests:       python(sqlite)
37 Suggests:       python-memcached
38 Suggests:       python-xapian
39 Conflicts:      python-xapian < 1.0.13
40 BuildArch:      noarch
41 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
42
43 %define         _webapps        /etc/webapps
44 %define         _webapp         %{name}
45 %define         _sysconfdir     %{_webapps}/%{_webapp}
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}
60 #%patch0 -p1
61 #%patch1 -p1
62 #%patch2 -p1
63
64 #%{__sed} -i -e '1s,#!.*env python,#!%{__python},' wsgi.py
65
66 %build
67 %py_build
68
69 %install
70 rm -rf $RPM_BUILD_ROOT
71 install -d $RPM_BUILD_ROOT{%{_sbindir},%{_datadir}/pootle,%{_sharedstatedir}/pootle/po/.tmp,%{_sysconfdir}}
72
73 %py_install
74
75 %{__rm} -r $RPM_BUILD_ROOT%{py_sitescriptdir}/tests
76
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}
82 %py_postclean
83
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 \
92                 > $RPM_BUILD_ROOT%{_mandir}/man1/$(basename $program).1 \
93                 || rm -f $RPM_BUILD_ROOT%{_mandir}/man1/$(basename $program).1
94                 ;;
95         esac
96 done
97
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
118                         attr='%attr(660,root,http) %config(noreplace) %verify(not md5 mtime size)'
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 }
134 scan_mo $RPM_BUILD_ROOT%{_sharedstatedir}/pootle/po/{pootle,terminology,tutorial}/* >> %{name}.lang
135 > %{name}.lang
136
137 # don't clobber user $PATH
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
141
142 install -d $RPM_BUILD_ROOT%{_sysconfdir}
143 cp -a %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/httpd.conf
144
145 # we do doc in rpm
146 rm -rf $RPM_BUILD_ROOT%{_docdir}/%{name}
147
148 # external pkg
149 #rm -r $RPM_BUILD_ROOT%{py_sitescriptdir}/djblets
150
151 %clean
152 rm -rf $RPM_BUILD_ROOT
153
154 %triggerin -- apache < 2.2.0, apache-base
155 %webapp_register httpd %{_webapp}
156
157 %triggerun -- apache < 2.2.0, apache-base
158 %webapp_unregister httpd %{_webapp}
159
160 %files -f %{name}.lang
161 %defattr(644,root,root,755)
162 %doc README.rst
163 %dir %attr(750,root,http) %{_sysconfdir}
164 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/httpd.conf
165 #%attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/localsettings.py
166 %attr(755,root,root) %{_bindir}/pootle
167
168 %if 0
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
175 %endif
176
177 %{py_sitescriptdir}/pootle
178 %{py_sitescriptdir}/Pootle-%{version}-py*.egg-info
179
180 %dir %{_sharedstatedir}/pootle
181 #%dir %attr(770,root,http) %{_sharedstatedir}/pootle/dbs
182 %dir %attr(770,root,http) %{_sharedstatedir}/pootle/po
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
188 # base translations from pootle itself
189 %if 0
190 %dir %attr(770,root,http) %{_sharedstatedir}/pootle/po/pootle
191 %dir %attr(770,root,http) %{_sharedstatedir}/pootle/po/terminology
192 %dir %attr(770,root,http) %{_sharedstatedir}/pootle/po/tutorial
193 %endif
This page took 0.087888 seconds and 3 git commands to generate.