diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2015-08-08 13:49:04 -0700 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2015-08-08 17:38:18 -0700 |
commit | 56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch) | |
tree | 3f91093cdb475e565ae857f1c5a7fd339e2d781e /sys-cluster/torque | |
download | gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2 gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip |
proj/gentoo: Initial commit
This commit represents a new era for Gentoo:
Storing the gentoo-x86 tree in Git, as converted from CVS.
This commit is the start of the NEW history.
Any historical data is intended to be grafted onto this point.
Creation process:
1. Take final CVS checkout snapshot
2. Remove ALL ChangeLog* files
3. Transform all Manifests to thin
4. Remove empty Manifests
5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$
5.1. Do not touch files with -kb/-ko keyword flags.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests
X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project
X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration
X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn
X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts
X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration
X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging
X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'sys-cluster/torque')
23 files changed, 1906 insertions, 0 deletions
diff --git a/sys-cluster/torque/Manifest b/sys-cluster/torque/Manifest new file mode 100644 index 000000000000..2b20c8acc5c6 --- /dev/null +++ b/sys-cluster/torque/Manifest @@ -0,0 +1,3 @@ +DIST torque-2.5.13.tar.gz 5854910 SHA256 ab59d4c8e8b45383ddd8202fa83956816175e348bb955a4ad5f7e3cd4dde5ff9 SHA512 e08ddf3950bb32177f4bc504a502fae3928a616739c28ca9687c5207606817d4589583306508a2c568cf19fc8c5617dc4a9decc81576c2875660b715c256cfcf WHIRLPOOL 29eefb89d1eb9d6a81735aa117922a1eb0b72e14eeccab7dbd70cdcf01431b7ecd9c3927e1c5c28b7f42d6739b28f45386740b92adb790ccdf9803e4c6e38534 +DIST torque-4.1.7.tar.gz 6218108 SHA256 3c86b2d84589f54ac222e81dd1953d153e1d836163d2000412369fefd25fb2af SHA512 5a085c0a7b205fed075bff4599db90ca5c4bb5f22d87d76fd56539d5cc1935bb8eeffcd4d18ba84401bd4ca128718070b69c8b91ab6814a4638622ba351654e6 WHIRLPOOL cae9216f0cebc22927eec2d1f007b1a3c4a6cc619f2926c40a5f46e0bd0eec19691f9aafcad4fe727e2c5ed2485d11c972603cca613269f82147ff1dc41f1ba4 +DIST torque-4.2.9.tar.gz 6294022 SHA256 46f1f319683af6d3820e18cda69ce59113c9a5c192e1f07826007be69385889b SHA512 898703fa1d02310c22e2a02b86d67ca52ebed46684597931944edebb39f8293746739c8dca9cd10e07c2e7274c3dd7f65a5664d1980817e3feec58952c4cf4d1 WHIRLPOOL e65be66b056a519ebd1c30c2c1ae2ddf43bc4e617a52d3caced1e6dfd2b0d8b2a83c26a0f2e6e41cfae791aca68b6f91424745b2baffa2085fccc8f6ae9b8e04 diff --git a/sys-cluster/torque/files/CVE-2013-4319-2.x-root-submit-fix.patch b/sys-cluster/torque/files/CVE-2013-4319-2.x-root-submit-fix.patch new file mode 100644 index 000000000000..aa53239f157c --- /dev/null +++ b/sys-cluster/torque/files/CVE-2013-4319-2.x-root-submit-fix.patch @@ -0,0 +1,40 @@ +From 5dee0365a56dd2cc4cfd0b182bc843b4f32c086c Mon Sep 17 00:00:00 2001 +From: Justin Bronder <jsbronder@gmail.com> +Date: Mon, 23 Dec 2013 12:40:27 -0500 +Subject: [PATCH] CVE-2013-4319: 2.x root submit fix + +https://bugs.gentoo.org/show_bug.cgi?id=484320 +http://nvd.nist.gov/nvd.cfm?cvename=CVE-2013-4319\ +--- + src/server/process_request.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/src/server/process_request.c b/src/server/process_request.c +index d4a3c92..b06a333 100644 +--- a/src/server/process_request.c ++++ b/src/server/process_request.c +@@ -640,6 +640,21 @@ void process_request( + log_buffer); + } + ++ if (svr_conn[sfds].cn_authen != PBS_NET_CONN_FROM_PRIVIL) ++ { ++ sprintf(log_buffer, "request type %s from host %s rejected (connection not privileged)", ++ reqtype_to_txt(request->rq_type), ++ request->rq_host); ++ ++ log_record(PBSEVENT_JOB, PBS_EVENTCLASS_JOB, id, log_buffer); ++ ++ req_reject(PBSE_BADHOST, 0, request, NULL, "request not authorized"); ++ ++ close_client(sfds); ++ ++ return; ++ } ++ + if (!tfind(svr_conn[sfds].cn_addr, &okclients)) + { + sprintf(log_buffer, "request type %s from host %s rejected (host not authorized)", +-- +1.8.3.2 + diff --git a/sys-cluster/torque/files/CVE-2013-4319-4.x-root-submit-fix.patch b/sys-cluster/torque/files/CVE-2013-4319-4.x-root-submit-fix.patch new file mode 100644 index 000000000000..3614e42721de --- /dev/null +++ b/sys-cluster/torque/files/CVE-2013-4319-4.x-root-submit-fix.patch @@ -0,0 +1,38 @@ +From 6424696d7b160c8a9ad806c4a6b0f77f0d359962 Mon Sep 17 00:00:00 2001 +From: Justin Bronder <jsbronder@gmail.com> +Date: Mon, 23 Dec 2013 12:48:22 -0500 +Subject: [PATCH] CVE-2013-4319: 4.x root submit fix + +https://bugs.gentoo.org/show_bug.cgi?id=484320 +http://nvd.nist.gov/nvd.cfm?cvename=CVE-2013-4319 +--- + src/resmom/mom_process_request.c | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/src/resmom/mom_process_request.c b/src/resmom/mom_process_request.c +index 049f63f..813833f 100644 +--- a/src/resmom/mom_process_request.c ++++ b/src/resmom/mom_process_request.c +@@ -238,6 +238,19 @@ void *mom_process_request( + log_record(PBSEVENT_JOB, PBS_EVENTCLASS_JOB, __func__, log_buffer); + } + ++ if (svr_conn[chan->sock].cn_authen != PBS_NET_CONN_FROM_PRIVIL) ++ { ++ sprintf(log_buffer, "request type %s from host %s rejected (connection not privileged)", ++ reqtype_to_txt(request->rq_type), ++ request->rq_host); ++ ++ log_record(PBSEVENT_JOB, PBS_EVENTCLASS_JOB, __func__, log_buffer); ++ req_reject(PBSE_BADHOST, 0, request, NULL, "request not authorized"); ++ mom_close_client(chan->sock); ++ DIS_tcp_cleanup(chan); ++ return NULL; ++ } ++ + if (!AVL_is_in_tree_no_port_compare(svr_conn[chan->sock].cn_addr, 0, okclients)) + { + sprintf(log_buffer, "request type %s from host %s rejected (host not authorized)", +-- +1.8.3.2 + diff --git a/sys-cluster/torque/files/CVE-2013-4495.4.1.patch b/sys-cluster/torque/files/CVE-2013-4495.4.1.patch new file mode 100644 index 000000000000..810a4f0944a5 --- /dev/null +++ b/sys-cluster/torque/files/CVE-2013-4495.4.1.patch @@ -0,0 +1,343 @@ +From 2aad72c3d2ac612ecbb66828ac6ed5ab51eff5f3 Mon Sep 17 00:00:00 2001 +From: David Beer <dbeer@adaptivecomputing.com> +Date: Mon, 11 Nov 2013 11:55:58 -0700 +Subject: [PATCH] Fix CVE 2013-4495. Note: this patch has been verified as + fixing this security hole but has not received other regression testing. + Could not cherry-pick as 2.5 and 4.1 are very different. + +--- + src/server/svr_mail.c | 265 ++++++++++++++++++++++++++++++++------------------ + 1 file changed, 170 insertions(+), 95 deletions(-) + +diff --git a/src/server/svr_mail.c b/src/server/svr_mail.c +index b269e82..52f2f1f 100644 +--- a/src/server/svr_mail.c ++++ b/src/server/svr_mail.c +@@ -89,6 +89,7 @@ + #include <stdio.h> + #include <stdlib.h> + #include <string.h> ++#include <unistd.h> + #include "list_link.h" + #include "attribute.h" + #include "server_limits.h" +@@ -136,6 +137,77 @@ void free_mail_info( + + + ++void add_body_info( ++ ++ char *bodyfmtbuf /* I */, ++ mail_info *mi /* I */) ++ ++ { ++ char *bodyfmt = NULL; ++ bodyfmt = strcpy(bodyfmtbuf, "PBS Job Id: %i\n" ++ "Job Name: %j\n"); ++ if (mi->exec_host != NULL) ++ { ++ strcat(bodyfmt, "Exec host: %h\n"); ++ } ++ ++ strcat(bodyfmt, "%m\n"); ++ ++ if (mi->text != NULL) ++ { ++ strcat(bodyfmt, "%d\n"); ++ } ++ } ++ ++ ++/* ++ * write_email() ++ * ++ * In emailing, the mail body is written to a pipe connected to ++ * standard input for sendmail. This function supplies the body ++ * of the message. ++ * ++ */ ++void write_email( ++ ++ FILE *outmail_input, ++ mail_info *mi) ++ ++ { ++ char *bodyfmt = NULL; ++ char *subjectfmt = NULL; ++ ++ /* Pipe in mail headers: To: and Subject: */ ++ fprintf(outmail_input, "To: %s\n", mi->mailto); ++ ++ /* mail subject line formating statement */ ++ get_svr_attr_str(SRV_ATR_MailSubjectFmt, (char **)&subjectfmt); ++ if (subjectfmt == NULL) ++ { ++ subjectfmt = "PBS JOB %i"; ++ } ++ ++ fprintf(outmail_input, "Subject: "); ++ svr_format_job(outmail_input, mi, subjectfmt); ++ fprintf(outmail_input, "\n"); ++ ++ /* Set "Precedence: bulk" to avoid vacation messages, etc */ ++ fprintf(outmail_input, "Precedence: bulk\n\n"); ++ ++ /* mail body formating statement */ ++ get_svr_attr_str(SRV_ATR_MailBodyFmt, &bodyfmt); ++ if (bodyfmt == NULL) ++ { ++ char bodyfmtbuf[MAXLINE]; ++ add_body_info(bodyfmtbuf, mi); ++ bodyfmt = bodyfmtbuf; ++ } ++ ++ /* Now pipe in the email body */ ++ svr_format_job(outmail_input, mi, bodyfmt); ++ ++ } /* write_email() */ ++ + + + void *send_the_mail( +@@ -143,15 +215,19 @@ void *send_the_mail( + void *vp) + + { +- mail_info *mi = (mail_info *)vp; +- +- int i; +- char *mailfrom = NULL; +- char *subjectfmt = NULL; +- char *bodyfmt = NULL; +- char *cmdbuf = NULL; +- char bodyfmtbuf[MAXLINE]; +- FILE *outmail; ++ mail_info *mi = (mail_info *)vp; ++ ++ int status = 0; ++ int numargs = 0; ++ int pipes[2]; ++ int counter; ++ pid_t pid; ++ char *mailptr; ++ char *mailfrom = NULL; ++ char tmpBuf[LOG_BUF_SIZE]; ++ // We call sendmail with cmd_name + 2 arguments + # of mailto addresses + 1 for null ++ char *sendmail_args[100]; ++ FILE *stream; + + /* Who is mail from, if SRV_ATR_mailfrom not set use default */ + get_svr_attr_str(SRV_ATR_mailfrom, &mailfrom); +@@ -173,124 +249,123 @@ void *send_the_mail( + mailfrom = PBS_DEFAULT_MAIL; + } + +- /* mail subject line formating statement */ +- get_svr_attr_str(SRV_ATR_MailSubjectFmt, &subjectfmt); +- if (subjectfmt == NULL) +- { +- subjectfmt = "PBS JOB %i"; +- } ++ sendmail_args[numargs++] = (char *)SENDMAIL_CMD; ++ sendmail_args[numargs++] = (char *)"-f"; ++ sendmail_args[numargs++] = (char *)mailfrom; + +- /* mail body formating statement */ +- get_svr_attr_str(SRV_ATR_MailBodyFmt, &bodyfmt); +- if (bodyfmt == NULL) ++ /* Add the e-mail addresses to the command line */ ++ mailptr = strdup(mi->mailto); ++ sendmail_args[numargs++] = mailptr; ++ for (counter=0; counter < (int)strlen(mailptr); counter++) + { +- bodyfmt = strcpy(bodyfmtbuf, "PBS Job Id: %i\n" +- "Job Name: %j\n"); +- if (mi->exec_host != NULL) ++ if (mailptr[counter] == ',') + { +- strcat(bodyfmt, "Exec host: %h\n"); +- } +- +- strcat(bodyfmt, "%m\n"); +- +- if (mi->text != NULL) +- { +- strcat(bodyfmt, "%d\n"); ++ mailptr[counter] = '\0'; ++ sendmail_args[numargs++] = mailptr + counter + 1; ++ if (numargs >= 99) ++ break; + } + } + +- /* setup sendmail command line with -f from_whom */ +- i = strlen(SENDMAIL_CMD) + strlen(mailfrom) + strlen(mi->mailto) + 6; +- +- if ((cmdbuf = calloc(1, i + 1)) == NULL) ++ sendmail_args[numargs] = NULL; ++ ++ /* Create a pipe to talk to the sendmail process we are about to fork */ ++ if (pipe(pipes) == -1) + { +- char tmpBuf[LOG_BUF_SIZE]; +- +- snprintf(tmpBuf,sizeof(tmpBuf), +- "Unable to popen() command '%s' for writing: '%s' (error %d)\n", +- SENDMAIL_CMD, +- strerror(errno), +- errno); ++ snprintf(tmpBuf, sizeof(tmpBuf), "Unable to pipes for sending e-mail\n"); + log_event(PBSEVENT_ERROR | PBSEVENT_ADMIN | PBSEVENT_JOB, + PBS_EVENTCLASS_JOB, + mi->jobid, + tmpBuf); +- +- free_mail_info(mi); + ++ free_mail_info(mi); ++ free(mailptr); + return(NULL); + } + +- sprintf(cmdbuf, "%s -f %s %s", +- SENDMAIL_CMD, +- mailfrom, +- mi->mailto); +- +- outmail = popen(cmdbuf, "w"); +- +- if (outmail == NULL) ++ if ((pid=fork()) == -1) + { +- char tmpBuf[LOG_BUF_SIZE]; +- +- snprintf(tmpBuf,sizeof(tmpBuf), +- "Unable to popen() command '%s' for writing: '%s' (error %d)\n", +- cmdbuf, +- strerror(errno), +- errno); ++ snprintf(tmpBuf, sizeof(tmpBuf), "Unable to fork for sending e-mail\n"); + log_event(PBSEVENT_ERROR | PBSEVENT_ADMIN | PBSEVENT_JOB, + PBS_EVENTCLASS_JOB, + mi->jobid, + tmpBuf); + + free_mail_info(mi); +- free(cmdbuf); +- ++ free(mailptr); ++ close(pipes[0]); ++ close(pipes[1]); + return(NULL); + } ++ else if (pid == 0) ++ { ++ /* CHILD */ + +- /* Pipe in mail headers: To: and Subject: */ +- fprintf(outmail, "To: %s\n", mi->mailto); ++ /* Make stdin the read end of the pipe */ ++ dup2(pipes[0], 0); + +- fprintf(outmail, "Subject: "); +- svr_format_job(outmail, mi, subjectfmt); +- fprintf(outmail, "\n"); ++ /* Close the rest of the open file descriptors */ ++ int numfds = sysconf(_SC_OPEN_MAX); ++ while (--numfds > 0) ++ close(numfds); + +- /* Set "Precedence: bulk" to avoid vacation messages, etc */ +- fprintf(outmail, "Precedence: bulk\n\n"); ++ execv(SENDMAIL_CMD, sendmail_args); ++ /* This never returns, but if the execv fails the child should exit */ ++ exit(1); ++ } ++ else ++ { ++ /* This is the parent */ + +- /* Now pipe in the email body */ +- svr_format_job(outmail, mi, bodyfmt); ++ /* Close the read end of the pipe */ ++ close(pipes[0]); + +- errno = 0; +- if ((i = pclose(outmail)) != 0) +- { +- char tmpBuf[LOG_BUF_SIZE]; ++ /* Write the body to the pipe */ ++ stream = fdopen(pipes[1], "w"); ++ write_email(stream, mi); + +- snprintf(tmpBuf,sizeof(tmpBuf), +- "Email '%c' to %s failed: Child process '%s' %s %d (errno %d:%s)\n", +- mi->mail_point, +- mi->mailto, +- cmdbuf, +- ((WIFEXITED(i)) ? ("returned") : ((WIFSIGNALED(i)) ? ("killed by signal") : ("croaked"))), +- ((WIFEXITED(i)) ? (WEXITSTATUS(i)) : ((WIFSIGNALED(i)) ? (WTERMSIG(i)) : (i))), +- errno, +- strerror(errno)); +- log_event(PBSEVENT_ERROR | PBSEVENT_ADMIN | PBSEVENT_JOB, +- PBS_EVENTCLASS_JOB, +- mi->jobid, +- tmpBuf); +- } +- else if (LOGLEVEL >= 4) +- { +- log_event(PBSEVENT_ERROR | PBSEVENT_ADMIN | PBSEVENT_JOB, +- PBS_EVENTCLASS_JOB, +- mi->jobid, +- "Email sent successfully\n"); +- } ++ fflush(stream); ++ ++ /* Close and wait for the command to finish */ ++ if (fclose(stream) != 0) ++ { ++ snprintf(tmpBuf,sizeof(tmpBuf), ++ "Piping mail body to sendmail closed: errno %d:%s\n", ++ errno, strerror(errno)); ++ ++ log_event(PBSEVENT_ERROR | PBSEVENT_ADMIN | PBSEVENT_JOB, ++ PBS_EVENTCLASS_JOB, ++ mi->jobid, ++ tmpBuf); ++ } ++ ++ // we aren't going to block in order to find out whether or not sendmail worked ++ if ((waitpid(pid, &status, WNOHANG) != 0) && ++ (status != 0)) ++ { ++ snprintf(tmpBuf,sizeof(tmpBuf), ++ "Sendmail command returned %d. Mail may not have been sent\n", ++ status); ++ ++ log_event(PBSEVENT_ERROR | PBSEVENT_ADMIN | PBSEVENT_JOB, ++ PBS_EVENTCLASS_JOB, ++ mi->jobid, ++ tmpBuf); ++ } + +- free_mail_info(mi); +- free(cmdbuf); ++ // don't leave zombies ++ while (waitpid(-1, &status, WNOHANG) != 0) ++ { ++ // zombie reaped, NO-OP ++ } ++ ++ free_mail_info(mi); ++ free(mailptr); ++ return(NULL); ++ } + ++ /* NOT REACHED */ ++ + return(NULL); + } /* END send_the_mail() */ + +-- +1.8.3.2 + diff --git a/sys-cluster/torque/files/CVE-2013-4495.patch b/sys-cluster/torque/files/CVE-2013-4495.patch new file mode 100644 index 000000000000..41232c07ec72 --- /dev/null +++ b/sys-cluster/torque/files/CVE-2013-4495.patch @@ -0,0 +1,32 @@ +From 8246d967bbcf174482ef01b1bf4920a5944b1011 Mon Sep 17 00:00:00 2001 +From: David Beer <dbeer@adaptivecomputing.com> +Date: Wed, 13 Nov 2013 10:47:48 -0700 +Subject: [PATCH] Use Michael Jenning's patch for CVE 2013-4495 instead of the + original. This one is being used because 2.5 should face the minimal possible + change. + +--- + src/server/svr_mail.c | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/src/server/svr_mail.c b/src/server/svr_mail.c +index 26b6dd7..241bdfc 100644 +--- a/src/server/svr_mail.c ++++ b/src/server/svr_mail.c +@@ -372,11 +372,9 @@ void svr_mailowner( + exit(1); + } + +- sprintf(cmdbuf, "%s -f %s %s", +- ++ sprintf(cmdbuf, "%s -t -f %s", + SENDMAIL_CMD, +- mailfrom, +- mailto); ++ mailfrom); + + outmail = (FILE *)popen(cmdbuf, "w"); + +-- +1.8.3.2 + diff --git a/sys-cluster/torque/files/CVE-2014-0749.patch b/sys-cluster/torque/files/CVE-2014-0749.patch new file mode 100644 index 000000000000..52131edcf7e0 --- /dev/null +++ b/sys-cluster/torque/files/CVE-2014-0749.patch @@ -0,0 +1,32 @@ +From 3ed749263abe3d69fa3626d142a5789dcb5a5684 Mon Sep 17 00:00:00 2001 +From: David Beer <dbeer@adaptivecomputing.com> +Date: Fri, 23 Aug 2013 15:53:09 -0600 +Subject: [PATCH] Merge pull request #171 into 2.5-fixes. + +--- + src/lib/Libdis/disrsi_.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/src/lib/Libdis/disrsi_.c b/src/lib/Libdis/disrsi_.c +index 69edd28..154514c 100644 +--- a/src/lib/Libdis/disrsi_.c ++++ b/src/lib/Libdis/disrsi_.c +@@ -112,6 +112,15 @@ int disrsi_( + if (dis_umaxd == 0) + disiui_(); + ++ if (count >= dis_umaxd) ++ { ++ if (count > dis_umaxd) ++ goto overflow; ++ ++ if (memcmp(scratch, dis_umax, dis_umaxd) > 0) ++ goto overflow; ++ } ++ + switch (c = (*dis_getc)(stream)) + { + +-- +1.8.3.2 + diff --git a/sys-cluster/torque/files/TRQ-2885-limit-tm_adopt-to-only-adopt-a-session-id-t.patch b/sys-cluster/torque/files/TRQ-2885-limit-tm_adopt-to-only-adopt-a-session-id-t.patch new file mode 100644 index 000000000000..63713a0bc16f --- /dev/null +++ b/sys-cluster/torque/files/TRQ-2885-limit-tm_adopt-to-only-adopt-a-session-id-t.patch @@ -0,0 +1,134 @@ +From f2f4c950f3d461a249111c8826da3beaafccace9 Mon Sep 17 00:00:00 2001 +From: Chad Vizino <cvizino@adaptivecomputing.com> +Date: Tue, 23 Sep 2014 17:40:59 -0600 +Subject: [PATCH 1/2] TRQ-2885 - limit tm_adopt() to only adopt a session id + that is owned by the calling user. + +--- + src/cmds/pbs_track.c | 6 ++++++ + src/include/tm.h | 2 +- + src/include/tm_.h | 1 + + src/lib/Libifl/tm.c | 37 ++++++++++++++++++++++++++++++++++--- + 5 files changed, 56 insertions(+), 4 deletions(-) + +diff --git a/src/cmds/pbs_track.c b/src/cmds/pbs_track.c +index 7a90fda..9383ea5 100644 +--- a/src/cmds/pbs_track.c ++++ b/src/cmds/pbs_track.c +@@ -164,6 +164,12 @@ int main( + + break; + ++ case TM_EPERM: ++ ++ fprintf(stderr, "pbs_track: permission denied: %s (%d)\n", ++ pbse_to_txt(rc), ++ rc); ++ + default: + + /* Unexpected error occurred */ +diff --git a/src/include/tm.h b/src/include/tm.h +index 106d3fb..2288828 100644 +--- a/src/include/tm.h ++++ b/src/include/tm.h +@@ -125,7 +125,7 @@ int tm_register(tm_whattodo_t *what, + /* + * DJH 15 Nov 2001. + * Generic "out-of-band" task adoption call for tasks parented by +- * another job management system. Minor security hole? ++ * another job management system. + * Cannot be called with any other tm call. + * 26 Feb 2002. Allows id to be jobid (adoptCmd = TM_ADOPT_JOBID) + * or some altid (adoptCmd = TM_ADOPT_ALTID) +diff --git a/src/include/tm_.h b/src/include/tm_.h +index c9393b9..8cae7b0 100644 +--- a/src/include/tm_.h ++++ b/src/include/tm_.h +@@ -136,6 +136,7 @@ typedef unsigned int tm_task_id; + #define TM_EBADENVIRONMENT 17005 + #define TM_ENOTFOUND 17006 + #define TM_BADINIT 17007 ++#define TM_EPERM 17008 + + #define TM_TODO_NOP 5000 /* Do nothing (the nodes value may be new) */ + #define TM_TODO_CKPT 5001 /* Checkpoint <what> and continue it */ +diff --git a/src/lib/Libifl/iff --git a/src/lib/Libifl/tm.c b/src/lib/Libifl/tm.c +index edb6273..4f38529 100644 +--- a/src/lib/Libifl/tm.c ++++ b/src/lib/Libifl/tm.c +@@ -94,6 +94,7 @@ + #include <errno.h> + #include <assert.h> + #include <sys/types.h> ++#include <sys/stat.h> + #include <sys/socket.h> + #include <sys/time.h> + #include <netinet/in.h> +@@ -169,6 +170,31 @@ typedef struct event_info + static event_info *event_hash[EVENT_HASH]; + + /* ++ * check if the owner of this process matches the owner of pid ++ * returns TRUE if so, FALSE otherwise ++ */ ++bool ispidowner(pid_t pid) ++ { ++ char path[MAXPATHLEN]; ++ struct stat sbuf; ++ ++ /* build path to pid */ ++ snprintf(path, sizeof(path), "/proc/%d", pid); ++ ++ /* do the stat */ ++ /* if it fails, assume not owner */ ++ if (stat(path, &sbuf) != 0) ++ return(FALSE); ++ ++ /* see if caller is the owner of pid */ ++ if (getuid() != sbuf.st_uid) ++ return(FALSE); ++ ++ /* caller is owner */ ++ return(TRUE); ++ } ++ ++/* + ** Find an event number or return a NULL. + */ + event_info *find_event( +@@ -1800,8 +1826,8 @@ tm_poll_error: + * some mpiruns simply use rsh to start remote processes - no AMS + * tracking or management facilities are available. + * +- * This function allows any task (session) to be adopted into a PBS +- * job. It is used by: ++ * This function allows any task (session) owned by the owner ++ * of the job to be adopted into a PBS job. It is used by: + * - "adopter" (which is in turn used by our pvmrun) + * - our rmsloader wrapper (a home-brew replacement for RMS' + * rmsloader that does some work and then exec()s the real +@@ -1835,7 +1861,8 @@ tm_poll_error: + * the mom. Returns TM_ENOTFOUND if the mom couldn't find a job + * with the given RMS resource id. Returns TM_ESYSTEM or + * TM_ENOTCONNECTED if there was some sort of comms error talking +- * to the mom ++ * to the mom. Returns TM_EPERM if an attempt was made to adopt ++ * a session not owned by the owner of the job. + * + * Side effects: + * Sets the tm_* globals to fake values if tm_init() has never +@@ -1860,6 +1887,10 @@ int tm_adopt( + + sid = getsid(pid); + ++ /* do not adopt a sid not owned by caller */ ++ if (!ispidowner(sid)) ++ return(TM_EPERM); ++ + /* Must be the only call to call to tm and + must only be called once */ + +-- +1.8.3.2 + diff --git a/sys-cluster/torque/files/pbs_mom-init.d b/sys-cluster/torque/files/pbs_mom-init.d new file mode 100644 index 000000000000..0bbd899bcf3e --- /dev/null +++ b/sys-cluster/torque/files/pbs_mom-init.d @@ -0,0 +1,48 @@ +#!/sbin/runscript +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the Torque 2.5+ License + +. /etc/conf.d/torque +PBS_SERVER_HOME="$(. /etc/env.d/25torque; echo ${PBS_SERVER_HOME})" + +depend() { + need net + after pbs_server + after pbs_sched + after logger +} + +checkconfig() { + for i in "server_name" "mom_priv/config"; do + if [ ! -e ${PBS_SERVER_HOME}/${i} ]; then + eerror "Missing config file ${PBS_SERVER_HOME}/${i}" + return 1 + fi + done +} + +start() { + checkconfig || return 1 + + ebegin "Starting Torque pbs_mom" + local extra_args="" + if [ -n "${PBS_MOM_LOG}" ]; then + extra_args="-L ${PBS_MOM_LOG}" + fi + start-stop-daemon --start -p ${PBS_SERVER_HOME}/mom_priv/mom.lock \ + --exec /usr/sbin/pbs_mom -- -d ${PBS_SERVER_HOME} ${extra_args} + eend ${?} +} + +stop() { + ebegin "Stopping Torque pbs_mom" + /usr/sbin/momctl -s || start-stop-daemon --stop -p ${PBS_SERVER_HOME}/mom_priv/mom.lock + eend ${?} +} + +restart() { + svc_stop + sleep 3 + svc_start +} +# vim:ts=4 diff --git a/sys-cluster/torque/files/pbs_mom-init.d-munge b/sys-cluster/torque/files/pbs_mom-init.d-munge new file mode 100644 index 000000000000..6c84dc647807 --- /dev/null +++ b/sys-cluster/torque/files/pbs_mom-init.d-munge @@ -0,0 +1,48 @@ +#!/sbin/runscript +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the Torque 2.5+ License + +. /etc/conf.d/torque +PBS_SERVER_HOME="$(. /etc/env.d/25torque; echo ${PBS_SERVER_HOME})" + +depend() { + local _need="net" + after pbs_server pbs_sched logger + [ ${PBS_USE_MUNGE} -ne 0 ] && _need="${_need} munged" + need ${_need} +} + +checkconfig() { + for i in "server_name" "mom_priv/config"; do + if [ ! -e ${PBS_SERVER_HOME}/${i} ]; then + eerror "Missing config file ${PBS_SERVER_HOME}/${i}" + return 1 + fi + done +} + +start() { + checkconfig || return 1 + + ebegin "Starting Torque pbs_mom" + local extra_args="" + if [ -n "${PBS_MOM_LOG}" ]; then + extra_args="-L ${PBS_MOM_LOG}" + fi + start-stop-daemon --start -p ${PBS_SERVER_HOME}/mom_priv/mom.lock \ + --exec /usr/sbin/pbs_mom -- -d ${PBS_SERVER_HOME} ${extra_args} + eend ${?} +} + +stop() { + ebegin "Stopping Torque pbs_mom" + /usr/sbin/momctl -s || start-stop-daemon --stop -p ${PBS_SERVER_HOME}/mom_priv/mom.lock + eend ${?} +} + +restart() { + svc_stop + sleep 3 + svc_start +} +# vim:ts=4 diff --git a/sys-cluster/torque/files/pbs_sched-init.d b/sys-cluster/torque/files/pbs_sched-init.d new file mode 100644 index 000000000000..72e565a20752 --- /dev/null +++ b/sys-cluster/torque/files/pbs_sched-init.d @@ -0,0 +1,48 @@ +#!/sbin/runscript +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the Torque 2.5+ License + +. /etc/conf.d/torque +PBS_SERVER_HOME="$(. /etc/env.d/25torque; echo ${PBS_SERVER_HOME})" + +depend() { + need net + after pbs_server + before pbs_mom + after logger +} + +checkconfig() { + for i in "server_name"; do + if [ ! -e ${PBS_SERVER_HOME}/${i} ]; then + eerror "Missing config file ${PBS_SERVER_HOME}/${i}" + return 1 + fi + done + + if [ -z "$(grep 'queue_type' ${PBS_SERVER_HOME}/server_priv/queues/*)" ]; then + eerror "No queues have been defined yet." + return 1 + fi +} + +start() { + checkconfig || return 1 + + ebegin "Starting Torque pbs_sched" + local extra_args="" + if [ -n "${PBS_SCHED_LOG}" ]; then + extra_args="-L ${PBS_SCHED_LOG}" + fi + + start-stop-daemon --start -p ${PBS_SERVER_HOME}/sched_priv/sched.lock \ + --exec /usr/sbin/pbs_sched -- -d ${PBS_SERVER_HOME} ${extra_args} + eend ${?} +} + +stop() { + ebegin "Stopping Torque pbs_sched" + start-stop-daemon --stop -p ${PBS_SERVER_HOME}/sched_priv/sched.lock + eend ${?} +} +# vim:ts=4 diff --git a/sys-cluster/torque/files/pbs_server-init.d b/sys-cluster/torque/files/pbs_server-init.d new file mode 100644 index 000000000000..dd39a97f7159 --- /dev/null +++ b/sys-cluster/torque/files/pbs_server-init.d @@ -0,0 +1,60 @@ +#!/sbin/runscript +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the Torque 2.5+ License + +. /etc/conf.d/torque +PBS_SERVER_HOME="$(. /etc/env.d/25torque; echo ${PBS_SERVER_HOME})" + +depend() { + need net + before pbs_sched + before pbs_mom + after logger +} + +checkconfig() { + for i in "server_name" "server_priv/nodes"; do + if [ ! -e "${PBS_SERVER_HOME}/${i}" ]; then + eerror "Missing config file ${PBS_SERVER_HOME}/${i}" + return 1 + fi + done + + if [ ! -e "${PBS_SERVER_HOME}/server_priv/serverdb" ]; then + eerror "Torque has not been fully configured to run." + eerror "Missing ${PBS_SERVER_HOME}/server_priv/serverdb" + return 1 + fi + + if [ -z "$(grep 'queue_type' ${PBS_SERVER_HOME}/server_priv/queues/*)" ]; then + eerror "No queues have been defined yet." + return 1 + fi +} + +start() { + checkconfig || return 1 + + ebegin "Starting Torque pbs_server" + local extra_args="" + if [ -n "${PBS_SERVER_LOG}" ]; then + extra_args="-L ${PBS_SERVER_LOG}" + fi + + start-stop-daemon --start -p ${PBS_SERVER_HOME}/server_priv/server.lock \ + --exec /usr/sbin/pbs_server -- -d ${PBS_SERVER_HOME} ${extra_args} + eend ${?} +} + +stop() { + ebegin "Stopping Torque pbs_server" + stop_type="${PBS_SERVER_STOP}" + if [ -z "${stop_type}" ]; then + ewarn "PBS_SERVER_STOP is not defined, defaulting to quick" + stop_type=quick + fi + + /usr/bin/qterm -t ${stop_type} || start-stop-daemon --stop -p ${PBS_SERVER_HOME}/server_priv/server.lock + eend ${?} +} +# vim:ts=4 diff --git a/sys-cluster/torque/files/pbs_server-init.d-munge b/sys-cluster/torque/files/pbs_server-init.d-munge new file mode 100644 index 000000000000..83101a2e2a47 --- /dev/null +++ b/sys-cluster/torque/files/pbs_server-init.d-munge @@ -0,0 +1,61 @@ +#!/sbin/runscript +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the Torque 2.5+ License + +. /etc/conf.d/torque +PBS_SERVER_HOME="$(. /etc/env.d/25torque; echo ${PBS_SERVER_HOME})" + +depend() { + local _need="net" + before pbs_sched pbs_mom + after logger + [ ${PBS_USE_MUNGE} -ne 0 ] && _need="${_need} munged" + need ${_need} +} + +checkconfig() { + for i in "server_name" "server_priv/nodes"; do + if [ ! -e "${PBS_SERVER_HOME}/${i}" ]; then + eerror "Missing config file ${PBS_SERVER_HOME}/${i}" + return 1 + fi + done + + if [ ! -e "${PBS_SERVER_HOME}/server_priv/serverdb" ]; then + eerror "Torque has not been fully configured to run." + eerror "Missing ${PBS_SERVER_HOME}/server_priv/serverdb" + return 1 + fi + + if [ -z "$(grep 'queue_type' ${PBS_SERVER_HOME}/server_priv/queues/*)" ]; then + eerror "No queues have been defined yet." + return 1 + fi +} + +start() { + checkconfig || return 1 + + ebegin "Starting Torque pbs_server" + local extra_args="" + if [ -n "${PBS_SERVER_LOG}" ]; then + extra_args="-L ${PBS_SERVER_LOG}" + fi + + start-stop-daemon --start -p ${PBS_SERVER_HOME}/server_priv/server.lock \ + --exec /usr/sbin/pbs_server -- -d ${PBS_SERVER_HOME} ${extra_args} + eend ${?} +} + +stop() { + ebegin "Stopping Torque pbs_server" + stop_type="${PBS_SERVER_STOP}" + if [ -z "${stop_type}" ]; then + ewarn "PBS_SERVER_STOP is not defined, defaulting to quick" + stop_type=quick + fi + + /usr/bin/qterm -t ${stop_type} || start-stop-daemon --stop -p ${PBS_SERVER_HOME}/server_priv/server.lock + eend ${?} +} +# vim:ts=4 diff --git a/sys-cluster/torque/files/tcl8.6.patch b/sys-cluster/torque/files/tcl8.6.patch new file mode 100644 index 000000000000..0361dbfead0a --- /dev/null +++ b/sys-cluster/torque/files/tcl8.6.patch @@ -0,0 +1,87 @@ +From 061f15e06d6cf85e951cd321360067de5f0b2ce0 Mon Sep 17 00:00:00 2001 +From: Justin Bronder <jsbronder@gmail.com> +Date: Thu, 7 Mar 2013 22:33:04 -0500 +Subject: [PATCH] support tcl-8.6 + +--- + src/cmds/qstat.c | 13 +++++++++---- + src/scheduler.tcl/pbs_tclWrap.c | 6 +++--- + 2 files changed, 12 insertions(+), 7 deletions(-) + +diff --git a/src/cmds/qstat.c b/src/cmds/qstat.c +index 5f85de7..7f289ba 100644 +--- a/src/cmds/qstat.c ++++ b/src/cmds/qstat.c +@@ -88,6 +88,11 @@ + #if TCL_QSTAT + #include <sys/stat.h> + #include <tcl.h> ++#if TCL_MAJOR_VERSION <=8 && TCL_MINOR_VERSION < 6 ++#define Tcl_GetStringResult(x) x->result ++#define Tcl_GetErrorLine(x) x->errorLine ++#define Tcl_SetResult(x, y, z) x->result = y ++#endif + #if TCLX + #include <tclExtend.h> + #endif +@@ -1856,7 +1861,7 @@ tcl_init(void) + if (Tcl_Init(interp) == TCL_ERROR) + { + fprintf(stderr, "Tcl_Init error: %s", +- interp->result); ++ Tcl_GetStringResult(interp)); + } + + #if TCLX +@@ -1869,7 +1874,7 @@ tcl_init(void) + { + #endif + fprintf(stderr, "Tclx_Init error: %s", +- interp->result); ++ Tcl_GetStringResult(interp)); + } + + #endif /* TCLX */ +@@ -1980,10 +1985,10 @@ void tcl_run( + trace = (char *)Tcl_GetVar(interp, "errorInfo", 0); + + if (trace == NULL) +- trace = interp->result; ++ trace = Tcl_GetStringResult(interp); + + fprintf(stderr, "%s: TCL error @ line %d: %s\n", +- script, interp->errorLine, trace); ++ script, Tcl_GetErrorLine(interp), trace); + } + + Tcl_DeleteInterp(interp); +diff --git a/src/scheduler.tcl/pbs_tclWrap.c b/src/scheduler.tcl/pbs_tclWrap.c +index e859ae5..194c24b 100644 +--- a/src/scheduler.tcl/pbs_tclWrap.c ++++ b/src/scheduler.tcl/pbs_tclWrap.c +@@ -924,7 +924,7 @@ char *argv[]; + + if (argc != 2) + { +- sprintf(interp->result, ++ sprintf(Tcl_GetStringResult(interp), + "%s: wrong # args: job_id", argv[0]); + return TCL_ERROR; + } +@@ -936,11 +936,11 @@ char *argv[]; + return TCL_OK; + } + +- interp->result = "0"; ++ Tcl_SetResult(interp, "0", TCL_STATIC); + + if (pbs_rerunjob(connector, argv[1], extend)) + { +- interp->result = "-1"; ++ Tcl_SetResult(interp, "-1", TCL_STATIC); + msg = pbs_geterrmsg(connector); + sprintf(log_buffer, "%s (%d)", msg ? msg : fail, pbs_errno); + log_err(-1, argv[0], log_buffer); +-- +1.7.12.4 + diff --git a/sys-cluster/torque/files/torque-4.1.5.1-tcl8.6.patch b/sys-cluster/torque/files/torque-4.1.5.1-tcl8.6.patch new file mode 100644 index 000000000000..2e8a8ed8f359 --- /dev/null +++ b/sys-cluster/torque/files/torque-4.1.5.1-tcl8.6.patch @@ -0,0 +1,93 @@ + src/cmds/qstat.c | 18 ++++++++++++++++++ + src/scheduler.tcl/pbs_tclWrap.c | 13 +++++++++++++ + 2 files changed, 31 insertions(+) + +diff --git a/src/cmds/qstat.c b/src/cmds/qstat.c +index 4e1c6b6..07ed448 100644 +--- a/src/cmds/qstat.c ++++ b/src/cmds/qstat.c +@@ -1795,8 +1795,13 @@ tcl_init(void) + + if (Tcl_Init(interp) == TCL_ERROR) + { ++#if TCL_MAJOR_VERSION <=8 && TCL_MINOR_VERSION < 6 + fprintf(stderr, "Tcl_Init error: %s", + interp->result); ++#else ++ fprintf(stderr, "Tcl_Init error: %s", ++ Tcl_GetStringResult(interp)); ++#endif + } + + #if TCLX +@@ -1808,8 +1813,14 @@ tcl_init(void) + if (Tclx_Init(interp) == TCL_ERROR) + { + #endif ++ ++#if TCL_MAJOR_VERSION <=8 && TCL_MINOR_VERSION < 6 + fprintf(stderr, "Tclx_Init error: %s", + interp->result); ++#else ++ fprintf(stderr, "Tclx_Init error: %s", ++ Tcl_GetStringResult(interp)); ++#endif + } + + #endif /* TCLX */ +@@ -1920,10 +1931,17 @@ void tcl_run( + trace = (char *)Tcl_GetVar(interp, "errorInfo", 0); + + if (trace == NULL) ++#if TCL_MAJOR_VERSION <=8 && TCL_MINOR_VERSION < 6 + trace = interp->result; + + fprintf(stderr, "%s: TCL error @ line %d: %s\n", + script, interp->errorLine, trace); ++#else ++ trace = Tcl_GetStringResult(interp); ++ ++ fprintf(stderr, "%s: TCL error @ line %d: %s\n", ++ script, Tcl_GetErrorLine(interp), trace); ++#endif + } + + Tcl_DeleteInterp(interp); +diff --git a/src/scheduler.tcl/pbs_tclWrap.c b/src/scheduler.tcl/pbs_tclWrap.c +index a85e8ff..46c1012 100644 +--- a/src/scheduler.tcl/pbs_tclWrap.c ++++ b/src/scheduler.tcl/pbs_tclWrap.c +@@ -900,8 +900,13 @@ char *argv[]; + + if (argc != 2) + { ++#if TCL_MAJOR_VERSION <=8 && TCL_MINOR_VERSION < 6 + sprintf(interp->result, + "%s: wrong # args: job_id", argv[0]); ++#else ++ sprintf(Tcl_GetStringResult(interp), ++ "%s: wrong # args: job_id", argv[0]); ++#endif + return TCL_ERROR; + } + +@@ -912,11 +917,19 @@ char *argv[]; + return TCL_OK; + } + ++#if TCL_MAJOR_VERSION <=8 && TCL_MINOR_VERSION < 6 + interp->result = "0"; ++#else ++ Tcl_SetResult(interp, "0", TCL_STATIC); ++#endif + + if (pbs_rerunjob_err(connector, argv[1], extend, &local_errno)) + { ++#if TCL_MAJOR_VERSION <=8 && TCL_MINOR_VERSION < 6 + interp->result = "-1"; ++#else ++ Tcl_SetResult(interp, "-1", TCL_STATIC); ++#endif + msg = pbs_geterrmsg(connector); + sprintf(log_buffer, "%s (%d)", msg ? msg : fail, local_errno); + log_err(-1, argv[0], log_buffer); diff --git a/sys-cluster/torque/files/torque-4.2.9-tcl8.6.patch b/sys-cluster/torque/files/torque-4.2.9-tcl8.6.patch new file mode 100644 index 000000000000..3a2a28ce4a2b --- /dev/null +++ b/sys-cluster/torque/files/torque-4.2.9-tcl8.6.patch @@ -0,0 +1,99 @@ + src/cmds/qstat.c | 20 +++++++++++++++++++- + src/scheduler.tcl/pbs_tclWrap.c | 13 +++++++++++++ + 2 files changed, 32 insertions(+), 1 deletion(-) + +diff --git a/src/cmds/qstat.c b/src/cmds/qstat.c +index f275cf8..23414b8 100644 +--- a/src/cmds/qstat.c ++++ b/src/cmds/qstat.c +@@ -2203,8 +2203,13 @@ tcl_init(void) + + if (Tcl_Init(interp) == TCL_ERROR) + { ++#if TCL_MAJOR_VERSION <=8 && TCL_MINOR_VERSION < 6 + fprintf(stderr, "Tcl_Init error: %s", + interp->result); ++#else ++ fprintf(stderr, "Tcl_Init error: %s", ++ Tcl_GetStringResult(interp)); ++#endif + } + + #if TCLX +@@ -2216,8 +2221,14 @@ tcl_init(void) + if (Tclx_Init(interp) == TCL_ERROR) + { + #endif ++ ++#if TCL_MAJOR_VERSION <=8 && TCL_MINOR_VERSION < 6 + fprintf(stderr, "Tclx_Init error: %s", + interp->result); ++#else ++ fprintf(stderr, "Tclx_Init error: %s", ++ Tcl_GetStringResult(interp)); ++#endif + } + + #endif /* TCLX */ +@@ -2328,15 +2339,22 @@ void tcl_run( + + if (f_opt && Tcl_EvalFile(interp, script) != TCL_OK) + { +- char *trace; ++ const char *trace; + + trace = (char *)Tcl_GetVar(interp, "errorInfo", 0); + + if (trace == NULL) ++#if TCL_MAJOR_VERSION <=8 && TCL_MINOR_VERSION < 6 + trace = interp->result; + + fprintf(stderr, "%s: TCL error @ line %d: %s\n", + script, interp->errorLine, trace); ++#else ++ trace = Tcl_GetStringResult(interp); ++ ++ fprintf(stderr, "%s: TCL error @ line %d: %s\n", ++ script, Tcl_GetErrorLine(interp), trace); ++#endif + } + + Tcl_DeleteInterp(interp); +diff --git a/src/scheduler.tcl/pbs_tclWrap.c b/src/scheduler.tcl/pbs_tclWrap.c +index 3eea0b0..7d0d610 100644 +--- a/src/scheduler.tcl/pbs_tclWrap.c ++++ b/src/scheduler.tcl/pbs_tclWrap.c +@@ -935,8 +935,13 @@ int PBS_ReRun( + + if (argc != 2) + { ++#if TCL_MAJOR_VERSION <=8 && TCL_MINOR_VERSION < 6 + sprintf(interp->result, + "%s: wrong # args: job_id", argv[0]); ++#else ++ Tcl_SetObjResult(interp, Tcl_ObjPrintf( ++ "%s: wrong # args: job_id", argv[0])); ++#endif + return TCL_ERROR; + } + +@@ -947,11 +952,19 @@ int PBS_ReRun( + return TCL_OK; + } + ++#if TCL_MAJOR_VERSION <=8 && TCL_MINOR_VERSION < 6 + interp->result = strdup("0"); ++#else ++ Tcl_SetResult(interp, "0", TCL_STATIC); ++#endif + + if (pbs_rerunjob_err(connector, strdup(argv[1]), extend, &local_errno)) + { ++#if TCL_MAJOR_VERSION <=8 && TCL_MINOR_VERSION < 6 + interp->result = strdup("-1"); ++#else ++ Tcl_SetResult(interp, "-1", TCL_STATIC); ++#endif + msg = pbs_geterrmsg(connector); + sprintf(log_buffer, "%s (%d)", msg ? msg : fail, local_errno); + log_err(-1, argv[0], log_buffer); diff --git a/sys-cluster/torque/files/torque-conf.d b/sys-cluster/torque/files/torque-conf.d new file mode 100644 index 000000000000..a6e6b08beace --- /dev/null +++ b/sys-cluster/torque/files/torque-conf.d @@ -0,0 +1,14 @@ +# The default logging takes place in $PBS_SERVER_HOME/<mom/server/sched>_priv. +# If you'd like to change that, use the following per service. +PBS_SERVER_LOG=/var/log/pbs_server.log +PBS_MOM_LOG=/var/log/pbs_mom.log +PBS_SCHED_LOG=/var/log/pbs_sched.log + + +# There are a number of ways to stop the pbs server. For more details, man qterm +# At the time of writing, checkpoint is probably not working. +# immediate: All jobs are killed. +# delay: Checkpoint, rerun or wait for jobs to finish before stopping +# quick: Remember running jobs, and let them run without interaction with pbs_server. +# This is the default action +PBS_SERVER_STOP=quick diff --git a/sys-cluster/torque/files/torque-conf.d-munge b/sys-cluster/torque/files/torque-conf.d-munge new file mode 100644 index 000000000000..a8456d526d46 --- /dev/null +++ b/sys-cluster/torque/files/torque-conf.d-munge @@ -0,0 +1,18 @@ +# The default logging takes place in $PBS_SERVER_HOME/<mom/server/sched>_priv. +# If you'd like to change that, use the following per service. +PBS_SERVER_LOG=/var/log/pbs_server.log +PBS_MOM_LOG=/var/log/pbs_mom.log +PBS_SCHED_LOG=/var/log/pbs_sched.log + + +# There are a number of ways to stop the pbs server. For more details, man qterm +# At the time of writing, checkpoint is probably not working. +# immediate: All jobs are killed. +# delay: Checkpoint, rerun or wait for jobs to finish before stopping +# quick: Remember running jobs, and let them run without interaction with pbs_server. +# This is the default action +PBS_SERVER_STOP=quick + +# Use munge auth by default. This causes all pbs service to require +# the munge service. Set to non-zero to enable. +PBS_USE_MUNGE=0 diff --git a/sys-cluster/torque/files/torque-env.d b/sys-cluster/torque/files/torque-env.d new file mode 100644 index 000000000000..40a08c016dee --- /dev/null +++ b/sys-cluster/torque/files/torque-env.d @@ -0,0 +1,7 @@ +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the Torque 2.5+ License + +# Configuration files that are included in the initial Torque install +PBS_SERVER_HOME="/var/spool/torque" +CONFIG_PROTECT="/var/spool/torque" + diff --git a/sys-cluster/torque/files/trqauthd-init.d b/sys-cluster/torque/files/trqauthd-init.d new file mode 100644 index 000000000000..b7896d6af7ef --- /dev/null +++ b/sys-cluster/torque/files/trqauthd-init.d @@ -0,0 +1,27 @@ +#!/sbin/runscript +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +depend() { + need net + after logger + + # 4.0+ only, make sure we run before the other torque services + before pbs_mom + before pbs_sched + before pbs_server +} + +start() { + start-stop-daemon \ + --start \ + --exec /usr/sbin/trqauthd +} + +stop() { + start-stop-daemon \ + --stop \ + --exec /usr/sbin/trqauthd +} + diff --git a/sys-cluster/torque/metadata.xml b/sys-cluster/torque/metadata.xml new file mode 100644 index 000000000000..703f1e22fac4 --- /dev/null +++ b/sys-cluster/torque/metadata.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <herd>cluster</herd> + <maintainer> + <email>jsbronder@gentoo.org</email> + </maintainer> + <use> + <flag name="cpusets">Enable pbs_mom to utilize linux cpusets if available</flag> + <flag name="drmaa">Enable the Distributed Resource Management Application API</flag> + <flag name="munge">Enable authentication via munge</flag> + <flag name="nvidia">Enable management of Nvidia GPUs</flag> + <flag name="server">Enable compilation of pbs_server and pbs_sched</flag> + </use> +</pkgmetadata> diff --git a/sys-cluster/torque/torque-2.5.13.ebuild b/sys-cluster/torque/torque-2.5.13.ebuild new file mode 100644 index 000000000000..252ac35161fc --- /dev/null +++ b/sys-cluster/torque/torque-2.5.13.ebuild @@ -0,0 +1,252 @@ +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=4 + +inherit autotools-utils eutils flag-o-matic linux-info + +DESCRIPTION="Resource manager and queuing system based on OpenPBS" +HOMEPAGE="http://www.adaptivecomputing.com/products/open-source/torque" +SRC_URI="http://www.adaptivecomputing.com/index.php?wpfb_dl=1643 -> ${P}.tar.gz" + +LICENSE="torque-2.5" + +SLOT="0" +KEYWORDS="alpha amd64 hppa ia64 ~mips ppc ppc64 sparc x86" +IUSE="cpusets +crypt doc drmaa kernel_linux munge server static-libs +syslog threads tk xml" + +# ed is used by makedepend-sh +DEPEND_COMMON="sys-libs/ncurses + sys-libs/readline + munge? ( sys-auth/munge ) + tk? ( dev-lang/tk ) + syslog? ( virtual/logger ) + !games-util/qstat" + +DEPEND="${DEPEND_COMMON} + sys-apps/ed + !sys-cluster/slurm" + +RDEPEND="${DEPEND_COMMON} + crypt? ( net-misc/openssh ) + !crypt? ( net-misc/netkit-rsh )" + +DOCS=( Release_Notes ) + +AUTOTOOLS_IN_SOURCE_BUILD=1 + +pkg_setup() { + PBS_SERVER_HOME="${PBS_SERVER_HOME:-/var/spool/torque}" + + # Find a Torque server to use. Check environment, then + # current setup (if any), and fall back on current hostname. + if [ -z "${PBS_SERVER_NAME}" ]; then + if [ -f "${ROOT}${PBS_SERVER_HOME}/server_name" ]; then + PBS_SERVER_NAME="$(<${ROOT}${PBS_SERVER_HOME}/server_name)" + else + PBS_SERVER_NAME=$(hostname -f) + fi + fi + + USE_CPUSETS="--disable-cpuset" + 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 + linux-info_pkg_setup + einfo + elog " Torque support for cpusets is still in development, you may" + elog "wish to disable it for production use." + einfo + if ! linux_config_exists || ! 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-cpuset" + fi + fi +} + +src_prepare() { + epatch "${FILESDIR}"/CVE-2013-4319-2.x-root-submit-fix.patch + epatch "${FILESDIR}"/tcl8.6.patch + + # 510726 + epatch "${FILESDIR}"/CVE-2014-0749.patch + + # 491270 + epatch "${FILESDIR}"/CVE-2013-4495.patch + + # Unused and causes breakage when switching from glibc to tirpc. + # https://github.com/adaptivecomputing/torque/pull/148 + sed -i '/rpc\/rpc\.h/d' src/lib/Libnet/net_client.c || die +} + +src_configure() { + local myeconfargs=( --with-rcp=mom_rcp ) + + use crypt && myeconfargs=( --with-rcp=scp ) + + myeconfargs+=( + $(use_enable tk gui) + $(use_enable tk tcl-qstat) + $(use_enable syslog) + $(use_enable server) + $(use_enable drmaa) + $(use_enable threads high-availability) + $(use_enable xml server-xml) + $(use_enable munge munge-library) + --with-server-home=${PBS_SERVER_HOME} + --with-environ=/etc/pbs_environment + --with-default-server=${PBS_SERVER_NAME} + --disable-gcc-warnings + --with-tcp-retry-limit=2 + ${USE_CPUSETS} + ) + autotools-utils_src_configure +} + +# 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}" || die + else + chmod ${m} "${root}${d}" || die + 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}" + + autotools-utils_src_install + + use doc && dodoc doc/admin_guide.ps doc/*.pdf + + # 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}" || die + done + + if use server; then + newinitd "${FILESDIR}"/pbs_server-init.d-munge pbs_server + newinitd "${FILESDIR}"/pbs_sched-init.d pbs_sched + fi + newinitd "${FILESDIR}"/pbs_mom-init.d-munge pbs_mom + newconfd "${FILESDIR}"/torque-conf.d-munge torque + newenvd "${FILESDIR}"/torque-env.d 25torque +} + +pkg_preinst() { + if [[ -f "${ROOT}etc/pbs_environment" ]]; then + cp "${ROOT}etc/pbs_environment" "${D}"/etc/pbs_environment || die + fi + + echo "${PBS_SERVER_NAME}" > "${D}${PBS_SERVER_HOME}/server_name" || die + + # 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 \ + || die + + if use munge; then + sed -i 's,\(PBS_USE_MUNGE=\).*,\11,' "${D}"etc/conf.d/torque || die + fi +} + +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" + echo + elog " For a basic setup, you may use emerge --config ${PN}" +} + +# 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="$(echo "${ROOT}/${PBS_SERVER_HOME}" | sed 's:///*:/:g')" + local rc=0 + + ebegin "Configuring Torque" + einfo "Using ${h} 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 Enter to" + ewarn "continue or Control-C to abort now" + read + fi + + # pbs_mom configuration. + echo "\$pbsserver ${PBS_SERVER_NAME}" > "${h}/mom_priv/config" || die + echo "\$logevent 255" >> "${h}/mom_priv/config" || die + + if use server; then + local qmgr="${ROOT}/usr/bin/qmgr -c" + # pbs_server bails on repeated backslashes. + if ! "${ROOT}"/usr/sbin/pbs_server -f -d "${h}" -t create; 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} \ + || die + + "${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" || die + fi + fi + eend ${rc} +} diff --git a/sys-cluster/torque/torque-4.1.7.ebuild b/sys-cluster/torque/torque-4.1.7.ebuild new file mode 100644 index 000000000000..ea148c3c701d --- /dev/null +++ b/sys-cluster/torque/torque-4.1.7.ebuild @@ -0,0 +1,229 @@ +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=5 + +inherit flag-o-matic eutils linux-info + +DESCRIPTION="Resource manager and queuing system based on OpenPBS" +HOMEPAGE="http://www.adaptivecomputing.com/products/open-source/torque" +# TODO: hopefully moving to github tags soon +# http://www.supercluster.org/pipermail/torquedev/2013-May/004519.html +SRC_URI="http://www.adaptivecomputing.com/index.php?wpfb_dl=1690 -> ${P}.tar.gz" + +LICENSE="torque-2.5" +SLOT="0" +KEYWORDS="alpha amd64 hppa ia64 ~mips ppc ppc64 sparc x86" +IUSE="cpusets +crypt doc drmaa kernel_linux munge nvidia server +syslog tk" + +DEPEND_COMMON=" + sys-libs/ncurses + sys-libs/readline + cpusets? ( sys-apps/hwloc ) + munge? ( sys-auth/munge ) + nvidia? ( >=x11-drivers/nvidia-drivers-275 ) + tk? ( dev-lang/tk ) + syslog? ( virtual/logger ) + !games-util/qstat" + +DEPEND="${DEPEND_COMMON} + !sys-cluster/slurm" + +RDEPEND="${DEPEND_COMMON} + crypt? ( net-misc/openssh ) + !crypt? ( net-misc/netkit-rsh ) + !dev-libs/uthash" + +# Torque should depend on dev-libs/uthash but that's pretty much impossible +# to patch in as they ship with a broken configure such that files referenced +# by the configure.ac and Makefile.am are missing. +# http://www.supercluster.org/pipermail/torquedev/2014-October/004773.html + +pkg_setup() { + PBS_SERVER_HOME="${PBS_SERVER_HOME:-/var/spool/${PN}}" + + # Find a Torque server to use. Check environment, then + # current setup (if any), and fall back on current hostname. + if [ -z "${PBS_SERVER_NAME}" ]; then + if [ -f "${ROOT}${PBS_SERVER_HOME}/server_name" ]; then + PBS_SERVER_NAME="$(<${ROOT}${PBS_SERVER_HOME}/server_name)" + else + PBS_SERVER_NAME=$(hostname -f) + fi + fi + + USE_CPUSETS="--disable-cpuset" + 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 + linux-info_pkg_setup + if ! linux_config_exists || ! 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-cpuset" + fi + fi +} + +src_prepare() { + # Unused and causes breakage when switching from glibc to tirpc. + # https://github.com/adaptivecomputing/torque/pull/148 + sed -i '/rpc\/rpc\.h/d' src/lib/Libnet/net_client.c || die + + # We install to a valid location, no need to muck with ld.so.conf + # --without-loadlibfile is supposed to do this for us... + sed -i '/mk_default_ld_lib_file || return 1/d' buildutils/pbs_mkdirs.in || die + + epatch "${FILESDIR}"/${PN}-4.1.5.1-tcl8.6.patch + + # 491270 + epatch "${FILESDIR}"/CVE-2013-4495.4.1.patch +} + +src_configure() { + local myconf="--with-rcp=mom_rcp" + + use crypt && myconf="--with-rcp=scp" + + econf \ + $(use_enable tk gui) \ + $(use_enable syslog) \ + $(use_enable server) \ + $(use_enable drmaa) \ + $(use_enable munge munge-auth) \ + $(use_enable nvidia nvidia-gpus) \ + --with-server-home=${PBS_SERVER_HOME} \ + --with-environ=/etc/pbs_environment \ + --with-default-server=${PBS_SERVER_NAME} \ + --disable-gcc-warnings \ + --with-tcp-retry-limit=2 \ + --without-loadlibfile \ + ${USE_CPUSETS} \ + ${myconf} +} + +src_install() { + local dir + + DOCS=( CHANGELOG README.* Release_Notes ) + use doc && DOCS+=( doc/admin_guide.ps doc/*.pdf ) + + default + + # 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 "${ED}" -iname tclIndex); do + sed \ + -e "s/${ED//\// }/ /" \ + -i "${file}" || die + done + + for dir in $(find "${ED}/${PBS_SERVER_HOME}" -type d); do + keepdir "${dir#${ED}}" + done + + if use server; then + newinitd "${FILESDIR}"/pbs_server-init.d-munge pbs_server + newinitd "${FILESDIR}"/pbs_sched-init.d pbs_sched + fi + newinitd "${FILESDIR}"/pbs_mom-init.d-munge pbs_mom + newconfd "${FILESDIR}"/${PN}-conf.d-munge ${PN} + newinitd "${FILESDIR}"/trqauthd-init.d trqauthd + newenvd "${FILESDIR}"/${PN}-env.d 25${PN} +} + +pkg_preinst() { + if [[ -f "${ROOT}etc/pbs_environment" ]]; then + cp "${ROOT}etc/pbs_environment" "${ED}"/etc/pbs_environment || die + fi + + if use server && [[ -f "${ROOT}${PBS_SERVER_HOME}/server_priv/nodes" ]]; then + cp \ + "${EROOT}${PBS_SERVER_HOME}/server_priv/nodes" \ + "${ED}/${PBS_SERVER_HOME}/server_priv/nodes" || die + fi + + echo "${PBS_SERVER_NAME}" > "${ED}${PBS_SERVER_HOME}/server_name" || die + + # Fix up the env.d file to use our set server home. + sed \ + -e "s:/var/spool/${PN}:${PBS_SERVER_HOME}:g" \ + -i "${ED}"/etc/env.d/25${PN} || die + + if use munge; then + sed -i 's,\(PBS_USE_MUNGE=\).*,\11,' "${ED}"/etc/conf.d/${PN} || die + fi +} + +pkg_postinst() { + 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" + echo "" + elog " For a basic setup, you may use emerge --config ${PN}" + echo "" + if [[ -z "${REPLACING_VERSIONS}" ]] || [[ ${REPLACING_VERSIONS} < 4 ]]; then + elog "Important 4.0+ updates" + elog " - The on-wire protocol version has been changed." + elog " Versions of Torque before 4.0.0 are no longer able to communicate." + elog " - pbs_iff has been replaced by trqauthd, you will now need to add" + elog " trqauthd to your default runlevel." + fi +} + +# 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="$(echo "${ROOT}/${PBS_SERVER_HOME}" | sed 's:///*:/:g')" + local rc=0 + + ebegin "Configuring Torque" + einfo "Using ${h} 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 Enter to" + ewarn "continue or Control-C to abort now" + read + fi + + # pbs_mom configuration. + echo "\$pbsserver ${PBS_SERVER_NAME}" > "${h}/mom_priv/config" || die + echo "\$logevent 255" >> "${h}/mom_priv/config" || die + + if use server; then + local qmgr="${EROOT}/usr/bin/qmgr -c" + # pbs_server bails on repeated backslashes. + if ! "${EROOT}"/usr/sbin/pbs_server -f -d "${h}" -t create; 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} \ + || die + + "${EROOT}"/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" || die + fi + fi + eend ${rc} +} diff --git a/sys-cluster/torque/torque-4.2.9-r4.ebuild b/sys-cluster/torque/torque-4.2.9-r4.ebuild new file mode 100644 index 000000000000..372a4a12c68d --- /dev/null +++ b/sys-cluster/torque/torque-4.2.9-r4.ebuild @@ -0,0 +1,178 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=5 + +inherit flag-o-matic eutils linux-info + +DESCRIPTION="Resource manager and queuing system based on OpenPBS" +HOMEPAGE="http://www.adaptivecomputing.com/products/open-source/torque" +# TODO: hopefully moving to github tags soon +# http://www.supercluster.org/pipermail/torquedev/2013-May/004519.html +SRC_URI="http://www.adaptivecomputing.com/index.php?wpfb_dl=2849 -> ${P}.tar.gz" + +LICENSE="torque-2.5" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86" +IUSE="cpusets +crypt doc drmaa kernel_linux munge nvidia server +syslog tk" + +DEPEND_COMMON=" + sys-libs/ncurses + sys-libs/readline:* + cpusets? ( sys-apps/hwloc ) + munge? ( sys-auth/munge ) + nvidia? ( >=x11-drivers/nvidia-drivers-275 ) + tk? ( dev-lang/tk:0 ) + syslog? ( virtual/logger ) + !games-util/qstat" + +DEPEND="${DEPEND_COMMON} + !sys-cluster/slurm" + +RDEPEND="${DEPEND_COMMON} + crypt? ( net-misc/openssh ) + !crypt? ( net-misc/netkit-rsh ) + !dev-libs/uthash" + +# Torque should depend on dev-libs/uthash but that's pretty much impossible +# to patch in as they ship with a broken configure such that files referenced +# by the configure.ac and Makefile.am are missing. +# http://www.supercluster.org/pipermail/torquedev/2014-October/004773.html + +pkg_setup() { + PBS_SERVER_HOME="${PBS_SERVER_HOME:-/var/spool/${PN}}" + + # Find a Torque server to use. Check environment, then + # current setup (if any), and fall back on current hostname. + if [ -z "${PBS_SERVER_NAME}" ]; then + if [ -f "${ROOT}${PBS_SERVER_HOME}/server_name" ]; then + PBS_SERVER_NAME="$(<${ROOT}${PBS_SERVER_HOME}/server_name)" + else + PBS_SERVER_NAME=$(hostname -f) + fi + fi + + USE_CPUSETS="--disable-cpuset" + 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 + linux-info_pkg_setup + if ! linux_config_exists || ! 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-cpuset" + fi + fi +} + +src_prepare() { + # Unused and causes breakage when switching from glibc to tirpc. + # https://github.com/adaptivecomputing/torque/pull/148 + sed -i '/rpc\/rpc\.h/d' src/lib/Libnet/net_client.c || die + + # We install to a valid location, no need to muck with ld.so.conf + # --without-loadlibfile is supposed to do this for us... + sed -i '/mk_default_ld_lib_file || return 1/d' buildutils/pbs_mkdirs.in || die + + epatch "${FILESDIR}"/${P}-tcl8.6.patch + + # 524362 + epatch "${FILESDIR}"/TRQ-2885-limit-tm_adopt-to-only-adopt-a-session-id-t.patch +} + +src_configure() { + local myconf="--with-rcp=mom_rcp" + + use crypt && myconf="--with-rcp=scp" + + econf \ + $(use_enable tk gui) \ + $(use_enable syslog) \ + $(use_enable server) \ + $(use_enable drmaa) \ + $(use_enable munge munge-auth) \ + $(use_enable nvidia nvidia-gpus) \ + --with-server-home=${PBS_SERVER_HOME} \ + --with-environ=/etc/pbs_environment \ + --with-default-server=${PBS_SERVER_NAME} \ + --disable-gcc-warnings \ + --with-tcp-retry-limit=2 \ + --without-loadlibfile \ + ${USE_CPUSETS} \ + ${myconf} +} + +src_install() { + local dir + + DOCS=( CHANGELOG README.* Release_Notes ) + use doc && DOCS+=( doc/admin_guide.ps doc/*.pdf ) + + default + + # 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 "${ED}" -iname tclIndex); do + sed \ + -e "s/${ED//\// }/ /" \ + -i "${file}" || die + done + + for dir in $(find "${ED}/${PBS_SERVER_HOME}" -type d); do + keepdir "${dir#${ED}}" + done + + if use server; then + newinitd "${FILESDIR}"/pbs_server-init.d-munge pbs_server + newinitd "${FILESDIR}"/pbs_sched-init.d pbs_sched + fi + newinitd "${FILESDIR}"/pbs_mom-init.d-munge pbs_mom + newconfd "${FILESDIR}"/${PN}-conf.d-munge ${PN} + newinitd "${FILESDIR}"/trqauthd-init.d trqauthd + newenvd "${FILESDIR}"/${PN}-env.d 25${PN} +} + +pkg_preinst() { + if [[ -f "${ROOT}etc/pbs_environment" ]]; then + cp "${ROOT}etc/pbs_environment" "${ED}"/etc/pbs_environment || die + fi + + if use server && [[ -f "${ROOT}${PBS_SERVER_HOME}/server_priv/nodes" ]]; then + cp \ + "${EROOT}${PBS_SERVER_HOME}/server_priv/nodes" \ + "${ED}/${PBS_SERVER_HOME}/server_priv/nodes" || die + fi + + echo "${PBS_SERVER_NAME}" > "${ED}${PBS_SERVER_HOME}/server_name" || die + + # Fix up the env.d file to use our set server home. + sed \ + -e "s:/var/spool/${PN}:${PBS_SERVER_HOME}:g" \ + -i "${ED}"/etc/env.d/25${PN} || die + + if use munge; then + sed -i 's,\(PBS_USE_MUNGE=\).*,\11,' "${ED}"/etc/conf.d/${PN} || die + fi +} + +pkg_postinst() { + 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://docs.adaptivecomputing.com/torque/${PN//./-}/Content/topics/1-installConfig/initializeConfigOnServer.htm" + if [[ -z "${REPLACING_VERSIONS}" ]] || [[ ${REPLACING_VERSIONS} < 4 ]]; then + echo + elog "Important 4.0+ updates" + elog " - The on-wire protocol version has been changed." + elog " Versions of Torque before 4.0.0 are no longer able to communicate." + elog " - pbs_iff has been replaced by trqauthd, you will now need to add" + elog " trqauthd to your default runlevel." + fi +} |