File seeddms.spec of Package seeddms

#
# spec file for package seeddms
#
# Copyright (c) 2020 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/
#


Name:           seeddms
Version:        6.0.35
Release:        0
Summary:        Open Source Document Management System
License:        GPL-2.0-only
Group:          Productivity/Networking/Web/Utilities
URL:            https://www.seeddms.org
Source0:        https://downloads.sourceforge.net/project/seeddms/seeddms-%{version}/seeddms-quickstart-%{version}.tar.gz
Source1:        %{name}.conf
Source2:        stopwords.txt
Source90:       README.SUSE
Source99:       %{name}-rpmlintrc
Patch1:         %{name}-config.patch
BuildRequires:  apache2
BuildRequires:  dos2unix
Requires:       apache2
Requires:       catdoc
Requires:       mod_php_any
Requires:       nodejs
Requires:       python3
Requires:       xpdf
Requires:       xpdf-tools
BuildArch:      noarch

%description
SeedDMS is an easy to use but powerful Open Source Document Management System based on PHP and MySQL or sqlite3. 
Many years of development has made it a mature and enterprise ready platform for sharing and storing documents.

%package apache
Summary:        Apache configuration for %{name}
Group:          Productivity/Networking/Web/Utilities
BuildRequires:  apache2
Requires:       %{name} >= %{version}
Requires:       apache2
Supplements:    (apache2 and %name)

%description apache
This subpackage contains the Apache configuration files

%prep
%setup -q -n %{name}60x
cp -dpR %{SOURCE2} ./conf
cp -dpR %{SOURCE90} .
%patch -P 1 -p1
#rpmlint
find . -type d "(" -name ".github" \
                ")" -exec rm -drf {} \; || :
find . -type f "(" -name "*.orig" -o -name ".gitignore" -o -name ".github" -o -name ".gitattributes" \
                -o -name ".editorconfig" -o -name ".jshint*" -o -name ".npmignore" \
                -o -name ".eslintrc.js" -o -name ".eslintignore" -o -name ".travis.yml" \
                -o -name ".bithoundrc" -o -name ".codeclimate.yml"  -o -name ".jsdoc" \
                -o -name ".eslintrc" -o -name ".empty" -o -name ".*swp" -o -name ".hhconfig" \
               ")" -delete
find . -type f "(" -name "*.txt" -o -name "*.html" -o -name "*.js" -o -name "*.css" \
                -o -name "*.svg" -o -name "*.xml" -o -name "*.scss" -o -name "*.htc" \
                -o -name "CHANGELOG*" -o -name "README*" -o -name "EndroidQrCode*.php" -o -name "Server.php" \
                ")" -exec chmod -x {} \;
find . -type f -name "*.py" -exec sed -i -e 's|\/usr\/bin\/env python3|\/usr\/bin\/python3|'g {} \;
find . -type f -exec sed -i -e 's|\/usr\/bin\/env python|\/usr\/bin\/python3|'g {} \;
find . -type f -exec sed -i -e 's|\/usr\/bin\/env bash|\/bin\/bash|'g {} \;
find . -type f -exec sed -i -e 's|\/usr\/bin\/env php|\/usr\/bin\/php|'g {} \;
find . -type f -exec sed -i -e 's|\/usr\/bin\/env node|\/usr\/bin\/node|'g {} \;
find . -type f -exec sed -i -e 's|\/usr\/bin\/env sh|\/usr\/bin\/sh|'g {} \;
# Fix rpmlint - not allowed
rm pear/vendor/seeddms/core/phpunit.xml.bak
# Fix rpmlint - script-withoutshebang
chmod -x pear/vendor/pear/auth_sasl/Auth/SASL.php
chmod -x pear/vendor/pear/auth_sasl/Auth/SASL/*.php
chmod -x pear/vendor/pear/log/*.php
chmod -x pear/vendor/pear/log/Log/*.php
chmod -x pear/vendor/pear/log/tests/levels.phpt
chmod -x pear/vendor/sabre/dav/bin/sabredav.php
chmod -x pear/vendor/pear/log/composer.json
chmod -x pear/vendor/pear/log/examples/*.php
chmod -x pear/vendor/seeddms/core/vendor/squizlabs/php_codesniffer/bin/phpcs.bat
chmod -x seeddms/styles/bootstrap/popper.js-1.14.3/docs/_config.yml
# rpmlint: wrong-script-end-of-line-encoding
dos2unix %{name}-%{version}/styles/bootstrap/1.x-1.1.15/README.md

%build
# nothing to build

%install
mkdir -p %{buildroot}/srv/www/%{name}
mkdir -p %{buildroot}/srv/www/%{name}/ext
mkdir -p %{buildroot}%{_localstatedir}/lib/%{name}
mkdir -p %{buildroot}%{_localstatedir}/lib/%{name}/backup
mkdir -p %{buildroot}%{_localstatedir}/log/%{name}
mkdir -p %{buildroot}%{_sysconfdir}/%{name}
cp -dpR conf/* %{buildroot}%{_sysconfdir}/%{name}
cp -dpR conf/.htaccess %{buildroot}%{_sysconfdir}/%{name}
cp -dpR data/* %{buildroot}%{_localstatedir}/lib/%{name}
cp -dpR %{name}-%{version}/* %{buildroot}/srv/www/%{name}
cp -dpR pear/ %{buildroot}/srv/www/%{name}
cp -dpR www/ext/ %{buildroot}/srv/www/%{name}
# Apache Config
# move .htaccess files to global config under %%{_sysconfdir}/apache2/conf.d/%%{name}.conf
rm %{buildroot}/srv/www/%{name}/{op,restapi,styles,utils,webdav}/.htaccess
# remove /etc/seeddms/.htaccess
rm %{buildroot}%{_sysconfdir}/%{name}/.htaccess
# install global .htaccess
install -D -m 0664 %{SOURCE1} %{buildroot}%{_sysconfdir}/apache2/conf.d/%{name}.conf
# move logfile
rm -df %{buildroot}%{_localstatedir}/lib/%{name}/log
ln -s %{_localstatedir}/log/%{name} %{buildroot}%{_localstatedir}/lib/%{name}/log
# Fix missing link source
rm %{buildroot}/srv/www/%{name}/pear/vendor/pear/net_smtp/README.rst

%files
%license seeddms/LICENSE
%doc seeddms/doc README.SUSE
%defattr(0640,wwwrun,www,0750)
%dir %{_sysconfdir}/%{name}
%config(noreplace) %{_sysconfdir}/%{name}/settings.xml
%config(noreplace) %{_sysconfdir}/%{name}/stopwords.txt
%defattr(-,wwwrun,www)
/srv/www/%{name}
%{_localstatedir}/lib/%{name}

%files apache
%config(noreplace) %{_sysconfdir}/apache2/conf.d/%{name}.conf

%changelog
openSUSE Build Service is sponsored by