##
## monotone.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 information
Name: monotone
Summary: Distributed Version Control System
URL: http://monotone.ca/
Vendor: Graydon Hoare et al.
Packager: OpenPKG Foundation e.V.
Distribution: OpenPKG Community
Class: EVAL
Group: SCM
License: GPL
Version: 0.41
Release: 20080904
# package options
%option with_rse yes
# list of sources
Source0: http://monotone.ca/downloads/%{version}/monotone-%{version}.tar.gz
Source1: rc.monotone
Source3: monotone-setup.sh
Source4: monotone-colorize.pl
Source5: monotone-colorize.bashrc
Source6: monotone.bashrc
Patch1: monotone.patch.rse
# build information
Prefix: %{l_prefix}
BuildRoot: %{l_buildroot}
BuildPreReq: OpenPKG, openpkg >= 20040130, gcc, gcc::with_cxx = yes, texinfo
PreReq: OpenPKG, openpkg >= 20040130, apg, diffutils, perl, perl-mail, perl-term, less
BuildPreReq: boost, zlib, pcre
PreReq: boost, zlib, pcre
AutoReq: no
AutoReqProv: no
%description
Monotone is a distributed version control system. It provides
a simple, single-file RDBMS based transactional version store,
with fully disconnected operation and an efficient peer-to-peer
synchronization protocol. It understands history-sensitive merging,
lightweight branches, integrated code review and third-party
testing. It uses cryptographic version naming and client-side RSA
certificates.
%track
prog monotone = {
version = %{version}
url = http://monotone.ca/downloads/
regex = (\d+\.\d+)/
url = http://monotone.ca/downloads/__NEWVER__/
regex = monotone-(__VER__)\.tar\.gz
}
%prep
%setup -q
%if "%{with_rse}" == "yes"
%patch -p0 -P 1
%endif
%build
# configure program
CC="%{l_cc}" \
CXX="%{l_cxx}" \
CFLAGS="%{l_cflags -O}" \
CXXFLAGS="%{l_cxxflags -O}" \
%if "%{with_rse}" == "yes"
CPPFLAGS="%{l_cppflags} -DRSE" \
%else
CPPFLAGS="%{l_cppflags}" \
%endif
LDFLAGS="%{l_ldflags}" \
./configure \
--prefix=%{l_prefix} \
--infodir=%{l_prefix}/info \
--mandir=%{l_prefix}/man \
--enable-static-boost=%{l_prefix} \
--with-system-pcre \
--disable-nls
# build program
%{l_make} %{l_mflags -O}
%install
# install program
rm -rf $RPM_BUILD_ROOT
%{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
# strip down installation
strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
mv $RPM_BUILD_ROOT%{l_prefix}/share/doc/monotone \
$RPM_BUILD_ROOT%{l_prefix}/share/monotone
rm -f $RPM_BUILD_ROOT%{l_prefix}/info/dir
rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/locale
rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/doc
# create additional directories for server operation
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/etc/monotone \
$RPM_BUILD_ROOT%{l_prefix}/var/monotone
# install contrib tools
%{l_shtool} install -c -m 755 \
-e 's;#! /usr/bin/perl;#!%{l_prefix}/bin/perl;g' \
-e 's;\(monotone-notify\)\.pl;\1;g' \
contrib/monotone-notify.pl \
$RPM_BUILD_ROOT%{l_prefix}/bin/monotone-notify
%{l_shtool} install -c -m 644 \
contrib/monotone.bash_completion \
$RPM_BUILD_ROOT%{l_prefix}/etc/monotone/monotone-complete.bashrc
%{l_shtool} install -c -m 644 %{l_value -s -a} \
%{SOURCE monotone-colorize.bashrc} \
$RPM_BUILD_ROOT%{l_prefix}/etc/monotone/
%{l_shtool} install -c -m 755 %{l_value -s -a} \
%{SOURCE monotone-colorize.pl} \
$RPM_BUILD_ROOT%{l_prefix}/bin/monotone-colorize
%{l_shtool} install -c -m 644 %{l_value -s -a} \
%{SOURCE monotone.bashrc} \
$RPM_BUILD_ROOT%{l_prefix}/etc/monotone/
# install run-command script
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/man/man1
%{l_shtool} install -c -m 644 \
debian/mtn.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/
# install setup script
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/sbin
%{l_shtool} install -c -m 755 %{l_value -s -a} \
-e 's;@l_shtool@;%{l_shtool};g' \
%{SOURCE monotone-setup.sh} \
$RPM_BUILD_ROOT%{l_prefix}/sbin/monotone-setup
# 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.monotone} \
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
# determine installation files
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
%{l_files_std} \
'%config %{l_prefix}/etc/monotone/*' \
'%doc %{l_prefix}/share/monotone/*' \
'%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/monotone'
%files -f files
%clean
rm -rf $RPM_BUILD_ROOT
%post
if [ $1 -eq 1 ]; then
# display initial hint
( echo "If you want to use the Monotone daemon for serving"
echo "a central permanently available database, run:"
echo " $RPM_INSTALL_PREFIX/sbin/monotone-setup install \\ "
echo " [ []]"
echo "and put into your $RPM_INSTALL_PREFIX/etc/rc.conf at least:"
echo " monotone_daemon=\"yes\""
echo " monotone_daemon_host=\"\""
) | %{l_rpmtool} msg -b -t notice
elif [ $1 -eq 2 ]; then
# after upgrade, restart service
eval `%{l_rc} monotone status 2>/dev/null`
[ ".$monotone_active" = .yes ] && %{l_rc} monotone restart
fi
exit 0
%preun
if [ $1 -eq 0 ]; then
# before erase, stop service and remove log files
%{l_rc} monotone stop 2>/dev/null
$RPM_INSTALL_PREFIX/sbin/monotone-setup uninstall >/dev/null 2>&1 || true
rm -f $RPM_INSTALL_PREFIX/var/monotone/monotone.log* >/dev/null 2>&1 || true
fi
exit 0