File websvn.spec of Package websvn

#
# spec file for package websvn
#
# 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/
#


Name:           websvn
Summary:        PHP based Interface for subversion repositories  
License:        GPL-2.0-or-later
Group:          Productivity/Networking
Version:        2.3.3
Release:        0
URL:            http://www.websvn.info/
BuildRequires:  apache-rpm-macros
BuildRequires:  apache2
Requires:       diffutils
Requires:       http_daemon
Requires:       mod_php_any
Requires:       php-pear
Requires:       php-pear-text_diff
Requires:       php-session
Requires:       subversion
Recommends:     enscript
# needed for apache_sysconfdir and apache_serverroot
Source0:        %name-%version.tar.gz
Source1:        websvn-README.SUSE
Source2:        websvn-httpd.conf 
Source3:        websvn-dummy.config.inc
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%define         wwwpath %{apache_serverroot}/%{name}
%define         confpath %{_sysconfdir}/%{name}

%description
WebSVN offers a view onto your subversion repositories that's been designed
to reflect the Subversion methodology. You can view the log of any file or
directory and see a list of all the files changed, added or deleted in any
given revision. You can also view the differences between 2 versions of a
file so as to see exactly what was changed in a particular revision.

WebSVN offers the following features:

* Easy to use interface
* Highly customisable templating system
* Colourisation of file listings
* Blame view
* Log message searching
* Fast browsing thanks to internal caching feature
* Apache MultiViews support
* RSS feed support

%package doc
Summary:        Documentation for websvn
Group:          Documentation/Other
Recommends:     %name = %version

%description doc
This package contains additional documentation for WebSVN. You can find 
all the documentation in /usr/share/doc/packages/websvn-doc/ .

%prep
%setup -q

%build

%install
install -d -m 0755 %buildroot/%wwwpath
cp -a * %buildroot/%{wwwpath}/

# install httpd.conf file and adapt the configuration
install -d -m 0755 %buildroot/%{apache_sysconfdir}/conf.d
sed -e "s#__WWWPATH__#%{wwwpath}#g" %{SOURCE2} > %buildroot/%{apache_sysconfdir}/conf.d/%name.conf

# install config file
install -d -m 0755 %buildroot/%confpath
cp include/distconfig.php %buildroot/%confpath/config.php
sed -e "s#__CONFPATH__#%{confpath}#g" %SOURCE3 > %buildroot/%{wwwpath}/include/config.php

# install docs 
install -d -m 0755 %buildroot/%_defaultdocdir/%name
sed -e "s#__WWWPATH__#%{wwwpath}#g" -e "s#__HTTPCONFDIR__#%{apache_sysconfdir}/conf.d#g" -e "s#__CONFPATH__#%{confpath}#g"  %{SOURCE1} > %buildroot/%_defaultdocdir/%name/README.SUSE
mv license.txt changes.txt %buildroot/%_defaultdocdir/%name/

%clean
rm -rf %buildroot

%post
if [ ${1:-0} -gt 1 ]; then
 # check if we update from an older version
 echo "Warning: Please read %{_defaultdocdir}/%{name}/UPGRADING before you proceed!"
fi

%files
%defattr(644, root, root,755)
%doc %_defaultdocdir/%name/ 
%dir %{wwwpath}
%dir %confpath
%config(noreplace) %{apache_sysconfdir}/conf.d/%name.conf
%config(noreplace) %confpath/config.php
%{wwwpath}/*
%defattr(644,wwwrun,www,775)
%{wwwpath}/cache

%files doc
%defattr(-,root,root)
%doc doc

%changelog
openSUSE Build Service is sponsored by