File wok.spec of Package wok

#
# spec file for package wok
#
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%{?!python_module:%define python_module() python-%{**} python3-%{**}}
# Python2 is not supported
%define skip_python2 1
Name:           wok
Version:        3.0.0
Release:        0
Summary:        A cherrypy framework for multi-purpose plug-ins
License:        Apache-2.0 AND MIT AND LGPL-2.1-only
URL:            https://github.com/kimchi-project/wok
Source:         %{url}/archive/refs/tags/%{version}.tar.gz#/%{name}-%{version}.tar.gz
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  libxslt-tools
BuildRequires:  logrotate
BuildRequires:  python-rpm-macros
BuildRequires:  %{python_module base}
BuildRequires:  %{python_module setuptools}
Requires:       python3-CherryPy
Requires:       python3-ldap
Requires:       python3-python-pam
Requires:       python3-Cheetah3
Requires:       python3-websockify
Requires:       python3-jsonschema
Requires:       python3-numpy
Requires:       python3-psutil
Requires:       nginx
BuildArch:      noarch

%description
Wok is a cherrypy-based web framework with HTML5 support originated from Kimchi.
It can be extended by plugins which expose functionality through REST APIs.

%lang_package

%prep
%autosetup

%build
./autogen.sh --system
%make_build

%install
%make_install
%__install -D -m 0644 contrib/wokd.service.systemd %{buildroot}%{_unitdir}/wokd.service
rm -rf %{buildroot}%{_sysconfdir}/init.d/wokd
rm -rf %{buildroot}%{_sysconfdir}/nginx/conf.d/wok.conf
%__install -D -m 0644 src/nginx/wok.conf %{buildroot}%{_sysconfdir}/nginx/vhost.d/wok.conf
%fdupes %{buildroot}%{_prefix}
%find_lang %{name}

%pre
%service_add_pre wokd.service

%post
%service_add_post wokd.service
if [ ! -e /etc/wok/dhparams.pem ]; then
        openssl dhparam -dsaparam -out /etc/wok/dhparams.pem 2048 >/dev/null 2>&1 || :
    fi
    if [ ! -e /etc/wok/wok-key.pem ] || [ ! -e /etc/wok/wok-cert.pem ]; then
        openssl req -x509 -newkey rsa:4096 -keyout /etc/wok/wok-key.pem -out /etc/wok/wok-cert.pem -days 365 -nodes -subj "/C=US/CN=wok/O=kimchi-project.org" >/dev/null 2>&1 || :
fi
exit 0

%preun
%service_del_preun wokd.service

%postun
%service_del_postun wokd.service

%files
%license COPYING.ASL2 COPYING.LGPL
%doc README.md
%{_bindir}/wokd
%dir %{_sysconfdir}/nginx
%dir %{_sysconfdir}/nginx/vhost.d
%dir %{_sysconfdir}/wok
%{_unitdir}/wokd.service
%config %{_sysconfdir}/logrotate.d/wokd
%config %{_sysconfdir}/nginx/vhost.d/wok.conf
%config %{_sysconfdir}/wok/wok.conf
%dir %{_prefix}/lib/firewalld
%dir %{_prefix}/lib/firewalld/services
%{_prefix}/lib/firewalld/services/wokd.xml
%{python_sitelib}/*
%{_datadir}/man/man8/wokd.8.gz
%{_datadir}/wok
%{_datadir}/wok/ui/robots.txt
%{_localstatedir}/log/wok
%ghost %{_localstatedir}/log/wok/wok-access.log
%ghost %{_localstatedir}/log/wok/wok-error.log

%files lang -f %{name}.lang

%changelog

openSUSE Build Service is sponsored by