[GE users] Universal RPM spec file

Olesen, Mark Mark.Olesen at arvinmeritor.com
Mon Jan 17 08:56:04 GMT 2005

> I'm trying to create an universal RPM spec file for SGE.  The idea is to
> have one spec file

This would be a terrific bonus.
My only request would be that the spec file generate distinct rpm's for the
config information (i.e., default/common) and the init.d scripts.
This would prevent the (NFS-mounted) config files from being accidentally
removed when a compute node is upgraded.

As a example of what I mean, I've attached my reworked spec file for v5.3p4

It would also be nice to have the core system as a re-locatable rpm.


# spec file for package gridengine (Version 5.3p4)
# Copyright (c) 2003 SuSE Linux AG, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
# Please submit bugfixes or comments via http://www.suse.de/feedback/

# neededforbuild  openmotif openmotif-devel openssl openssl-devel pvm
pvm-devel tcsh x-devel-packages
# usedforbuild    aaa_base acl attr bash bind9-utils bison coreutils cpio
cpp cvs cyrus-sasl2 db devs diffutils e2fsprogs file filesystem fillup
findutils flex gawk gdbm-devel glibc glibc-devel glibc-locale gpm grep groff
gzip info insserv kbd less libacl libattr libgcc libstdc++ libxcrypt m4 make
man mktemp modutils ncurses ncurses-devel net-tools netcfg pam pam-devel
pam-modules patch permissions ps rcs readline sed sendmail shadow strace
syslogd sysvinit tar texinfo timezone unzip util-linux vim zlib zlib-devel
XFree86-devel XFree86-libs autoconf automake binutils bzip2 cracklib gcc
gdbm gettext libtool openmotif openmotif-devel openssl openssl-devel perl
pvm pvm-devel rpm tcsh

%define sge_root   /opt/gridengine
%define sge_spool  /var/spool/gridengine/default

Name:         gridengine
Version:      5.3p4
Release:      9
Summary:      Distributed resource management software
License:      Other License(s), see package
Group:        Productivity/Clustering/Computing
URL:          http://gridengine.sunsource.net
Autoreqprov:  on
Source0:      sge-V53p4_TAG-src.tar.gz
Source1:      %{name}-configuration
Source2:      rcsge
Source3:      rcsge.cfg
Source4:      gridengine.csh
Source5:      gridengine.sh
Source6:      SuSEconfig.gridengine
Source7:      sysconfig.gridengine
Source10:     %{name}-permissions
Patch:        %{name}-%{version}-aimk.site.dif
Patch1:       %{name}-%{version}-distinst.site.dif
Patch2:       %{name}-%{version}-aimk.dif
Patch3:       %{name}-%{version}-aimk-lib64.dif
Patch4:       %{name}-%{version}-aimk-cflags.dif
Patch5:       %{name}-%{version}-warnings.dif
Patch6:       %{name}-%{version}-varargs.dif
Patch7:       %{name}-%{version}-suid.dif
Patch8:       %{name}-%{version}-aimk-pvm.dif
Patch9:       %{name}-%{version}-arch.dif
Patch10:      %{name}-%{version}-error.patch
Requires:     ksh, openmotif, binutils
Provides:     gridengine
BuildRequires:	openmotif-devel
BuildRoot:    %{_tmppath}/%{name}-%{version}-build
#!# PreReq:       %insserv_prereq  %fillup_prereq

The Grid Engine project is an open source community effort to facilitate the
adoption of distributed computing solutions. Sponsored by Sun Microsystems
and hosted by CollabNet, the Grid Engine project provides enabling
distributed resource management software for wide ranging requirements from
compute farms to grid computing.
To run the gridengine, you will also need to install the gridengine-config
package or (if you know what you are doing) create the files by hand.

%package config
Summary:      Distributed resource management software
Group:        Productivity/Clustering/Computing

%description config
The configuration files for the Grid Engine.
Packaging the configuration separately from the gridengine package allows
local binaries and a shared configuration to be installed.

%package rcsge
Summary:      Distributed resource management software
Group:        Productivity/Clustering/Computing
Conflicts:    gridengine

%description rcsge
The startup file(s) for the Grid Engine.
Useful for using binaries located on a shared filesystem.
Not needed if the gridengine package is already installed.

%package devel
Summary:      Distributed resource management software
Group:        Productivity/Clustering/Computing
Requires:     gridengine

%description devel
Documentation and manpages for the Grid Engine internals.
Only required if you are hacking on the source.

%setup -q -n gridengine
if [ "%_lib" = lib64 ]; then
#!# %patch6
#!# %patch10

## for i in source/doc/man*
## echo $PWD
## cd source/doc/man

find -name "CVS" | xargs rm -rf
cd source
# create the sge-depend tool
./aimk -only-depend
# create the dependencies
./aimk depend
# create the core programs, qmon, qmake and qrsh/qtcsh
# create new manpages under 'source/MANSBUILD_ge/SEDMAN'
./aimk -man
if [ $? = 0 ]; then
  gzip -f MANSBUILD_ge/SEDMAN/man/man*/*.?

export SGE_ROOT=$RPM_BUILD_ROOT%{sge_root}
export PVM_ROOT=/usr/lib/pvm3
export PVM_ARCH=`$PVM_ROOT/lib/pvmgetarch`
install -d $SGE_ROOT
cd source
echo sge > product_mode
ln -s scripts/distinst myinst
yes | ./myinst -all glinux -- locale
# for 'execd_spool_dir', perhaps also for 'qmaster_spool_dir'
install -d $RPM_BUILD_ROOT%{sge_spool}
install -d $SGE_ROOT/default
install -d $SGE_ROOT/default/common
install -d $SGE_ROOT/default/spool
# <sge_root>/<sge_cell>/common configuration directory
export COMMONDIR=$SGE_ROOT/default/common
install -d $COMMONDIR/history
install -d $COMMONDIR/local_conf
install -m 644 %{S:1} $COMMONDIR/configuration
install -m 755 %{S:2} $COMMONDIR/rcsge
install -m 644 %{S:3} $COMMONDIR/rcsge.cfg
install -m 644 %{S:4} $COMMONDIR/settings.csh
install -m 644 %{S:5} $COMMONDIR/settings.sh
install -m 444 product_mode $COMMONDIR/product_mode
install -d $RPM_BUILD_ROOT/etc/profile.d
install -m 644 %{S:4} $RPM_BUILD_ROOT/etc/profile.d/gridengine.csh
install -m 644 %{S:5} $RPM_BUILD_ROOT/etc/profile.d/gridengine.sh
# default host + queue complexes are in $SGE_ROOT/util/resources/complexes
# AddCommonFiles
#    Copy files from util directory to common dir
for f in sge_aliases qtask sge_request;
    install -m 644 $SGE_ROOT/util/$f  $COMMONDIR
# init.d file
install -d $RPM_BUILD_ROOT/usr/sbin
install -d $RPM_BUILD_ROOT/etc/init.d
install -m 755 %{S:2} $RPM_BUILD_ROOT/etc/init.d/sge
( cd $RPM_BUILD_ROOT/usr/sbin && ln -sf ../../etc/init.d/sge rcsge )
# man pages
cd ../
install -d $SGE_ROOT/man
cp -a source/MANSBUILD_ge/SEDMAN/man/man* $SGE_ROOT/man
rm -rf $SGE_ROOT/doc

install -d $RPM_BUILD_ROOT/etc/permissions.d
install -m 644 %{S:10} $RPM_BUILD_ROOT/etc/permissions.d/gridengine
# compile PVM code
  cd $SGE_ROOT/pvm/src
  cd ..
  mkdir bin
  export SGE_ARCH=`$SGE_ROOT/util/arch`
  mv src/$SGE_ARCH bin/
  rm bin/$SGE_ARCH/*.o
install -d $RPM_BUILD_ROOT/sbin/conf.d
install -m 755 %{S:6} $RPM_BUILD_ROOT/sbin/conf.d/
install -d $RPM_BUILD_ROOT/var/adm/fillup-templates
install -m 644 %{S:7} $RPM_BUILD_ROOT/var/adm/fillup-templates/
# export manpath="$manpath %{sge_root}/man"


%{fillup_and_insserv sge}

# %preun
# # stop the rcsge script
# if [ -x /usr/sbin/rcsge ]; then
#    /usr/sbin/rcsge stop >/dev/null 2>&1
#    # kill leftover sge processes
#    ps ax | grep sge_ | for i in `awk '{print $1}'`; do kill -9 $i
>/dev/null 2>&1; done
# fi


%defattr(-, root, root)
%doc doc/load_parameters.asc doc/compatibility_test.html doc/INSTALL
%dir %{sge_root}
%dir %{sge_root}/man
%dir %{sge_spool}

%post config
# initialize with this host being the qmaster - this allows us to get going

export SGE_ROOT=%{sge_root}
if [ ! -s $SGE_ROOT/default/common/act_qmaster ]; then
  /bin/hostname -f > $SGE_ROOT/default/common/act_qmaster
  ## the alternative to using '/bin/hostname -f'
  ## will fail if the gridengine is not already installed
  # $SGE_ROOT/utilbin/$($SGE_ROOT/util/arch)/gethostname -aname  >

%files config
%defattr(-, root, root)
%dir %{sge_root}/default
%dir %{sge_root}/default/common
%dir %{sge_root}/default/common/history
%dir %{sge_root}/default/common/local_conf
%dir %{sge_root}/default/spool

%config %{sge_root}/default/common/configuration
%config %{sge_root}/default/common/qtask
%config %{sge_root}/default/common/sge_aliases
%config %{sge_root}/default/common/sge_request
%config %{sge_root}/default/common/rcsge.cfg


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

%files devel
%defattr(-, root, root)
%doc doc/devel/*

%changelog -n gridengine
* Fri Sep 12 2003 - mark olesen
- adapted to version 5.3p4, the diffs now also include the version number
- include MANPATH in the settings.{csh,sh} files
- preserve configuration files in $SGE_ROOT/default/common
- uninstall shutdown sge_* commands
- uninstall removes man[1358] directories
- process manpages with sed
- remove /var/spool/gridengine/qmaster dir (duplicates
- update rcsge script
- find the correct execd_spool_dir!
- rcsge sources common/rcsge.cfg for extra environment variables
* Fri Feb 14 2003 - schwab at suse.de
- Don't link libXm statically.
* Mon Feb 10 2003 - nashif at suse.de
- remove -fmminimal-toc (ppc-only)
* Tue Feb 04 2003 - nashif at suse.de
- fixed #22645: Added meta data to sysconfig file
- Update to patchlevel 2
* Mon Aug 19 2002 - nashif at suse.de
- Fixed bug #17866 : Added PreReq
- Added missing bin directory to file list in spec
- moved post-install operations to a SuSEconfig script
* Thu Aug 15 2002 - schwab at suse.de
- Fix broken use of strings.
* Wed Aug 07 2002 - nashif at suse.de
- Compile PVM start programs
- Move man pages to /opt/gridengine
- dont include empty diectories to file list
* Fri Jul 19 2002 - nashif at suse.de
- Update to version 5.3 patch level 1
- Fixed build on various platforms
* Mon Jul 01 2002 - olh at suse.de
- use RPM_OPT_FLAGS, build with -mminimal-toc on ppc64
* Thu Jun 06 2002 - ro at suse.de
- fix build for x86_64
* Wed May 15 2002 - schwab at suse.de
- Fix warnings.
- Don't link libXm statically.
* Sun Feb 03 2002 - nashif at suse.de
- Initial Release (5.3b2)

To unsubscribe, e-mail: users-unsubscribe at gridengine.sunsource.net
For additional commands, e-mail: users-help at gridengine.sunsource.net

More information about the gridengine-users mailing list