[packages/prewikka] - updated to 3.1.0 - added localedir patch, install locale files in system locale dir - added instal
qboosh
qboosh at pld-linux.org
Sun Oct 16 14:43:49 CEST 2016
commit 305407afc65f5130ef2980093ef9d1e1183a5e78
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date: Sun Oct 16 14:45:58 2016 +0200
- updated to 3.1.0
- added localedir patch, install locale files in system locale dir
- added install patch (fixes install with prefix=/usr or build-base)
- adjusted init script to use http user for prewikka-httpd, separated it to -httpd subpackage
prewikka-install.patch | 20 +++++++++
prewikka-localedir.patch | 11 +++++
prewikka.init | 2 +-
prewikka.spec | 112 +++++++++++++++++++++++++++++------------------
4 files changed, 102 insertions(+), 43 deletions(-)
---
diff --git a/prewikka.spec b/prewikka.spec
index 51e85a7..29116b5 100644
--- a/prewikka.spec
+++ b/prewikka.spec
@@ -1,21 +1,27 @@
+# TODO: apache (and other webservers?) configuration for prewikka WSGI
Summary: Prelude IDS web application
Summary(pl.UTF-8): Aplikacja WWW dla Prelude IDS
Name: prewikka
-Version: 1.0.0
+Version: 3.1.0
Release: 1
License: GPL v2+
Group: Applications/Networking
-#Source0Download: http://www.prelude-ids.com/developpement/telechargement/index.html
-Source0: http://www.prelude-ids.com/download/releases/prewikka/%{name}-%{version}.tar.gz
-# Source0-md5: 87c20b23a909b2af2c68a9ded0a987bc
+#Source0Download: https://www.prelude-siem.org/projects/prelude/files
+Source0: https://www.prelude-siem.org/attachments/download/727/%{name}-%{version}.tar.gz
+# Source0-md5: a7c721c3322558f8e94608cc3a12abb2
Source1: %{name}.init
Source2: %{name}.sysconfig
-URL: http://www.prelude-ids.com/
-BuildRequires: python >= 1:2.5
+Patch0: %{name}-localedir.patch
+Patch1: %{name}-install.patch
+URL: https://www.prelude-siem.org/
+BuildRequires: python >= 1:2.6
BuildRequires: python-cheetah
+BuildRequires: python-lesscpy
+BuildRequires: python-setuptools
BuildRequires: rpm-pythonprov
-BuildRequires: rpmbuild(macros) >= 1.219
+BuildRequires: rpmbuild(macros) >= 1.714
%pyrequires_eq python-modules
+Requires: python-babel
Requires: python-cheetah
Requires: python-libprelude >= 1.0.0
Requires: python-libpreludedb >= 1.0.0
@@ -30,18 +36,42 @@ feature like contextual filtering, aggregation, etc.
Prewikka to profesjonalnie wyglądająca aplikacja dająca zaawansowane
możliwości, takie jak filtrowanie kontekstowe, agregację itp.
+%package httpd
+Summary: Standalone Prewikka HTTP server
+Summary(pl.UTF-8): Samodzielny serwer HTTP dla Prewikki
+Group: Daemons
+Requires(pre): /bin/id
+Requires(pre): /usr/bin/getgid
+Requires(pre): /usr/sbin/groupadd
+Requires(pre): /usr/sbin/useradd
+Requires(post,preun): /sbin/chkconfig
+Requires(postun): /usr/sbin/groupdel
+Requires(postun): /usr/sbin/userdel
+Requires: rc-scripts
+Provides: group(http)
+Provides: user(http)
+Requires: %{name} = %{version}-%{release}
+
+%description httpd
+Standalone Prewikka HTTP server. Allows to run Prewikka on user
+available port (>= 1024, 8000 by default).
+
+%description httpd -l pl.UTF-8
+Samodzielny serwer HTTP dla Prewikki. Pozwala na uruchomienie Prewikki
+na porcie dostępnym dla użytkownika (>= 1024, domyślnie 8000).
+
%prep
%setup -q
+%patch0 -p1
+%patch1 -p1
%build
-%{__python} setup.py build
+%py_build
%install
rm -rf $RPM_BUILD_ROOT
-%{__python} setup.py install \
- --optimize=2 \
- --root=$RPM_BUILD_ROOT
+%py_install
install -d $RPM_BUILD_ROOT/etc/{rc.d/init.d,sysconfig}
install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
@@ -50,6 +80,9 @@ install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
install -d $RPM_BUILD_ROOT%{_sysconfdir}/%{name}
install conf/prewikka.conf $RPM_BUILD_ROOT%{_sysconfdir}/%{name}
+install -d $RPM_BUILD_ROOT%{_datadir}
+%{__mv} $RPM_BUILD_ROOT%{py_sitescriptdir}/prewikka/locale $RPM_BUILD_ROOT%{_datadir}
+
%py_postclean
%find_lang %{name}
@@ -57,57 +90,52 @@ install conf/prewikka.conf $RPM_BUILD_ROOT%{_sysconfdir}/%{name}
%clean
rm -rf $RPM_BUILD_ROOT
-%post
+%pre httpd
+%groupadd -g 51 http
+%useradd -u 51 -r -d /home/services/httpd -s /bin/false -c "HTTP User" -g http http
+
+%post httpd
/sbin/chkconfig --add prewikka
if [ "$1" = "1" ]; then
%banner -e %{name} <<EOF
-Create new database and database user for prewikka
-(or update an existing one if needed) using templates from
-%{_datadir}/%{name}/database and configure Prewikka
-for reference visit %{url}
+Create new database and database user for Prewikka (or update an existing
+one if needed) and configure Prewikka. For reference visit:
+https://www.prelude-siem.org/projects/prelude/wiki/InstallingPreludePrewikka
To connect to console point Your browser to:
http://`hostname`:8000/
-REMEMBER to change password for admin (default:admin)
+REMEMBER to change password for admin (default: admin)
EOF
fi
%service prewikka restart "Prewikka"
-%preun
+%preun httpd
if [ "$1" = "0" ]; then
%service prewikka stop
/sbin/chkconfig --del prewikka
fi
+%postun httpd
+if [ "$1" = "0" ]; then
+ %userremove http
+ %groupremove http
+fi
+
%files -f %{name}.lang
%defattr(644,root,root,755)
-%doc AUTHORS NEWS README
-%attr(755,root,root) %{_bindir}/prewikka-httpd
+%doc AUTHORS COPYING.* NEWS README
%dir %{_sysconfdir}/%{name}
%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/prewikka.conf
+%dir %{_datadir}/%{name}
+%dir %{_datadir}/%{name}/prewikka.wsgi
+%{py_sitescriptdir}/prewikka
+%{py_sitescriptdir}/prewikka-%{version}-py*.egg-info
+%attr(770,root,http) %dir /var/lib/prewikka
+
+%files httpd
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/prewikka-httpd
%attr(754,root,root) /etc/rc.d/init.d/%{name}
%config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
-%dir %{_datadir}/%{name}
-%dir %{_datadir}/%{name}/cgi-bin
-%attr(755,root,root) %{_datadir}/%{name}/cgi-bin/prewikka.cgi
-%{_datadir}/%{name}/database
-%{_datadir}/%{name}/htdocs
-%dir %{py_sitescriptdir}/%{name}
-%{py_sitescriptdir}/%{name}/*.py[co]
-%dir %{py_sitescriptdir}/%{name}/modules
-%{py_sitescriptdir}/%{name}/modules/*.py[co]
-%dir %{py_sitescriptdir}/%{name}/modules/auth
-%{py_sitescriptdir}/%{name}/modules/auth/*.py[co]
-%dir %{py_sitescriptdir}/%{name}/modules/auth/anonymous
-%{py_sitescriptdir}/%{name}/modules/auth/anonymous/*.py[co]
-%dir %{py_sitescriptdir}/%{name}/modules/auth/cgi
-%{py_sitescriptdir}/%{name}/modules/auth/cgi/*.py[co]
-%dir %{py_sitescriptdir}/%{name}/modules/auth/loginpassword
-%{py_sitescriptdir}/%{name}/modules/auth/loginpassword/*.py[co]
-%dir %{py_sitescriptdir}/%{name}/views
-%{py_sitescriptdir}/%{name}/views/*.py[co]
-%dir %{py_sitescriptdir}/%{name}/templates
-%{py_sitescriptdir}/%{name}/templates/*.py[co]
-%{py_sitescriptdir}/prewikka-*.egg-info
diff --git a/prewikka-install.patch b/prewikka-install.patch
new file mode 100644
index 0000000..e0a29b5
--- /dev/null
+++ b/prewikka-install.patch
@@ -0,0 +1,20 @@
+--- prewikka-3.1.0/setup.py.orig 2016-09-15 08:49:49.000000000 +0200
++++ prewikka-3.1.0/setup.py 2016-10-16 09:08:52.787464603 +0200
+@@ -184,7 +184,7 @@
+ class my_install(install):
+ def finalize_options(self):
+ ### if no prefix is given, configuration should go to /etc or in {prefix}/etc otherwise
+- if self.prefix:
++ if self.prefix and self.prefix != '/usr':
+ self.conf_prefix = self.prefix + "/etc/prewikka"
+ self.data_prefix = self.prefix + "/var/lib/prewikka"
+ else:
+@@ -209,7 +209,7 @@
+ self.mkpath((self.root or "") + self.data_prefix)
+
+ def init_siteconfig(self):
+- config = open("prewikka/siteconfig.py", "w")
++ config = open(os.path.join(self.build_lib, "prewikka/siteconfig.py"), "w")
+ print >> config, "conf_dir = '%s'" % os.path.abspath((self.conf_prefix))
+ print >> config, "data_dir = '%s'" % os.path.abspath(self.data_prefix)
+ print >> config, "libprelude_required_version = '%s'" % LIBPRELUDE_REQUIRED_VERSION
diff --git a/prewikka-localedir.patch b/prewikka-localedir.patch
new file mode 100644
index 0000000..e8a00d7
--- /dev/null
+++ b/prewikka-localedir.patch
@@ -0,0 +1,11 @@
+--- prewikka-3.1.0/prewikka/localization.py.orig 2016-09-15 08:49:49.000000000 +0200
++++ prewikka-3.1.0/prewikka/localization.py 2016-10-16 08:28:51.410825370 +0200
+@@ -43,7 +43,7 @@
+ self._catalogs_lock = Lock()
+
+ self._domains_lock = Lock()
+- self._domains = utils.OrderedDict([("prewikka", pkg_resources.resource_filename(__name__, "locale"))])
++ self._domains = utils.OrderedDict([("prewikka", "/usr/share/locale")])
+
+ def addDomain(self, domain, locale_dir):
+ with self._domains_lock:
diff --git a/prewikka.init b/prewikka.init
index a8d6958..ae118e1 100644
--- a/prewikka.init
+++ b/prewikka.init
@@ -19,7 +19,7 @@ fi
start() {
if [ ! -f /var/lock/subsys/prewikka ]; then
msg_starting "Prewikka"
- daemon --fork prewikka-httpd $PREWIKKA_OPTS
+ daemon --user http --fork prewikka-httpd $PREWIKKA_OPTS
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/prewikka
else
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/prewikka.git/commitdiff/305407afc65f5130ef2980093ef9d1e1183a5e78
More information about the pld-cvs-commit
mailing list