This commit is contained in:
ruoyunbai
2021-09-29 21:06:16 +08:00
parent b200bb2f20
commit 2bb9621e30
2960 changed files with 642536 additions and 1 deletions
+13
View File
@@ -0,0 +1,13 @@
AUTOMAKE_OPTIONS = foreign
PBS_MKDIRS = $(SHELL) $(top_builddir)/buildutils/pbs_mkdirs
AM_CPPFLAGS = -I$(top_srcdir)/src/include `xml2-config --cflags`
IFF_PATH = $(sbindir)/$(program_prefix)pbs_iff$(program_suffix)
DEMUX_PATH = $(sbindir)/$(program_prefix)pbs_demux$(program_suffix)
XPBS_DIR = $(libdir)/xpbs
XPBSMON_DIR = $(libdir)/xpbsmon
SUBMIT_FILTER_PATH = $(libexecdir)/qsub_filter
+108
View File
@@ -0,0 +1,108 @@
#!/bin/bash
# Script to "probe" current machine for what linux distribution type it is running on
#
# Output possibilities:
#
# no args:
# Unknown
# el
# sles
#
# w/args
# Unknown
# el<ver>
# sles<ver>
# We prefer to use /etc/os-release if it is available
if test -f /etc/os-release; then
# read in the variables
. /etc/os-release
# Map ID to a normalized output
case ${ID} in
# RHEL distros
centos|rhel)
DISTRO=el
;;
# SLES distros
sles)
DISTRO=sles
;;
*)
DISTRO=unknown
;;
esac
# get the distro release
REL=${VERSION_ID}
else
# If /etc/os-release not found, use lsb_release if it is available
LSB_RELEASE=`which lsb_release 2>/dev/null`;
if [ $? -eq 0 ] ; then
if [ -e ${LSB_RELEASE} ] ; then
#
# extract the distro and the distro release
#
DISTRO=`lsb_release -i | sed -e "s/Distributor[ \t]*ID:[ \t]*//"`
REL=`lsb_release -r | sed -e "s/Release:[ \t]*//" -e "s/\..*$//"`
# Map raw data stream to a normalized output
case ${DISTRO} in
CentOS)
DISTRO=el
;;
RedHatEnterpriseServer)
DISTRO=el
;;
RHEL)
DISTRO=el
;;
'SUSE LINUX')
DISTRO=sles
;;
SLES)
DISTRO=sles
;;
SUSE)
DISTRO=sles
;;
Scientific)
DISTRO=el
;;
*)
DISTRO=unknown
;;
esac
fi
# If lsb_release is not found, look for a /etc/*-release file
elif test -f /etc/redhat-release; then
DISTRO=el
REL=`cat /etc/redhat-release | sed -e "s/^[^0-9]*//" -e "s/[^0-9].*$//"`
elif test -f /etc/SuSE-release; then
DISTRO=sles
REL=`grep SUSE /etc/SuSE-release | sed -e "s/^[^0-9]*//" -e "s/[^0-9].*$//"`
elif test -f /etc/lsb-release; then
DISTRO=`grep DISTRIB_ID /etc/lsb-release | sed "s/^DISTRIB_ID=//"`
REL=`grep DISTRIB_RELEASE /etc/lsb-release | sed -e "s/^DISTRIB_RELEASE=//" -e "s/[^0-9].*$//"`
# Otherwise it is unknown
else
DISTRO=unknown
fi
fi
#
# If an arg was given, then map to a common distro type and append the release
#
if [ -n "$1" ] ; then
echo ${DISTRO}${REL}
else
echo $DISTRO
fi
+15
View File
@@ -0,0 +1,15 @@
#!/bin/sh
if [ ! -s "${PWD}/configure.ac" -o ! -d "${PWD}/buildutils" ] || \
! grep -q -E 'AC_INIT[[:blank:]]*\([[:blank:]]*\[torque\]' \
"${PWD}/configure.ac"
then
echo "It appears that the present working directory" >&2
echo " '${PWD}' doesn't describe the root source" >&2
echo " path." >&2
echo " This script must be run from the root souce path." >&2
exit 1
fi
release=`git log --pretty=format:%ct_%h -1`
echo "${release}"
+24
View File
@@ -0,0 +1,24 @@
#!/bin/bash
root_path="${1}"
if [ -z "${root_path}" ]
then
base_name="`echo ${0} | sed 's|[^/]*$||'`"
# Assume the script directory is buildutils/
root_path="${base_name}/../"
fi
cat "${root_path}/configure.ac" | awk '/^ *AC_INIT/ {
ac_init_line = $0
while (!match($0,/\)/))
{
getline
ac_init_line = ac_init_line $0
}
sub(/AC_INIT *\([ \t]*\[/,"",ac_init_line)
sub(/\][ \t]*\) *$/,"",ac_init_line)
split(ac_init_line,info,/\][ \t]*,[ \t]*\[/)
name=info[1]
version=info[2]
email=info[3]
print version
}'
+17
View File
@@ -0,0 +1,17 @@
#%Module######################################################################
##
## Torque Module
##
proc ModulesHelp { } {
puts stderr " TORQUE modulefile"
}
set sys [uname sysname]
set host [uname nodename]
set os [uname release]
set version @PACKAGE_VERSION@
set prefix @prefix@
set exec_prefix @exec_prefix@
prepend-path PATH @bindir@
prepend-path PATH @sbindir@
prepend-path MANPATH @mandir@
+2
View File
@@ -0,0 +1,2 @@
#%Module
set ModulesVersion @PACKAGE_VERSION@
+212
View File
@@ -0,0 +1,212 @@
#!/bin/sh
#
# OpenPBS (Portable Batch System) v2.3 Software License
#
# Copyright (c) 1999-2000 Veridian Information Solutions, Inc.
# All rights reserved.
#
# ---------------------------------------------------------------------------
# For a license to use or redistribute the OpenPBS software under conditions
# other than those described below, or to purchase support for this software,
# please contact Veridian Systems, PBS Products Department ("Licensor") at:
#
# www.OpenPBS.org +1 650 967-4675 sales@OpenPBS.org
# 877 902-4PBS (US toll-free)
# ---------------------------------------------------------------------------
#
# This license covers use of the OpenPBS v2.3 software (the "Software") at
# your site or location, and, for certain users, redistribution of the
# Software to other sites and locations. Use and redistribution of
# OpenPBS v2.3 in source and binary forms, with or without modification,
# are permitted provided that all of the following conditions are met.
# After December 31, 2001, only conditions 3-6 must be met:
#
# 1. Commercial and/or non-commercial use of the Software is permitted
# provided a current software registration is on file at www.OpenPBS.org.
# If use of this software contributes to a publication, product, or
# service, proper attribution must be given; see www.OpenPBS.org/credit.html
#
# 2. Redistribution in any form is only permitted for non-commercial,
# non-profit purposes. There can be no charge for the Software or any
# software incorporating the Software. Further, there can be no
# expectation of revenue generated as a consequence of redistributing
# the Software.
#
# 3. Any Redistribution of source code must retain the above copyright notice
# and the acknowledgment contained in paragraph 6, this list of conditions
# and the disclaimer contained in paragraph 7.
#
# 4. Any Redistribution in binary form must reproduce the above copyright
# notice and the acknowledgment contained in paragraph 6, this list of
# conditions and the disclaimer contained in paragraph 7 in the
# documentation and/or other materials provided with the distribution.
#
# 5. Redistributions in any form must be accompanied by information on how to
# obtain complete source code for the OpenPBS software and any
# modifications and/or additions to the OpenPBS software. The source code
# must either be included in the distribution or be available for no more
# than the cost of distribution plus a nominal fee, and all modifications
# and additions to the Software must be freely redistributable by any party
# (including Licensor) without restriction.
#
# 6. All advertising materials mentioning features or use of the Software must
# display the following acknowledgment:
#
# "This product includes software developed by NASA Ames Research Center,
# Lawrence Livermore National Laboratory, and Veridian Information
# Solutions, Inc.
# Visit www.OpenPBS.org for OpenPBS software support,
# products, and information."
#
# 7. DISCLAIMER OF WARRANTY
#
# THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. ANY EXPRESS
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT
# ARE EXPRESSLY DISCLAIMED.
#
# IN NO EVENT SHALL VERIDIAN CORPORATION, ITS AFFILIATED COMPANIES, OR THE
# U.S. GOVERNMENT OR ANY OF ITS AGENCIES BE LIABLE FOR ANY DIRECT OR 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.
#
# This license will be governed by the laws of the Commonwealth of Virginia,
# without reference to its choice of law rules.
#
#
# This is a simple script that generates a machine type name
# based on the output of uname. The generated name is in the
# style of old PBS machine names and thus a hand generated
# mapping needs to take place. If you port PBS to new architectures
# you should modify the lookup table. A better way would have been
# to name the machines in a more "standard" way but it would require
# a considerable amount of effort to find all the dependencies in
# the code and documentation.
#
# The big kluge is when we are on an AIX box to figure out whether or
# not we are running on an SP2. What we do is have the user set
# --enable-sp2 when configuring. Since this script is needed by configure
# we can't perform a substitution on it based on the output of configure.
# Thus the case of the sp2 will be handled by configure.
# All of this is rather cheesy as sp2, aix3, aix4, and aix5
# are logically overlapping.
#
OS=`uname -s | tr '[A-Z]' '[a-z]'`
REL=`uname -r`
VER=`uname -v 2> /dev/null`
test "$VER" = unicosmk && OS="$VER"
bad_rel=n
verbose=""; export verbose
test "$1" = "-v" && verbose=yes
case "$OS" in
sun*) case "$REL" in
4*) mach=sunos4 ;;
5.10) mach=solaris7 ;;
5.[0123456]*) mach=solaris5 ;;
5.*) mach=solaris7 ;;
*) bad_rel=y ;;
esac ;;
cm*) mach=cm5 ;;
#
# as usual, AIX is different...
#
aix*) REL=`uname -v`
case "$REL" in
3*) mach=aix3 ;;
4*) mach=aix4 ;;
5*) mach=aix5 ;;
*) bad_rel=y ;;
esac ;;
hp*) case "$REL" in
B.1[1-9].[1-9]*) mach=hpux11 ;;
*) mach=hpux10 ;;
esac ;;
irix*) case "$REL" in
5*) mach=irix5 ;;
6*) mach=irix6 ;;
*) bad_rel=y ;;
esac ;;
netbsd*) mach=netbsd ;;
freebsd*)
if [ `echo "$REL" | cut -f 1 -d .` -lt 5 ]; then
mach=freebsd
else
mach=freebsd5
fi
;;
darwin*) mach=darwin ;;
linux*) mach=linux ;;
cygwin*) mach=cygwin ;;
unicosmk*) mach=unicosmk2 ;;
gnu/kfreebsd) mach=freebsd5 ;;
gnu) mach=linux ;;
unicos*) mach=unicos8 ;;
sn*) if echo $OS | egrep '^sn[0-9]+$' > /dev/null ; then
mach=unicos8;
else
echo $0: the operating system \"$OS\" is unknown >&2 ;
echo unknown ;
exit 1 ;
fi;;
osf*) mach=digitalunix ;;
unix_system_v ) mach=fujitsu ;;
*) test -n "$verbose" && \
echo $0: the operating system \"$OS\" is unknown >&2 ;
echo unknown ;
exit 1 ;;
esac
if test "$bad_rel" = y; then
test -n "$verbose" && \
echo $0: for operating system \"$OS\", release \"$REL\" is unknown >&2
echo unknown
exit 2
fi
#
# an irix6array is a machine running irix6 with the array daemon
# configured to start at boot time. The whole concept of embedding
# the release number of the OS in the machine type is retarded.
#
IRIX_ARRAY_CONF=/etc/config/array
if test "$mach" = irix6; then
test -r "$IRIX_ARRAY_CONF" && \
test `cat "$IRIX_ARRAY_CONF"` = on && \
mach=irix6array
fi
echo $mach
exit 0
+517
View File
@@ -0,0 +1,517 @@
#!/bin/sh
#
#
# OpenPBS (Portable Batch System) v2.3 Software License
#
# Copyright (c) 1999-2000 Veridian Information Solutions, Inc.
# All rights reserved.
#
# ---------------------------------------------------------------------------
# For a license to use or redistribute the OpenPBS software under conditions
# other than those described below, or to purchase support for this software,
# please contact Veridian Systems, PBS Products Department ("Licensor") at:
#
# www.OpenPBS.org +1 650 967-4675 sales@OpenPBS.org
# 877 902-4PBS (US toll-free)
# ---------------------------------------------------------------------------
#
# This license covers use of the OpenPBS v2.3 software (the "Software") at
# your site or location, and, for certain users, redistribution of the
# Software to other sites and locations. Use and redistribution of
# OpenPBS v2.3 in source and binary forms, with or without modification,
# are permitted provided that all of the following conditions are met.
# After December 31, 2001, only conditions 3-6 must be met:
#
# 1. Commercial and/or non-commercial use of the Software is permitted
# provided a current software registration is on file at www.OpenPBS.org.
# If use of this software contributes to a publication, product, or
# service, proper attribution must be given; see www.OpenPBS.org/credit.html
#
# 2. Redistribution in any form is only permitted for non-commercial,
# non-profit purposes. There can be no charge for the Software or any
# software incorporating the Software. Further, there can be no
# expectation of revenue generated as a consequence of redistributing
# the Software.
#
# 3. Any Redistribution of source code must retain the above copyright notice
# and the acknowledgment contained in paragraph 6, this list of conditions
# and the disclaimer contained in paragraph 7.
#
# 4. Any Redistribution in binary form must reproduce the above copyright
# notice and the acknowledgment contained in paragraph 6, this list of
# conditions and the disclaimer contained in paragraph 7 in the
# documentation and/or other materials provided with the distribution.
#
# 5. Redistributions in any form must be accompanied by information on how to
# obtain complete source code for the OpenPBS software and any
# modifications and/or additions to the OpenPBS software. The source code
# must either be included in the distribution or be available for no more
# than the cost of distribution plus a nominal fee, and all modifications
# and additions to the Software must be freely redistributable by any party
# (including Licensor) without restriction.
#
# 6. All advertising materials mentioning features or use of the Software must
# display the following acknowledgment:
#
# "This product includes software developed by NASA Ames Research Center,
# Lawrence Livermore National Laboratory, and Veridian Information
# Solutions, Inc.
# Visit www.OpenPBS.org for OpenPBS software support,
# products, and information."
#
# 7. DISCLAIMER OF WARRANTY
#
# THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. ANY EXPRESS
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT
# ARE EXPRESSLY DISCLAIMED.
#
# IN NO EVENT SHALL VERIDIAN CORPORATION, ITS AFFILIATED COMPANIES, OR THE
# U.S. GOVERNMENT OR ANY OF ITS AGENCIES BE LIABLE FOR ANY DIRECT OR 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.
#
# This license will be governed by the laws of the Commonwealth of Virginia,
# without reference to its choice of law rules.
# pbs_mkdirs:
#
# This will make the various directories that are needed for PBS
# housekeeping.
#
# Usage:
# pbs_mkdirs [-v] [-c] [-C chk_tree_location] what
# -v be verbose
# -c allow usage of chk_tree (do not use this within a make install)
# -C Specify where the location of the chk_tree binary
# what select from the following list
# server -- dirs needed by pbs_server
# mom -- dirs needed by pbs_mom
# aux -- the aux directory
# default -- the default file
# common -- make common directory to all daemons
# check -- run chk_tree (turns on -c automatically)
# all -- do all of the above
#
# SVN INFO:
# $Id$
#
#
# check tree should not be called until it is installed since
# only relative paths are used by autoconf.
#
prefix=@prefix@
exec_prefix=@exec_prefix@
CHK_TREE=${DESTDIR}@bindir@/chk_tree
PBS_DEFAULT_SERVER=@PBS_DEFAULT_SERVER@
PBS_LIB_PATH=@prefix@/lib
PBS_LOAD_LIB_DIR=/etc/ld.so.conf.d
PBS_LOAD_LIB_FILE=/etc/ld.so.conf.d/libtorque.conf
HAVE_LOAD_LIB_FILE=@have_loadlibfile@
# PBS_SERVER_HOME is defined without DESTDIR so that DEFAULT_FILE and EVIRON
# can be based on SERVER_HOME. SERVER_HOME is defined a second time to pick
# up DESTDIR
test -n "$PBS_SERVER_HOME" || PBS_SERVER_HOME=@PBS_SERVER_HOME@
test -n "$PBS_DEFAULT_FILE" || PBS_DEFAULT_FILE=${DESTDIR}@PBS_DEFAULT_FILE@
test -n "$PBS_ENVIRON" || PBS_ENVIRON=${DESTDIR}@PBS_ENVIRON@
PBS_SERVER_HOME=${DESTDIR}$PBS_SERVER_HOME
PBS_NODES_FILE=$PBS_SERVER_HOME/server_priv/nodes
if test @PBS_MACH@ = cygwin; then
# AUX is reserved word in Windows
AUX_PATH=auxx
else
AUX_PATH=aux
fi
verbose=""
display_flags()
{
cat << EOF
Usage:
pbs_mkdirs [-v] [-c] [-C chk_tree_location] what
-v be verbose
-c allow usage of chk_tree (do not use this within a make install)
-C Specify where the location of the chk_tree binary
what select from the following list
server -- dirs needed by pbs_server
mom -- dirs needed by pbs_mom
aux -- the aux directory
default -- the default file
common -- make common directory to all daemons
check -- run chk_tree (turns on -c automatically)
all -- do all of the above
EOF
exit 0
}
#
# this will create a directory and any chain of parent directories
# that might be needed
# All of this is somewhat lame because install-sh is used
# along with install_dir in various places.
#
install_dir()
{
# use the id_ for namespace disambiguation
id_dname="$1"
id_mode=`test -n "$2" && echo "$2" || echo 755`
# dlist will contain a list of directory names to make
id_dlist=""
while [ ! \( -z "$id_dname" -o "$id_dname" = / -o \
"$id_dname" = "." \) ]; do
test -f $id_dname && return 1
test -d $id_dname && break
id_dlist="`basename $id_dname` $id_dlist"
id_dname=`dirname "$id_dname"`
done
id_dir="$id_dname"
for id_d in $id_dlist ""; do
id_dir="$id_dir/$id_d"
test -z "$id_d" && return 0
mkdir $id_dir && chmod $id_mode $id_dir || return 1
done
return 0
}
#
# This will take the name of the variable (not value) and
# make a directory. This is just to stick with the original
# way things were done in the top-level make file in PBS
#
install_dir_by_varname()
{
idv_dvarname="$1"
idv_dname=`eval 'echo $'$idv_dvarname`
idv_mode=`test -n "$2" && echo "$2" || echo 755`
if [ X$idv_dname = X ] ; then
echo $idv_dvarname is not defined 1>&2
return 1
elif [ -f $idv_dname ] ; then
echo $idv_dvarname exists and is not a directory 1>&2
return 1
elif [ -d $idv_dname ] ; then
chmod $idv_mode $idv_dname || return 1
return 0
elif [ ! -d $idv_dname ] ; then
test -n "$verbose" && echo Creating $idv_dname
install_dir `dirname $idv_dname` 755 && \
mkdir $idv_dname && chmod $idv_mode $idv_dname || return 1
fi
return 0
}
check_env()
{
test -n "$verbose" && echo Making environment file
if [ ! -f $PBS_ENVIRON ] ; then
install_dir `dirname $PBS_ENVIRON` || return 1
echo "PATH=/bin:/usr/bin" > $PBS_ENVIRON || return 1
if [ X$TZ != X ] ; then
echo "TZ=$TZ" >> $PBS_ENVIRON || return 1
fi
if [ X$LANG != X ] ; then
echo "LANG=$LANG" >> $PBS_ENVIRON || return 1
fi
if [ X$LC_ALL != X ] ; then
echo "LC_ALL=$LC_ALL" >> $PBS_ENVIRON || return 1
fi
if [ X$LC_COLLATE != X ] ; then
echo "LC_COLLATE=$LC_COLLATE" >> $PBS_ENVIRON || return 1
fi
if [ X$LC_CTYPE != X ] ; then
echo "LC_CTYPE=$LC_CTYPE" >> $PBS_ENVIRON || return 1
fi
if [ X$LC_MONETARY != X ] ; then
echo "LC_MONETARY=$LC_MONETARY" >> $PBS_ENVIRON || return 1
fi
if [ X$LC_NUMERIC != X ] ; then
echo "LC_NUMERIC=$LC_NUMERIC" >> $PBS_ENVIRON || return 1
fi
if [ X$LC_TIME != X ] ; then
echo "LC_TIME=$LC_TIME" >> $PBS_ENVIRON || return 1
fi
chmod 644 $PBS_ENVIRON || return 1
fi
}
chk_tree_wrap()
{
if test -n "$chktree";then
$CHK_TREE $* || return 1
fi
}
mk_server_dirs()
{
test -n "$verbose" && echo Creating Directories required for the Server
install_dir_by_varname PBS_SERVER_HOME 755 || return 1
install_dir $PBS_SERVER_HOME/spool 1777 || return 1
install_dir $PBS_SERVER_HOME/checkpoint 1777 || return 1
install_dir $PBS_SERVER_HOME/server_priv 750 || return 1
install_dir $PBS_SERVER_HOME/server_priv/jobs 750 || return 1
# make the numbered directories (used if use_jobs_subdirs server parameter set)
for i in {0..9}; do
install_dir $PBS_SERVER_HOME/server_priv/jobs/$i 750 || return 1
done
install_dir $PBS_SERVER_HOME/server_priv/hostlist 750 || return 1
install_dir $PBS_SERVER_HOME/server_priv/queues 750 || return 1
install_dir $PBS_SERVER_HOME/server_priv/acl_svr 750 || return 1
install_dir $PBS_SERVER_HOME/server_priv/acl_hosts 750 || return 1
install_dir $PBS_SERVER_HOME/server_priv/acl_users 750 || return 1
install_dir $PBS_SERVER_HOME/server_priv/acl_groups 750 || return 1
install_dir $PBS_SERVER_HOME/server_priv/disallowed_types 750 || return 1
install_dir $PBS_SERVER_HOME/server_priv/accounting 755 || return 1
install_dir $PBS_SERVER_HOME/job_logs 755 || return 1
install_dir $PBS_SERVER_HOME/server_logs 755 || return 1
install_dir $PBS_SERVER_HOME/sched_priv 750 || return 1
install_dir $PBS_SERVER_HOME/sched_priv/accounting 755 || return 1
install_dir $PBS_SERVER_HOME/sched_logs 755 || return 1
install_dir $PBS_SERVER_HOME/server_priv/arrays 750 || return 1
# make the numbered directories (used if use_jobs_subdirs server parameter set)
for i in {0..9}; do
install_dir $PBS_SERVER_HOME/server_priv/arrays/$i 750 || return 1
done
install_dir $PBS_SERVER_HOME/server_priv/credentials 750 || return 1
test -f $PBS_ENVIRON || check_env || return 1
chk_tree_wrap -d -n $PBS_SERVER_HOME/server_priv/jobs \
$PBS_SERVER_HOME/server_priv/hostlist \
$PBS_SERVER_HOME/server_priv/queues \
$PBS_SERVER_HOME/server_priv/acl_svr \
$PBS_SERVER_HOME/server_priv/acl_hosts \
$PBS_SERVER_HOME/server_priv/acl_users \
$PBS_SERVER_HOME/server_priv/acl_groups \
$PBS_SERVER_HOME/server_priv/accounting \
$PBS_SERVER_HOME/job_logs \
$PBS_SERVER_HOME/server_logs \
$PBS_SERVER_HOME/server_priv/arrays \
$PBS_SERVER_HOME/server_priv/credentials || return 1
chk_tree_wrap -d -n -s $PBS_SERVER_HOME/spool || return 1
chk_tree_wrap -n $PBS_ENVIRON || return 1
test -n "$verbose" && echo "Making default nodes file"
# Add an empty nodes file with a brief example
# and a link to more information in the documentation
if [ ! -e $PBS_NODES_FILE ]; then
rm -f $PBS_NODES_FILE > /dev/null 2>&1
echo -e "## This is the TORQUE server \"nodes\" file." \
"\n## \n## To add a node, enter its hostname, optional processor count (np=)," \
"\n## and optional feature names.\n##" \
"\n## Example:\n## host01 np=8 featureA featureB" \
"\n## host02 np=8 featureA featureB\n##" \
"\n## for more information, please visit:\n##" \
"\n## http://www.adaptivecomputing.com/resources/docs/\n" > $PBS_NODES_FILE && \
chmod 644 $PBS_NODES_FILE || return 1
fi
}
mk_mom_dirs()
{
test -n "$verbose" && echo Creating Directories required for MOM
install_dir_by_varname PBS_SERVER_HOME 755 || return 1
test -d $PBS_SERVER_HOME/spool || \
install_dir $PBS_SERVER_HOME/spool 1777 || return 1
install_dir $PBS_SERVER_HOME/checkpoint 1777 || return 1
install_dir $PBS_SERVER_HOME/undelivered 1777 || return 1
install_dir $PBS_SERVER_HOME/mom_priv 751 || return 1
install_dir $PBS_SERVER_HOME/mom_priv/jobs 751 || return 1
install_dir $PBS_SERVER_HOME/mom_logs 755 || return 1
mk_default_file || return 1
test -f $PBS_ENVIRON || check_env || return 1
chk_tree_wrap -d -n $PBS_SERVER_HOME/checkpoint \
$PBS_SERVER_HOME/mom_priv/jobs \
$PBS_SERVER_HOME/mom_logs || return 1
chk_tree_wrap -d -n -s $PBS_SERVER_HOME/spool \
$PBS_SERVER_HOME/undelivered || return 1
chk_tree_wrap -n $PBS_ENVIRON || return 1
}
mk_default_ld_lib_file()
{
echo "loadlibfile = $HAVE_LOAD_LIB_FILE"
test -n "$verbose" && echo "loadlibfile = $HAVE_LOAD_LIB_FILE"
if [ "$HAVE_LOAD_LIB_FILE" = "yes" ]; then
test -n "$verbose" && echo Making libtorque.conf
if [ ! -d $PBS_LOAD_LIB_DIR ]; then
echo $PBS_LOAD_LIB_DIR missing
else
echo $PBS_LIB_PATH > $PBS_LOAD_LIB_FILE && \
chmod 644 $PBS_LOAD_LIB_FILE || return 1
chk_tree_wrap -n $PBS_LOAD_LIB_FILE || return 1
fi
fi
}
mk_default_file()
{
test -n "$verbose" && echo Making default server file
install_dir `dirname $PBS_DEFAULT_FILE` || return 1
# I think I know better than pbs. --pw
if [ ! -e $PBS_DEFAULT_FILE ]; then
rm -f $PBS_DEFAULT_FILE > /dev/null 2>&1
echo $PBS_DEFAULT_SERVER > $PBS_DEFAULT_FILE && \
chmod 644 $PBS_DEFAULT_FILE || return 1
fi
mk_default_ld_lib_file || return 1
chk_tree_wrap -n $PBS_DEFAULT_FILE || return 1
}
mk_common()
{
echo $PBS_LIB_PATH > $PBS_LOAD_LIB_FILE
$ECHO "$PBS_LOAD_LIB_FILE"
mk_default_file || return 1
mk_ld_lib_file
mk_aux_dir || return 1
install_dir $PBS_SERVER_HOME/spool 1777 || return 1
check_env || return 1
}
mk_aux_dir()
{
install_dir $PBS_SERVER_HOME/$AUX_PATH 755 || return 1
chk_tree_wrap -d -n $PBS_SERVER_HOME/$AUX_PATH || return 1
}
do_check_tree()
{
chk_tree_wrap -d $PBS_SERVER_HOME/server_priv/jobs \
$PBS_SERVER_HOME/server_priv/queues \
$PBS_SERVER_HOME/server_priv/acl_svr \
$PBS_SERVER_HOME/server_priv/acl_hosts \
$PBS_SERVER_HOME/server_priv/acl_users \
$PBS_SERVER_HOME/server_priv/acl_groups \
$PBS_SERVER_HOME/server_priv/accounting \
$PBS_SERVER_HOME/job_logs || return 1
$PBS_SERVER_HOME/server_logs || return 1
chk_tree_wrap -d $PBS_SERVER_HOME/checkpoint \
$PBS_SERVER_HOME/mom_priv/jobs \
$PBS_SERVER_HOME/mom_logs || return 1
chk_tree_wrap -d -s $PBS_SERVER_HOME/spool \
$PBS_SERVER_HOME/undelivered || return 1
chk_tree_wrap -d $PBS_SERVER_HOME/$AUX_PATH || return 1
chk_tree_wrap $PBS_DEFAULT_FILE || return 1
}
# mk_dirs() will generate the set of directories needed
# for server and mom execution.
mk_dirs()
{
chktree=yes
mk_server_dirs || return 1
mk_mom_dirs || return 1
mk_default_file || return 1
mk_aux_dir || return 1
}
getopt vcd:C:h "$@" > /dev/null || display_flags
set -- `getopt vcd:C:h "$@"`
while true
do
case "$1" in
-v)
verbose=yes
shift
;;
-d)
PBS_SERVER_HOME=$2
shift 2
;;
-h)
display_flags
;;
-c)
chktree=yes
shift
;;
-C)
CHK_TREE=$2
shift 2
;;
--)
shift; break
;;
esac
done
while [ $# -gt 0 ]
do
case "$1" in
serv*)
mk_server_dirs || exit 1
break
;;
mom*)
mk_mom_dirs || exit 1
break
;;
aux*)
mk_aux_dir || exit 1
break
;;
default*)
mk_default_file || exit 1
break
;;
common*)
mk_common || exit 1
break
;;
check*)
chktree=yes
do_check_tree || exit 1
break
;;
all*)
mk_dirs || exit 1
break
;;
*)
echo "$1 is unknown flag"
display_flags
break
;;
esac
shift
done
+178
View File
@@ -0,0 +1,178 @@
#!/bin/sh
# self-extracting distribution packages
PBS_SERVER_HOME=@PBS_SERVER_HOME@
PBS_DEFAULT_FILE=@PBS_DEFAULT_FILE@
PBS_ENVIRON=@PBS_ENVIRON@
export PBS_SERVER_HOME PBS_DEFAULT_FILE PBS_ENVIRON
prefix=@prefix@
exec_prefix=@exec_prefix@
XPBS_DIR=@libdir@/xpbs
XPBSMON_DIR=@libdir@/xpbsmon
libdir=@libdir@
bindir=@bindir@
sbindir=@sbindir@
program_prefix=@program_prefix@
program_suffix=@program_suffix@
export XPBS_DIR XPBSMON_DIR
conffiles="$PBS_SERVER_HOME/sched_priv/sched_config
$PBS_SERVER_HOME/sched_priv/resource_group
$PBS_SERVER_HOME/sched_priv/holidays
$PBS_SERVER_HOME/sched_priv/dedicated_time
$PBS_ENVIRON
$PBS_DEFAULT_FILE
$PBS_SERVER_HOME/server_priv/nodes"
saveext=save.$$
SKIP=`awk '/^__ARCHIVE_FOLLOWS__/ { print NR + 1; exit 0; }' $0`
# set package defaults
install=0
listfiles=0
extract=0
user=0
group=0
chownfiles=1
saveconfs=1
destdir=/
verbose=0
postscript=1
vopt=""
usage() {
cat <<__EOF__
$0: [--install] [--listfiles] [--extractfiles]
[--destdir dir] [--nochown] [--overwriteconf]
[--instuser user] [--instgroup group] [--verbose]
[--nopostscript]
Usually just use --install
__EOF__
}
# parse command line args
while test $# -gt 0 ;do
case $1 in
--install|-i) install=1;;
--listfiles|-l) listfiles=1;;
--extractfiles|-e) extract=1;;
--destdir|-d) shift; destdir=$1/;;
--nochown) chownfiles=0;;
--overwriteconf) saveconfs=0;;
--instuser) shift; user=$1;;
--instgroup) shift; group=$1;;
--nopostscript) postscript=0;;
--verbose) verbose=1; vopt="v";;
*) usage; exit 1;;
esac
shift
done
# user didn't specify an action
if test $extract -lt 1 -a $listfiles -lt 1 -a $install -lt 1;then
usage
exit 1
fi
# make sure any leading directories are created with world-readable perms
umask 022
#
# start doing real work
#
# extract the files in the tarball
if test $extract -gt 0;then
# be sure to respect $destdir
test $destdir = / && destdir=.
if test -d $destdir;then
echo "Extracting files into $destdir..."
else
echo "Unable to extract files: $destdir is not a directory" 1>&2
exit 1
fi
sed -n $SKIP,\$p $0 | gzip -dc | (cd $destdir; tar x${vopt}f -)
echo "Done."
fi
# just list the files in the tarball
if test $listfiles -gt 0;then
sed -n $SKIP,\$p $0 | gzip -dc | tar t${vopt}f -
fi
# install the tarball
if test $install -gt 0;then
if test -d $destdir;then
echo ""
echo "Installing TORQUE archive... "
echo ""
else
echo "Unable to install archive: $destdir is not a directory" 1>&2
exit 1
fi
# save any existing conf files
if test $saveconfs -gt 0;then
for a in $conffiles;do
test -f $destdir$a && mv -f$vopt $destdir$a $destdir$a.$saveext
done
fi
# take the archive portion of this file and pipe it to tar
sed -n $SKIP,\$p $0 | gzip -dc | (cd $destdir; tar x${vopt}f - )
# finalized files should be owned by root, not the package-builder
if test $chownfiles -gt 0;then
test $verbose -gt 0 && echo "setting file user and group ownerships"
sed -n $SKIP,\$p $0 | gzip -dc | tar tf - | \
while read line; do
chown $user $destdir$line; chgrp $group $destdir$line
case $line in
*$sbindir/${program_prefix}pbs_iff${program_suffix})
chmod u+s $destdir$sbindir/${program_prefix}pbs_iff${program_suffix};;
*$bindir/${program_prefix}pbs_rcp${program_suffix})
chmod u+s $destdir$bindir/${program_prefix}pbs_rcp${program_suffix};;
*$PBS_SERVER_HOME/spool)
chmod 1777 $destdir$PBS_SERVER_HOME/spool;;
esac
done
fi
# see if we need to do an ldconfig
sed -n $SKIP,\$p $0 | gzip -dc | tar tf - | \
(do_ldconfig=0; while read line; do
case $line in
*/etc/ld.so.conf.d/torque.conf)
do_ldconfig=1;;
esac
done; test $do_ldconfig -gt 0 && /sbin/ldconfig)
# restore the original conf files
if test $saveconfs -gt 0;then
for a in $conffiles;do
test -f $destdir$a -a -f $destdir$a.$saveext && mv -f$vopt $destdir$a $destdir$a.new;
test -f $destdir$a.$saveext && mv -f$vopt $destdir$a.$saveext $destdir$a
done
fi
# run user-specified post-install script
if test -f ${destdir}post-install;then
if test $postscript -gt 0;then
test $verbose -gt 0 && echo "Running ${destdir}post-install..."
( cd $destdir && ./post-install && rm -f ./post-install )
else
echo "Skipping ${destdir}post-install"
fi
fi
echo "Done."
fi
exit 0
__ARCHIVE_FOLLOWS__
+68
View File
@@ -0,0 +1,68 @@
#!/bin/sh
if [ -z "${1}" -o "${1}" = '-h' -o "${1}" = '--help' ]
then
echo "Usage: snapshot-version <new-version>" >&2
exit 1
fi
if [ ! -s "${PWD}/application.properties" -o \
! -d "${PWD}/build" ] || \
! grep -q -E 'app\.name[[:blank:]]*=[[:blank:]]*mws' \
"${PWD}/application.properties"
then
echo "It appears that the present working directory" >&2
echo " '${PWD}' doesn't describe the root source" >&2
echo " path." >&2
echo " This script must be run from the root souce path." >&2
exit 1
fi
if [ -n "`git status --porcelain`" ]
then
echo "It appears that the working directory is not clean." >&2
echo " cannot continue." >&2
exit 1
fi
current_version="`build/determine-version`"
echo "This script will cause additional commits to be made."
printf "continue [y/N]? "
read answer
echo ""
if ! echo "${answer}" | grep -i -q '^y'
then
echo "You have not answered yes."
echo "Exiting."
exit 0
fi
set -x
git add application.properties || :
ed application.properties << ED
/app\.version
s@${current_version}@${1}@
wq
ED
git commit -a -m "Snapshot version at '${1}' from '${current_version}'"
git tag -a "${1}" -m "Snapshot version at '${1}' from '${current_version}'"
ed application.properties << ED
/app\.version
s@${1}@${current_version}@
wq
ED
git commit -a -m "Restore version from '${1}' to '${current_version}'"
set +x
echo "Successfully taken snapshot with version '${1}'."
echo "To look at what was done, run:"
echo " git log -3"
echo " git tag -l | grep '${1}'"
echo "If you like the changes, run:"
echo " git pull --rebase"
echo " git push"
echo " git push --tag"
echo "If you don't like the changes, run:"
echo " git reset --hard HEAD^^"
echo " git tag -d '${1}'"
+359
View File
@@ -0,0 +1,359 @@
#!/bin/bash
POSIXLY_CORRECT=1
# If there are any errors at all, fail.
set -e
usage() {
echo "Usage: torque-build [<options>]"
echo " Where <options> can be one of:"
echo " -h|--help Print this help page"
echo " -r|--root-path <path> Root path of the MOAB source code"
echo " (default is the current"
echo " directory)"
echo " -d|--debug Enable debug mode"
echo " -q|--quiet Enable quiet mode"
echo " -p|--hwloc-path <path> Path to the hwloc package (required by cgroups)"
echo " (default is /usr/local)"
echo " -v|--verbose Enable verbose mode"
echo
echo " -t|--tarball Make the TORQUE distribution tarball"
echo " -T|--no-tarball Do not make the TORQUE distribution tarball"
echo " (takes precedent over quiet mode)"
echo " -a|--adaptive-rpm Make the adaptive RPM (default)"
echo " -A|--no-adaptive-rpm Do not make the adaptive RPM"
echo ""
echo " -c|--coverity <cov-build> Run coverity using the <cov-build>"
echo " script (e.g.,"
echo " /opt/coverity/default/bin/cov-build)"
echo " -C|--no-coverity Do not run coverity (default)"
echo ""
echo " -g|--enable-cgroups Enable cgroups (default)"
echo " -G|--disable-cgroups Do not enable cgroups"
echo " -u|--unit-tests Run unit-tests (default)"
echo " -U|--no-unit-tests Do not run unit tests"
echo ""
echo " -j <number> Passes '-j <number>' to make"
echo " ('3' by default)"
exit 1
}
# Default values for options
root_path="${PWD}"
verbose=0
debug=0
quiet=0
adaptive_rpm=1
coverity=0
unit_tests=1
parallel=3
tarball=1
cgroups=1
hwloc_path=/usr/local
configure_options=""
# To be set later
version=
release=
cov_build=
while [ -n "${1}" ]
do
case "${1}" in
-h|--help)
usage
;;
-r|--root-path)
shift
root_path="${1}"
shift
;;
-p|--hwloc-path)
shift
hwloc_path="${1}"
shift
;;
-n|--name-suffix)
shift
name_suffix="${1}"
shift
;;
-d|--debug)
debug=1
verbose=1
shift
;;
-q|--quiet)
quiet=1
shift
;;
-v|--verbose)
verbose=1
shift
;;
-a|--adaptive-rpm)
adaptive_rpm=1
shift
;;
-A|--no-adaptive-rpm)
adaptive_rpm=0
shift
;;
-t|--tarball)
tarball=1
shift
;;
-T|--no-tarball)
tarball=0
shift
;;
-c|--coverity)
coverity=1
shift
cov_build="${1}"
shift
;;
-C|--no-coverity)
coverity=0
shift
;;
-u|--unit-tests)
unit_tests=1
shift
;;
-U|--no-unit-tests)
unit_tests=0
shift
;;
-j)
shift
parallel="${1}"
shift
;;
-g|--enable-cgroups)
cgroups=1
shift
;;
-G|--disable-cgroups)
cgroups=0
with_option="$with_option --without cgroups --without hwloc"
shift
;;
*)
echo "Invalid argument '${1}' specified." >&2
usage
;;
esac
done
# Argument processing
if [ ${tarball} -eq 0 -a \
${adaptive_rpm} -eq 0 -a \
${coverity} -eq 0 -a \
${unit_tests} -eq 0 ]
then
echo "No artifacts or tests were requested." >&2
usage
fi
# Root path needs to be an absolute path
if ! echo "${root_path}" | grep -q -E '^(/[^/]*)+$'
then
root_path="${PWD}/${root_path}"
fi
if echo "${root_path}" | grep -q -E '^/+$'
then
echo "The root path to the source code must not be '/'." >&2
usage
fi
if [ ! -s "${root_path}/configure.ac" -o ! -d "${root_path}/buildutils" ] || \
! grep -q -E 'AC_INIT[[:blank:]]*\([[:blank:]]*\[torque\]' \
"${root_path}/configure.ac"
then
echo "It appears that '${root_path}' doesn't describe the root source" >&2
echo " path for TORQUE." >&2
usage
fi
cd "${root_path}"
if [ ${verbose} -ne 0 ]
then
set -x
fi
if [ ${verbose} -ne 0 ]
then
quiet=0
fi
quiet_redirect=""
if [ ${quiet} -ne 0 ]
then
quiet_redirect=">/dev/null"
fi
if ! echo "${parallel}" | grep -q -E '^[[:digit:]]+$'
then
echo "Argument provided to the '-j' option must be a number." >&2
usage
fi
epoch=`date +%s`
print_build_date="`date --date="@$epoch"`"
branch=`git branch | awk '/^[*]/ { print $2}'`
version=`buildutils/determine.version`
release=`buildutils/determine.release`
distro=`buildutils/determine.distro -c`
if [ -z "${version}" ]
then
echo "A <version> could not be found." >&2
echo " Perhaps this is not a TORQUE repository?" >&2
usage
fi
if [ "${release}" = "_" ]
then
echo "Something went wrong in creating the release number." >&2
usage
fi
echo "Started ${0}, version ${version}, release ${release}." \
${quiet_redirect}
if [ $cgroups -ne 0 ]
then
cgroupsopts="--enable-cgroups"
configure_options="$configure_options --enable-cgroups --with-hwloc-path=$hwloc_path"
else
hwloc_path=none
cgroupsopts="--disable-cgroups"
fi
# set so child makefiles know this
export FROM_TORQUE_BUILD=1
echo $(git rev-parse HEAD) > current_hash
sh autogen.sh
./configure $configure_options
if [ ${coverity} -ne 0 -o ${unit_tests} -ne 0 ]
then
./configure --with-debug --with-check
make -j${parallel} clean || :
fi
if [ ${coverity} -ne 0 ]
then
if [ ! -x "${cov_build}" ]
then
echo "'${cov_build}' is not a valid script." >&2
usage
fi
"${cov_build}" --dir cov-int make
fi
if [ ${unit_tests} -ne 0 ]
then
make -j${parallel}
chmod +x src/test/test_scripts/*
make check
make check | ./parse_cov_results.py
fi
if [[ ${version} =~ ^[0-9]+\.[0-9]+((\.[0-9]+)*\.?(a|b|r?c)[0-9]+|(\.[0-9]+)+(\.h[0-9]+)?)$ ]]
then
package_version="${version}"
release=1
else
package_version="${version}-${release}"
fi
distdir="torque-${package_version}"
if [ ${tarball} -ne 0 ]
then
make -j${parallel} clean
make -j${parallel} distclean
sh autogen.sh
./configure $configure_options
make distcheck -j${parallel} distdir="${distdir}"
fi
# TORQUE RPMs ##################################################################
if [ ${adaptive_rpm} -ne 0 ]
then
# blow away old build stuff
rm -rf buildutils/rpmbuild
mkdir -p buildutils/rpmbuild/tmp
chmod a+rwxt buildutils/rpmbuild/tmp
mkdir -p buildutils/rpmbuild/BUILD
mkdir -p buildutils/rpmbuild/SOURCES
mkdir -p buildutils/rpmbuild/SPECS
mkdir -p buildutils/rpmbuild/RPMS/{i386,i686,noarch,x86_64}
# ignore SP version suffix for SLES12
echo "${distro}" | fgrep -q sles12. && distro=sles12
if [ "${distro}" = el7 ]; then
cp buildutils/torque.adaptive.spec.el7 \
buildutils/rpmbuild/SPECS/torque.adaptive.spec
elif [ "${distro}" = el6 ]; then
cp buildutils/torque.adaptive.spec.el6 \
buildutils/rpmbuild/SPECS/torque.adaptive.spec
elif [ "${distro}" = sles12 ]; then
cp buildutils/torque.adaptive.spec.sles12 \
buildutils/rpmbuild/SPECS/torque.adaptive.spec
else
echo "RPM building not supported for distro $distro" >&2
exit 1
fi
source_file=${distdir}.tar.gz
if [ ! -s "${source_file}" ]
then
echo "TORQUE tarball '${source_file}' not found!" >&2
exit 1
fi
cp -f "${source_file}" buildutils/rpmbuild/SOURCES
verbose_option=
if [ ${debug} -ne 0 ]
then
verbose_option="-vv"
elif [ ${quiet} -ne 0 ]
then
verbose_option="--quiet"
elif [ ${verbose} -ne 0 ]
then
verbose_option="-v"
else
verbose_option=""
fi
rpmbuild_option="-ba"
test ${quiet} -eq 0 && echo "Making adaptive rpm..."
mkdir -p buildutils/rpmbuild/moab-workload-manager-${version}
rpmbuild ${verbose_option} ${rpmbuild_option} ${with_option} \
buildutils/rpmbuild/SPECS/torque.adaptive.spec \
--buildroot "%{_topdir}/moab-torque${version}" \
--define "_topdir ${root_path}/buildutils/rpmbuild" \
--define "_rpmdir ${root_path}/buildutils/rpmbuild/RPMS" \
--define "_sourcedir ${root_path}/buildutils/rpmbuild/SOURCES" \
--define "_specdir ${root_path}/buildutils/rpmbuild/SPECS" \
--define "_tmppath ${root_path}/buildutils/rpmbuild/tmp" \
--define "_hwlocpath $hwloc_path" \
--define "_cgroupsopt ${cgroupsopts}" \
--define "version ${version}" \
--define "release ${release}.${distro}" \
--define "source_file ${source_file}" \
--define "base_name ${distdir}"
fi
File diff suppressed because it is too large Load Diff
+993
View File
@@ -0,0 +1,993 @@
# since this spec file is 'pristine' (not requiring the use of configure, etc),
# it uses macros defined by the user to build correctly.
# Example of suggested build command:
# rpmbuild -ba --define "version 4.2.0" --define "release 48"
%{!?version:%{error:%%version not defined.}}
%{!?release:%{error:%%release not defined.}}
# Autoconf variables
# These are set in /usr/lib/rpm/macros, but are explicitly defined here
# For consistency between distributions.
%define _prefix /usr/local
%define _exec_prefix %{_prefix}
%define _bindir %{_exec_prefix}/bin
%define _sbindir %{_exec_prefix}/sbin
%define _libexecdir %{_exec_prefix}/libexec
%define _datadir %{_prefix}/share
%define _sysconfdir %{_prefix}/etc
%define _sharedstatedir %{_prefix}/com
%define _localstatedir %{_prefix}/var
%define _lib lib
%define _libdir %{_exec_prefix}/%{_lib}
%define _includedir %{_prefix}/include
%define _oldincludedir /usr/include
%define _infodir %{_prefix}/info
%define _mandir %{_prefix}/man
%define _unitdir %{_sysconfdir}/usr/lib/systemd/system
# Autoconf variables, which are not set in /usr/lib/rpm/macros.
# Set according to the standard found here:
# http://www.gnu.org/prep/standards/html_node/Directory-Variables.html
%define _man1dir %{_mandir}/man1
%define _man2dir %{_mandir}/man2
%define _lispdir %{_datarootdir}/emacs/site-lisp
%define _logdir %{_localstatedir}/log
%define _datarootdir %{_prefix}/share
%define _oldincludedir /usr/include
%define _localedir %{_datarootdir}/locale
%define _docdir %{_datarootdir}/doc
%define _htmldir %{_docdir}
%define _dvidir %{_docdir}
%define _pdfdir %{_docdir}
%define _psdir %{_docdir}
# Not standard, but useful.
%define pkg_doc_dir %{_docdir}/%{name}-%{version}
# Autoconf variables supported in Adaptive's build environment
# (Some products use homedir, TORQUE uses spool,appstate, and homedir)
# The latter three are intended to follow the Linux FHS standard.
%define _man3dir %{_mandir}/man3
%define _homedir %{_prefix}
%define _spooldir %{_localstatedir}/spool
%define _cachedir %{_localstatedir}/cache
%define _appstatedir %{_localstatedir}/lib
# Nice error message if some macro is undefined.
%define macro_undefined_error() \
%{error:%{?1:%{1}}%{!?1:macro} is not defined.}
%define _configure ./configure
%define configure \
unset CONFFLAGS \
CONFFLAGS_FILE=`mktemp %{_tmppath}/confflags.XXXX` \
./configure --help 2>&1 > ${CONFFLAGS_FILE} \
if test %{_hwlocpath} != none \
then \
if grep -q -- '--with-hwloc-path' "${CONFFLAGS_FILE}" \
then \
CONFFLAGS='--with-hwloc-path=%{_hwlocpath}' \
fi \
fi \
if grep -q -- '--enable-cgroups' "${CONFFLAGS_FILE}" \
then \
CONFFLAGS="${CONFFLAGS} %{_cgroupsopt}" \
fi \
if grep -q -- '--oldincludedir' "${CONFFLAGS_FILE}" \
then \
CONFFLAGS="${CONFFLAGS} --oldincludedir=%{_oldincludedir}" \
fi \
if grep -q -- '--datarootdir' ${CONFFLAGS_FILE} \
then \
CONFFLAGS="${CONFFLAGS} --datarootdir=%{_datarootdir}" \
fi \
if grep -q -- '--localedir' ${CONFFLAGS_FILE} \
then \
CONFFLAGS="${CONFFLAGS} --localedir=%{_localedir}" \
fi \
if grep -q -- '--docdir' ${CONFFLAGS_FILE} \
then \
CONFFLAGS="${CONFFLAGS} --docdir=%{_docdir}" \
fi \
if grep -q -- '--htmldir' ${CONFFLAGS_FILE} \
then \
CONFFLAGS="${CONFFLAGS} --htmldir=%{_htmldir}" \
fi \
if grep -q -- '--dvidir' ${CONFFLAGS_FILE} \
then \
CONFFLAGS="${CONFFLAGS} --dvidir=%{_dvidir}" \
fi \
if grep -q -- '--pdfdir' ${CONFFLAGS_FILE} \
then \
CONFFLAGS="${CONFFLAGS} --pdfdir=%{_pdfdir}" \
fi \
if grep -q -- '--psdir' ${CONFFLAGS_FILE} \
then \
CONFFLAGS="${CONFFLAGS} --psdir=%{_psdir}" \
fi \
if grep -q -- '--homedir' ${CONFFLAGS_FILE} \
then \
CONFFLAGS="${CONFFLAGS} --homedir=%{_homedir}" \
fi \
if grep -q -- '--spooldir' ${CONFFLAGS_FILE} \
then \
CONFFLAGS="${CONFFLAGS} --spooldir=%{_spooldir}" \
fi \
if grep -q -- '--cachedir' ${CONFFLAGS_FILE} \
then \
CONFFLAGS="${CONFFLAGS} --cachedir=%{_cachedir}" \
fi \
if grep -q -- '--appstatedir' ${CONFFLAGS_FILE} \
then \
CONFFLAGS="${CONFFLAGS} --appstatedir=%{_appstatedir}" \
fi \
if grep -q -- '--logdir' ${CONFFLAGS_FILE} \
then \
CONFFLAGS="${CONFFLAGS} --logdir=%{_logdir}" \
fi \
if grep -q -- '--lispdir' ${CONFFLAGS_FILE} \
then \
CONFFLAGS="${CONFFLAGS} --lispdir=%{_lispdir}" \
fi \
if grep -q -- '--man1dir' ${CONFFLAGS_FILE} \
then \
CONFFLAGS="${CONFFLAGS} --man1dir=%{_man1dir}" \
fi \
if grep -q -- '--man2dir' ${CONFFLAGS_FILE} \
then \
CONFFLAGS="${CONFFLAGS} --man2dir=%{_man2dir}" \
fi \
if grep -q -- '--unitdir' ${CONFFLAGS_FILE} \
then \
CONFFLAGS="${CONFFLAGS} --unitdir=%{_unitdir}" \
fi \
CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \
CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \
FFLAGS="${FFLAGS:-%optflags}" ; export FFLAGS ; \
%{_configure} --host=%{_host} --build=%{_build} --target=%{_target} \\\
--program-prefix=%{?_program_prefix} \\\
--prefix=%{_prefix} \\\
--exec-prefix=%{_exec_prefix} \\\
--bindir=%{_bindir} \\\
--sbindir=%{_sbindir} \\\
--sysconfdir=%{_sysconfdir} \\\
--datadir=%{_datadir} \\\
--includedir=%{_includedir} \\\
--libdir=%{_libdir} \\\
--libexecdir=%{_libexecdir} \\\
--localstatedir=%{_localstatedir} \\\
--sharedstatedir=%{_sharedstatedir} \\\
--mandir=%{_mandir} \\\
--infodir=%{_infodir} ${CONFFLAGS}
# The following 'makefile_*_subst' macros are designed to be used AFTER
# autoconf has been run, and AFTER the configure script has been run as well.
# There is a bug in autoconf which in some cases does not substitute correctly
# into makefiles. This is the reason why we explicitly replace autoconf
# variables in any 'Makefile's found.
%define makefile_autoconf_subst \
for j in "Makefile" "makefile" "Makefile.include" "makefile.include" \
do \
for i in `find . -type f -name "${j}"` \
do \
%{__sed} -i \\\
-e "s|@prefix@|%{_prefix}|g" \\\
-e "s|@exec_prefix@|%{_exec_prefix}|g" \\\
-e "s|@bindir@|%{_bindir}|g" \\\
-e "s|@sbindir@|%{_sbindir}|g" \\\
-e "s|@libexecdir@|%{_libexecdir}|g" \\\
-e "s|@datadir@|%{_datadir}|g" \\\
-e "s|@datarootdir@|%{_datarootdir}|g" \\\
-e "s|@sysconfdir@|%{_sysconfdir}|g" \\\
-e "s|@sharedstatedir@|%{_sharedstatedir}|g" \\\
-e "s|@localstatedir@|%{_localstatedir}|g" \\\
-e "s|@libdir@|%{_libdir}|g" \\\
-e "s|@oldincludedir@|%{_oldincludedir}|g" \\\
-e "s|@includedir@|%{_includedir}|g" \\\
-e "s|@localedir@|%{_localedir}|g" \\\
-e "s|@docdir@|%{_docdir}|g" \\\
-e "s|@htmldir@|%{_htmldir}|g" \\\
-e "s|@dvidir@|%{_dvidir}|g" \\\
-e "s|@pdfdir@|%{_pdfdir}|g" \\\
-e "s|@psdir@|%{_psdir}|g" \\\
-e "s|@man1dir@|%{_man1dir}|g" \\\
-e "s|@man2dir@|%{_man2dir}|g" \\\
-e "s|@lispdir@|%{_lispdir}|g" \\\
-e "s|@homedir@|%{_homedir}|g" \\\
-e "s|@spooldir@|%{_spooldir}|g" \\\
-e "s|@cachedir@|%{_cachedir}|g" \\\
-e "s|@appstatedir@|%{_appstatedir}|g" \\\
-e "s|@unitdir@|%{_unitdir}|g" \\\
-e "s|@logdir@|%{_logdir}|g" "${i}" \
done \
done
%define makefile_ldconfig_subst \
for j in "Makefile" "makefile" "Makefile.include" "makefile.include" \
do \
for i in `find . -type f -name "${j}"` \
do \
%{__sed} -i \\\
-e "s/ldconfig/echo 'skipped calling ldconfig'/g" "${i}" \
done \
done
# Another autoconf bug macro.
%define makefile_destdir_subst \
for j in "Makefile" "makefile" "Makefile.include" "makefile.include" \
do \
for i in `find . -type f -name "${j}"` \
do \
%{__sed} -i \\\
-e 's/\\([^)]\\)\\$(prefix)/\\1$(DESTDIR)$(prefix)/g' \\\
-e 's/\\([^)]\\)\\$(exec_prefix)/\\1$(DESTDIR)$(exec_prefix)/g' \\\
-e 's/\\([^)]\\)\\$(bindir)/\\1$(DESTDIR)$(bindir)/g' \\\
-e 's/\\([^)]\\)\\$(sbindir)/\\1$(DESTDIR)$(sbindir)/g' \\\
-e 's/\\([^)]\\)\\$(libexecdir)/\\1$(DESTDIR)$(libexecdir)/g' \\\
-e 's/\\([^)]\\)\\$(datadir)/\\1$(DESTDIR)$(datadir)/g' \\\
-e 's/\\([^)]\\)\\$(datarootdir)/\\1$(DESTDIR)$(datarootdir)/g' \\\
-e 's/\\([^)]\\)\\$(sysconfdir)/\\1$(DESTDIR)$(sysconfdir)/g' \\\
-e 's/\\([^)]\\)\\$(sharedstatedir)/\\1$(DESTDIR)$(sharedstatedir)/g' \\\
-e 's/\\([^)]\\)\\$(localstatedir)/\\1$(DESTDIR)$(localstatedir)/g' \\\
-e 's/\\([^)]\\)\\$(libdir)/\\1$(DESTDIR)$(libdir)/g' \\\
-e 's/\\([^)]\\)\\$(oldincludedir)/\\1$(DESTDIR)$(oldincludedir)/g' \\\
-e 's/\\([^)]\\)\\$(includedir)/\\1$(DESTDIR)$(includedir)/g' \\\
-e 's/\\([^)]\\)\\$(localedir)/\\1$(DESTDIR)$(localedir)/g' \\\
-e 's/\\([^)]\\)\\$(docdir)/\\1$(DESTDIR)$(docdir)/g' \\\
-e 's/\\([^)]\\)\\$(htmldir)/\\1$(DESTDIR)$(htmldir)/g' \\\
-e 's/\\([^)]\\)\\$(dvidir)/\\1$(DESTDIR)$(dvidir)/g' \\\
-e 's/\\([^)]\\)\\$(pdfdir)/\\1$(DESTDIR)$(pdfdir)/g' \\\
-e 's/\\([^)]\\)\\$(psdir)/\\1$(DESTDIR)$(psdir)/g' \\\
-e 's/\\([^)]\\)\\$(man1dir)/\\1$(DESTDIR)$(man1dir)/g' \\\
-e 's/\\([^)]\\)\\$(man2dir)/\\1$(DESTDIR)$(man2dir)/g' \\\
-e 's/\\([^)]\\)\\$(lispdir)/\\1$(DESTDIR)$(lispdir)/g' \\\
-e 's/\\([^)]\\)\\$(homedir)/\\1$(DESTDIR)$(homedir)/g' \\\
-e 's/\\([^)]\\)\\$(spooldir)/\\1$(DESTDIR)$(spooldir)/g' \\\
-e 's/\\([^)]\\)\\$(cachedir)/\\1$(DESTDIR)$(cachedir)/g' \\\
-e 's/\\([^)]\\)\\$(appstatedir)/\\1$(DESTDIR)$(appstatedir)/g' \\\
-e 's/\\([^)]\\)\\$(unitdir)/\\1$(DESTDIR)$(unitdir)/g' \\\
-e 's/\\([^)]\\)\\$(logdir)/\\1$(DESTDIR)$(logdir)/g' "${i}" \
done \
done
# This is the proper make install macro to use. It contains 'subst' macros
# which are designed to work around autoconf bugs.
%define make_install \
%makefile_autoconf_subst \
%makefile_destdir_subst \
%makefile_ldconfig_subst \
make DESTDIR="%{?buildroot:%{buildroot}}" install
# This is the name of the tarball of the source code. If not set,
# the default <name>-<version> tarball is used from the web site.
%{!?source_file:%{warn:%%source_file not defined.}}
# This is the name of the directory contained in the tarball.
# If it is not set, the default <name>-<version> directory name is used.
%{!?base_name:%{warn:%%base_name not defined.}}
%ifarch x86_64 amd64
%define _lib lib64
%endif
# To be able to distinguish between AC's and the community RPMs, and also to
# provide interoperability, we prefix the names of all the torque packages with
# 'moab'.
%define name_prefix moab
%define project_name torque
%define name %{name_prefix}-%{project_name}
# These are the names of subpackages, of the form %%{name}-<subpackage> .
%define client_sub client
%define common_sub common
%define mom_sub mom
%define server_sub server
%define devel_sub devel
%define community_top_pkg %{project_name}
%define community_client_pkg %{project_name}
%define community_mom_pkg %{project_name}-client
%define community_server_pkg %{project_name}-server
%define community_devel_pkg %{project_name}-devel
%define common_pkg %{name}-%{common_sub}
%define client_pkg %{name}-%{client_sub}
%define server_pkg %{name}-%{server_sub}
%define mom_pkg %{name}-%{mom_sub}
%define devel_pkg %{name}-%{devel_sub}
%define server_pkg_doc_dir %{_docdir}/%{server_pkg}-%{version}
%define mom_pkg_doc_dir %{_docdir}/%{mom_pkg}-%{version}
%define client_pkg_doc_dir %{_docdir}/%{client_pkg}-%{version}
%define common_pkg_doc_dir %{_docdir}/%{common_pkg}-%{version}
# End Autoconf variables #######################################################
### Features disabled by default
%bcond_with blcr
%bcond_with cpuset
%bcond_with libcpuset
%bcond_with memacct
%bcond_with munge
%bcond_with numa
%bcond_with pam
%bcond_with top
### Features enabled by default
%bcond_without cgroups
%bcond_without scp
%bcond_without spool
%bcond_without syslog
### Autoconf macro expansions
%define ac_with_blcr --%{?with_blcr:en}%{!?with_blcr:dis}able-blcr
%define ac_with_cpuset --%{?with_cpuset:en}%{!?with_cpuset:dis}able-cpuset
%define ac_with_cgroups --%{?with_cgroups:en}%{!?with_cgroups:dis}able-cgroups
%define ac_with_drmaa --%{?with_drmaa:en}%{!?with_drmaa:dis}able-drmaa
%define ac_with_munge --%{?with_munge:en}%{!?with_munge:dis}able-munge-auth
%define ac_with_numa --%{?with_numa:en}%{!?with_numa:dis}able-numa-support
%define ac_with_memacct --%{?with_memacct:en}%{!?with_memacct:dis}able-memacct
%define ac_with_libcpuset --%{?with_libcpuset:en}%{!?with_libcpuset:dis}able-libcpuset
%define ac_with_top --%{?with_top:en}%{!?with_top:dis}able-top-tempdir-only
%define ac_with_pam --with%{!?with_pam:out}-pam%{?with_pam:=/%{_lib}/security}
%define ac_with_scp --with-rcp=%{?with_scp:scp}%{!?with_scp:pbs_rcp}
%define ac_with_spool --%{?with_spool:en}%{!?with_spool:dis}able-spool
%define ac_with_syslog --%{?with_syslog:en}%{!?with_syslog:dis}able-syslog
### Build Requirements
%define breq_munge %{?with_munge:munge-devel}
%define breq_pam %{?with_pam:pam-devel}
%define breq_scp %{?with_scp:/usr/bin/scp}
%define breq_cgroups %{?with_cgroups:libcgroup-tools} %{?with_cgroups:hwloc >= 1.9.1}
# Missing:
# libcpuset -> libcpuset.so.*
# numa: hwloc.so.*
# cpuset: hwloc.so.*
# memacct: memacct.so.*
### Macro variables
%{!?torque_user:%global torque_user root}
%{!?torque_home:%global torque_home %{_var}/spool/%{project_name}}
%{!?sendmail_path:%global sendmail_path /usr/sbin/sendmail}
# This ensures that the debugging symbols are not stripped
%define __os_install_post /usr/lib/rpm/brp-compress
# Additional autoconf variables
# Set according to the standard found here:
# http://www.gnu.org/prep/standards/html_node/Directory-Variables.html
%define _appstatedir %{_localstatedir}/lib
%define _logdir %{_localstatedir}/log
%define _spooldir %{_localstatedir}/spool
%define _unitdir /usr/lib/systemd/system
%define torque_sysconfdir %{torque_home}
%define torque_appstatedir %{torque_home}
%define torque_logdir %{torque_home}
%define torque_spooldir %{torque_home}
# These macros allow for easy searching and replacing of unwanted strings.
%define grep_safety_net_error \
%{error:Usage: grep_safety_net <directory> <search-str> <repl-str>}
%define grep_safety_net() \
%{!?1:%grep_safety_net_error} \
%{!?2:%grep_safety_net_error} \
%{!?3:%grep_safety_net_error} \
for i in `%{__grep} -H -r -l -I %{?4} "%{2}" "%{1}"` \
do \
%{__sed} -i "s|%{2}|%{3}|g" $i \
done \
# These allow the automatic back up to take place.
%define pre_clear_back_up() \
echo " Removing files looking like " \
echo " '/var/tmp/backup-%{name}%{?1:-%{1}}.*\\.tar'..." \
ls -1A /var/tmp | \
grep 'backup-%{name}%{?1:-%{1}}.*\\.tar' | \
xargs rm -f >/dev/null 2>&1 || :
%define pre_add_back_up_dir() \
if [ -d "%{1}" ] \
then \
echo " Adding '%{1}' to the back-up tar file" \
echo " '/var/tmp/backup-%{name}%{?2:-%{2}}.tar'..." \
tar uf "/var/tmp/backup-%{name}%{?2:-%{2}}.tar" "%{1}" \
fi
%define pre_add_back_up_file() \
if [ -f "%{1}" ] \
then \
echo " Adding '%{1}' to the back-up tar file" \
echo " '/var/tmp/backup-%{name}%{?2:-%{2}}.tar'..." \
tar uf "/var/tmp/backup-%{name}%{?2:-%{2}}.tar" "%{1}" \
fi
%define pre_zip_back_up() \
if [ -s "/var/tmp/backup-%{name}%{?1:-%{1}}.tar" ] \
then \
echo " gzipping the file " \
echo " '/var/tmp/backup-%{name}%{?1:-%{1}}.tar'..." \
gzip "/var/tmp/backup-%{name}%{?1:-%{1}}.tar" \
fi
Name: %{name}
Version: %{version}
Release: %{release}
Summary: Tera-scale Open-source Resource and QUEue manager
License: OpenPBS License (ASF-like)
URL: http://www.adaptivecomputing.com/products/open-source/torque/
Group: Applications/System
Packager: %{?_packager:%{_packager}}%{!?_packager:%{_vendor}}
Distribution: %{?_distribution:%{_distribution}}%{!?_distribution:%{_vendor}}
BuildRequires: %{breq_munge} %{breq_pam} %{breq_scp} make
Source: %{?source_file}%{!?source_file:"http://www.adaptivecomputing.com/resources/downloads/%{project_name}/%{project_name}-%{version}.tar.gz"}
Vendor: %{?_vendorinfo:%{_vendorinfo}}%{!?_vendorinfo:%{_vendor}}
%description
TORQUE is an open source resource manager providing control over batch
jobs and distributed compute nodes. It is a community effort based on
the original *PBS project and has incorporated significant advances in the
areas of scalability, fault tolerance, and feature extensions contributed by
NCSA, OSC, USC, the U.S. Dept of Energy, Sandia, PNNL, U of Buffalo, TeraGrid,
and many other leading edge HPC organizations.
This edition of the TORQUE has been packaged specifically for the MOAB HPC
Suite.
%package %{common_sub}
Group: Applications/System
Summary: TORQUE Common Files
%if %{with cgroups}
Requires: %{breq_cgroups}
%endif
%description %{common_sub}
Common files shared by TORQUE Server, Client, and MOM packages
%package %{client_sub}
Summary: TORQUE Client
Group: Applications/System
Conflicts: pbspro, openpbs, openpbs-oscar
Obsoletes: scatorque <= %{version}-%{release}
Provides: pbs, pbs-docs %{?with_pam:, pbs-pam}
Provides: %{community_client_pkg} = %{version}-%{release}
Obsoletes: %{community_client_pkg} < %{version}-%{release}
%ifarch x86_64 amd64
Provides: %{community_client_pkg}(x86-64) = %{version}-%{release}
Obsoletes: %{community_client_pkg}(x86-64) < %{version}-%{release}
%endif
Provides: %{community_top_pkg}-docs = %{version}-%{release}
Obsoletes: %{community_top_pkg}-docs < %{version}-%{release}
Requires: %{common_pkg}
%description %{client_sub}
TORQUE Client provides the client utilities necessary for interacting with
TORQUE Server.
%package %{server_sub}
Summary: TORQUE Server
Group: System Environment/Daemons
Provides: pbs-server = %{version}-%{release}
Provides: %{community_server_pkg} = %{version}-%{release}
Obsoletes: %{community_server_pkg} < %{version}-%{release}
%ifarch x86_64 amd64
Provides: %{community_server_pkg}(x86-64) = %{version}-%{release}
Obsoletes: %{community_server_pkg}(x86-64) < %{version}-%{release}
%endif
%if %{with cgroups}
Requires: %{breq_cgroups}
%endif
Requires: %{common_pkg}
Requires: %{client_pkg}
%description %{server_sub}
TORQUE Resource Manager provides control over batch jobs and distributed
computing resources. It is an advanced open-source product based on the
original PBS project* and incorporates the best of both community and
professional development.
%package %{devel_sub}
Summary: TORQUE Development Files
Group: Applications/System
Requires: %{client_pkg} = %{version}-%{release}
Provides: pbs-devel = %{version}-%{release}
Provides: lib%{project_name}-devel = %{version}-%{release}
Provides: %{community_devel_pkg} = %{version}-%{release}
Obsoletes: %{community_devel_pkg} < %{version}-%{release}
%ifarch x86_64 amd64
Provides: %{community_devel_pkg}(x86-64) = %{version}-%{release}
Obsoletes: %{community_devel_pkg}(x86-64) < %{version}-%{release}
%endif
%if %{with cgroups}
Requires: %{breq_cgroups}
%endif
%description %{devel_sub}
Development headers and libraries for TORQUE
%package %{mom_sub}
Summary: TORQUE MOM agent
Group: Applications/System
Provides: pbs-client pbs-mom %{?with_pam:pbs-pam}
%if %{with pam}
Provides: %{community_top_pkg}-pam = %{version}-%{release}
Obsoletes: %{community_top_pkg}-pam < %{version}-%{release}
Provides: %{community_top_pkg}-pam = %{version}-%{release}
Obsoletes: %{community_top_pkg}-pam < %{version}-%{release}
%endif
Requires: %{common_pkg}
Provides: %{community_mom_pkg} = %{version}-%{release}
Obsoletes: %{community_mom_pkg} < %{version}-%{release}
%ifarch x86_64 amd64
Provides: %{community_mom_pkg}(x86-64) = %{version}-%{release}
Obsoletes: %{community_mom_pkg}(x86-64) < %{version}-%{release}
%endif
%if %{with cgroups}
Requires: %{breq_cgroups}
%endif
%description %{mom_sub}
TORQUE MOM provides the agent necessary for each compute node in a
TORQUE-managed batch system.
%prep
%setup %{?base_name:-n %{base_name}}
%build
# 0 optimization for full-on debugging.
CFLAGS="-g3 -O0"
CXXFLAGS="-g3 -O0"
%configure --includedir=%{_includedir}/%{project_name} \
--with-server-home=%{torque_home} \
--with-sendmail=%{sendmail_path} \
--disable-dependency-tracking \
--disable-gcc-warnings \
--disable-qsub-keep-override \
--with-debug \
--without-tcl \
%{ac_with_scp} %{ac_with_syslog} \
%{ac_with_munge} %{ac_with_pam} \
%{ac_with_blcr} %{ac_with_cpuset} \
%{ac_with_cgroups} %{ac_with_spool} %{?acflags}
%{__make} clean
%{__make} %{?_smp_mflags} %{?mflags}
%install
%{__install} -d %{buildroot}%{torque_appstatedir}/server_priv
%{__install} -d %{buildroot}%{torque_logdir}
%{__install} -d %{buildroot}%{torque_spooldir}
%{__install} -d %{buildroot}%{torque_sysconfdir}
%{__install} -d %{buildroot}%{_sbindir}
%{make_install} \
sysconfdir=%{torque_sysconfdir} \
appstatedir=%{torque_appstatedir} \
logdir=%{torque_logdir} \
spooldir=%{torque_spooldir} \
%{?mflags_install}
%{__rm} -rf %{buildroot}/%{_lib}/security/*a \
%{buildroot}%{_sysconfdir}/modulefiles
# systemd unit files
%{__mkdir_p} %{buildroot}%{_unitdir}
for UNITFILE in pbs_mom.service pbs_server.service trqauthd.service
do
%{__sed} -e 's|^PBS_HOME=.*|PBS_HOME=%{torque_appstatedir}|' \
-e 's|^SYSCONF_PATH=.*|SYSCONF_PATH=%{torque_sysconfdir}|' \
-e 's|^APPSTATE_PATH=.*|APPSTATE_PATH=%{torque_appstatedir}|' \
-e 's|^LOG_PATH=.*|LOG_PATH=%{torque_logdir}|' \
-e 's|^SPOOL_PATH=.*|SPOOL_PATH=%{torque_spooldir}|' \
-e 's|^BIN_PATH=.*|BIN_PATH=%{_bindir}|' \
-e 's|^SBIN_PATH=.*|SBIN_PATH=%{_sbindir}|' \
contrib/systemd/$UNITFILE > %{buildroot}%{_unitdir}/$UNITFILE
done
%{__install} torque.setup %{buildroot}%{_sbindir}
## Configuration
echo '__AC_HOSTNAME_NOT_SET__ np=__AC_PROCS_NOT_SET__' > \
%{buildroot}%{torque_sysconfdir}/server_priv/nodes
echo '$logevent 225 # bitmap of which events to log' > \
%{buildroot}%{torque_sysconfdir}/mom_priv/config
%{__mkdir_p} %{buildroot}/etc/profile.d
echo 'test -d %{_bindir} && export PATH=%{_bindir}:${PATH}' > %{buildroot}/etc/profile.d/torque.sh
echo 'test `id -u` = 0 && test -d %{_sbindir} && export PATH=%{_sbindir}:${PATH}' >> %{buildroot}/etc/profile.d/torque.sh
echo 'test -d %{_bindir} && setenv PATH %{_bindir}:${PATH}' > %{buildroot}/etc/profile.d/torque.csh
echo 'test `id -u` = 0 && test -d %{_sbindir} && setenv PATH %{_sbindir}:${PATH}' >> %{buildroot}/etc/profile.d/torque.csh
# Moab requires libtorque.so.0, but works with libtorque.so.2, so fudge it
%{__ln_s} libtorque.so.2 %{buildroot}%{_libdir}/libtorque.so.0
# We do not package the FIFO scheduler with our suites.
rm -rf %{buildroot}%{torque_spooldir}/sched_priv
rm -f %{buildroot}%{_sbindir}/pbs_sched
rm -f %{buildroot}%{_sbindir}/qschedd
rm -rf %{buildroot}%{torque_spooldir}/sched_logs
# Empty config files
touch %{buildroot}%{torque_appstatedir}/server_priv/serverdb
touch %{buildroot}%{torque_sysconfdir}/server_priv/mom_hierarchy
# %%ghost files
%{__install} -d %{buildroot}%{torque_appstatedir}/server_priv/bad_job_state
%{__install} -d %{buildroot}/etc/ld.so.conf.d
echo '%{_libdir}' > %{buildroot}/etc/ld.so.conf.d/torque.conf
%grep_safety_net %{buildroot} %{buildroot} %{nil}
%grep_safety_net %{buildroot} ${HOSTNAME} __AC_HOSTNAME_NOT_SET__
%grep_safety_net %{buildroot} localhost __AC_HOSTNAME_NOT_SET__
%pre %{common_sub}
TIMESTAMP="`date +%%Y.%%m.%%d_%%H.%%M.%%S`"
# This for loop enables globbing, which the macros do not support
%{pre_clear_back_up %{common_sub}-${TIMESTAMP}}
for file in %{_libdir}/lib%{project_name}.so*
do
%{pre_add_back_up_file ${file} %{common_sub}-${TIMESTAMP}}
done
%{pre_add_back_up_dir %{common_pkg_doc_dir} %{common_sub}-${TIMESTAMP}}
%{pre_add_back_up_dir %{torque_spooldir}/spool %{common_sub}-${TIMESTAMP}}
%{pre_add_back_up_dir %{torque_appstatedir}/checkpoint %{common_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{torque_sysconfdir}/pbs_environment %{common_sub}-${TIMESTAMP}}
%{pre_add_back_up_file /etc/ld.so.conf.d/torque.conf %{common_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{torque_sysconfdir}/server_name %{common_sub}-${TIMESTAMP}}
%{pre_zip_back_up %{common_sub}-${TIMESTAMP}}
%post %{common_sub}
%grep_safety_net %{torque_home} __AC_HOSTNAME_NOT_SET__ ${HOSTNAME}
echo " Running 'ldconfig'..."
ldconfig
%postun %{common_sub}
echo " Running 'ldconfig'..."
ldconfig
%pre %{client_sub}
TIMESTAMP="`date +%%Y.%%m.%%d_%%H.%%M.%%S`"
%{pre_clear_back_up %{client_sub}-${TIMESTAMP}}
# Taken from the client's file list
%{pre_add_back_up_file %{_unitdir}/trqauthd.service %{client_sub}-${TIMESTAMP}}
%{pre_add_back_up_file /etc/profile.d/torque.sh %{client_sub}-${TIMESTAMP}}
%{pre_add_back_up_file /etc/profile.d/torque.csh %{client_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{_bindir}/chk_tree %{client_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{_bindir}/hostn %{client_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{_bindir}/nqs2pbs %{client_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{_bindir}/pbs_track %{client_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{_bindir}/pbsdsh %{client_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{_bindir}/pbsnodes %{client_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{_bindir}/printjob %{client_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{_bindir}/printserverdb %{client_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{_bindir}/printtracking %{client_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{_bindir}/printtracking %{client_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{_bindir}/printtracking %{client_sub}-${TIMESTAMP}}
for file in %{_bindir}/q*
do
%{pre_add_back_up_file ${file} %{client_sub}-${TIMESTAMP}}
done
%{pre_add_back_up_file %{_bindir}/tracejob %{client_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{_sbindir}/trqauthd %{client_sub}-${TIMESTAMP}}
%{pre_zip_back_up %{client_sub}-${TIMESTAMP}}
%post %{client_sub}
echo " Executing the '%{client_pkg}' post-install script..."
if [ $1 -eq 1 ]
then
echo " No other installation of '%{client_pkg}' detected on"
echo " the system."
systemctl enable trqauthd >/dev/null 2>&1 || :
else
echo " Additional instance of '%{client_pkg}' detected on"
echo " the system."
fi
%preun %{client_sub}
echo " Executing the '%{client_pkg}' pre-uninstall script..."
if [ $1 -eq 0 ]
then
echo " No other installation of '%{client_pkg} detected on"
echo " the system other than the one being uninstalled."
echo " Stopping the 'trqauthd' service..."
systemctl stop trqauthd >/dev/null 2>&1 || :
systemctl disable trqauthd >/dev/null 2>&1 || :
fi
%pre %{server_sub}
TIMESTAMP="`date +%%Y.%%m.%%d_%%H.%%M.%%S`"
%{pre_clear_back_up %{server_sub}-${TIMESTAMP}}
%{pre_add_back_up_file /etc/profile.d/torque.sh %{server_sub}-${TIMESTAMP}}
%{pre_add_back_up_file /etc/profile.d/torque.csh %{server_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{server_pkg_doc_dir}/doc/admin_guide.ps %{server_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{_sbindir}/torque.setup %{server_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{torque_sysconfdir}/server_priv/mom_hierarchy \
%{server_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{torque_sysconfdir}/server_priv/nodes \
%{server_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{_unitdir}/pbs_server.service %{server_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{_sbindir}/pbs_server %{server_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{_sbindir}/qserverd %{server_sub}-${TIMESTAMP}}
%{pre_add_back_up_dir %{torque_logdir}/server_logs %{server_sub}-${TIMESTAMP}}
%{pre_add_back_up_dir %{torque_appstatedir}/server_priv %{server_sub}-${TIMESTAMP}}
%{pre_zip_back_up %{server_sub}-${TIMESTAMP}}
%post %{server_sub}
%grep_safety_net %{torque_home} __AC_HOSTNAME_NOT_SET__ ${HOSTNAME}
# This is used in the server_priv/nodes file.
%grep_safety_net %{torque_home} __AC_PROCS_NOT_SET__ ${NUM_PROCS}
if [ $1 -eq 1 ]
then
echo " No other installation of '%{server_pkg}' detected on"
echo " the system."
echo " Ensuring for the presence of the user '%{torque_user}'..."
grep '^%{torque_user}:' /etc/passwd >/dev/null 2>&1 || \
useradd -r %{torque_user} || :
echo " Looking for PBS services in '/etc/services'..."
grep -q 'PBS services' /etc/services >/dev/null 2>&1 || {
echo " No PBS services found in '/etc/services'."
echo " Populating '/etc/services' with pbs service information..."
cat <<EOF >>/etc/services
# Standard PBS services
pbs 15001/tcp # pbs server (pbs_server)
pbs 15001/udp # pbs server (pbs_server)
pbs_mom 15002/tcp # mom to/from server
pbs_mom 15002/udp # mom to/from server
pbs_resmom 15003/tcp # mom resource management requests
pbs_resmom 15003/udp # mom resource management requests
pbs_sched 15004/tcp # scheduler
pbs_sched 15004/udp # scheduler
trqauthd 15005/tcp # authorization daemon
trqauthd 15005/udp # authorization daemon
EOF
}
echo "`hostname` np=`grep processor /proc/cpuinfo | wc -l`" > \
%{torque_sysconfdir}/server_priv/nodes
NODES_FILE="%{torque_sysconfdir}/server_priv/nodes"
NUM_PROCS="`grep processor /proc/cpuinfo | wc -l`"
echo " Checking for the existence of the file"
echo " '%{torque_appstatedir}/server_priv/serverdb'..."
if [ ! -s %{torque_appstatedir}/server_priv/serverdb ]
then
echo " '%{torque_appstatedir}/server_priv/serverdb' does not"
echo " exist or is empty."
# In 4.2-EA, TRQ-1578, torque.setup is found to delete the
# 'nodes' file when run. This prevents that.
echo " Backing up nodes file..."
NODES_BACKUP_FILE=`mktemp -u "/var/tmp/nodes.XXXXXX"`
cp "${NODES_FILE}" \
"${NODES_BACKUP_FILE}" || {
echo "Could not back up nodes file!"
exit 1
}
export TORQUE_SERVER="${HOSTNAME}"
echo " Running '%{_sbindir}/torque.setup' with first argument as"
echo " '%{torque_user}'..."
yes 'y' | %{_sbindir}/torque.setup \
"%{torque_user}" >/dev/null
%{_bindir}/qterm >/dev/null 2>&1 || :
%{_sbindir}/trqauthd -d >/dev/null 2>&1 || :
if [ ! -s "${NODES_FILE}" ]
then
echo "Restoring nodes file..."
cp "${NODES_BACKUP_FILE}" \
"${NODES_FILE}"
fi
fi
systemctl enable pbs_server >/dev/null 2>&1 || :
else
echo " Additional instance of '%{server_pkg}' detected on"
echo " the system."
fi
%preun %{server_sub}
echo " Executing the '%{server_pkg}' pre-uninstall script..."
if [ $1 -eq 0 ]
then
echo " No other installation of '%{server_pkg}' detected on"
echo " the system other than the one being uninstalled."
echo " Stopping the 'pbs_server' service..."
systemctl stop pbs_server >/dev/null 2>&1 || :
systemctl disable pbs_server >/dev/null 2>&1 || :
fi
%pre %{devel_sub}
TIMESTAMP="`date +%%Y.%%m.%%d_%%H.%%M.%%S`"
%{pre_clear_back_up %{devel_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{_bindir}/pbs-config %{devel_sub}-${TIMESTAMP}}
%{pre_add_back_up_dir %{_includedir}/%{project_name} %{devel_sub}-${TIMESTAMP}}
for file in %{_libdir}/lib%{project_name}*a
do
%{pre_add_back_up_file ${file} %{devel_sub}-${TIMESTAMP}}
done
for file in %{_libdir}/lib%{project_name}*so
do
%{pre_add_back_up_file ${file} %{devel_sub}-${TIMESTAMP}}
done
%{pre_zip_back_up %{devel_sub}-${TIMESTAMP}}
%post %{devel_sub}
echo " Running 'ldconfig'..."
ldconfig
%postun %{devel_sub}
echo " Running 'ldconfig'..."
ldconfig
%pre %{mom_sub}
TIMESTAMP="`date +%%Y.%%m.%%d_%%H.%%M.%%S`"
%{pre_clear_back_up %{mom_sub}-${TIMESTAMP}}
%{pre_add_back_up_dir %{torque_appstatedir}/mom_priv %{mom_sub}-${TIMESTAMP}}
%{pre_add_back_up_dir %{torque_appstatedir}/aux %{mom_sub}-${TIMESTAMP}}
%{pre_add_back_up_dir %{torque_logdir}/mom_logs %{mom_sub}-${TIMESTAMP}}
%{pre_add_back_up_dir %{torque_spooldir}/undelivered %{mom_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{torque_sysconfdir}/mom_priv/config %{mom_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{_unitdir}/pbs_mom.service %{mom_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{_sbindir}/pbs_demux %{mom_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{_sbindir}/pbs_mom %{mom_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{_sbindir}/momctl %{mom_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{_sbindir}/qnoded %{mom_sub}-${TIMESTAMP}}
%if %{with pam}
%{pre_add_back_up_file /%{_lib}/security/pam_pbssimpleauth.so %{mom_sub}-${TIMESTAMP}}
%endif
%if %{with scp}
%{pre_add_back_up_file %{_sbindir}/pbs_rcp %{mom_sub}-${TIMESTAMP}}
%endif
%{pre_zip_back_up %{mom_sub}-${TIMESTAMP}}
%post %{mom_sub}
echo " Executing the '%{mom_pkg}' post-install script..."
%grep_safety_net %{torque_home} __AC_HOSTNAME_NOT_SET__ ${HOSTNAME}
if [ $1 -eq 1 ]
then
echo " No other installation of '%{mom_pkg}' detected on"
echo " the system."
echo " Looking for PBS services in '/etc/services'..."
grep -q 'PBS services' /etc/services >/dev/null 2>&1 || {
echo " No PBS services found in '/etc/services'."
echo " Populating '/etc/services' with pbs service information..."
cat <<EOF >>/etc/services
# Standard PBS services
pbs 15001/tcp # pbs server (pbs_server)
pbs 15001/udp # pbs server (pbs_server)
pbs_mom 15002/tcp # mom to/from server
pbs_mom 15002/udp # mom to/from server
pbs_resmom 15003/tcp # mom resource management requests
pbs_resmom 15003/udp # mom resource management requests
pbs_sched 15004/tcp # scheduler
pbs_sched 15004/udp # scheduler
trqauthd 15005/tcp # authorization daemon
trqauthd 15005/udp # authorization daemon
EOF
}
export TORQUE_SERVER="${HOSTNAME}"
systemctl enable pbs_mom >/dev/null 2>&1 || :
else
echo " Additional instance of '%{mom_pkg}' detected on"
echo " the system."
fi
echo " Running 'ldconfig'..."
ldconfig
%preun %{mom_sub}
echo " Executing the '%{mom_pkg}' pre-uninstall script..."
if [ $1 -eq 0 ]
then
echo " No other installation of '%{mom_pkg}' detected on"
echo " the system other than the one being uninstalled."
echo " Stopping the 'pbs_mom' service..."
systemctl stop pbs_mom stop >/dev/null 2>&1 || :
systemctl disable pbs_mom >/dev/null 2>&1 || :
fi
%postun %{mom_sub}
echo " Running 'ldconfig'..."
ldconfig
%files
%files %{common_sub}
%attr(-,root,root) %{_libdir}/lib%{project_name}.so*
%attr(-,root,root) %config(noreplace) %{torque_sysconfdir}/pbs_environment
%attr(-,root,root) %config(noreplace) /etc/ld.so.conf.d/torque.conf
%attr(-,root,root) %config(noreplace) %{torque_sysconfdir}/server_name
%attr(-,root,root) %doc INSTALL INSTALL.GNU CHANGELOG PBS_License.txt README.*
%attr(-,root,root) %doc Release_Notes src/pam/README.pam
%attr(-,root,root) %doc doc/READ_ME doc/doc_fonts doc/soelim.c doc/ers
# This is needed by TORQUE MOM, but also by the server (pbsd_init). Therefore,
# it is in the 'common' RPM.
%attr(1777,root,root) %dir %{torque_spooldir}/spool
%attr(1777,root,root) %dir %{torque_appstatedir}/checkpoint
%files %{client_sub}
%attr(-,root,root) %config(noreplace) %{_unitdir}/trqauthd.service
%attr(-,root,root) %config(noreplace) /etc/profile.d/torque.sh
%attr(-,root,root) %config(noreplace) /etc/profile.d/torque.csh
%attr(-,root,root) %{_bindir}/chk_tree
%attr(-,root,root) %{_bindir}/hostn
%attr(-,root,root) %{_bindir}/nqs2pbs
%attr(-,root,root) %{_bindir}/pbs_*
%attr(-,root,root) %{_bindir}/pbsdsh
%attr(-,root,root) %{_bindir}/pbsnodes
%attr(-,root,root) %{_bindir}/printjob
%attr(-,root,root) %{_bindir}/printserverdb
%attr(-,root,root) %{_bindir}/printtracking
%attr(-,root,root) %{_bindir}/q*
%attr(-,root,root) %{_bindir}/tracejob
%attr(-,root,root) %{_sbindir}/trqauthd
%attr(-,root,root) %doc %{_mandir}/man*/*
%files %{server_sub}
%attr(-,root,root) %doc doc/admin_guide.ps
%attr(0755,root,root) %{_sbindir}/torque.setup
%attr(-,root,root) %config(noreplace) /etc/profile.d/torque.sh
%attr(-,root,root) %config(noreplace) /etc/profile.d/torque.csh
%attr(-,root,root) %config(noreplace) %{torque_sysconfdir}/server_priv/mom_hierarchy
%attr(-,root,root) %config(noreplace) %{torque_appstatedir}/server_priv/serverdb
%attr(-,root,root) %config(noreplace) %{torque_sysconfdir}/server_priv/nodes
%attr(-,root,root) %config(noreplace) %{_unitdir}/pbs_server.service
%attr(-,root,root) %{_sbindir}/pbs_server
%attr(-,root,root) %{_sbindir}/qserverd
%attr(0755,root,root) %dir %{torque_logdir}/server_logs
%attr(0750,root,root) %dir %{torque_appstatedir}/server_priv
%attr(-,root,root) %dir %{torque_appstatedir}/server_priv/accounting
%attr(-,root,root) %dir %{torque_appstatedir}/server_priv/acl*
%attr(-,root,root) %dir %{torque_appstatedir}/server_priv/arrays
%attr(-,root,root) %dir %{torque_appstatedir}/server_priv/credentials
%attr(-,root,root) %dir %{torque_appstatedir}/server_priv/disallowed_types
%attr(-,root,root) %dir %{torque_appstatedir}/server_priv/hostlist
%attr(-,root,root) %dir %{torque_appstatedir}/server_priv/jobs
%attr(-,root,root) %dir %{torque_appstatedir}/server_priv/bad_job_state
%attr(-,root,root) %dir %{torque_appstatedir}/server_priv/queues
%files %{devel_sub}
%attr(-,root,root) %{_bindir}/pbs-config
%attr(-,root,root) %{_includedir}/%{project_name}
%attr(-,root,root) %{_libdir}/lib%{project_name}*a
%attr(-,root,root) %{_libdir}/lib%{project_name}*so
%files %{mom_sub}
%attr(-,root,root) %dir %{torque_appstatedir}/mom_priv
%attr(-,root,root) %dir %{torque_appstatedir}/aux
%attr(-,root,root) %dir %{torque_appstatedir}/mom_priv/jobs/
%attr(-,root,root) %dir %{torque_logdir}/mom_logs
%attr(-,root,root) %dir %{torque_spooldir}/undelivered
%attr(-,root,root) %config(noreplace) %{torque_sysconfdir}/mom_priv/config
%attr(-,root,root) %config(noreplace) %{_unitdir}/pbs_mom.service
%attr(-,root,root) %config(noreplace) /etc/profile.d/torque.sh
%attr(-,root,root) %config(noreplace) /etc/profile.d/torque.csh
%attr(-,root,root) %{_sbindir}/pbs_demux
%attr(-,root,root) %{_sbindir}/pbs_mom
%attr(-,root,root) %{_sbindir}/momctl
%attr(-,root,root) %{_sbindir}/qnoded
%if %{with pam}
%attr(-,root,root) /%{_lib}/security/pam_pbssimpleauth.so
%endif
%if %{without scp}
%attr(4755, root, root) %{_sbindir}/pbs_rcp
%endif
@@ -0,0 +1,993 @@
# since this spec file is 'pristine' (not requiring the use of configure, etc),
# it uses macros defined by the user to build correctly.
# Example of suggested build command:
# rpmbuild -ba --define "version 4.2.0" --define "release 48"
%{!?version:%{error:%%version not defined.}}
%{!?release:%{error:%%release not defined.}}
# Autoconf variables
# These are set in /usr/lib/rpm/macros, but are explicitly defined here
# For consistency between distributions.
%define _prefix /usr/local
%define _exec_prefix %{_prefix}
%define _bindir %{_exec_prefix}/bin
%define _sbindir %{_exec_prefix}/sbin
%define _libexecdir %{_exec_prefix}/libexec
%define _datadir %{_prefix}/share
%define _sysconfdir %{_prefix}/etc
%define _sharedstatedir %{_prefix}/com
%define _localstatedir %{_prefix}/var
%define _lib lib
%define _libdir %{_exec_prefix}/%{_lib}
%define _includedir %{_prefix}/include
%define _oldincludedir /usr/include
%define _infodir %{_prefix}/info
%define _mandir %{_prefix}/man
%define _unitdir %{_sysconfdir}/usr/lib/systemd/system
# Autoconf variables, which are not set in /usr/lib/rpm/macros.
# Set according to the standard found here:
# http://www.gnu.org/prep/standards/html_node/Directory-Variables.html
%define _man1dir %{_mandir}/man1
%define _man2dir %{_mandir}/man2
%define _lispdir %{_datarootdir}/emacs/site-lisp
%define _logdir %{_localstatedir}/log
%define _datarootdir %{_prefix}/share
%define _oldincludedir /usr/include
%define _localedir %{_datarootdir}/locale
%define _docdir %{_datarootdir}/doc
%define _htmldir %{_docdir}
%define _dvidir %{_docdir}
%define _pdfdir %{_docdir}
%define _psdir %{_docdir}
# Not standard, but useful.
%define pkg_doc_dir %{_docdir}/%{name}-%{version}
# Autoconf variables supported in Adaptive's build environment
# (Some products use homedir, TORQUE uses spool,appstate, and homedir)
# The latter three are intended to follow the Linux FHS standard.
%define _man3dir %{_mandir}/man3
%define _homedir %{_prefix}
%define _spooldir %{_localstatedir}/spool
%define _cachedir %{_localstatedir}/cache
%define _appstatedir %{_localstatedir}/lib
# Nice error message if some macro is undefined.
%define macro_undefined_error() \
%{error:%{?1:%{1}}%{!?1:macro} is not defined.}
%define _configure ./configure
%define configure \
unset CONFFLAGS \
CONFFLAGS_FILE=`mktemp %{_tmppath}/confflags.XXXX` \
./configure --help 2>&1 > ${CONFFLAGS_FILE} \
if test %{_hwlocpath} != none \
then \
if grep -q -- '--with-hwloc-path' "${CONFFLAGS_FILE}" \
then \
CONFFLAGS='--with-hwloc-path=%{_hwlocpath}' \
fi \
fi \
if grep -q -- '--enable-cgroups' "${CONFFLAGS_FILE}" \
then \
CONFFLAGS="${CONFFLAGS} %{_cgroupsopt}" \
fi \
if grep -q -- '--oldincludedir' "${CONFFLAGS_FILE}" \
then \
CONFFLAGS="${CONFFLAGS} --oldincludedir=%{_oldincludedir}" \
fi \
if grep -q -- '--datarootdir' ${CONFFLAGS_FILE} \
then \
CONFFLAGS="${CONFFLAGS} --datarootdir=%{_datarootdir}" \
fi \
if grep -q -- '--localedir' ${CONFFLAGS_FILE} \
then \
CONFFLAGS="${CONFFLAGS} --localedir=%{_localedir}" \
fi \
if grep -q -- '--docdir' ${CONFFLAGS_FILE} \
then \
CONFFLAGS="${CONFFLAGS} --docdir=%{_docdir}" \
fi \
if grep -q -- '--htmldir' ${CONFFLAGS_FILE} \
then \
CONFFLAGS="${CONFFLAGS} --htmldir=%{_htmldir}" \
fi \
if grep -q -- '--dvidir' ${CONFFLAGS_FILE} \
then \
CONFFLAGS="${CONFFLAGS} --dvidir=%{_dvidir}" \
fi \
if grep -q -- '--pdfdir' ${CONFFLAGS_FILE} \
then \
CONFFLAGS="${CONFFLAGS} --pdfdir=%{_pdfdir}" \
fi \
if grep -q -- '--psdir' ${CONFFLAGS_FILE} \
then \
CONFFLAGS="${CONFFLAGS} --psdir=%{_psdir}" \
fi \
if grep -q -- '--homedir' ${CONFFLAGS_FILE} \
then \
CONFFLAGS="${CONFFLAGS} --homedir=%{_homedir}" \
fi \
if grep -q -- '--spooldir' ${CONFFLAGS_FILE} \
then \
CONFFLAGS="${CONFFLAGS} --spooldir=%{_spooldir}" \
fi \
if grep -q -- '--cachedir' ${CONFFLAGS_FILE} \
then \
CONFFLAGS="${CONFFLAGS} --cachedir=%{_cachedir}" \
fi \
if grep -q -- '--appstatedir' ${CONFFLAGS_FILE} \
then \
CONFFLAGS="${CONFFLAGS} --appstatedir=%{_appstatedir}" \
fi \
if grep -q -- '--logdir' ${CONFFLAGS_FILE} \
then \
CONFFLAGS="${CONFFLAGS} --logdir=%{_logdir}" \
fi \
if grep -q -- '--lispdir' ${CONFFLAGS_FILE} \
then \
CONFFLAGS="${CONFFLAGS} --lispdir=%{_lispdir}" \
fi \
if grep -q -- '--man1dir' ${CONFFLAGS_FILE} \
then \
CONFFLAGS="${CONFFLAGS} --man1dir=%{_man1dir}" \
fi \
if grep -q -- '--man2dir' ${CONFFLAGS_FILE} \
then \
CONFFLAGS="${CONFFLAGS} --man2dir=%{_man2dir}" \
fi \
if grep -q -- '--unitdir' ${CONFFLAGS_FILE} \
then \
CONFFLAGS="${CONFFLAGS} --unitdir=%{_unitdir}" \
fi \
CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \
CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \
FFLAGS="${FFLAGS:-%optflags}" ; export FFLAGS ; \
%{_configure} --host=%{_host} --build=%{_build} --target=%{_target} \\\
--program-prefix=%{?_program_prefix} \\\
--prefix=%{_prefix} \\\
--exec-prefix=%{_exec_prefix} \\\
--bindir=%{_bindir} \\\
--sbindir=%{_sbindir} \\\
--sysconfdir=%{_sysconfdir} \\\
--datadir=%{_datadir} \\\
--includedir=%{_includedir} \\\
--libdir=%{_libdir} \\\
--libexecdir=%{_libexecdir} \\\
--localstatedir=%{_localstatedir} \\\
--sharedstatedir=%{_sharedstatedir} \\\
--mandir=%{_mandir} \\\
--infodir=%{_infodir} ${CONFFLAGS}
# The following 'makefile_*_subst' macros are designed to be used AFTER
# autoconf has been run, and AFTER the configure script has been run as well.
# There is a bug in autoconf which in some cases does not substitute correctly
# into makefiles. This is the reason why we explicitly replace autoconf
# variables in any 'Makefile's found.
%define makefile_autoconf_subst \
for j in "Makefile" "makefile" "Makefile.include" "makefile.include" \
do \
for i in `find . -type f -name "${j}"` \
do \
%{__sed} -i \\\
-e "s|@prefix@|%{_prefix}|g" \\\
-e "s|@exec_prefix@|%{_exec_prefix}|g" \\\
-e "s|@bindir@|%{_bindir}|g" \\\
-e "s|@sbindir@|%{_sbindir}|g" \\\
-e "s|@libexecdir@|%{_libexecdir}|g" \\\
-e "s|@datadir@|%{_datadir}|g" \\\
-e "s|@datarootdir@|%{_datarootdir}|g" \\\
-e "s|@sysconfdir@|%{_sysconfdir}|g" \\\
-e "s|@sharedstatedir@|%{_sharedstatedir}|g" \\\
-e "s|@localstatedir@|%{_localstatedir}|g" \\\
-e "s|@libdir@|%{_libdir}|g" \\\
-e "s|@oldincludedir@|%{_oldincludedir}|g" \\\
-e "s|@includedir@|%{_includedir}|g" \\\
-e "s|@localedir@|%{_localedir}|g" \\\
-e "s|@docdir@|%{_docdir}|g" \\\
-e "s|@htmldir@|%{_htmldir}|g" \\\
-e "s|@dvidir@|%{_dvidir}|g" \\\
-e "s|@pdfdir@|%{_pdfdir}|g" \\\
-e "s|@psdir@|%{_psdir}|g" \\\
-e "s|@man1dir@|%{_man1dir}|g" \\\
-e "s|@man2dir@|%{_man2dir}|g" \\\
-e "s|@lispdir@|%{_lispdir}|g" \\\
-e "s|@homedir@|%{_homedir}|g" \\\
-e "s|@spooldir@|%{_spooldir}|g" \\\
-e "s|@cachedir@|%{_cachedir}|g" \\\
-e "s|@appstatedir@|%{_appstatedir}|g" \\\
-e "s|@unitdir@|%{_unitdir}|g" \\\
-e "s|@logdir@|%{_logdir}|g" "${i}" \
done \
done
%define makefile_ldconfig_subst \
for j in "Makefile" "makefile" "Makefile.include" "makefile.include" \
do \
for i in `find . -type f -name "${j}"` \
do \
%{__sed} -i \\\
-e "s/ldconfig/echo 'skipped calling ldconfig'/g" "${i}" \
done \
done
# Another autoconf bug macro.
%define makefile_destdir_subst \
for j in "Makefile" "makefile" "Makefile.include" "makefile.include" \
do \
for i in `find . -type f -name "${j}"` \
do \
%{__sed} -i \\\
-e 's/\\([^)]\\)\\$(prefix)/\\1$(DESTDIR)$(prefix)/g' \\\
-e 's/\\([^)]\\)\\$(exec_prefix)/\\1$(DESTDIR)$(exec_prefix)/g' \\\
-e 's/\\([^)]\\)\\$(bindir)/\\1$(DESTDIR)$(bindir)/g' \\\
-e 's/\\([^)]\\)\\$(sbindir)/\\1$(DESTDIR)$(sbindir)/g' \\\
-e 's/\\([^)]\\)\\$(libexecdir)/\\1$(DESTDIR)$(libexecdir)/g' \\\
-e 's/\\([^)]\\)\\$(datadir)/\\1$(DESTDIR)$(datadir)/g' \\\
-e 's/\\([^)]\\)\\$(datarootdir)/\\1$(DESTDIR)$(datarootdir)/g' \\\
-e 's/\\([^)]\\)\\$(sysconfdir)/\\1$(DESTDIR)$(sysconfdir)/g' \\\
-e 's/\\([^)]\\)\\$(sharedstatedir)/\\1$(DESTDIR)$(sharedstatedir)/g' \\\
-e 's/\\([^)]\\)\\$(localstatedir)/\\1$(DESTDIR)$(localstatedir)/g' \\\
-e 's/\\([^)]\\)\\$(libdir)/\\1$(DESTDIR)$(libdir)/g' \\\
-e 's/\\([^)]\\)\\$(oldincludedir)/\\1$(DESTDIR)$(oldincludedir)/g' \\\
-e 's/\\([^)]\\)\\$(includedir)/\\1$(DESTDIR)$(includedir)/g' \\\
-e 's/\\([^)]\\)\\$(localedir)/\\1$(DESTDIR)$(localedir)/g' \\\
-e 's/\\([^)]\\)\\$(docdir)/\\1$(DESTDIR)$(docdir)/g' \\\
-e 's/\\([^)]\\)\\$(htmldir)/\\1$(DESTDIR)$(htmldir)/g' \\\
-e 's/\\([^)]\\)\\$(dvidir)/\\1$(DESTDIR)$(dvidir)/g' \\\
-e 's/\\([^)]\\)\\$(pdfdir)/\\1$(DESTDIR)$(pdfdir)/g' \\\
-e 's/\\([^)]\\)\\$(psdir)/\\1$(DESTDIR)$(psdir)/g' \\\
-e 's/\\([^)]\\)\\$(man1dir)/\\1$(DESTDIR)$(man1dir)/g' \\\
-e 's/\\([^)]\\)\\$(man2dir)/\\1$(DESTDIR)$(man2dir)/g' \\\
-e 's/\\([^)]\\)\\$(lispdir)/\\1$(DESTDIR)$(lispdir)/g' \\\
-e 's/\\([^)]\\)\\$(homedir)/\\1$(DESTDIR)$(homedir)/g' \\\
-e 's/\\([^)]\\)\\$(spooldir)/\\1$(DESTDIR)$(spooldir)/g' \\\
-e 's/\\([^)]\\)\\$(cachedir)/\\1$(DESTDIR)$(cachedir)/g' \\\
-e 's/\\([^)]\\)\\$(appstatedir)/\\1$(DESTDIR)$(appstatedir)/g' \\\
-e 's/\\([^)]\\)\\$(unitdir)/\\1$(DESTDIR)$(unitdir)/g' \\\
-e 's/\\([^)]\\)\\$(logdir)/\\1$(DESTDIR)$(logdir)/g' "${i}" \
done \
done
# This is the proper make install macro to use. It contains 'subst' macros
# which are designed to work around autoconf bugs.
%define make_install \
%makefile_autoconf_subst \
%makefile_destdir_subst \
%makefile_ldconfig_subst \
make DESTDIR="%{?buildroot:%{buildroot}}" install
# This is the name of the tarball of the source code. If not set,
# the default <name>-<version> tarball is used from the web site.
%{!?source_file:%{warn:%%source_file not defined.}}
# This is the name of the directory contained in the tarball.
# If it is not set, the default <name>-<version> directory name is used.
%{!?base_name:%{warn:%%base_name not defined.}}
%ifarch x86_64 amd64
%define _lib lib64
%endif
# To be able to distinguish between AC's and the community RPMs, and also to
# provide interoperability, we prefix the names of all the torque packages with
# 'moab'.
%define name_prefix moab
%define project_name torque
%define name %{name_prefix}-%{project_name}
# These are the names of subpackages, of the form %%{name}-<subpackage> .
%define client_sub client
%define common_sub common
%define mom_sub mom
%define server_sub server
%define devel_sub devel
%define community_top_pkg %{project_name}
%define community_client_pkg %{project_name}
%define community_mom_pkg %{project_name}-client
%define community_server_pkg %{project_name}-server
%define community_devel_pkg %{project_name}-devel
%define common_pkg %{name}-%{common_sub}
%define client_pkg %{name}-%{client_sub}
%define server_pkg %{name}-%{server_sub}
%define mom_pkg %{name}-%{mom_sub}
%define devel_pkg %{name}-%{devel_sub}
%define server_pkg_doc_dir %{_docdir}/%{server_pkg}-%{version}
%define mom_pkg_doc_dir %{_docdir}/%{mom_pkg}-%{version}
%define client_pkg_doc_dir %{_docdir}/%{client_pkg}-%{version}
%define common_pkg_doc_dir %{_docdir}/%{common_pkg}-%{version}
# End Autoconf variables #######################################################
### Features disabled by default
%bcond_with blcr
%bcond_with cpuset
%bcond_with libcpuset
%bcond_with memacct
%bcond_with munge
%bcond_with numa
%bcond_with pam
%bcond_with top
### Features enabled by default
%bcond_without cgroups
%bcond_without scp
%bcond_without spool
%bcond_without syslog
### Autoconf macro expansions
%define ac_with_blcr --%{?with_blcr:en}%{!?with_blcr:dis}able-blcr
%define ac_with_cpuset --%{?with_cpuset:en}%{!?with_cpuset:dis}able-cpuset
%define ac_with_cgroups --%{?with_cgroups:en}%{!?with_cgroups:dis}able-cgroups
%define ac_with_drmaa --%{?with_drmaa:en}%{!?with_drmaa:dis}able-drmaa
%define ac_with_munge --%{?with_munge:en}%{!?with_munge:dis}able-munge-auth
%define ac_with_numa --%{?with_numa:en}%{!?with_numa:dis}able-numa-support
%define ac_with_memacct --%{?with_memacct:en}%{!?with_memacct:dis}able-memacct
%define ac_with_libcpuset --%{?with_libcpuset:en}%{!?with_libcpuset:dis}able-libcpuset
%define ac_with_top --%{?with_top:en}%{!?with_top:dis}able-top-tempdir-only
%define ac_with_pam --with%{!?with_pam:out}-pam%{?with_pam:=/%{_lib}/security}
%define ac_with_scp --with-rcp=%{?with_scp:scp}%{!?with_scp:pbs_rcp}
%define ac_with_spool --%{?with_spool:en}%{!?with_spool:dis}able-spool
%define ac_with_syslog --%{?with_syslog:en}%{!?with_syslog:dis}able-syslog
### Build Requirements
%define breq_munge %{?with_munge:munge-devel}
%define breq_pam %{?with_pam:pam-devel}
%define breq_scp %{?with_scp:/usr/bin/scp}
%define breq_cgroups %{?with_cgroups:libcgroup-tools} %{?with_cgroups:hwloc >= 1.9.1}
# Missing:
# libcpuset -> libcpuset.so.*
# numa: hwloc.so.*
# cpuset: hwloc.so.*
# memacct: memacct.so.*
### Macro variables
%{!?torque_user:%global torque_user root}
%{!?torque_home:%global torque_home %{_var}/spool/%{project_name}}
%{!?sendmail_path:%global sendmail_path /usr/sbin/sendmail}
# This ensures that the debugging symbols are not stripped
%define __os_install_post /usr/lib/rpm/brp-compress
# Additional autoconf variables
# Set according to the standard found here:
# http://www.gnu.org/prep/standards/html_node/Directory-Variables.html
%define _appstatedir %{_localstatedir}/lib
%define _logdir %{_localstatedir}/log
%define _spooldir %{_localstatedir}/spool
%define _unitdir /usr/lib/systemd/system
%define torque_sysconfdir %{torque_home}
%define torque_appstatedir %{torque_home}
%define torque_logdir %{torque_home}
%define torque_spooldir %{torque_home}
# These macros allow for easy searching and replacing of unwanted strings.
%define grep_safety_net_error \
%{error:Usage: grep_safety_net <directory> <search-str> <repl-str>}
%define grep_safety_net() \
%{!?1:%grep_safety_net_error} \
%{!?2:%grep_safety_net_error} \
%{!?3:%grep_safety_net_error} \
for i in `%{__grep} -H -r -l -I %{?4} "%{2}" "%{1}"` \
do \
%{__sed} -i "s|%{2}|%{3}|g" $i \
done \
# These allow the automatic back up to take place.
%define pre_clear_back_up() \
echo " Removing files looking like " \
echo " '/var/tmp/backup-%{name}%{?1:-%{1}}.*\\.tar'..." \
ls -1A /var/tmp | \
grep 'backup-%{name}%{?1:-%{1}}.*\\.tar' | \
xargs rm -f >/dev/null 2>&1 || :
%define pre_add_back_up_dir() \
if [ -d "%{1}" ] \
then \
echo " Adding '%{1}' to the back-up tar file" \
echo " '/var/tmp/backup-%{name}%{?2:-%{2}}.tar'..." \
tar uf "/var/tmp/backup-%{name}%{?2:-%{2}}.tar" "%{1}" \
fi
%define pre_add_back_up_file() \
if [ -f "%{1}" ] \
then \
echo " Adding '%{1}' to the back-up tar file" \
echo " '/var/tmp/backup-%{name}%{?2:-%{2}}.tar'..." \
tar uf "/var/tmp/backup-%{name}%{?2:-%{2}}.tar" "%{1}" \
fi
%define pre_zip_back_up() \
if [ -s "/var/tmp/backup-%{name}%{?1:-%{1}}.tar" ] \
then \
echo " gzipping the file " \
echo " '/var/tmp/backup-%{name}%{?1:-%{1}}.tar'..." \
gzip "/var/tmp/backup-%{name}%{?1:-%{1}}.tar" \
fi
Name: %{name}
Version: %{version}
Release: %{release}
Summary: Tera-scale Open-source Resource and QUEue manager
License: OpenPBS License (ASF-like)
URL: http://www.adaptivecomputing.com/products/open-source/torque/
Group: Applications/System
Packager: %{?_packager:%{_packager}}%{!?_packager:%{_vendor}}
Distribution: %{?_distribution:%{_distribution}}%{!?_distribution:%{_vendor}}
BuildRequires: %{breq_munge} %{breq_pam} %{breq_scp} make
Source: %{?source_file}%{!?source_file:"http://www.adaptivecomputing.com/resources/downloads/%{project_name}/%{project_name}-%{version}.tar.gz"}
Vendor: %{?_vendorinfo:%{_vendorinfo}}%{!?_vendorinfo:%{_vendor}}
%description
TORQUE is an open source resource manager providing control over batch
jobs and distributed compute nodes. It is a community effort based on
the original *PBS project and has incorporated significant advances in the
areas of scalability, fault tolerance, and feature extensions contributed by
NCSA, OSC, USC, the U.S. Dept of Energy, Sandia, PNNL, U of Buffalo, TeraGrid,
and many other leading edge HPC organizations.
This edition of the TORQUE has been packaged specifically for the MOAB HPC
Suite.
%package %{common_sub}
Group: Applications/System
Summary: TORQUE Common Files
%if %{with cgroups}
Requires: %{breq_cgroups}
%endif
%description %{common_sub}
Common files shared by TORQUE Server, Client, and MOM packages
%package %{client_sub}
Summary: TORQUE Client
Group: Applications/System
Conflicts: pbspro, openpbs, openpbs-oscar
Obsoletes: scatorque <= %{version}-%{release}
Provides: pbs, pbs-docs %{?with_pam:, pbs-pam}
Provides: %{community_client_pkg} = %{version}-%{release}
Obsoletes: %{community_client_pkg} < %{version}-%{release}
%ifarch x86_64 amd64
Provides: %{community_client_pkg}(x86-64) = %{version}-%{release}
Obsoletes: %{community_client_pkg}(x86-64) < %{version}-%{release}
%endif
Provides: %{community_top_pkg}-docs = %{version}-%{release}
Obsoletes: %{community_top_pkg}-docs < %{version}-%{release}
Requires: %{common_pkg}
%description %{client_sub}
TORQUE Client provides the client utilities necessary for interacting with
TORQUE Server.
%package %{server_sub}
Summary: TORQUE Server
Group: System Environment/Daemons
Provides: pbs-server = %{version}-%{release}
Provides: %{community_server_pkg} = %{version}-%{release}
Obsoletes: %{community_server_pkg} < %{version}-%{release}
%ifarch x86_64 amd64
Provides: %{community_server_pkg}(x86-64) = %{version}-%{release}
Obsoletes: %{community_server_pkg}(x86-64) < %{version}-%{release}
%endif
%if %{with cgroups}
Requires: %{breq_cgroups}
%endif
Requires: %{common_pkg}
Requires: %{client_pkg}
%description %{server_sub}
TORQUE Resource Manager provides control over batch jobs and distributed
computing resources. It is an advanced open-source product based on the
original PBS project* and incorporates the best of both community and
professional development.
%package %{devel_sub}
Summary: TORQUE Development Files
Group: Applications/System
Requires: %{client_pkg} = %{version}-%{release}
Provides: pbs-devel = %{version}-%{release}
Provides: lib%{project_name}-devel = %{version}-%{release}
Provides: %{community_devel_pkg} = %{version}-%{release}
Obsoletes: %{community_devel_pkg} < %{version}-%{release}
%ifarch x86_64 amd64
Provides: %{community_devel_pkg}(x86-64) = %{version}-%{release}
Obsoletes: %{community_devel_pkg}(x86-64) < %{version}-%{release}
%endif
%if %{with cgroups}
Requires: %{breq_cgroups}
%endif
%description %{devel_sub}
Development headers and libraries for TORQUE
%package %{mom_sub}
Summary: TORQUE MOM agent
Group: Applications/System
Provides: pbs-client pbs-mom %{?with_pam:pbs-pam}
%if %{with pam}
Provides: %{community_top_pkg}-pam = %{version}-%{release}
Obsoletes: %{community_top_pkg}-pam < %{version}-%{release}
Provides: %{community_top_pkg}-pam = %{version}-%{release}
Obsoletes: %{community_top_pkg}-pam < %{version}-%{release}
%endif
Requires: %{common_pkg}
Provides: %{community_mom_pkg} = %{version}-%{release}
Obsoletes: %{community_mom_pkg} < %{version}-%{release}
%ifarch x86_64 amd64
Provides: %{community_mom_pkg}(x86-64) = %{version}-%{release}
Obsoletes: %{community_mom_pkg}(x86-64) < %{version}-%{release}
%endif
%if %{with cgroups}
Requires: %{breq_cgroups}
%endif
%description %{mom_sub}
TORQUE MOM provides the agent necessary for each compute node in a
TORQUE-managed batch system.
%prep
%setup %{?base_name:-n %{base_name}}
%build
# 0 optimization for full-on debugging.
CFLAGS="-g3 -O0"
CXXFLAGS="-g3 -O0"
%configure --includedir=%{_includedir}/%{project_name} \
--with-server-home=%{torque_home} \
--with-sendmail=%{sendmail_path} \
--disable-dependency-tracking \
--disable-gcc-warnings \
--disable-qsub-keep-override \
--with-debug \
--without-tcl \
%{ac_with_scp} %{ac_with_syslog} \
%{ac_with_munge} %{ac_with_pam} \
%{ac_with_blcr} %{ac_with_cpuset} \
%{ac_with_cgroups} %{ac_with_spool} %{?acflags}
%{__make} clean
%{__make} %{?_smp_mflags} %{?mflags}
%install
%{__install} -d %{buildroot}%{torque_appstatedir}/server_priv
%{__install} -d %{buildroot}%{torque_logdir}
%{__install} -d %{buildroot}%{torque_spooldir}
%{__install} -d %{buildroot}%{torque_sysconfdir}
%{__install} -d %{buildroot}%{_sbindir}
%{make_install} \
sysconfdir=%{torque_sysconfdir} \
appstatedir=%{torque_appstatedir} \
logdir=%{torque_logdir} \
spooldir=%{torque_spooldir} \
%{?mflags_install}
%{__rm} -rf %{buildroot}/%{_lib}/security/*a \
%{buildroot}%{_sysconfdir}/modulefiles
# systemd unit files
%{__mkdir_p} %{buildroot}%{_unitdir}
for UNITFILE in pbs_mom.service pbs_server.service trqauthd.service
do
%{__sed} -e 's|^PBS_HOME=.*|PBS_HOME=%{torque_appstatedir}|' \
-e 's|^SYSCONF_PATH=.*|SYSCONF_PATH=%{torque_sysconfdir}|' \
-e 's|^APPSTATE_PATH=.*|APPSTATE_PATH=%{torque_appstatedir}|' \
-e 's|^LOG_PATH=.*|LOG_PATH=%{torque_logdir}|' \
-e 's|^SPOOL_PATH=.*|SPOOL_PATH=%{torque_spooldir}|' \
-e 's|^BIN_PATH=.*|BIN_PATH=%{_bindir}|' \
-e 's|^SBIN_PATH=.*|SBIN_PATH=%{_sbindir}|' \
contrib/systemd/$UNITFILE > %{buildroot}%{_unitdir}/$UNITFILE
done
%{__install} torque.setup %{buildroot}%{_sbindir}
## Configuration
echo '__AC_HOSTNAME_NOT_SET__ np=__AC_PROCS_NOT_SET__' > \
%{buildroot}%{torque_sysconfdir}/server_priv/nodes
echo '$logevent 225 # bitmap of which events to log' > \
%{buildroot}%{torque_sysconfdir}/mom_priv/config
%{__mkdir_p} %{buildroot}/etc/profile.d
echo 'test -d %{_bindir} && export PATH=%{_bindir}:${PATH}' > %{buildroot}/etc/profile.d/torque.sh
echo 'test `id -u` = 0 && test -d %{_sbindir} && export PATH=%{_sbindir}:${PATH}' >> %{buildroot}/etc/profile.d/torque.sh
echo 'test -d %{_bindir} && setenv PATH %{_bindir}:${PATH}' > %{buildroot}/etc/profile.d/torque.csh
echo 'test `id -u` = 0 && test -d %{_sbindir} && setenv PATH %{_sbindir}:${PATH}' >> %{buildroot}/etc/profile.d/torque.csh
# Moab requires libtorque.so.0, but works with libtorque.so.2, so fudge it
%{__ln_s} libtorque.so.2 %{buildroot}%{_libdir}/libtorque.so.0
# We do not package the FIFO scheduler with our suites.
rm -rf %{buildroot}%{torque_spooldir}/sched_priv
rm -f %{buildroot}%{_sbindir}/pbs_sched
rm -f %{buildroot}%{_sbindir}/qschedd
rm -rf %{buildroot}%{torque_spooldir}/sched_logs
# Empty config files
touch %{buildroot}%{torque_appstatedir}/server_priv/serverdb
touch %{buildroot}%{torque_sysconfdir}/server_priv/mom_hierarchy
# %%ghost files
%{__install} -d %{buildroot}%{torque_appstatedir}/server_priv/bad_job_state
%{__install} -d %{buildroot}/etc/ld.so.conf.d
echo '%{_libdir}' > %{buildroot}/etc/ld.so.conf.d/torque.conf
%grep_safety_net %{buildroot} %{buildroot} %{nil}
%grep_safety_net %{buildroot} ${HOSTNAME} __AC_HOSTNAME_NOT_SET__
%grep_safety_net %{buildroot} localhost __AC_HOSTNAME_NOT_SET__
%pre %{common_sub}
TIMESTAMP="`date +%%Y.%%m.%%d_%%H.%%M.%%S`"
# This for loop enables globbing, which the macros do not support
%{pre_clear_back_up %{common_sub}-${TIMESTAMP}}
for file in %{_libdir}/lib%{project_name}.so*
do
%{pre_add_back_up_file ${file} %{common_sub}-${TIMESTAMP}}
done
%{pre_add_back_up_dir %{common_pkg_doc_dir} %{common_sub}-${TIMESTAMP}}
%{pre_add_back_up_dir %{torque_spooldir}/spool %{common_sub}-${TIMESTAMP}}
%{pre_add_back_up_dir %{torque_appstatedir}/checkpoint %{common_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{torque_sysconfdir}/pbs_environment %{common_sub}-${TIMESTAMP}}
%{pre_add_back_up_file /etc/ld.so.conf.d/torque.conf %{common_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{torque_sysconfdir}/server_name %{common_sub}-${TIMESTAMP}}
%{pre_zip_back_up %{common_sub}-${TIMESTAMP}}
%post %{common_sub}
%grep_safety_net %{torque_home} __AC_HOSTNAME_NOT_SET__ ${HOSTNAME}
echo " Running 'ldconfig'..."
ldconfig
%postun %{common_sub}
echo " Running 'ldconfig'..."
ldconfig
%pre %{client_sub}
TIMESTAMP="`date +%%Y.%%m.%%d_%%H.%%M.%%S`"
%{pre_clear_back_up %{client_sub}-${TIMESTAMP}}
# Taken from the client's file list
%{pre_add_back_up_file %{_unitdir}/trqauthd.service %{client_sub}-${TIMESTAMP}}
%{pre_add_back_up_file /etc/profile.d/torque.sh %{client_sub}-${TIMESTAMP}}
%{pre_add_back_up_file /etc/profile.d/torque.csh %{client_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{_bindir}/chk_tree %{client_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{_bindir}/hostn %{client_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{_bindir}/nqs2pbs %{client_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{_bindir}/pbs_track %{client_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{_bindir}/pbsdsh %{client_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{_bindir}/pbsnodes %{client_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{_bindir}/printjob %{client_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{_bindir}/printserverdb %{client_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{_bindir}/printtracking %{client_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{_bindir}/printtracking %{client_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{_bindir}/printtracking %{client_sub}-${TIMESTAMP}}
for file in %{_bindir}/q*
do
%{pre_add_back_up_file ${file} %{client_sub}-${TIMESTAMP}}
done
%{pre_add_back_up_file %{_bindir}/tracejob %{client_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{_sbindir}/trqauthd %{client_sub}-${TIMESTAMP}}
%{pre_zip_back_up %{client_sub}-${TIMESTAMP}}
%post %{client_sub}
echo " Executing the '%{client_pkg}' post-install script..."
if [ $1 -eq 1 ]
then
echo " No other installation of '%{client_pkg}' detected on"
echo " the system."
systemctl enable trqauthd >/dev/null 2>&1 || :
else
echo " Additional instance of '%{client_pkg}' detected on"
echo " the system."
fi
%preun %{client_sub}
echo " Executing the '%{client_pkg}' pre-uninstall script..."
if [ $1 -eq 0 ]
then
echo " No other installation of '%{client_pkg} detected on"
echo " the system other than the one being uninstalled."
echo " Stopping the 'trqauthd' service..."
systemctl stop trqauthd >/dev/null 2>&1 || :
systemctl disable trqauthd >/dev/null 2>&1 || :
fi
%pre %{server_sub}
TIMESTAMP="`date +%%Y.%%m.%%d_%%H.%%M.%%S`"
%{pre_clear_back_up %{server_sub}-${TIMESTAMP}}
%{pre_add_back_up_file /etc/profile.d/torque.sh %{server_sub}-${TIMESTAMP}}
%{pre_add_back_up_file /etc/profile.d/torque.csh %{server_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{server_pkg_doc_dir}/doc/admin_guide.ps %{server_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{_sbindir}/torque.setup %{server_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{torque_sysconfdir}/server_priv/mom_hierarchy \
%{server_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{torque_sysconfdir}/server_priv/nodes \
%{server_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{_unitdir}/pbs_server.service %{server_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{_sbindir}/pbs_server %{server_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{_sbindir}/qserverd %{server_sub}-${TIMESTAMP}}
%{pre_add_back_up_dir %{torque_logdir}/server_logs %{server_sub}-${TIMESTAMP}}
%{pre_add_back_up_dir %{torque_appstatedir}/server_priv %{server_sub}-${TIMESTAMP}}
%{pre_zip_back_up %{server_sub}-${TIMESTAMP}}
%post %{server_sub}
%grep_safety_net %{torque_home} __AC_HOSTNAME_NOT_SET__ ${HOSTNAME}
# This is used in the server_priv/nodes file.
%grep_safety_net %{torque_home} __AC_PROCS_NOT_SET__ ${NUM_PROCS}
if [ $1 -eq 1 ]
then
echo " No other installation of '%{server_pkg}' detected on"
echo " the system."
echo " Ensuring for the presence of the user '%{torque_user}'..."
grep '^%{torque_user}:' /etc/passwd >/dev/null 2>&1 || \
useradd -r %{torque_user} || :
echo " Looking for PBS services in '/etc/services'..."
grep -q 'PBS services' /etc/services >/dev/null 2>&1 || {
echo " No PBS services found in '/etc/services'."
echo " Populating '/etc/services' with pbs service information..."
cat <<EOF >>/etc/services
# Standard PBS services
pbs 15001/tcp # pbs server (pbs_server)
pbs 15001/udp # pbs server (pbs_server)
pbs_mom 15002/tcp # mom to/from server
pbs_mom 15002/udp # mom to/from server
pbs_resmom 15003/tcp # mom resource management requests
pbs_resmom 15003/udp # mom resource management requests
pbs_sched 15004/tcp # scheduler
pbs_sched 15004/udp # scheduler
trqauthd 15005/tcp # authorization daemon
trqauthd 15005/udp # authorization daemon
EOF
}
echo "`hostname` np=`grep processor /proc/cpuinfo | wc -l`" > \
%{torque_sysconfdir}/server_priv/nodes
NODES_FILE="%{torque_sysconfdir}/server_priv/nodes"
NUM_PROCS="`grep processor /proc/cpuinfo | wc -l`"
echo " Checking for the existence of the file"
echo " '%{torque_appstatedir}/server_priv/serverdb'..."
if [ ! -s %{torque_appstatedir}/server_priv/serverdb ]
then
echo " '%{torque_appstatedir}/server_priv/serverdb' does not"
echo " exist or is empty."
# In 4.2-EA, TRQ-1578, torque.setup is found to delete the
# 'nodes' file when run. This prevents that.
echo " Backing up nodes file..."
NODES_BACKUP_FILE=`mktemp -u "/var/tmp/nodes.XXXXXX"`
cp "${NODES_FILE}" \
"${NODES_BACKUP_FILE}" || {
echo "Could not back up nodes file!"
exit 1
}
export TORQUE_SERVER="${HOSTNAME}"
echo " Running '%{_sbindir}/torque.setup' with first argument as"
echo " '%{torque_user}'..."
yes 'y' | %{_sbindir}/torque.setup \
"%{torque_user}" >/dev/null
%{_bindir}/qterm >/dev/null 2>&1 || :
%{_sbindir}/trqauthd -d >/dev/null 2>&1 || :
if [ ! -s "${NODES_FILE}" ]
then
echo "Restoring nodes file..."
cp "${NODES_BACKUP_FILE}" \
"${NODES_FILE}"
fi
fi
systemctl enable pbs_server >/dev/null 2>&1 || :
else
echo " Additional instance of '%{server_pkg}' detected on"
echo " the system."
fi
%preun %{server_sub}
echo " Executing the '%{server_pkg}' pre-uninstall script..."
if [ $1 -eq 0 ]
then
echo " No other installation of '%{server_pkg}' detected on"
echo " the system other than the one being uninstalled."
echo " Stopping the 'pbs_server' service..."
systemctl stop pbs_server >/dev/null 2>&1 || :
systemctl disable pbs_server >/dev/null 2>&1 || :
fi
%pre %{devel_sub}
TIMESTAMP="`date +%%Y.%%m.%%d_%%H.%%M.%%S`"
%{pre_clear_back_up %{devel_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{_bindir}/pbs-config %{devel_sub}-${TIMESTAMP}}
%{pre_add_back_up_dir %{_includedir}/%{project_name} %{devel_sub}-${TIMESTAMP}}
for file in %{_libdir}/lib%{project_name}*a
do
%{pre_add_back_up_file ${file} %{devel_sub}-${TIMESTAMP}}
done
for file in %{_libdir}/lib%{project_name}*so
do
%{pre_add_back_up_file ${file} %{devel_sub}-${TIMESTAMP}}
done
%{pre_zip_back_up %{devel_sub}-${TIMESTAMP}}
%post %{devel_sub}
echo " Running 'ldconfig'..."
ldconfig
%postun %{devel_sub}
echo " Running 'ldconfig'..."
ldconfig
%pre %{mom_sub}
TIMESTAMP="`date +%%Y.%%m.%%d_%%H.%%M.%%S`"
%{pre_clear_back_up %{mom_sub}-${TIMESTAMP}}
%{pre_add_back_up_dir %{torque_appstatedir}/mom_priv %{mom_sub}-${TIMESTAMP}}
%{pre_add_back_up_dir %{torque_appstatedir}/aux %{mom_sub}-${TIMESTAMP}}
%{pre_add_back_up_dir %{torque_logdir}/mom_logs %{mom_sub}-${TIMESTAMP}}
%{pre_add_back_up_dir %{torque_spooldir}/undelivered %{mom_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{torque_sysconfdir}/mom_priv/config %{mom_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{_unitdir}/pbs_mom.service %{mom_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{_sbindir}/pbs_demux %{mom_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{_sbindir}/pbs_mom %{mom_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{_sbindir}/momctl %{mom_sub}-${TIMESTAMP}}
%{pre_add_back_up_file %{_sbindir}/qnoded %{mom_sub}-${TIMESTAMP}}
%if %{with pam}
%{pre_add_back_up_file /%{_lib}/security/pam_pbssimpleauth.so %{mom_sub}-${TIMESTAMP}}
%endif
%if %{with scp}
%{pre_add_back_up_file %{_sbindir}/pbs_rcp %{mom_sub}-${TIMESTAMP}}
%endif
%{pre_zip_back_up %{mom_sub}-${TIMESTAMP}}
%post %{mom_sub}
echo " Executing the '%{mom_pkg}' post-install script..."
%grep_safety_net %{torque_home} __AC_HOSTNAME_NOT_SET__ ${HOSTNAME}
if [ $1 -eq 1 ]
then
echo " No other installation of '%{mom_pkg}' detected on"
echo " the system."
echo " Looking for PBS services in '/etc/services'..."
grep -q 'PBS services' /etc/services >/dev/null 2>&1 || {
echo " No PBS services found in '/etc/services'."
echo " Populating '/etc/services' with pbs service information..."
cat <<EOF >>/etc/services
# Standard PBS services
pbs 15001/tcp # pbs server (pbs_server)
pbs 15001/udp # pbs server (pbs_server)
pbs_mom 15002/tcp # mom to/from server
pbs_mom 15002/udp # mom to/from server
pbs_resmom 15003/tcp # mom resource management requests
pbs_resmom 15003/udp # mom resource management requests
pbs_sched 15004/tcp # scheduler
pbs_sched 15004/udp # scheduler
trqauthd 15005/tcp # authorization daemon
trqauthd 15005/udp # authorization daemon
EOF
}
export TORQUE_SERVER="${HOSTNAME}"
systemctl enable pbs_mom >/dev/null 2>&1 || :
else
echo " Additional instance of '%{mom_pkg}' detected on"
echo " the system."
fi
echo " Running 'ldconfig'..."
ldconfig
%preun %{mom_sub}
echo " Executing the '%{mom_pkg}' pre-uninstall script..."
if [ $1 -eq 0 ]
then
echo " No other installation of '%{mom_pkg}' detected on"
echo " the system other than the one being uninstalled."
echo " Stopping the 'pbs_mom' service..."
systemctl stop pbs_mom stop >/dev/null 2>&1 || :
systemctl disable pbs_mom >/dev/null 2>&1 || :
fi
%postun %{mom_sub}
echo " Running 'ldconfig'..."
ldconfig
%files
%files %{common_sub}
%attr(-,root,root) %{_libdir}/lib%{project_name}.so*
%attr(-,root,root) %config(noreplace) %{torque_sysconfdir}/pbs_environment
%attr(-,root,root) %config(noreplace) /etc/ld.so.conf.d/torque.conf
%attr(-,root,root) %config(noreplace) %{torque_sysconfdir}/server_name
%attr(-,root,root) %doc INSTALL INSTALL.GNU CHANGELOG PBS_License.txt README.*
%attr(-,root,root) %doc Release_Notes src/pam/README.pam
%attr(-,root,root) %doc doc/READ_ME doc/doc_fonts doc/soelim.c doc/ers
# This is needed by TORQUE MOM, but also by the server (pbsd_init). Therefore,
# it is in the 'common' RPM.
%attr(1777,root,root) %dir %{torque_spooldir}/spool
%attr(1777,root,root) %dir %{torque_appstatedir}/checkpoint
%files %{client_sub}
%attr(-,root,root) %config(noreplace) %{_unitdir}/trqauthd.service
%attr(-,root,root) %config(noreplace) /etc/profile.d/torque.sh
%attr(-,root,root) %config(noreplace) /etc/profile.d/torque.csh
%attr(-,root,root) %{_bindir}/chk_tree
%attr(-,root,root) %{_bindir}/hostn
%attr(-,root,root) %{_bindir}/nqs2pbs
%attr(-,root,root) %{_bindir}/pbs_*
%attr(-,root,root) %{_bindir}/pbsdsh
%attr(-,root,root) %{_bindir}/pbsnodes
%attr(-,root,root) %{_bindir}/printjob
%attr(-,root,root) %{_bindir}/printserverdb
%attr(-,root,root) %{_bindir}/printtracking
%attr(-,root,root) %{_bindir}/q*
%attr(-,root,root) %{_bindir}/tracejob
%attr(-,root,root) %{_sbindir}/trqauthd
%attr(-,root,root) %doc %{_mandir}/man*/*
%files %{server_sub}
%attr(-,root,root) %doc doc/admin_guide.ps
%attr(0755,root,root) %{_sbindir}/torque.setup
%attr(-,root,root) %config(noreplace) /etc/profile.d/torque.sh
%attr(-,root,root) %config(noreplace) /etc/profile.d/torque.csh
%attr(-,root,root) %config(noreplace) %{torque_sysconfdir}/server_priv/mom_hierarchy
%attr(-,root,root) %config(noreplace) %{torque_appstatedir}/server_priv/serverdb
%attr(-,root,root) %config(noreplace) %{torque_sysconfdir}/server_priv/nodes
%attr(-,root,root) %config(noreplace) %{_unitdir}/pbs_server.service
%attr(-,root,root) %{_sbindir}/pbs_server
%attr(-,root,root) %{_sbindir}/qserverd
%attr(0755,root,root) %dir %{torque_logdir}/server_logs
%attr(0750,root,root) %dir %{torque_appstatedir}/server_priv
%attr(-,root,root) %dir %{torque_appstatedir}/server_priv/accounting
%attr(-,root,root) %dir %{torque_appstatedir}/server_priv/acl*
%attr(-,root,root) %dir %{torque_appstatedir}/server_priv/arrays
%attr(-,root,root) %dir %{torque_appstatedir}/server_priv/credentials
%attr(-,root,root) %dir %{torque_appstatedir}/server_priv/disallowed_types
%attr(-,root,root) %dir %{torque_appstatedir}/server_priv/hostlist
%attr(-,root,root) %dir %{torque_appstatedir}/server_priv/jobs
%attr(-,root,root) %dir %{torque_appstatedir}/server_priv/bad_job_state
%attr(-,root,root) %dir %{torque_appstatedir}/server_priv/queues
%files %{devel_sub}
%attr(-,root,root) %{_bindir}/pbs-config
%attr(-,root,root) %{_includedir}/%{project_name}
%attr(-,root,root) %{_libdir}/lib%{project_name}*a
%attr(-,root,root) %{_libdir}/lib%{project_name}*so
%files %{mom_sub}
%attr(-,root,root) %dir %{torque_appstatedir}/mom_priv
%attr(-,root,root) %dir %{torque_appstatedir}/aux
%attr(-,root,root) %dir %{torque_appstatedir}/mom_priv/jobs/
%attr(-,root,root) %dir %{torque_logdir}/mom_logs
%attr(-,root,root) %dir %{torque_spooldir}/undelivered
%attr(-,root,root) %config(noreplace) %{torque_sysconfdir}/mom_priv/config
%attr(-,root,root) %config(noreplace) %{_unitdir}/pbs_mom.service
%attr(-,root,root) %config(noreplace) /etc/profile.d/torque.sh
%attr(-,root,root) %config(noreplace) /etc/profile.d/torque.csh
%attr(-,root,root) %{_sbindir}/pbs_demux
%attr(-,root,root) %{_sbindir}/pbs_mom
%attr(-,root,root) %{_sbindir}/momctl
%attr(-,root,root) %{_sbindir}/qnoded
%if %{with pam}
%attr(-,root,root) /%{_lib}/security/pam_pbssimpleauth.so
%endif
%if %{without scp}
%attr(4755, root, root) %{_sbindir}/pbs_rcp
%endif
+391
View File
@@ -0,0 +1,391 @@
# comment out snap if building a real release
%define name @spec_name@
%define version @spec_version@
@spec_snap@ # dist_spec_snap
%define release 1cri
%define torquehomedir /var/spool/torque
%define server_name localhost
%define drmaadocdir %{_datadir}/doc/torque-drmaa
%define use_tcl 1
%define build_server yes
%define build_mom yes
%define build_clients yes
%define build_gui yes
%define build_pbs_rcp no
%define build_drmaa yes
%define build_drmaa_docs yes
%define pammoddir /%{_lib}/security
%define modulefiles_dir no
%define configure_args --with-server-home=%{torquehomedir} --enable-server --enable-mom --enable-clients --enable-gui --enable-drmaa --with-tcl --with-tcltk --with-pam=%{pammoddir}
############################################
## no user serviceable parts below this line
%if "%build_gui" == "yes"
%if "%use_tcl" == "0"
%error GUI cannot be built without TCL support
%endif
%endif
%define shared_description %(echo -e "TORQUE (Tera-scale Open-source Resource and QUEue manager) is a resource \\nmanager providing control over batch jobs and distributed compute nodes. \\nTorque is based on OpenPBS version 2.3.12 and incorporates scalability, \\nfault tolerance, and feature extension patches provided by USC, NCSA, OSC, \\nthe U.S. Dept of Energy, Sandia, PNNL, U of Buffalo, TeraGrid, and many \\nother leading edge HPC organizations.\\n\\nThis build was configured with:\\n %{?configure_args}\\n \\n")
Summary: Tera-scale Open-source Resource and QUEue manager
Name: %{name}
Version: %{version}
Release: %{?snap:snap.%snap.}%{release}
Source: torque-%{version}%{?snap:-snap.%snap}.tar.gz
License: OpenPBS
Group: System Environment/Daemons
URL: http://www.clusterresources.com/products/torque/
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
Provides: pbs
BuildRequires: ed doxygen tcl-devel tk-devel pam-devel
Conflicts: pbspro, openpbs, openpbs-oscar
Obsoletes: scatorque
%if "%build_gui" == "no"
Obsoletes: %{name}-gui
%endif
%description
%shared_description
This package holds just a few shared files and directories.
%prep
%setup -n torque-%{version}%{?snap:-snap.%snap}
%build
%{configure} %{?configure_args}
%{__make} %{?_smp_mflags}
%install
[ "$RPM_BUILD_ROOT" != "/" ] && %{__rm} -rf "$RPM_BUILD_ROOT"
%{__make} install DESTDIR=$RPM_BUILD_ROOT INSTALL="%{__install} -p"
env DESTDIR=$RPM_BUILD_ROOT sh ./buildutils/pbs_mkdirs common
if [ -f /etc/SuSE-release ];then
initpre="suse."
else
initpre=""
fi
# install initscripts
serverinit="`test "%build_server" == "yes" && echo pbs_sched pbs_server || echo`"
mominit="`test "%build_mom" == "yes" && echo pbs_mom || echo`"
%{__mkdir_p} $RPM_BUILD_ROOT%{_initrddir}
for initscript in $serverinit $mominit; do
%__sed -e 's|^PBS_HOME=.*|PBS_HOME=%{torquehomedir}|' \
-e 's|^PBS_DAEMON=.*|PBS_DAEMON=%{_sbindir}/'$initscript'|' \
< contrib/init.d/$initpre$initscript > $RPM_BUILD_ROOT%{_initrddir}/$initscript
%__chmod 755 $RPM_BUILD_ROOT%{_initrddir}/$initscript
done
# remove libtool droppings
%{__rm} -vf $RPM_BUILD_ROOT/%pammoddir/pam_pbssimpleauth.{a,la} $RPM_BUILD_ROOT/%{_libdir}/*.la
%clean
[ "$RPM_BUILD_ROOT" != "/" ] && %{__rm} -rf $RPM_BUILD_ROOT
%post
if %__grep -q "PBS services" /etc/services;then
: PBS services already installed
else
cat<<-__EOF__>>/etc/services
# Standard PBS services
pbs 15001/tcp # pbs server (pbs_server)
pbs 15001/udp # pbs server (pbs_server)
pbs_mom 15002/tcp # mom to/from server
pbs_mom 15002/udp # mom to/from server
pbs_resmom 15003/tcp # mom resource management requests
pbs_resmom 15003/udp # mom resource management requests
pbs_sched 15004/tcp # scheduler
pbs_sched 15004/udp # scheduler
__EOF__
fi
%files
%defattr(-, root, root)
%doc INSTALL README.torque torque.setup Release_Notes CHANGELOG PBS_License.txt
%config(noreplace) %{torquehomedir}/server_name
%config(noreplace) %{torquehomedir}/pbs_environment
%{torquehomedir}/spool
%{torquehomedir}/aux
%{_libdir}/libtorque*.so.*
%if "%modulefiles_dir" != "no"
%modulefiles_dir/%{name}
%endif
%package docs
Group: Documentation
Summary: docs for Torque
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
Provides: pbs-docs
%description docs
%shared_description
This package holds the documentation files.
%files docs
%defattr(-, root, root)
%doc doc/admin_guide.ps
%{_mandir}/man*/*
%package scheduler
Group: System Environment/Daemons
Summary: scheduler part of Torque
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
Provides: pbs-scheduler
%description scheduler
%shared_description
This package holds the fifo C scheduler.
%if "%build_server" == "yes"
%files scheduler
%defattr(-, root, root)
%{_sbindir}/pbs_sched
%{_sbindir}/qschedd
%{_initrddir}/pbs_sched
%dir %{torquehomedir}/sched_priv
%config(noreplace) %{torquehomedir}/sched_priv/*
%{torquehomedir}/sched_logs
%endif
%post scheduler
/sbin/chkconfig --add pbs_sched
%preun scheduler
[ $1 = 0 ] || exit 0
/sbin/chkconfig --del pbs_sched
%package server
Group: System Environment/Daemons
Summary: server part of Torque
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
Provides: pbs-server
%description server
%shared_description
This package holds the server.
%if "%build_server" == "yes"
%files server
%defattr(-, root, root)
%{_sbindir}/pbs_server
%{_sbindir}/qserverd
%{_initrddir}/pbs_server
%{torquehomedir}/server_logs
%{torquehomedir}/server_priv
%endif
%post server
/sbin/chkconfig --add pbs_server
%preun server
[ $1 = 0 ] || exit 0
/sbin/chkconfig --del pbs_server
%package mom
Group: System Environment/Daemons
Summary: execution part of Torque
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
Provides: pbs-mom
%description mom
%shared_description
This package holds the execute daemon required on every node.
%if "%build_mom" == "yes"
%files mom
%defattr(-, root, root)
%{_sbindir}/pbs_mom
%{_sbindir}/qnoded
%{_sbindir}/pbs_demux
%{_bindir}/pbs_track
%{_initrddir}/pbs_mom
%if "%build_pbs_rcp" == "yes"
%attr(4755 root root) %{_sbindir}/pbs_rcp
%endif
%{torquehomedir}/mom_priv/*
%{torquehomedir}/mom_logs
%{torquehomedir}/checkpoint
%{torquehomedir}/undelivered
%endif
%post mom
/sbin/chkconfig --add pbs_mom
%preun mom
[ $1 = 0 ] || exit 0
/sbin/chkconfig --del pbs_mom
%package client
Group: Applications/System
Summary: client part of Torque
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
Provides: pbs-client
%description client
%shared_description
This package holds the command-line client programs.
%if "%build_clients" == "yes"
%files client
%defattr(-, root, root)
%{_bindir}/q*
%{_bindir}/chk_tree
%{_bindir}/hostn
%{_bindir}/nqs2pbs
%{_bindir}/pbsdsh
%{_bindir}/pbsnodes
%{_bindir}/printjob
%{_bindir}/printtracking
%{_bindir}/printserverdb
%{_bindir}/tracejob
%{_sbindir}/momctl
%attr(4755 root root) %{_sbindir}/pbs_iff
%if "%use_tcl" == "1"
%{_bindir}/pbs_tclsh
%endif
%endif
%package gui
Group: Applications/System
Summary: graphical client part of Torque
Requires: %{name}-client = %{?epoch:%{epoch}:}%{version}-%{release}
Provides: xpbs xpbsmon
%description gui
%shared_description
This package holds the graphical clients.
%if "%build_gui" == "yes"
%files gui
%defattr(-, root, root)
%{_bindir}/pbs_wish
%{_bindir}/xpbs
%{_bindir}/xpbsmon
%{_libdir}/xpbs
%{_libdir}/xpbsmon
%endif
%package localhost
Group: Applications/System
Summary: installs and configures a minimal localhost-only batch queue system
PreReq: pbs-mom pbs-server pbs-client pbs-scheduler
%description localhost
%shared_description
This package installs and configures a minimal localhost-only batch queue system.
%files localhost
%defattr(-, root, root)
%post localhost
/sbin/chkconfig pbs_mom on
/sbin/chkconfig pbs_server on
/sbin/chkconfig pbs_sched on
/bin/hostname --long > %{torquehomedir}/server_priv/nodes
/bin/hostname --long > %{torquehomedir}/server_name
/bin/hostname --long > %{torquehomedir}/mom_priv/config
pbs_server -t create
qmgr -c "s s scheduling=true"
qmgr -c "c q batch queue_type=execution"
qmgr -c "s q batch started=true"
qmgr -c "s q batch enabled=true"
qmgr -c "s q batch resources_default.nodes=1"
qmgr -c "s q batch resources_default.walltime=3600"
qmgr -c "s s default_queue=batch"
%{_initrddir}/pbs_mom restart
%{_initrddir}/pbs_sched restart
%{_initrddir}/pbs_server restart
qmgr -c "s n `/bin/hostname --long` state=free" -e
%package devel
Summary: Development tools for programs which will use the %{name} library
Group: Development/Libraries
Provides: lib%{name}-devel
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
%description devel
%shared_description
This package includes the header files and static libraries
necessary for developing programs which will use %{name}.
%files devel
%defattr(-, root, root)
%{_libdir}/libtorque*.a
%{_libdir}/libtorque*.so
%{_includedir}/pbs_error.h
%{_includedir}/pbs_error_db.h
%{_includedir}/pbs_ifl.h
%{_includedir}/rm.h
%{_includedir}/rpp.h
%{_includedir}/tm_.h
%{_includedir}/tm.h
%{_bindir}/pbs-config
%package pam
Summary: PAM module for PBS MOM nodes
Group: System Environment/Base
%description pam
%shared_description
A simple PAM module to authorize users on PBS MOM nodes with a running job.
%if "%pammoddir" != "disabled"
%files pam
%defattr(-, root, root)
%doc src/pam/README.pam
%pammoddir/pam_pbssimpleauth.so
%endif
%package drmaa
Summary: DRMAA 1.0 implementation for PBS/TORQUE
Group: System Environment/Base
%description drmaa
%shared_description
An API specification for the submission and control of jobs to one or more
Distributed Resource Management (DRM) systems.
%if "%build_drmaa" == "yes"
%files drmaa
%defattr(-, root, root)
%{_libdir}/libdrmaa.*
%{_includedir}/drmaa.h
%endif
%package drmaa-docs
Summary: DRMAA 1.0 implementation for PBS/TORQUE
Group: System Environment/Base
%description drmaa-docs
%shared_description
An API specification for the submission and control of jobs to one or more
Distributed Resource Management (DRM) systems.
%if "%build_drmaa_docs" == "yes"
%files drmaa-docs
%defattr(-, root, root)
%{drmaadocdir}
%endif
+517
View File
@@ -0,0 +1,517 @@
# Conditional build stuff; from rpm 4.4 /usr/lib/rpm/macros.
# bcond_without defaults to WITH, and vice versa.
%if %{!?with:1}0
%define with() %{expand:%%{?with_%{1}:1}%%{!?with_%{1}:0}}
%endif
%if %{!?without:1}0
%define without() %{expand:%%{?with_%{1}:0}%%{!?with_%{1}:1}}
%endif
%if %{!?bcond_with:1}0
%define bcond_with() %{expand:%%{?_with_%{1}:%%global with_%{1} 1}}
%endif
%if %{!?bcond_without:1}0
%define bcond_without() %{expand:%%{!?_without_%{1}:%%global with_%{1} 1}}
%endif
# If _initrddir is defined, which indicates that we are on a system with SYSV
# init.d services, define _initrddir to be /etc/init.d so that the source
# tarball will work across both Red Hat and SUSE distros.
%if %{?_initrddir:1}0
%define _initrddir /etc/init.d
%endif
# some binaries under /bin in el5|6 are only provided in /usr/bin in el7+.
# the el7 rpms actually provide the old location, but can't be used as a rpm requirement
# introducing the rootbin macro for this, as none seems to exists
%if 0%{?el6:1} || 0%{?el5:1}
%define rootbin /bin
%else
%define rootbin /usr/bin
%endif
### Features disabled by default
%bcond_with blcr
%bcond_with cpuset
%bcond_with cgroups
%bcond_with debug
%bcond_with drmaa
%bcond_with gui
%bcond_with libcpuset
%bcond_with memacct
%bcond_with munge
%bcond_with numa
%bcond_with pam
%bcond_with top
%bcond_with readline
### Features enabled by default
%bcond_without scp
%bcond_without spool
%bcond_without syslog
### Autoconf macro expansions
%define ac_with_blcr --%{?with_blcr:en}%{!?with_blcr:dis}able-blcr
%define ac_with_cpuset --%{?with_cpuset:en}%{!?with_cpuset:dis}able-cpuset
%define ac_with_cgroups --%{?with_cgroups:en}%{!?with_cgroups:dis}able-cgroups
%define ac_with_debug --with%{!?with_debug:out}-debug %{?with_debug:CFLAGS="-O0 -g3" CXXFLAGS="-O0 -g3"}
%define ac_with_drmaa --%{?with_drmaa:en}%{!?with_drmaa:dis}able-drmaa
%define ac_with_gui --%{?with_gui:en}%{!?with_gui:dis}able-gui --with%{!?with_gui:out}-tcl
%define ac_with_munge --%{?with_munge:en}%{!?with_munge:dis}able-munge-auth --%{?with_munge:en}%{!?with_munge:dis}able-munge-library
%define ac_with_numa --%{?with_numa:en}%{!?with_numa:dis}able-numa-support
%define ac_with_memacct --%{?with_memacct:en}%{!?with_memacct:dis}able-memacct
%define ac_with_libcpuset --%{?with_libcpuset:en}%{!?with_libcpuset:dis}able-libcpuset
%define ac_with_top --%{?with_top:en}%{!?with_top:dis}able-top-tempdir-only
%define ac_with_pam --with%{!?with_pam:out}-pam%{?with_pam:=/%{_lib}/security}
%define ac_with_scp --with-rcp=%{?with_scp:scp}%{!?with_scp:pbs_rcp}
%define ac_with_spool --%{?with_spool:en}%{!?with_spool:dis}able-spool
%define ac_with_syslog --%{?with_syslog:en}%{!?with_syslog:dis}able-syslog
%define ac_trqauthd_sock_dir %{?trqauthd_sock_dir:%{trqauthd_sock_dir}}%{!?trqauthd_sock_dir:/tmp}
### Build Requirements
%define breq_cpuset %{?with_cpuset:hwloc-devel}
%define breq_gui %{?with_gui:tcl-devel tk-devel tclx}
%define breq_numa %{?with_cpuset:hwloc-devel}
%define breq_munge %{?with_munge:munge-devel}
%define breq_pam %{?with_pam:pam-devel}
%define breq_readline %{?with_readline:readline-devel}
%define breq_scp %{?with_scp:/usr/bin/scp}
# Requirements
%define req_cgroups %{?with_cgroups:%{rootbin}/lssubsys}
### Macro variables
%{!?torque_user:%global torque_user torque}
%{!?torque_home:%global torque_home %{_var}/spool/%{name}}
%{!?torque_server:%global torque_server localhost}
%{!?sendmail_path:%global sendmail_path %{_sbindir}/sendmail}
### Do not strip executables when debugging.
%if %{with debug}
%global __os_install_post /usr/lib/rpm/brp-compress
%global __debug_install_post %{nil}
%global debug_package %{nil}
%endif
### Handle logic for snapshots
%define tarversion @SPEC_VERSION@
#define snap 0
%if %{?snap}0
%{expand:%%define version %(echo %{tarversion} | sed 's/-snap\..*$//')}
%{expand:%%define release 0.adaptive.snap.%(echo %{tarversion} | sed 's/^.*-snap\.//').0%{?dist}}
%else
%define version %{tarversion}
%define release 1.adaptive%{?dist}
%endif
Name: @SPEC_NAME@
Version: %{version}
Release: %{release}
Summary: Tera-scale Open-source Resource and QUEue manager
License: OpenPBS License (ASF-like)
Group: Applications/System
URL: http://www.clusterresources.com/products/torque/
Packager: %{?_packager:%{_packager}}%{!?_packager:%{_vendor}}
Source: http://www.clusterresources.com/downloads/torque/%{name}-%{tarversion}.tar.gz
Vendor: %{?_vendorinfo:%{_vendorinfo}}%{!?_vendorinfo:%{_vendor}}
Distribution: %{?_distribution:%{_distribution}}%{!?_distribution:%{_vendor}}
#BuildSuggests: openssh-clients tcl-devel tclx tk-devel
BuildRequires: %{breq_cpuset} %{breq_gui} %{breq_numa} %{breq_munge} %{breq_pam} %{breq_readline} %{breq_scp} make openssl-devel libxml2-devel boost-devel
Conflicts: pbspro, openpbs, openpbs-oscar
Obsoletes: scatorque <= %{version}-%{release}, %{!?with_gui:%{name}-gui < %{version}-%{release}}
Provides: pbs, pbs-docs, pbs-pam, %{!?with_gui:%{name}-gui = %{version}-%{release}}
Provides: %{name}-docs = %{version}-%{release}
Prefix: %{_prefix}
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
%description
TORQUE is an open source resource manager providing control over batch
jobs and distributed compute nodes. It is a community effort based on
the original *PBS project and, with more than 5,200 patches, has
incorporated significant advances in the areas of scalability, fault
tolerance, and feature extensions contributed by NCSA, OSC, USC, the
U.S. Dept of Energy, Sandia, PNNL, U of Buffalo, TeraGrid, and many
other leading edge HPC organizations.
%package server
Summary: TORQUE Server
Group: Applications/System
Provides: pbs-server = %{version}-%{release}
%description server
Package for TORQUE server systems.
%package devel
Summary: TORQUE Development Files
Group: Applications/System
Requires: %{name} = %{version}-%{release}
Provides: pbs-devel = %{version}-%{release}
Provides: lib%{name}-devel = %{version}-%{release}
%description devel
Development headers and libraries for TORQUE
%package scheduler
Summary: TORQUE FIFO Scheduler
Group: Applications/System
Requires: %{name} = %{version}-%{release}
Provides: pbs-scheduler = %{version}-%{release}
%description scheduler
A simple FIFO scheduler for TORQUE
%package client
Summary: TORQUE Client
Group: Applications/System
Requires: %{name} = %{version}-%{release}
%if %{with cgroups}
Requires: %{req_cgroups}
%endif
Provides: pbs-client pbs-mom %{?with_pam:pbs-pam}
Provides: %{name}-mom = %{version}-%{release}
Obsoletes: %{name}-mom < %{version}-%{release}
%if %{with pam}
Provides: %{name}-pam = %{version}-%{release}
Obsoletes: %{name}-pam < %{version}-%{release}
%endif
%description client
Package for TORQUE client systems.
%if %{with gui}
%package gui
Summary: TORQUE GUI
Group: Applications/System
Requires: %{name}-client = %{version}-%{release}
Provides: pbs-gui = %{version}-%{release}, xpbs, xpbsmon
%description gui
Graphical clients for TORQUE
%endif
%if %{with drmaa}
%package drmaa
Summary: DRMAA 1.0 Implementation for TORQUE
Group: Applications/System
Provides: pbs-drmaa = %{version}-%{release}
%description drmaa
This package contains a DRMAA 1.0 implementation for use with TORQUE.
%endif
%prep
%setup -q -n %{name}-%{tarversion}
%build
CFLAGS="%{?cflags:%{cflags}}%{!?cflags:$RPM_OPT_FLAGS}"
CXXFLAGS="%{?cxxflags:%{cxxflags}}%{!?cxxflags:$RPM_OPT_FLAGS}"
LDFLAGS="%{?ldflags:%{ldflags}}%{!?ldflags:$RPM_LD_FLAGS}"
export CFLAGS CXXFLAGS LDFLAGS
# use cached configure DOXYGEN
export ac_cv_path_DOXYGEN=none
%configure --includedir=%{_includedir}/%{name} --with-default-server=%{torque_server} \
--with-server-home=%{torque_home} %{ac_with_debug} %{ac_with_libcpuset} \
--with-sendmail=%{sendmail_path} %{ac_with_numa} %{ac_with_memacct} %{ac_with_top} \
--with-trqauthd-sock-dir=%{ac_trqauthd_sock_dir} %{?xauth_path:--with-xauth=%{xauth_path}} \
--disable-dependency-tracking %{ac_with_gui} %{ac_with_scp} %{ac_with_syslog} \
--disable-gcc-warnings %{ac_with_munge} %{ac_with_pam} %{ac_with_drmaa} \
--disable-qsub-keep-override %{ac_with_blcr} %{ac_with_cpuset} %{ac_with_cgroups} %{ac_with_spool} %{?acflags}
%{__make} %{?_smp_mflags} %{?mflags}
%install
%{__make} install DESTDIR=$RPM_BUILD_ROOT %{?mflags_install}
%{__rm} -rf $RPM_BUILD_ROOT/%{_lib}/security/*a $RPM_BUILD_ROOT%{_sysconfdir}/modulefiles
%if %{?_unitdir:1}0
# systemd unit files
%{__mkdir_p} $RPM_BUILD_ROOT%{_unitdir}
for UNITFILE in pbs_mom.service pbs_sched.service pbs_server.service trqauthd.service ; do
%{__sed} -e 's|^PBS_HOME=.*|PBS_HOME=%{torque_home}|' \
-e 's|^BIN_PATH=.*|BIN_PATH=%{_bindir}|' \
-e 's|^SBIN_PATH=.*|SBIN_PATH=%{_sbindir}|' contrib/systemd/$UNITFILE \
> $RPM_BUILD_ROOT%{_unitdir}/$UNITFILE
done
%else
%if %{?_initrddir:1}0
# init.d scripts
%{__mkdir_p} $RPM_BUILD_ROOT%{_initrddir}
INIT_PREFIX=""
test -f /etc/SuSE-release && INIT_PREFIX="suse."
for PROG in pbs_mom pbs_sched pbs_server trqauthd ; do
%{__sed} -e 's|^PBS_HOME=.*|PBS_HOME=%{torque_home}|' \
-e 's|^BIN_PATH=.*|BIN_PATH=%{_bindir}|' \
-e 's|^SBIN_PATH=.*|SBIN_PATH=%{_sbindir}|' \
-e 's|^PBS_DAEMON=.*|PBS_DAEMON=%{_sbindir}/'$PROG'|' contrib/init.d/$INIT_PREFIX$PROG \
> $RPM_BUILD_ROOT%{_initrddir}/$PROG
%{__chmod} 0755 $RPM_BUILD_ROOT%{_initrddir}/$PROG
done
%endif
%endif
# Configuration
echo %{torque_server} > $RPM_BUILD_ROOT%{torque_home}/server_priv/nodes
echo '$pbsserver %{torque_server}' > $RPM_BUILD_ROOT%{torque_home}/mom_priv/config
# Moab requires libtorque.so.0, but works with libtorque.so.2, so fudge it.
%{__ln_s} libtorque.so.2 $RPM_BUILD_ROOT%{_libdir}/libtorque.so.0
%if %{with drmaa}
# Move DRMAA docs back to the source tree so we can install them properly.
if test -d $RPM_BUILD_ROOT%{_docdir}/*drmaa*/html ; then
mv $RPM_BUILD_ROOT%{_docdir}/*drmaa* drmaa-doc-dir
else
mkdir drmaa-doc-dir
echo "Doxygen is required to build DRMAA API docs but was not present at build time." > drmaa-doc-dir/README.drmaa_docs
fi
%endif
%post
/sbin/ldconfig
if [ $1 -eq 1 ]; then
chkconfig --add trqauthd >/dev/null 2>&1 || :
chkconfig trqauthd on >/dev/null 2>&1 || :
service trqauthd start >/dev/null 2>&1 || :
else
service trqauthd try-restart >/dev/null 2>&1 || :
fi
%preun
if [ $1 -eq 0 ]; then
chkconfig trqauthd off >/dev/null 2>&1 || :
service trqauthd stop >/dev/null 2>&1 || :
chkconfig --del trqauthd >/dev/null 2>&1 || :
fi
%postun -p /sbin/ldconfig
%post server
if [ $1 -eq 1 ]; then
grep '^%{torque_user}:' /etc/passwd >/dev/null 2>&1 || useradd -r %{torque_user} || :
grep 'PBS services' /etc/services >/dev/null 2>&1 || cat <<-EOF >>/etc/services
# Standard PBS services
pbs 15001/tcp # pbs server (pbs_server)
pbs 15001/udp # pbs server (pbs_server)
pbs_mom 15002/tcp # mom to/from server
pbs_mom 15002/udp # mom to/from server
pbs_resmom 15003/tcp # mom resource management requests
pbs_resmom 15003/udp # mom resource management requests
pbs_sched 15004/tcp # scheduler
pbs_sched 15004/udp # scheduler
trqauthd 15005/tcp # authorization daemon
trqauthd 15005/udp # authorization daemon
EOF
if [ ! -e %{torque_home}/server_priv/serverdb ]; then
if [ "%{torque_server}" = "localhost" ]; then
TORQUE_SERVER=`hostname`
perl -pi -e "s/localhost/$TORQUE_SERVER/g" %{torque_home}/server_name %{torque_home}/server_priv/nodes 2>/dev/null || :
else
TORQUE_SERVER="%{torque_server}"
fi
pbs_server -t create -f >/dev/null 2>&1 || :
sleep 1
qmgr -c "set server scheduling = true" >/dev/null 2>&1 || :
qmgr -c "set server managers += root@$TORQUE_SERVER" >/dev/null 2>&1 || :
qmgr -c "set server managers += %{torque_user}@$TORQUE_SERVER" >/dev/null 2>&1 || :
qmgr -c "create queue batch queue_type = execution" >/dev/null 2>&1 || :
qmgr -c "set queue batch started = true" >/dev/null 2>&1 || :
qmgr -c "set queue batch enabled = true" >/dev/null 2>&1 || :
qmgr -c "set queue batch resources_default.walltime = 1:00:00" >/dev/null 2>&1 || :
qmgr -c "set queue batch resources_default.nodes = 1" >/dev/null 2>&1 || :
qmgr -c "set server default_queue = batch" >/dev/null 2>&1 || :
qmgr -c "set node $TORQUE_SERVER state = free" >/dev/null 2>&1 || :
killall -TERM pbs_server >/dev/null 2>&1 || :
fi
chkconfig --add pbs_server >/dev/null 2>&1 || :
chkconfig pbs_server on >/dev/null 2>&1 || :
service pbs_server start >/dev/null 2>&1 || :
else
service pbs_server try-restart >/dev/null 2>&1 || :
fi
%preun server
if [ $1 -eq 0 ]; then
chkconfig pbs_server off >/dev/null 2>&1 || :
service pbs_server stop >/dev/null 2>&1 || :
chkconfig --del pbs_server >/dev/null 2>&1 || :
fi
%post client
if [ $1 -eq 1 ]; then
grep 'PBS services' /etc/services >/dev/null 2>&1 || cat <<-EOF >>/etc/services
# Standard PBS services
pbs 15001/tcp # pbs server (pbs_server)
pbs 15001/udp # pbs server (pbs_server)
pbs_mom 15002/tcp # mom to/from server
pbs_mom 15002/udp # mom to/from server
pbs_resmom 15003/tcp # mom resource management requests
pbs_resmom 15003/udp # mom resource management requests
pbs_sched 15004/tcp # scheduler
pbs_sched 15004/udp # scheduler
trqauthd 15005/tcp # authorization daemon
trqauthd 15005/udp # authorization daemon
EOF
if [ "%{torque_server}" = "localhost" ]; then
TORQUE_SERVER=`hostname`
perl -pi -e "s/localhost/$TORQUE_SERVER/g" %{torque_home}/mom_priv/config 2>/dev/null || :
fi
chkconfig --add pbs_mom >/dev/null 2>&1 || :
chkconfig pbs_mom on >/dev/null 2>&1 || :
service pbs_mom start >/dev/null 2>&1 || :
else
service pbs_mom try-restart >/dev/null 2>&1 || :
fi
%preun client
if [ $1 -eq 0 ]; then
chkconfig pbs_mom off >/dev/null 2>&1 || :
service pbs_mom stop >/dev/null 2>&1 || :
chkconfig --del pbs_mom >/dev/null 2>&1 || :
fi
%post scheduler
if [ $1 -eq 1 ]; then
chkconfig --add pbs_sched >/dev/null 2>&1 || :
chkconfig pbs_sched on >/dev/null 2>&1 || :
service pbs_sched start >/dev/null 2>&1 || :
else
service pbs_sched try-restart >/dev/null 2>&1 || :
fi
%preun scheduler
if [ $1 -eq 0 ]; then
chkconfig pbs_sched off >/dev/null 2>&1 || :
service pbs_sched stop >/dev/null 2>&1 || :
chkconfig --del pbs_sched >/dev/null 2>&1 || :
fi
%clean
test "x$RPM_BUILD_ROOT" != "x/" && rm -rf $RPM_BUILD_ROOT
%files
%defattr(-, root, root)
%doc INSTALL INSTALL.GNU CHANGELOG PBS_License.txt README.* Release_Notes src/pam/README.pam
%doc doc/READ_ME doc/doc_fonts doc/soelim.c doc/ers
%config(noreplace) %{torque_home}/pbs_environment
%config(noreplace) /etc/ld.so.conf.d/torque.conf
%config(noreplace) /etc/profile.d/torque.sh
%config(noreplace) /etc/profile.d/torque.csh
%config(noreplace) %{torque_home}/server_name
%if %{?_unitdir:1}0
%{_unitdir}/trqauthd.service
%else
%if %{?_initrddir:1}0
%{_initrddir}/trqauthd
%endif
%endif
%{_bindir}/chk_tree
%{_bindir}/hostn
%{_bindir}/nqs2pbs
%{_bindir}/pbs_track
%{_bindir}/pbsdsh
%{_bindir}/pbsnodes
%{_bindir}/printjob
%{_bindir}/printserverdb
%{_bindir}/printtracking
%{_bindir}/q*
%{_bindir}/tracejob
%{_sbindir}/trqauthd
%if %{without scp}
%attr(4755, root, root) %{_sbindir}/pbs_rcp
%endif
%{_libdir}/lib%{name}.so*
%{torque_home}/aux
%{torque_home}/spool
%{torque_home}/checkpoint
%{_mandir}/man*/*
%files server
%defattr(-, root, root)
%doc torque.setup doc/admin_guide.ps
%dir %{torque_home}/server_priv
%config(noreplace) %{torque_home}/server_priv/nodes
%if %{?_unitdir:1}0
%{_unitdir}/pbs_server.service
%else
%if %{?_initrddir:1}0
%{_initrddir}/pbs_server
%endif
%endif
%{_sbindir}/momctl
%{_sbindir}/pbs_server
%{_sbindir}/qserverd
%{torque_home}/server_logs
%{torque_home}/server_priv/accounting
%{torque_home}/server_priv/acl*
%{torque_home}/server_priv/arrays
%{torque_home}/server_priv/credentials
%{torque_home}/server_priv/disallowed_types
%{torque_home}/server_priv/hostlist
%{torque_home}/server_priv/jobs
%{torque_home}/server_priv/queues
%files devel
%defattr(-, root, root)
%{_bindir}/pbs-config
%{_includedir}/%{name}
%{_libdir}/lib%{name}*a
%{_libdir}/lib%{name}*so
%files scheduler
%defattr(-, root, root)
%dir %{torque_home}/sched_priv
%config(noreplace) %{torque_home}/sched_priv/*
%{_sbindir}/pbs_sched
%{_sbindir}/qschedd
%if %{?_unitdir:1}0
%{_unitdir}/pbs_sched.service
%else
%if %{?_initrddir:1}0
%{_initrddir}/pbs_sched
%endif
%endif
%{torque_home}/sched_logs
%files client
%defattr(-, root, root)
%dir %{torque_home}/mom_priv
%config(noreplace) %{torque_home}/mom_priv/config
%if %{?_unitdir:1}0
%{_unitdir}/pbs_mom.service
%else
%if %{?_initrddir:1}0
%{_initrddir}/pbs_mom
%endif
%endif
%{_sbindir}/momctl
%{_sbindir}/pbs_demux
%{_sbindir}/pbs_mom
%{_sbindir}/qnoded
%if %{with pam}
/%{_lib}/security/pam_pbssimpleauth.so
%endif
%{torque_home}/mom_logs
%{torque_home}/mom_priv/jobs/
%{torque_home}/undelivered
%if %{with gui}
%files gui
%defattr(-, root, root)
%{_bindir}/pbs_tclsh
%{_bindir}/pbs_wish
%{_bindir}/xpbs*
%{_libdir}/xpbs*
%endif
%if %{with drmaa}
%files drmaa
%defattr(-, root, root)
%doc drmaa-doc-dir/*
%{_includedir}/%{name}/drmaa.h
%{_libdir}/libdrmaa.*
%endif
%changelog
* Sat Apr 07 2007 Mezzanine <mezzanine@kainx.org>
- Specfile auto-generated by Mezzanine