Attached please find updated copies of the perforce spec and rc files,
as well as the patches for these files against the current versions in
CVS. They should pass the lint tests cleanly. I've modeled my changes
to the perforce package after the CVS package, for consistency's sake.
I've performed a moderate amount of testing at my site, mostly as a
perforce client, and everything seems to work fine. Hopefully this
helps bring the perforce package a little closer to PLUS status.
--
Larry Lansing
Index: perforce.spec
===================================================================
RCS file: /v/openpkg/cvs/openpkg-src/perforce/perforce.spec,v
retrieving revision 1.35
diff -u -r1.35 perforce.spec
--- perforce.spec 1 Jan 2006 13:18:50 -0000 1.35
+++ perforce.spec 7 Feb 2006 19:17:32 -0000
@@ -25,6 +25,7 @@
# package version
%define V_full 2005.1
%define V_dist r05.2
+%define V_p4el 10.6
# package information
Name: perforce
@@ -37,7 +38,9 @@
Group: SCM
License: Commercial
Version: %{V_full}
-Release: 20051121
+Release: 20060207
+
+%option with_emacs no
# list of sources
Source0:
ftp://ftp.openpkg.org/sources/CPY/perforce/perforce-%{V_full}.tar.bz2
@@ -48,13 +51,18 @@
Source5: http://www.perforce.com/perforce/doc.042/manuals/p4sag/p4sag.pdf
Source6:
http://www.perforce.com/perforce/doc.042/manuals/cmdref/cmdref.pdf
Source7: http://www.perforce.com/perforce/doc.042/manuals/p4ftp/p4ftp.pdf
-Source9: rc.perforce
+Source8: rc.perforce
+Source9: http://osdn.dl.sourceforge.net/sourceforge/p4el/p4.el-10.6.tgz
# build information
Prefix: %{l_prefix}
BuildRoot: %{l_buildroot}
BuildPreReq: OpenPKG, openpkg >= 20040130
PreReq: OpenPKG, openpkg >= 20040130
+%if "%{with_emacs}" == "yes"
+BuildPreReq: emacs
+PreReq: emacs
+%endif
AutoReq: no
AutoReqProv: no
@@ -74,10 +82,18 @@
url = ftp://ftp.perforce.com/perforce/
regex = (r0[2-9].\d)
}
+ prog perforce:p4el = {
+ version = %{V_p4el}
+ url = http://prdownloads.sourceforge.net/p4el/
+ regex = p4.el-(__VER__).tgz
+ }
%prep
%setup -q -c
%setup -q -T -D -a 1
+%if "%{with_emacs}" == "yes"
+ %setup -q -T -D -a 9
+%endif
%build
( cd c4-*
@@ -134,6 +150,18 @@
%{l_shtool} install -c -m 755 %{l_value -s -a} \
%{SOURCE rc.perforce} \
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
+
+ # optionally install emacs perforce bindings
+%if "%{with_emacs}" == "yes"
+ %{l_prefix}/bin/emacs -batch -f batch-byte-compile p4.el
+ %{l_shtool} mkdir -f -p -m 755 \
+ $RPM_BUILD_ROOT%{l_prefix}/share/emacs/site-lisp
+ %{l_shtool} install -c -m 755 \
+ p4.el \
+ p4.elc \
+ $RPM_BUILD_ROOT%{l_prefix}/share/emacs/site-lisp/
+%endif
+
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
%{l_files_std} \
'%dir %attr(700,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/perforce' \
@@ -146,16 +174,15 @@
rm -rf $RPM_BUILD_ROOT
%post
- if [ ".$1" = .1 ]; then
- $RPM_INSTALL_PREFIX/etc/rc perforce start
- sleep 1
- P4PORT=`$RPM_INSTALL_PREFIX/etc/rc -q perforce_port`
- export P4PORT
- ( echo "Protections:"
- echo " read user * * //..."
- echo " write user * * //..."
- echo " super user %{l_rusr} * //..."
- ) | su %{l_rusr} -c "$RPM_INSTALL_PREFIX/bin/p4 protect -i" >/dev/null
2>&1
- $RPM_INSTALL_PREFIX/etc/rc perforce stop
- fi
+ # after upgrade, restart service
+ [ $1 -eq 2 ] || exit 0
+ eval `%{l_rc} perforce status 2>/dev/null`
+ [ ".$perforce_active" = .yes ] && %{l_rc} perforce restart
+ exit 0
+
+%preun
+ # before erase, stop service
+ [ $1 -eq 0 ] || exit 0
+ %{l_rc} perforce stop 2>/dev/null
+ exit 0
[EMAIL PROTECTED]@/lib/openpkg/bash @l_prefix@/etc/rc
##
## rc.perforce -- Run-Commands
##
%config
perforce_enable="$openpkg_rc_def"
perforce_daemon="$openpkg_rc_def"
perforce_port="localhost:1666"
perforce_rootdir="@l_prefix@/var/perforce/p4d.depot"
perforce_journal="@l_prefix@/var/perforce/p4d.journal"
perforce_logfile="@l_prefix@/var/perforce/p4d.log"
%status -u util -o
perforce_usable="unknown"
perforce_active="no"
rcService perforce enable yes && rcVarIsYes perforce_daemon && \
@l_prefix@/bin/p4 -p ${perforce_port} help >/dev/null && \
perforce_active="yes"
echo "perforce_enable=\"$perforce_enable\""
echo "perforce_usable=\"$perforce_usable\""
echo "perforce_active=\"$perforce_active\""
%start -u @l_susr@
rcService perforce enable yes || exit 0
rcService perforce active no || exit 0
if rcVarIsYes perforce_daemon; then
cmd="@l_prefix@/sbin/p4d"
cmd="$cmd -q -d -z"
cmd="$cmd -p ${perforce_port}"
cmd="$cmd -r ${perforce_rootdir}"
cmd="$cmd -J ${perforce_journal}"
cmd="$cmd -L ${perforce_logfile}"
umask 077
nohup $cmd </dev/null >/dev/null 2>&1 &
if [ ! -f ${perforce_rootdir}/db.depot ]; then
sleep 1
cmd="@l_prefix@/bin/p4"
cmd="$cmd -p ${perforce_port}"
cmd="$cmd protect -i"
( echo "Protections:"
echo " read user * * //..."
echo " write user * * //..."
echo " super user @l_susr@ * //..."
) | $cmd >/dev/null 2>&1
fi
fi
%stop -u @l_susr@
rcService perforce enable yes || exit 0
rcService perforce active yes || exit 0
if rcVarIsYes perforce_daemon; then
cmd="@l_prefix@/bin/p4"
cmd="$cmd -p ${perforce_port}"
cmd="$cmd admin stop"
umask 077
$cmd
fi
%restart -u @l_susr@
rcService perforce enable yes || exit 0
rcService perforce active yes || exit 0
rc perforce stop start
%env
rcService perforce enable yes || exit 0
P4PORT=${perforce_port}
export P4PORT
P4CONFIG=.p4rc
export P4CONFIG
Index: rc.perforce
===================================================================
RCS file: /v/openpkg/cvs/openpkg-src/perforce/rc.perforce,v
retrieving revision 1.9
diff -u -r1.9 rc.perforce
--- rc.perforce 22 Jul 2003 08:10:58 -0000 1.9
+++ rc.perforce 7 Feb 2006 19:22:14 -0000
@@ -5,27 +5,67 @@
%config
perforce_enable="$openpkg_rc_def"
+ perforce_daemon="$openpkg_rc_def"
perforce_port="localhost:1666"
perforce_rootdir="@l_prefix@/var/perforce/p4d.depot"
perforce_journal="@l_prefix@/var/perforce/p4d.journal"
perforce_logfile="@l_prefix@/var/perforce/p4d.log"
+%status -u util -o
+ perforce_usable="unknown"
+ perforce_active="no"
+ rcService perforce enable yes && rcVarIsYes perforce_daemon && \
+ @l_prefix@/bin/p4 -p ${perforce_port} help >/dev/null && \
+ perforce_active="yes"
+ echo "perforce_enable=\"$perforce_enable\""
+ echo "perforce_usable=\"$perforce_usable\""
+ echo "perforce_active=\"$perforce_active\""
+
%start -u @l_susr@
rcService perforce enable yes || exit 0
- cmd="@l_prefix@/sbin/p4d"
- cmd="$cmd -q -d -z"
- cmd="$cmd -p ${perforce_port}"
- cmd="$cmd -r ${perforce_rootdir}"
- cmd="$cmd -J ${perforce_journal}"
- cmd="$cmd -L ${perforce_logfile}"
- umask 077
- su @l_rusr@ -c "nohup $cmd </dev/null >/dev/null 2>&1 &"
+ rcService perforce active no || exit 0
+ if rcVarIsYes perforce_daemon; then
+ cmd="@l_prefix@/sbin/p4d"
+ cmd="$cmd -q -d -z"
+ cmd="$cmd -p ${perforce_port}"
+ cmd="$cmd -r ${perforce_rootdir}"
+ cmd="$cmd -J ${perforce_journal}"
+ cmd="$cmd -L ${perforce_logfile}"
+ umask 077
+ nohup $cmd </dev/null >/dev/null 2>&1 &
+ if [ ! -f ${perforce_rootdir}/db.depot ]; then
+ sleep 1
+ cmd="@l_prefix@/bin/p4"
+ cmd="$cmd -p ${perforce_port}"
+ cmd="$cmd protect -i"
+ ( echo "Protections:"
+ echo " read user * * //..."
+ echo " write user * * //..."
+ echo " super user @l_susr@ * //..."
+ ) | $cmd >/dev/null 2>&1
+ fi
+ fi
%stop -u @l_susr@
rcService perforce enable yes || exit 0
- cmd="@l_prefix@/bin/p4"
- cmd="$cmd -p ${perforce_port}"
- cmd="$cmd admin stop"
- umask 077
- su @l_rusr@ -c "$cmd"
+ rcService perforce active yes || exit 0
+ if rcVarIsYes perforce_daemon; then
+ cmd="@l_prefix@/bin/p4"
+ cmd="$cmd -p ${perforce_port}"
+ cmd="$cmd admin stop"
+ umask 077
+ $cmd
+ fi
+
+%restart -u @l_susr@
+ rcService perforce enable yes || exit 0
+ rcService perforce active yes || exit 0
+ rc perforce stop start
+
+%env
+ rcService perforce enable yes || exit 0
+ P4PORT=${perforce_port}
+ export P4PORT
+ P4CONFIG=.p4rc
+ export P4CONFIG
##
## perforce.spec -- OpenPKG RPM Package Specification
## Copyright (c) 2000-2006 OpenPKG Foundation e.V. <http://openpkg.net/>
## Copyright (c) 2000-2006 Ralf S. Engelschall <http://engelschall.com/>
##
## 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_full 2005.1
%define V_dist r05.2
%define V_p4el 10.6
# package information
Name: perforce
Summary: The Perforce SCM System
URL: http://www.perforce.com/
Vendor: Perforce Software
Packager: OpenPKG
Distribution: OpenPKG
Class: EVAL
Group: SCM
License: Commercial
Version: %{V_full}
Release: 20060207
%option with_emacs no
# list of sources
Source0:
ftp://ftp.openpkg.org/sources/CPY/perforce/perforce-%{V_full}.tar.bz2
Source1: ftp://ftp.perforce.com/perforce/utils/c4/c4.tar.gz
Source2: http://www.perforce.com/perforce/doc.042/man/p4.1
Source3: http://www.perforce.com/perforce/doc.042/man/p4d.1
Source4:
http://www.perforce.com/perforce/doc.042/manuals/p4guide/p4guide.pdf
Source5: http://www.perforce.com/perforce/doc.042/manuals/p4sag/p4sag.pdf
Source6: http://www.perforce.com/perforce/doc.042/manuals/cmdref/cmdref.pdf
Source7: http://www.perforce.com/perforce/doc.042/manuals/p4ftp/p4ftp.pdf
Source8: rc.perforce
Source9: http://osdn.dl.sourceforge.net/sourceforge/p4el/p4.el-10.6.tgz
# build information
Prefix: %{l_prefix}
BuildRoot: %{l_buildroot}
BuildPreReq: OpenPKG, openpkg >= 20040130
PreReq: OpenPKG, openpkg >= 20040130
%if "%{with_emacs}" == "yes"
BuildPreReq: emacs
PreReq: emacs
%endif
AutoReq: no
AutoReqProv: no
%description
Perforce (P4) is a commercial (but freely available and usable
for Open Source projects) Software Configuration Management (SCM)
system. It is superior to Concurrent Versions System (CVS) and
even (with the help of an existing CVS to P4 repository conversion
tool) can operate on the RCS files of CVS. This is the unlicensed
demo version. It has full time-unlimited functionality, but is
restricted to 2 users. For a real license one has to contact
<[EMAIL PROTECTED]>.
%track
prog perforce = {
version = %{V_dist}
url = ftp://ftp.perforce.com/perforce/
regex = (r0[2-9].\d)
}
prog perforce:p4el = {
version = %{V_p4el}
url = http://prdownloads.sourceforge.net/p4el/
regex = p4.el-(__VER__).tgz
}
%prep
%setup -q -c
%setup -q -T -D -a 1
%if "%{with_emacs}" == "yes"
%setup -q -T -D -a 9
%endif
%build
( cd c4-*
%{l_make} %{l_mflags} \
CC="%{l_cc}" CFLAGS="%{l_cflags -O}"
) || exit $?
%install
rm -rf $RPM_BUILD_ROOT
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/bin \
$RPM_BUILD_ROOT%{l_prefix}/sbin \
$RPM_BUILD_ROOT%{l_prefix}/man/man1 \
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
$RPM_BUILD_ROOT%{l_prefix}/libexec/perforce \
$RPM_BUILD_ROOT%{l_prefix}/share/perforce \
$RPM_BUILD_ROOT%{l_prefix}/var/perforce/p4d.depot
case "%{l_platform -t}" in
*686*-freebsd* ) subdir="bin.freebsd4" ;;
*686*-linux* ) subdir="bin.linux24x86" ;;
*sun*-sunos* ) subdir="bin.solaris8sparc" ;;
* ) echo "platform %{l_platform -t} not supported" 1>&2; exit 1 ;;
esac
( cd perforce-%{V_full}/$subdir
%{l_shtool} install -c -m 755 \
p4 $RPM_BUILD_ROOT%{l_prefix}/bin/
%{l_shtool} install -c -m 755 \
p4d p4web p4ftpd p4p $RPM_BUILD_ROOT%{l_prefix}/sbin/
%{l_shtool} install -c -m 644 \
%{SOURCE p4.1} %{SOURCE p4d.1} $RPM_BUILD_ROOT%{l_prefix}/man/man1/
%{l_shtool} install -c -m 644 \
%{SOURCE p4guide.pdf} %{SOURCE p4sag.pdf} \
%{SOURCE cmdref.pdf} %{SOURCE p4ftp.pdf} \
$RPM_BUILD_ROOT%{l_prefix}/share/perforce/
%{l_gzip} -d -c p4v.t* | %{l_tar} xf -
%{l_shtool} install -c -m 755 \
p4v $RPM_BUILD_ROOT%{l_prefix}/libexec/perforce/
( echo "#!/bin/sh"
echo "P4VRES=\"%{l_prefix}/share/perforce/P4VResources\""
echo "export P4VRES"
echo "exec %{l_prefix}/libexec/perforce/p4v \${1+\"[EMAIL PROTECTED]"}"
) >p4v.sh
%{l_shtool} install -c -m 755 \
p4v.sh $RPM_BUILD_ROOT%{l_prefix}/bin/p4v
cp -rp P4VResources \
$RPM_BUILD_ROOT%{l_prefix}/share/perforce/
) || exit $?
( cd c4-*
%{l_shtool} install -c -m 755 \
c4 $RPM_BUILD_ROOT%{l_prefix}/bin/
%{l_shtool} install -c -m 644 \
c4.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/
) || exit $?
%{l_shtool} install -c -m 755 %{l_value -s -a} \
%{SOURCE rc.perforce} \
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
# optionally install emacs perforce bindings
%if "%{with_emacs}" == "yes"
%{l_prefix}/bin/emacs -batch -f batch-byte-compile p4.el
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/share/emacs/site-lisp
%{l_shtool} install -c -m 755 \
p4.el \
p4.elc \
$RPM_BUILD_ROOT%{l_prefix}/share/emacs/site-lisp/
%endif
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
%{l_files_std} \
'%dir %attr(700,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/perforce' \
'%dir %attr(700,%{l_rusr},%{l_rgrp})
%{l_prefix}/var/perforce/p4d.depot' \
'%doc %{l_prefix}/share/perforce/*.pdf'
%files -f files
%clean
rm -rf $RPM_BUILD_ROOT
%post
# after upgrade, restart service
[ $1 -eq 2 ] || exit 0
eval `%{l_rc} perforce status 2>/dev/null`
[ ".$perforce_active" = .yes ] && %{l_rc} perforce restart
exit 0
%preun
# before erase, stop service
[ $1 -eq 0 ] || exit 0
%{l_rc} perforce stop 2>/dev/null
exit 0