[Spread-users] RPM package and some questions

Daniel Rall dlr at finemaltcoding.com
Tue Aug 20 15:33:25 EDT 2002

Juan Carlos CORUÑA <jcoruna at ibdosnorte.com> writes:

> I'm trying to compile a RPM package, but I still have problems
> writing a script to start and stop spread.

Performing quick restarts (especially on loaded servers) is not
possible on some operating systems (Linux, for instance) without my
SO_REUSEADDR patch (still not committed to CVS by the maintainers for
some unknown reason).  You can grab it out of the list archive.

> Has anybody compiled a RPM package yet? Can you mail me a copy?

CollabNet has one which we use internally, but it's a bit of a mess
(specifically, the installation section).  If you're able to clean it
up, would you mind posting your improvments?

--- snip ---
Summary: Spread
Name: spread
%define spread_dir /var/run/spread
%define dir_version 3.16.2
Version: %{dir_version}
Epoch: 1
Release: sourcecast.6
Source: %{name}-src-%{version}.tar.gz
Patch0: build.xml.patch
Patch1: so_reuseaddr.patch
Patch2: server_msg_queue_size.patch
Group: Networking/Daemons
URL: http://www.spread.org
Copyright: Spread Open Source License
BuildRoot: %{_tmppath}/%{name}-buildroot
Packager: CollabNet Release Engineering <dev at releng.extranet.collab.net>
BuildRequires: ant

%package perl
Summary: perl
Group: Networking/Daemons

%package java
Summary: java
Group: Networking/Daemons


%description perl
Spread client library Perl implementation

%description java
Spread client library Java implementation


%setup -n %{name}-src-%{version}
%patch0 -p1
%patch1 -p0
%patch2 -p0

%ifos Linux
ln -s $RPM_BUILD_DIR/%{name}-src-%{dir_version}/LINUX_makefile $RPM_BUILD_DIR/%{name}-src-%{dir_version}/Makefile

%ifos solaris2.8
ln -s $RPM_BUILD_DIR/%{name}-src-%{dir_version}/SOLARIS_makefile $RPM_BUILD_DIR/%{name}-src-%{dir_version}/Makefile


cd $RPM_BUILD_DIR/%{name}-src-%{dir_version}/perl/Spread
CFLAGS="$RPM_OPT_FLAGS" perl Makefile.PL
make PREFIX=$RPM_BUILD_ROOT/%{_prefix}

cd $RPM_BUILD_DIR/%{name}-src-%{dir_version}/java
ant -Dsrc.java.dir=%{name}

[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{_prefix}/bin
mkdir -p $RPM_BUILD_ROOT/usr/local/lib
mkdir -p $RPM_BUILD_ROOT/usr/lib/java
mkdir -p $RPM_BUILD_ROOT%{_prefix}/include
mkdir -p $RPM_BUILD_ROOT%{_prefix}/man/man1
mkdir -p $RPM_BUILD_ROOT%{_prefix}/man/man3

cp $RPM_BUILD_DIR/%{name}-src-%{dir_version}/spread $RPM_BUILD_ROOT%{_prefix}/bin/
cp $RPM_BUILD_DIR/%{name}-src-%{dir_version}/spflooder $RPM_BUILD_ROOT%{_prefix}/bin/
cp $RPM_BUILD_DIR/%{name}-src-%{dir_version}/spmonitor $RPM_BUILD_ROOT%{_prefix}/bin/
cp $RPM_BUILD_DIR/%{name}-src-%{dir_version}/spuser $RPM_BUILD_ROOT%{_prefix}/bin/
cp $RPM_BUILD_DIR/%{name}-src-%{dir_version}/sptuser $RPM_BUILD_ROOT%{_prefix}/bin/
cp $RPM_BUILD_DIR/%{name}-src-%{dir_version}/libsp.a $RPM_BUILD_ROOT/usr/local/lib/
cp $RPM_BUILD_DIR/%{name}-src-%{dir_version}/libtsp.a $RPM_BUILD_ROOT/usr/local/lib/
cp $RPM_BUILD_DIR/%{name}-src-%{dir_version}/sp.h $RPM_BUILD_ROOT%{_prefix}/include/
cp $RPM_BUILD_DIR/%{name}-src-%{dir_version}/sp_func.h $RPM_BUILD_ROOT%{_prefix}/include/
cp $RPM_BUILD_DIR/%{name}-src-%{dir_version}/sp_events.h $RPM_BUILD_ROOT%{_prefix}/include/
cp $RPM_BUILD_DIR/%{name}-src-%{dir_version}/docs/*.3 $RPM_BUILD_ROOT%{_prefix}/man/man3/
cp $RPM_BUILD_DIR/%{name}-src-%{dir_version}/docs/*.1 $RPM_BUILD_ROOT%{_prefix}/man/man1/

cd $RPM_BUILD_DIR/%{name}-src-%{dir_version}/perl/Spread
eval `perl '-V:installarchlib'`
mkdir -p $RPM_BUILD_ROOT/$installarchlib
make PREFIX=$RPM_BUILD_ROOT%{_prefix} install

[ -x %{_prefix}/lib/rpm/brp-compress ] && %{_prefix}/lib/rpm/brp-compress

find $RPM_BUILD_ROOT%{_prefix}/lib/perl5 -type f -print | sed "s@^$RPM_BUILD_ROOT@@g" | grep -v perllocal.pod > $RPM_BUILD_DIR/%{name}-src-%{dir_version}/%{name}-%{dir_version}-filelist

cp $RPM_BUILD_DIR/%{name}-src-%{dir_version}/java/dest/*.jar $RPM_BUILD_ROOT/usr/lib/java/.

[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT

%defattr(- root root)
%attr(0755, root, root) %{_prefix}/bin/*

%files perl -f %{name}-%{dir_version}-filelist
%defattr(- root root)

%files java
%defattr(- root root)

groupadd -g 5600 spread
useradd -u 5600 -d %{spread_dir} -g spread -c 'Spread daemon user' -s /bin/false spread || /bin/true

if [ $1 = 0 ]; then
    userdel spread
    groupdel spread || true
    rm -rf %{spread_dir}

* Fri Apr 19 2002 <dlr at collab.net>
 - Fixed socket creation in so_reuseaddr.patch and .spec BUILD path
* Fri Apr 05 2002 <dlr at collab.net>
 - Updated to 3.16.2
* Mon Apr 01 2002 <dlr at collab.net>
 - Increased dameon msg queue size from 1k to 5k
 - Updated to 3.16.2rc1
* Tue Jan 08 2002 <dlr at collab.net>
 - Added use of the socket option SO_REUSEADDR to the daemon
* Fri Dec 14 2001 <lucas at collab.net>
 - Updated to 3.16.1
* Thu Nov 01 2001 <lucas at collab.net>
 - Updated to 3.16.1rc1
 - used new dir_version variable
 - took out some of the patches 
* Tue Aug 07 2001 <dlr at collab.net>
 - Added Leonard Richardson's <leonardr at collab.net> impls. of hashCode()
* Tue Aug 07 2001 <lucas at collab.net>
 - Giving the spread user a set UID/GID
 - Hard-coding the path to the spread.jar
 - Fixed Summary
 - Bumped release number
* Tue Aug 07 2001 <dlr at collab.net>
 - Added creation/deletion of Unix user and group for Spread daemon, with a
   home directory of /var/run/spread (as per spread_params.h)
* Mon Aug 06 2001 <stephane at collab.net>
 - Added brp-compress line so perl filelist is built correctly.
 - Changed RPM to use %{_prefix}.
* Thu Aug 02 2001 <dlr at collab.net>
 - Added patches to Java code.  Code reduction to SpreadGroup, and major
   bug fix to SpreadConnection which brings connect() in line with the C API
   version of the same.
* Tue Jul 24 2001 <stephane at collab.net>
 - Initial packaging.
--- snip ---

> Another question is about the user/group you run spread. What is the
> recommendation? Do you create a system user/group called spread?


> How do you run spread? Maybe "su -c spread spread"? And the
> redirection of the stdout?

We run spread via DJB's supervise; if the daemon process crashes,
supervise will re-start it.

Daniel Rall <dlr at finemaltcoding.com>

More information about the Spread-users mailing list