##
## subversion15.spec -- OpenPKG RPM Package Specification
## Copyright (c) 2000-2008 OpenPKG Foundation e.V.
##
## Permission to use, copy, modify, and distribute this software for
## any purpose with or without fee is hereby granted, provided that
## the above copyright notice and this permission notice appear in all
## copies.
##
## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
## SUCH DAMAGE.
##
# package version
%define V_dist 1.5.0-beta1
%define V_opkg 1.5.0b1
%define V_cvs2svn 2.1.0
%define V_svn2cvs 20071222
%define V_book_html 20071222
%define V_book_pdf 20071222
# package information
Name: subversion15
Summary: Source Revision Control System
URL: http://subversion.tigris.org/
Vendor: Tigris
Packager: OpenPKG Foundation e.V.
Distribution: OpenPKG Community
Class: EVAL
Group: SCM
License: Apache/BSD
Version: %{V_opkg}
Release: 20080403
# package options
%option with_cvs2svn no
%option with_svn2cvs no
%option with_apache no
%option with_perl no
%option with_python no
%option with_ruby no
# list of sources
Source0: http://subversion.tigris.org/downloads/subversion-%{V_dist}.tar.bz2
Source1: http://subversion.tigris.org/downloads/subversion-deps-%{V_dist}.tar.bz2
Source2: ftp://ftp.openpkg.org/sources/CPY/subversion/cvs2svn-%{V_cvs2svn}.tar.gz
Source3: ftp://ftp.openpkg.org/sources/CPY/subversion/svn2cvs.pl-%{V_svn2cvs}
Source4: ftp://ftp.openpkg.org/sources/CPY/subversion/svn-book-%{V_book_html}.html
Source5: ftp://ftp.openpkg.org/sources/CPY/subversion/svn-book-%{V_book_pdf}.pdf
Source6: subversion.config
Source7: subversion.config.apache
Source8: subversion.servers
Source9: rc.subversion
Patch0: subversion15.patch
# build information
Prefix: %{l_prefix}
BuildRoot: %{l_buildroot}
BuildPreReq: OpenPKG, openpkg >= 20060823, make, libtool, sed, pkgconfig
PreReq: OpenPKG, openpkg >= 20060823
BuildPreReq: diffutils, db, openssl, zlib, libiconv, expat
PreReq: diffutils, db, openssl, zlib, libiconv, expat
%if "%{with_cvs2svn}" == "yes"
PreReq: rcs, python, python::with_dbm = yes
%endif
%if "%{with_svn2cvs}" == "yes"
BuildPreReq: perl
PreReq: perl, perl-xml, cvs, rcs
%endif
%if "%{with_apache}" == "yes"
BuildPreReq: apache, apache::with_mod_dav = yes
PreReq: apache, apache::with_mod_dav = yes
%endif
%if "%{with_perl}" == "yes" || "%{with_python}" == "yes"
BuildPreReq: swig
%endif
%if "%{with_perl}" == "yes"
BuildPreReq: perl, perl-openpkg
PreReq: perl
%endif
%if "%{with_python}" == "yes"
BuildPreReq: python, swig
PreReq: python
%endif
%if "%{with_ruby}" == "yes"
BuildPreReq: ruby
PreReq: ruby
%endif
AutoReq: no
AutoReqProv: no
Provides: subversion = %{version}-%{release}
Conflicts: subversion
%description
Subversion is a modern Version Control System (VCS) providing most
current CVS features, versioned directories/renames/meta-data,
atomic commits, cheap branching and tagging, native client/server
architecture, and the choice of database or plain-file repository
implementations.
%track
prog subversion15 = {
version = %{V_dist}
url = http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=260
regex = subversion-(1\.5\.\d+)\.tar\.bz2
}
prog subversion15:cvs2svn = {
version = %{V_cvs2svn}
url = ftp://ftp.openpkg.org/sources/CPY/subversion/
regex = cvs2svn-(__VER__)\.tar\.gz
}
prog subversion15:svn2cvs = {
version = %{V_svn2cvs}
url = ftp://ftp.openpkg.org/sources/CPY/subversion/
regex = svn2cvs.pl-(__VER__)
}
%prep
%setup -q -n subversion-%{V_dist}
%setup -q -n subversion-%{V_dist} -T -D -b 1
%setup -q -n subversion-%{V_dist} -T -D -a 2
cp %{SOURCE svn2cvs.pl-%{V_svn2cvs}} svn2cvs.pl
%patch -p0
# substitute path from applied patch
%{l_shtool} subst %{l_value -s -a} \
subversion/bindings/swig/perl/native/Makefile.PL.in
# patch: correctly pass --disable-shared to sub-directories
%{l_shtool} subst \
-e 's;\($ac_abs_srcdir/configure $ac_configure_args\);\1 --disable-shared;' \
configure
# patch: adjust path to configuration directory
%{l_shtool} subst \
-e 's;/etc/subversion;%{l_prefix}/etc/subversion;g' \
subversion/libsvn_subr/config_impl.h \
subversion/libsvn_subr/config_file.c
# patch: fix installation of APR
%{l_shtool} subst \
-e '/^/,/<\/Layout>/{ s!\(^[ ]*prefix:\).*$!\1 %{l_prefix}!; s!\(^[ ]*sysconfdir:\).*$!\1 %{l_prefix}/etc/subversion!; }' \
apr/config.layout \
apr-util/config.layout
%build
# configure package
CC="%{l_cc}" \
CFLAGS="%{l_cflags -O}" \
CPPFLAGS="%{l_cppflags libxml2 .}" \
LDFLAGS="%{l_ldflags} `pkg-config db --libs-only-L`" \
LIBS="`pkg-config db --libs-only-l`" \
CONFIG_SHELL="%{l_bash}" \
./configure \
--prefix=%{l_prefix} \
--mandir=%{l_prefix}/man \
--with-berkeley-db=%{l_prefix} \
--with-dbm=db45 \
--with-ssl=openssl \
--with-zlib=%{l_prefix} \
--without-libxml2 \
--without-gssapi \
%if "%{with_apache}" == "yes"
--with-apxs \
--disable-mod-activation \
%else
--without-apxs \
%endif
%if "%{with_perl}" == "yes" || "%{with_python}" == "yes"
--with-swig=%{l_prefix}/bin/swig \
%endif
%if "%{with_perl}" == "yes"
--with-perl=%{l_prefix}/bin/perl \
%endif
%if "%{with_python}" == "yes"
--with-python=%{l_prefix}/bin/python \
%endif
%if "%{with_ruby}" == "yes"
--with-ruby=%{l_prefix}/bin/ruby \
%endif
--disable-nls \
--disable-shared \
--enable-static
# build package
%{l_make} %{l_mflags}
# build Perl bindings
%if "%{with_perl}" == "yes"
( cd apr; ln -s .libs/libapr-1.a . ) || exit $?
( cd apr-util; ln -s .libs/libaprutil-1.a . ) || exit $?
%{l_make} %{l_mflags} swig-pl
%endif
# build Python bindings
%if "%{with_python}" == "yes"
%{l_make} %{l_mflags} swig-py
%endif
# build Ruby bindings
%if "%{with_ruby}" == "yes"
%{l_make} %{l_mflags} swig-rb
%endif
%install
# install package
rm -rf $RPM_BUILD_ROOT
%{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
# install Perl bindings
%if "%{with_perl}" == "yes"
%{l_make} %{l_mflags} install-swig-pl DESTDIR=$RPM_BUILD_ROOT
%{l_prefix}/bin/perl-openpkg -F- fixate >/dev/null
rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/libsvn_swig_perl*
%endif
# install Python bindings
%if "%{with_python}" == "yes"
%{l_make} %{l_mflags} install-swig-py DESTDIR=$RPM_BUILD_ROOT
rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/libsvn_swig_py*
rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/svn-python/libsvn/_*.a
rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/svn-python/libsvn/_*.la
mv $RPM_BUILD_ROOT%{l_prefix}/lib/svn-python \
$RPM_BUILD_ROOT%{l_prefix}/lib/python
%endif
# install Ruby bindings
%if "%{with_ruby}" == "yes"
%{l_make} %{l_mflags} install-swig-rb DESTDIR=$RPM_BUILD_ROOT
rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/libsvn_swig_ruby*
%endif
# adjust APR installation for SVN local namespace
( cd $RPM_BUILD_ROOT%{l_prefix}/include/apr-1
for i in *; do
mv $i ../subversion-1/svn_$i
done
) || exit $?
%{l_shtool} subst \
-e 's;^\(#include <\)\(apr.*\)$;\1svn_\2;' \
$RPM_BUILD_ROOT/%{l_prefix}/include/subversion-1/svn*.h
( cd $RPM_BUILD_ROOT%{l_prefix}/lib
for i in libapr*; do
[ ".$i" = ".libapr*" ] && continue
mv $i `echo "$i" | sed -e 's;^libapr\(.*\)$;libsvn_apr\1;'`
done
) || exit $?
( cd $RPM_BUILD_ROOT%{l_prefix}/libexec/subversion/neon/lib
for i in libneon*; do
[ ".$i" = ".libneon*" ] && continue
mv $i $RPM_BUILD_ROOT%{l_prefix}/lib/`echo "$i" | sed -e 's;^libneon\(.*\)$;libsvn_neon\1;'`
done
) || exit $?
%{l_shtool} subst \
-e 's;libapr;libsvn_apr;g' \
$RPM_BUILD_ROOT%{l_prefix}/lib/libsvn_apr*.la
%{l_shtool} subst \
-e 's;^\(libdir='\).*\('\);\1%{l_prefix}/lib\2;g' \
-e 's;libneon;libsvn_neon;g' \
$RPM_BUILD_ROOT%{l_prefix}/lib/libsvn_neon.la
# strip down installation
rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/apr-config
rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/apu-config
rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/apr.exp
rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/aprutil.exp
rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/libexpat.*
rm -rf $RPM_BUILD_ROOT%{l_prefix}/libexec/subversion/neon
rmdir $RPM_BUILD_ROOT%{l_prefix}/libexec/subversion >/dev/null 2>&1 || true
rm -rf $RPM_BUILD_ROOT%{l_prefix}/include/apr-1
rm -f $RPM_BUILD_ROOT%{l_prefix}/include/subversion-1/svn-revision.txt
rm -f $RPM_BUILD_ROOT%{l_prefix}/include/subversion-1/mod_dav_svn.h
rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/doc
rm -rf $RPM_BUILD_ROOT%{l_prefix}/build
rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man1/neon*
strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
# install svn_load_dirs(1) tool
%{l_shtool} install -c -m 755 \
-e 's;#!/usr/bin/perl;#!%{l_prefix}/bin/perl;' \
contrib/client-side/svn_load_dirs/svn_load_dirs.pl \
$RPM_BUILD_ROOT%{l_prefix}/bin/svn_load_dirs
# install Subversion default global configuration files
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/etc/subversion
%{l_shtool} install -c -m 644 %{l_value -s -a} \
%{SOURCE subversion.config} \
$RPM_BUILD_ROOT%{l_prefix}/etc/subversion/config
%{l_shtool} install -c -m 644 \
%{SOURCE subversion.servers} \
$RPM_BUILD_ROOT%{l_prefix}/etc/subversion/servers
# install Subversion Bash command completion
%{l_shtool} install -c -m 644 \
tools/client-side/bash_completion \
$RPM_BUILD_ROOT%{l_prefix}/etc/subversion/bashrc
# install Subversion book
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/share/subversion
%{l_shtool} install -c -m 644 \
%{SOURCE svn-book-%{V_book_pdf}.pdf} \
$RPM_BUILD_ROOT%{l_prefix}/share/subversion/svn-book.pdf
%{l_shtool} install -c -m 644 \
%{SOURCE svn-book-%{V_book_html}.html} \
$RPM_BUILD_ROOT%{l_prefix}/share/subversion/svn-book.html
%if "%{with_cvs2svn}" == "yes"
# install cvs2svn(1) tool
( cd cvs2svn-%{V_cvs2svn}
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/libexec/subversion/cvs2svn/cvs2svn_rcsparse \
$RPM_BUILD_ROOT%{l_prefix}/libexec/subversion/cvs2svn/cvs2svn_lib
( echo "#!/bin/sh"
echo "PYTHONPATH=\"%{l_prefix}/libexec/subversion/cvs2svn\""
echo "export PYTHONPATH"
echo "%{l_prefix}/bin/python %{l_prefix}/libexec/subversion/cvs2svn/cvs2svn \${1+\"\$@\"}"
) >cvs2svn.sh
%{l_shtool} install -c -m 755 \
cvs2svn.sh $RPM_BUILD_ROOT%{l_prefix}/bin/cvs2svn
%{l_shtool} install -c -m 644 \
cvs2svn.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/
%{l_shtool} install -c -m 644 \
cvs2svn $RPM_BUILD_ROOT%{l_prefix}/libexec/subversion/cvs2svn/
%{l_shtool} install -c -m 644 \
cvs2svn_rcsparse/*.py \
$RPM_BUILD_ROOT%{l_prefix}/libexec/subversion/cvs2svn/cvs2svn_rcsparse/
%{l_shtool} install -c -m 644 \
cvs2svn_lib/*.py \
$RPM_BUILD_ROOT%{l_prefix}/libexec/subversion/cvs2svn/cvs2svn_lib/
) || exit $?
%endif
%if "%{with_svn2cvs}" == "yes"
# install svn2cvs(1) tool
%{l_shtool} install -c -m 755 \
-e 's;#!/usr/bin/perl;#!%{l_prefix}/bin/perl;' \
svn2cvs.pl $RPM_BUILD_ROOT%{l_prefix}/bin/svn2cvs
%{l_prefix}/bin/pod2man svn2cvs.pl >svn2cvs.1
%{l_shtool} install -c -m 644 \
svn2cvs.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/svn2cvs.1
%endif
%if "%{with_apache}" == "yes"
# install Apache configuration file
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/etc/apache/apache.d
%{l_shtool} install -c -m 644 %{l_value -s -a} \
%{SOURCE subversion.config.apache} \
$RPM_BUILD_ROOT%{l_prefix}/etc/apache/apache.d/subversion.conf
%endif
# install run-command script
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
%{l_shtool} install -c -m 755 %{l_value -s -a} \
%{SOURCE rc.subversion} \
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
# create directory for default repository and svnserve pidfile
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/var/subversion
# determine installation files
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
%{l_files_std} \
'%config %{l_prefix}/etc/subversion/*' \
'%doc %{l_prefix}/share/subversion/svn-book.*'
%files -f files
%clean
rm -rf $RPM_BUILD_ROOT
%post
# create default repository
if [ ! -d $RPM_INSTALL_PREFIX/var/subversion/default ]; then
$RPM_INSTALL_PREFIX/bin/svnadmin create \
$RPM_INSTALL_PREFIX/var/subversion/default
fi
# after upgrade, restart service
[ $1 -eq 2 ] || exit 0
eval `%{l_rc} subversion status 2>/dev/null`
[ ".$subversion_active" = .yes ] && %{l_rc} subversion restart
%if "%{with_apache}" == "yes"
eval `%{l_rc} apache status 2>/dev/null`
[ ".$apache_active" = .yes ] && %{l_rc} apache restart
%endif
exit 0
%preun
# before erase, stop service
[ $1 -eq 0 ] || exit 0
%{l_rc} subversion stop 2>/dev/null
exit 0