diff options
author | Justin Bronder <jsbronder@gentoo.org> | 2008-03-14 17:28:10 +0000 |
---|---|---|
committer | Justin Bronder <jsbronder@gentoo.org> | 2008-03-14 17:28:10 +0000 |
commit | 39b5cf78029339800ec3aaf94f92ad735c035cc5 (patch) | |
tree | 87d3b359fdaeead844667c8a098d6d1b97084036 /sys-cluster/torque | |
parent | seamonkey is affected as well (diff) | |
download | historical-39b5cf78029339800ec3aaf94f92ad735c035cc5.tar.gz historical-39b5cf78029339800ec3aaf94f92ad735c035cc5.tar.bz2 historical-39b5cf78029339800ec3aaf94f92ad735c035cc5.zip |
Fixes build problem when -DNDEBUG is in CPPFLAGS, bug #213279. Thanks to glen for the quick patch.
Package-Manager: portage-2.1.4.4
Diffstat (limited to 'sys-cluster/torque')
-rw-r--r-- | sys-cluster/torque/ChangeLog | 9 | ||||
-rw-r--r-- | sys-cluster/torque/Manifest | 10 | ||||
-rw-r--r-- | sys-cluster/torque/files/2.3.0-fixes_r2031.patch | 342 | ||||
-rw-r--r-- | sys-cluster/torque/torque-2.3.0-r1.ebuild | 232 |
4 files changed, 588 insertions, 5 deletions
diff --git a/sys-cluster/torque/ChangeLog b/sys-cluster/torque/ChangeLog index 5bd4dcce22e3..ea26537c9605 100644 --- a/sys-cluster/torque/ChangeLog +++ b/sys-cluster/torque/ChangeLog @@ -1,6 +1,13 @@ # ChangeLog for sys-cluster/torque # Copyright 2000-2008 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-cluster/torque/ChangeLog,v 1.59 2008/03/12 17:55:19 jsbronder Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-cluster/torque/ChangeLog,v 1.60 2008/03/14 17:28:09 jsbronder Exp $ + +*torque-2.3.0-r1 (14 Mar 2008) + + 14 Mar 2008; Justin Bronder <jsbronder@gentoo.org> + +files/2.3.0-fixes_r2031.patch, +torque-2.3.0-r1.ebuild: + Fixes build problem when -DNDEBUG is in CPPFLAGS, bug #213279. Thanks to + glen for the quick patch. *torque-2.3.0 (12 Mar 2008) diff --git a/sys-cluster/torque/Manifest b/sys-cluster/torque/Manifest index ef6840ff86e9..c8f1b2d66a45 100644 --- a/sys-cluster/torque/Manifest +++ b/sys-cluster/torque/Manifest @@ -1,6 +1,7 @@ -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 +AUX 2.3.0-fixes_r2031.patch 8484 RMD160 58429355795ed3304c986b7b667d86486bb1c8cf SHA1 2a47b277277fcfc97a26ccad7c967c9f8bf72932 SHA256 9f847cc8273b2b227d7163299ea856830c4d333527e1566b13e989d980866398 AUX pbs_mom-init.d-2.2.1 1003 RMD160 97be9b485fabd022ff209c910ae3974a73ebbc30 SHA1 cf50bac5a12a07535104ff7f7dcdfd054c995b2b SHA256 ef010854efc7a5c310c34bc53d1d927b7928bfa0d48bb5d8ae76bd3453f37a25 AUX pbs_mom-init.d-2.2.1-r1 1093 RMD160 ade6389bcda7974fd17c56c5f6f7a1c5b19c7fda SHA1 051455da4526b908ddb2346c912b68ba22245209 SHA256 ce5dfb1db62de8611974dcf15698dce75ef289f2a13d6a95039aec724748e64d AUX pbs_sched-init.d-2.2.1 1084 RMD160 a4f8b42dc5e004cbd9f8168cc39520d8bc1168d6 SHA1 57a9cb58ec8def6f3f51d7f76cf38c6375549fa1 SHA256 6efcf1b9f8f0f99599dacab686ce1e53b8202574d1a2ad7b138d1451cd466000 @@ -18,13 +19,14 @@ DIST torque-2.2.1.tar.gz 5370260 RMD160 219e5a4234a1bbf0241c15f568a720752e48587c DIST torque-2.3.0.tar.gz 5419629 RMD160 7dd4885cda583aa8ba16dce7b9001c009f264881 SHA1 e600b121aa6dae8e872935907311913cf8631d75 SHA256 eb5e694b6acdfe84249dfdf71552cb38d26e29fcda7ba09574b041e06290ec57 EBUILD torque-2.1.6.ebuild 4046 RMD160 8f86e25570708f5b654ddbaf457e63e3b6216d2a SHA1 da6d4c28dc8e4bd3602c774077e8105ad53dc138 SHA256 e50485f520e7f986daee2bee32a9c1a8bb5d5ad39a98c0a339b3935c0584d4af EBUILD torque-2.2.1-r2.ebuild 7217 RMD160 3c92a5d006c29eecc8581d8e8af781e41bbe7321 SHA1 687138f0dcec4ec79c7746f487ba3d2927c4b38c SHA256 8e5171c8dc04d36ca8812f337d7e2f1f1e3a8884858e4bf1d4883b209cb15548 +EBUILD torque-2.3.0-r1.ebuild 7310 RMD160 98bc45cf523d0bca9f49ca1e60311dc0ebb57087 SHA1 b8eb2b70605b81702a41c0c9fad7ad535bbe4ae0 SHA256 211f5884b598794b1971813cad91de3299aa3f4b387b53051c5b605bc4729f84 EBUILD torque-2.3.0.ebuild 7096 RMD160 6a333db5fead5a53805ea5424d061f20876d96f4 SHA1 f3ff1056ce34bfbb8f94b4a459dfb5aee1c0a1ce SHA256 a750f5a14bd4d22bdb7d1d94ddd3c61c843e4f2e5f296c0060a368af83df5798 -MISC ChangeLog 10870 RMD160 72b6ac7990f5e4f0e9760f64a92c58b20ea57a42 SHA1 a5ed6974925cce64deffb1e0f8125a1c8056f277 SHA256 73e247c99b8e32ef0c4ac1de65ab6c3684c30a9aed7c2c8b3a3d20b209c4e88b +MISC ChangeLog 11118 RMD160 6e93a8f604b78ca69ca43a6fdccd094ff4072ac2 SHA1 034ff8f9cc3d93c92c96113ad74056103f2b38b4 SHA256 9168e000ebd106324a6b941aec633883ac9781cb1c040934b4766182eb22a6c8 MISC metadata.xml 163 RMD160 ea1530cd45b9e04e8693261b9a94b5988e4b09a1 SHA1 443b7a3d8fb76c8d20647b165032ad358bfa3b6a SHA256 5a03bf3074b07158dffe793af69f7b0cd1e5c785537574713f9a7978032363a3 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.7 (GNU/Linux) -iD8DBQFH2Bh64MrvBE1wQ8kRAsJfAJ9+GrVvTEC07/4hPwXonpqZDkXZ+wCeIZGY -xNjVKG0jDF42C39fJU5Z2uw= -=fv1y +iD8DBQFH2rUs4MrvBE1wQ8kRAq5+AJ4tXvKFtJ0yKI4Sc9rbA6jWdc/hTQCgpeiI +Bm3m/T743Joe6JChIuV8cMA= +=LHy0 -----END PGP SIGNATURE----- diff --git a/sys-cluster/torque/files/2.3.0-fixes_r2031.patch b/sys-cluster/torque/files/2.3.0-fixes_r2031.patch new file mode 100644 index 000000000000..499a5e2e5b37 --- /dev/null +++ b/sys-cluster/torque/files/2.3.0-fixes_r2031.patch @@ -0,0 +1,342 @@ +Index: CHANGELOG +=================================================================== +--- CHANGELOG (revision 2013) ++++ CHANGELOG (revision 2032) +@@ -1,5 +1,9 @@ + c - crash b - bug fix e - enhancement f - new feature + ++2.3.1 ++ b - fixed memory leak in free_br for PBS_BATCH_MvJobFile case ++ e - torque can now compile on Linux and OS X with NDEBUG defined ++ + 2.3.0 + e - redesign how torque.spec is built + e - added -a to qrun to allow asynchronous job start +Index: src/resmom/start_exec.c +=================================================================== +--- src/resmom/start_exec.c (revision 2013) ++++ src/resmom/start_exec.c (revision 2032) +@@ -3313,16 +3313,18 @@ + + if (strlen(shell) == 0) + { ++#ifndef NDEBUG + extern char mom_host[]; +- ++#endif + DBPRT(("user \"%s\" may not have a shell defined on node \"%s\"\n", + pwdp->pw_name, + mom_host)); + } + else if (strstr(shell,"/bin/false") != NULL) + { ++#ifndef NDEBUG + extern char mom_host[]; +- ++#endif + DBPRT(("user \"%s\" has shell \"/bin/false\" on node \"%s\"\n", + pwdp->pw_name, + mom_host)); +Index: src/resmom/requests.c +=================================================================== +--- src/resmom/requests.c (revision 2013) ++++ src/resmom/requests.c (revision 2032) +@@ -1479,8 +1479,9 @@ + int signum) + + { ++#ifndef NDEBUG + char id[] = "sigalltasks_sisters"; +- ++#endif + char *cookie; + eventent *ep; + int i; +Index: src/resmom/mom_main.c +=================================================================== +--- src/resmom/mom_main.c (revision 2013) ++++ src/resmom/mom_main.c (revision 2032) +@@ -4884,8 +4884,9 @@ + int fd) + + { ++#ifndef NDEBUG + static char id[] = "do_tcp"; +- ++#endif + int ret, proto, version; + int tm_request A_((int stream, int version)); + +Index: src/resmom/darwin/mom_mach.c +=================================================================== +--- src/resmom/darwin/mom_mach.c (revision 2013) ++++ src/resmom/darwin/mom_mach.c (revision 2032) +@@ -400,7 +400,9 @@ + job *pjob) + + { ++#ifndef NDEBUG + static char id[] = "cput_sum"; ++#endif + int i; + u_long cputime; + int nps = 0; +@@ -480,7 +482,9 @@ + job *pjob) /* I */ + + { ++#ifndef NDEBUG + char *id = "mem_sum"; ++#endif + int i; + unsigned long memsize = 0; + +@@ -527,7 +531,9 @@ + job *pjob) + + { ++#ifndef NDEBUG + char *id = "resi_sum"; ++#endif + int i; + unsigned long memsize = 0; + +@@ -658,7 +664,9 @@ + job *pjob; + int set_mode; /* SET_LIMIT_SET or SET_LIMIT_ALTER */ + { ++#ifndef NDEBUG + char *id = "mom_set_limits"; ++#endif + char *pname; + int retval; + unsigned long value; /* place in which to build resource value */ +@@ -777,7 +785,9 @@ + + job *pjob) + { ++#ifndef NDEBUG + char *id = "mom_do_poll"; ++#endif + char *pname; + resource *pres; + +@@ -820,7 +830,9 @@ + int mom_open_poll() + + { ++#ifndef NDEBUG + char *id = "mom_open_poll"; ++#endif + + DBPRT(("%s: entered\n", + id)) +@@ -1032,7 +1044,9 @@ + job *pjob) + + { ++#ifndef NDEBUG + char *id = "mom_over_limit"; ++#endif + char *pname; + int retval; + unsigned long value, num; +@@ -1416,7 +1430,9 @@ + pid_t jobid) + + { ++#ifndef NDEBUG + char *id = "cput_job"; ++#endif + int i; + unsigned long cputime; + time_value_t total_time; +@@ -1487,7 +1503,9 @@ + pid_t pid) + + { ++#ifndef NDEBUG + char *id = "cput_proc"; ++#endif + uint cputime; + int i; + time_value_t total_time; +@@ -1597,7 +1615,9 @@ + pid_t jobid) + + { ++#ifndef NDEBUG + char *id = "mem_job"; ++#endif + int i; + int memsize, addmem; + int found = 0; +Index: src/resmom/darwin/mom_start.c +=================================================================== +--- src/resmom/darwin/mom_start.c (revision 2013) ++++ src/resmom/darwin/mom_start.c (revision 2032) +@@ -188,7 +188,9 @@ + + void scan_for_terminated() + { ++#ifndef NDEBUG + static char id[] = "scan_for_terminated"; ++#endif + int exiteval; + pid_t pid; + job *pjob; +Index: src/resmom/mom_inter.c +=================================================================== +--- src/resmom/mom_inter.c (revision 2013) ++++ src/resmom/mom_inter.c (revision 2032) +@@ -581,8 +581,9 @@ + #ifdef IPV6_V6ONLY + if (ai->ai_family == AF_INET6) { + int on = 1; +- if (setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof(on)) < 0) ++ if (setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof(on)) < 0) { + DBPRT(("setsockopt IPV6_V6ONLY: %.100s\n", strerror(errno))); ++ } + } + #endif + if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) { +Index: src/server/node_func.c +=================================================================== +--- src/server/node_func.c (revision 2013) ++++ src/server/node_func.c (revision 2032) +@@ -1132,7 +1132,9 @@ + int update_nodes_file() + + { ++#ifndef NDEBUG + static char id[] = "update_nodes_file"; ++#endif + struct pbsnode *np; + int i, j; + FILE *nin; +Index: src/server/req_movejob.c +=================================================================== +--- src/server/req_movejob.c (revision 2013) ++++ src/server/req_movejob.c (revision 2032) +@@ -121,7 +121,9 @@ + struct batch_request *req) + + { ++#ifndef NDEBUG + char *id = "req_movejob"; ++#endif + job *jobp; + + jobp = chk_job_request(req->rq_ind.rq_move.rq_jid,req); +@@ -220,7 +222,9 @@ + struct batch_request *req) /* I */ + + { ++#ifndef NDEBUG + char *id = "req_orderjob"; ++#endif + job *pjob; + job *pjob1; + job *pjob2; +Index: src/server/node_manager.c +=================================================================== +--- src/server/node_manager.c (revision 2013) ++++ src/server/node_manager.c (revision 2032) +@@ -2130,7 +2130,9 @@ + */ + int write_node_note() + { ++#ifndef NDEBUG + static char id[] = "write_node_note"; ++#endif + struct pbsnode *np; + int i; + FILE *nin; +Index: src/server/process_request.c +=================================================================== +--- src/server/process_request.c (revision 2013) ++++ src/server/process_request.c (revision 2032) +@@ -1080,11 +1080,7 @@ + + break; + +- /* CRI RT #255 reports a memory leak at this point, but I can't +- * reproduce it, so I'm just leaving this here for now */ + case PBS_BATCH_MvJobFile: +- log_err(-1,"free_br","BUG: NOT freeing from PBS_BATCH_MvJobFile"); +- break; + case PBS_BATCH_jobscript: + + if (preq->rq_ind.rq_jobfile.rq_data) +Index: src/lib/Libattr/attr_fn_resc.c +=================================================================== +--- src/lib/Libattr/attr_fn_resc.c (revision 2013) ++++ src/lib/Libattr/attr_fn_resc.c (revision 2032) +@@ -81,9 +81,7 @@ + #include <assert.h> + #include <ctype.h> + #include <memory.h> +-#ifndef NDEBUG + #include <stdio.h> +-#endif + #include <stdlib.h> + #include <string.h> + #include "pbs_ifl.h" +Index: src/lib/Libattr/attr_node_func.c +=================================================================== +--- src/lib/Libattr/attr_node_func.c (revision 2013) ++++ src/lib/Libattr/attr_node_func.c (revision 2032) +@@ -82,9 +82,7 @@ + #include <sys/types.h> + #include <ctype.h> + #include <memory.h> +-#ifndef NDEBUG + #include <stdio.h> +-#endif + #include <stdlib.h> + #include <string.h> + #include <assert.h> +Index: src/lib/Libifl/tcp_dis.c +=================================================================== +--- src/lib/Libifl/tcp_dis.c (revision 2013) ++++ src/lib/Libifl/tcp_dis.c (revision 2032) +@@ -587,8 +587,9 @@ + size_t ct) /* I */ + + { ++#ifndef NDEBUG + char *id = "tcp_puts"; +- ++#endif + struct tcpdisbuf *tp; + + tp = &tcparray[fd]->writebuf; +Index: src/lib/Libifl/list_link.c +=================================================================== +--- src/lib/Libifl/list_link.c (revision 2013) ++++ src/lib/Libifl/list_link.c (revision 2032) +@@ -81,10 +81,8 @@ + + #include "portability.h" + #include "list_link.h" +-#ifndef NDEBUG + #include <stdio.h> + #include <stdlib.h> +-#endif + + + /* +Index: src/lib/Libnet/rm.c +=================================================================== +--- src/lib/Libnet/rm.c (revision 2013) ++++ src/lib/Libnet/rm.c (revision 2032) +@@ -998,7 +998,9 @@ + int activereq(void) + + { ++#ifndef NDEBUG + static char id[] = "activereq"; ++#endif + + #if RPP + struct out *op; diff --git a/sys-cluster/torque/torque-2.3.0-r1.ebuild b/sys-cluster/torque/torque-2.3.0-r1.ebuild new file mode 100644 index 000000000000..e5074ad5827e --- /dev/null +++ b/sys-cluster/torque/torque-2.3.0-r1.ebuild @@ -0,0 +1,232 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-cluster/torque/torque-2.3.0-r1.ebuild,v 1.1 2008/03/14 17:28:09 jsbronder Exp $ + +inherit autotools flag-o-matic eutils linux-info + +DESCRIPTION="Resource manager and queuing system based on OpenPBS" +HOMEPAGE="http://www.clusterresources.com/products/torque/" +SRC_URI="http://www.clusterresources.com/downloads/${PN}/${P}.tar.gz" + +LICENSE="openpbs" + +SLOT="0" +KEYWORDS="~amd64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86" +IUSE="tk crypt server syslog doc cpusets kernel_linux" +PROVIDE="virtual/pbs" + +# ed is used by makedepend-sh +DEPEND_COMMON="virtual/libc + sys-libs/ncurses + sys-libs/readline + tk? ( dev-lang/tk ) + syslog? ( virtual/logger ) + !virtual/pbs + !sys-cluster/openpbs-common + !<x11-misc/qterm-0.4.0-r1" + +DEPEND="${DEPEND_COMMON} + sys-apps/ed" + +RDEPEND="${DEPEND_COMMON} + crypt? ( net-misc/openssh ) + !crypt? ( net-misc/netkit-rsh )" + +[ -n "${PBS_SERVER_HOME}" ] || PBS_SERVER_HOME="/var/spool/torque" + +pkg_setup() { + linux-info_pkg_setup + USE_CPUSETS="--disable-cpusets" + if use cpusets; then + if use ! kernel_linux; then + einfo + elog " Torque currently only has support for cpusets in linux." + elog "Assuming you didn't really want this USE flag." + einfo + else + einfo + elog " Torque support for cpusets is still in development, you may" + elog "wish to disable it for production use." + einfo + if ! linux_chkconfig_present CPUSETS; then + einfo + elog " Torque support for cpusets will require that you recompile" + elog "your kernel with CONFIG_CPUSETS enabled." + einfo + fi + USE_CPUSETS="--enable-cpusets" + fi + fi +} + +src_unpack() { + unpack ${A} + cd "${S}" + + # Pulled from the torque-2.3.0-fixes branch. Takes care of bug 213279. + # Will not be required next version. + epatch "${FILESDIR}"/${PV}-fixes_r2031.patch +} + +src_compile() { + local myconf="--with-rcp=mom_rcp" + + use crypt && myconf="--with-rcp=scp" + + [ -n "${PBS_SERVER_NAME}" ] || PBS_SERVER_NAME=$(hostname -f) + + econf \ + $(use_enable tk gui) \ + $(use_enable syslog) \ + $(use_enable server) \ + --with-server-home=${PBS_SERVER_HOME} \ + --with-environ=/etc/pbs_environment \ + --with-default-server=${PBS_SERVER_NAME} \ + --disable-gcc-warnings \ + ${USE_CPUSETS} \ + ${myconf} \ + || die "econf failed" + emake || die "emake failed" +} + +# WARNING +# OpenPBS is extremely stubborn about directory permissions. Sometimes it will +# just fall over with the error message, but in some spots it will just ignore +# you and fail strangely. Likewise it also barfs on our .keep files! +pbs_createspool() { + local root="$1" + local s="$(dirname "${PBS_SERVER_HOME}")" + local h="${PBS_SERVER_HOME}" + local sp="${h}/server_priv" + einfo "Building spool directory under ${D}${h}" + local a d m + local dir_spec=" + 0755:${h}/aux 0700:${h}/checkpoint + 0755:${h}/mom_logs 0751:${h}/mom_priv 0751:${h}/mom_priv/jobs + 1777:${h}/spool 1777:${h}/undelivered" + + if use server; then + dir_spec="${dir_spec} 0755:${h}/sched_logs + 0755:${h}/sched_priv/accounting 0755:${h}/server_logs + 0750:${h}/server_priv 0755:${h}/server_priv/accounting + 0750:${h}/server_priv/acl_groups 0750:${h}/server_priv/acl_hosts + 0750:${h}/server_priv/acl_svr 0750:${h}/server_priv/acl_users + 0750:${h}/server_priv/jobs 0750:${h}/server_priv/queues" + fi + + for a in ${dir_spec}; do + d="${a/*:}" + m="${a/:*}" + if [[ ! -d "${root}${d}" ]]; then + install -d -m${m} "${root}${d}" + else + chmod ${m} "${root}${d}" + fi + # (#149226) If we're running in src_*, then keepdir + if [[ "${root}" = "${D}" ]]; then + keepdir ${d} + fi + done +} + +src_install() { + # Make directories first + pbs_createspool "${D}" + + make DESTDIR="${D}" install || die "make install failed" + + dodoc CHANGELOG DEVELOPMENT README.* Release_Notes || die "dodoc failed" + if use doc; then + dodoc doc/admin_guide.ps doc/*.pdf || die "dodoc failed" + fi + + # The build script isn't alternative install location friendly, + # So we have to fix some hard-coded paths in tclIndex for xpbs* to work + for file in `find "${D}" -iname tclIndex`; do + sed -e "s/${D//\// }/ /" "${file}" > "${file}.new" + mv "${file}.new" "${file}" + done + + if use server; then + newinitd "${FILESDIR}"/pbs_server-init.d-2.2.1-r1 pbs_server + newinitd "${FILESDIR}"/pbs_sched-init.d-2.2.1-r1 pbs_sched + fi + newinitd "${FILESDIR}"/pbs_mom-init.d-2.2.1-r1 pbs_mom + newconfd "${FILESDIR}"/torque-conf.d-2.2.1-r1 torque + newenvd "${FILESDIR}"/torque-env.d-2.2.1-r1 25torque +} + +pkg_preinst() { + if [[ -f "${ROOT}etc/pbs_environment" ]]; then + cp "${ROOT}etc/pbs_environment" "${D}"/etc/pbs_environment + fi + + if [ -n "${PBS_SERVER_NAME}" ]; then + echo "${PBS_SERVER_NAME}" > "${D}${PBS_SERVER_HOME}/server_name" + elif [[ -f "${ROOT}${PBS_SERVER_HOME}/server_name" ]]; then + cp "${ROOT}${PBS_SERVER_HOME}/server_name" "${D}${PBS_SERVER_HOME}/server_name" + fi + + # Fix up the env.d file to use our set server home. + sed -i "s:/var/spool/torque:${PBS_SERVER_HOME}:g" "${D}"/etc/env.d/25torque +} + +pkg_postinst() { + pbs_createspool "${ROOT}" + elog " If this is the first time torque has been installed, then you are not" + elog "ready to start the server. Please refer to the documentation located at:" + elog "http://www.clusterresources.com/wiki/doku.php?id=torque:torque_wiki" + + elog " For a basic setup, you may use emerge --config ${PN}" +} + +# Either the correct PBS_SERVER_HOME and PBS_SERVER_NAME are set +# or we use the default HOME and the localhost as the server. +# root will be setup as the primary operator/manager, the local machine +# will be added as a node and we'll create a simple queue, batch. +pkg_config() { + local h="${ROOT}/${PBS_SERVER_HOME}" + local rc=0 + + ebegin "Configuring Torque" + [ -n "${PBS_SERVER_NAME}" ] || PBS_SERVER_NAME=$(hostname -f) + einfo "Using ${PBS_SERVER_HOME} as the pbs homedir" + einfo "Using ${PBS_SERVER_NAME} as the pbs_server" + + # Check for previous configuration and bail if found. + if [ -e "${h}/server_priv/acl_svr/operators" ] \ + || [ -e "${h}/server_priv/nodes" ] \ + || [ -e "${h}/mom_priv/config" ]; then + ewarn "Previous Torque configuration detected. Press any key to" + ewarn "continue or press Control-C to abort now" + read + fi + + # pbs_mom configuration. + echo "\$pbsserver ${PBS_SERVER_NAME}" > "${h}/mom_priv/config" + echo "\$logevent 255" >> "${h}/mom_priv/config" + + if use server; then + local qmgr="${ROOT}/usr/bin/qmgr -c" + if ! echo "y" | "${ROOT}"/usr/sbin/pbs_server \ + -d "${ROOT}${PBS_SERVER_HOME}" -t create &>/dev/null; then + eerror "Failed to start pbs_server" + rc=1 + else + ${qmgr} "set server operators = root@$(hostname -f)" ${PBS_SERVER_NAME} + ${qmgr} "create queue batch" ${PBS_SERVER_NAME} + ${qmgr} "set queue batch queue_type = Execution" ${PBS_SERVER_NAME} + ${qmgr} "set queue batch started = True" ${PBS_SERVER_NAME} + ${qmgr} "set queue batch enabled = True" ${PBS_SERVER_NAME} + ${qmgr} "set server default_queue = batch" ${PBS_SERVER_NAME} + ${qmgr} "set server resources_default.nodes = 1" ${PBS_SERVER_NAME} + ${qmgr} "set server scheduling = True" ${PBS_SERVER_NAME} + + "${ROOT}"/usr/bin/qterm -t quick ${PBS_SERVER_NAME} || rc=1 + + # Add the local machine as a node. + echo "$(hostname -f) np=1" > "${h}/server_priv/nodes" + fi + fi + eend ${rc} +} |