summaryrefslogtreecommitdiff
path: root/sys-cluster/torque
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /sys-cluster/torque
reinit the tree, so we can have metadata
Diffstat (limited to 'sys-cluster/torque')
-rw-r--r--sys-cluster/torque/Manifest31
-rw-r--r--sys-cluster/torque/files/CVE-2013-4319-2.x-root-submit-fix.patch40
-rw-r--r--sys-cluster/torque/files/CVE-2013-4495.4.1.patch343
-rw-r--r--sys-cluster/torque/files/CVE-2013-4495.patch32
-rw-r--r--sys-cluster/torque/files/CVE-2014-0749.patch32
-rw-r--r--sys-cluster/torque/files/TRQ-2885-limit-tm_adopt-to-only-adopt-a-session-id-t.patch134
-rw-r--r--sys-cluster/torque/files/pbs_mom-init.d48
-rw-r--r--sys-cluster/torque/files/pbs_mom-init.d-munge48
-rw-r--r--sys-cluster/torque/files/pbs_sched-init.d48
-rw-r--r--sys-cluster/torque/files/pbs_server-init.d60
-rw-r--r--sys-cluster/torque/files/pbs_server-init.d-munge61
-rw-r--r--sys-cluster/torque/files/tcl8.6.patch87
-rw-r--r--sys-cluster/torque/files/torque-4.1.5.1-tcl8.6.patch93
-rw-r--r--sys-cluster/torque/files/torque-4.2-dont-mess-with-cflags.patch27
-rw-r--r--sys-cluster/torque/files/torque-4.2.9-tcl8.6.patch99
-rw-r--r--sys-cluster/torque/files/torque-conf.d14
-rw-r--r--sys-cluster/torque/files/torque-conf.d-munge18
-rw-r--r--sys-cluster/torque/files/torque-env.d7
-rw-r--r--sys-cluster/torque/files/trqauthd-init.d26
-rw-r--r--sys-cluster/torque/metadata.xml22
-rw-r--r--sys-cluster/torque/torque-2.5.13-r1.ebuild253
-rw-r--r--sys-cluster/torque/torque-4.1.7-r1.ebuild233
-rw-r--r--sys-cluster/torque/torque-4.2.10.ebuild196
-rw-r--r--sys-cluster/torque/torque-4.2.9-r5.ebuild183
-rw-r--r--sys-cluster/torque/torque-6.0.3.ebuild178
25 files changed, 2313 insertions, 0 deletions
diff --git a/sys-cluster/torque/Manifest b/sys-cluster/torque/Manifest
new file mode 100644
index 000000000000..f84a47ec7748
--- /dev/null
+++ b/sys-cluster/torque/Manifest
@@ -0,0 +1,31 @@
+AUX CVE-2013-4319-2.x-root-submit-fix.patch 1253 SHA256 a6ebd0c0966148ecb34fb885911e163f93749be72fc5a2e58f11f3c7a9523f45 SHA512 78780ad87e997f22b6abbc3cb51c313616e90320d997705c534c35fbc7f5738b7a2e0ace33051e6e15d4f6e0ab6f97ab9f1ef60dcee5fc4544db13b0a72ea5c4 WHIRLPOOL 64eaf701099da902282b3e1debb6bbfa323fc266ad067047c43dcb353463bf2df7475066f9e263cc9a506b2905aba19c290d50a419ee56a0daa65f237693ede7
+AUX CVE-2013-4495.4.1.patch 9063 SHA256 78a368607133cc9daeca9872ef61ac4117268e091a11554b72ccd48c1a34e781 SHA512 52d0105c8d756e50252926c764eff46653544584c25c43d4dbaf70ed45a1c610c9381b1f735ff6c436774fb8d77a2a7607e0ea2b70eaae927e9a1024b3048913 WHIRLPOOL 815c1719548f21c4cf712c96577701f084ab5f6fc7287e4cd1ddd4fd9678c19a303a94546842c890d0e994c84bae8768aa2ddf49e6ef3094c6b1c61193873d32
+AUX CVE-2013-4495.patch 836 SHA256 4cfaef5ced3b336920821089a97a86f38d71fcc573951912be701d2c51253d45 SHA512 91522f5c8b6fa2e5de80f02e24b2a6827422c335d88600bcbb1a763dd985b3e52b850eab5059adbe4e543311551ec0da21cd69fcb7dc6e01ff93bff843769d8c WHIRLPOOL 17e2790d362a16dcd58b0cb0a9acc81d5f920b96ad8d4eb99fff6cbd58a49e312414c9c9b580b9fbdbd35b4314fb0ea820888e4d93723ffec5ec02cc3c72bbf2
+AUX CVE-2014-0749.patch 750 SHA256 e79c9c2e08aec2e0adc4a10c2d97510ccc6780d5d2944e9fd646bf99b0a5e5aa SHA512 8830f4d1a0190876e97fc568a3ac84341c042686a630cc5a7d8f254414dd13063f08db3b490e447698d9c16430ab6c8990c70ee1acda2435a0b0debfb2666829 WHIRLPOOL 76a459649865456b1d004de5d728c97697f4351870f54980748dfc2046df26ed791738cea96189d3f82b76f8aa370904060ecdbcc0b52c5e092d2870221a132c
+AUX TRQ-2885-limit-tm_adopt-to-only-adopt-a-session-id-t.patch 4292 SHA256 67338a9c338b71b4dff5a911978798a4e51a2f84ce1429d80d70819511874e43 SHA512 15bb5b271b62be03df2b6aeab89082f3003abc67e00aaef96539ab88f21879f3cf30a95303fe68b3e4984cdc4f4c020e61328a4e3c26b4e44be9eafa9be3b5a6 WHIRLPOOL 00342548ab024f70f4f3de6c5982dbcdf5a4acedad94d46d340368bff58e7023a97d386486805a93a1f3da415345bf56ae5b93d7cfec320695bdb4461949b3ac
+AUX pbs_mom-init.d 1084 SHA256 b9f65c9d2fa74835e0737d3ffa3c54a15a6b27a1a42a84f7a2058c2b48874443 SHA512 698707c833070f77224e55788799ae4b32088b47221bfd9ed8fbb4097095bb4771ec39db831bbfd5af46d0a6addee04464bc71ef548ca94f3a324ebb97ce8a9c WHIRLPOOL 8884a378af2ef147314709dc133375e41099ffcc0b2afaf8dec1a62e8c50f2928558614b5302084ce80a661fc65bdad68a25b67f6b8ed2e5fa0bbf04831ce3ce
+AUX pbs_mom-init.d-munge 1149 SHA256 ed2bdf0ac4469dde1c19f9beb5aa6fa69840dc9a471a4195eea952ecfc91d1b7 SHA512 643deb1f21983dbdd8aa53416899db01ff651d81b3d989299eef9c2d3e1aab0e9b083cfae9bb559b6c3195238998a881ec5bf2a663e09f7f8508bb895bc11027 WHIRLPOOL 98ff6b73f83f4ed1859337b126473bc1915cea8dd358caea4aa19aa9880859c66fa6b1e96363838481c465a3237beaee2fa2fa91a079fd0b6f5d9cb7698b5c4f
+AUX pbs_sched-init.d 1165 SHA256 b04d43a838d271c2d78dee950ed9ea2f87a4cd6f3eb4409537a015d286f4c68d SHA512 9417ffe5a417d69e03262221816b2778aacfe7cf393ea5b5ea535497f4dfcbad9545d49cdbcacaaa5e8a0fd01432806aac8e050b4979cabb59656c1256a91dd0 WHIRLPOOL cca5750647349612ad9bd534fe53fb33d851fdb4c9ac705bcb685276538e11c867e6acbbd1dfb6124e2832dbef77ee16c96a925eb650e61afa33f1c3ca4b8c7c
+AUX pbs_server-init.d 1615 SHA256 e6c4bdd33ab79b9e0ca085269e845fbd8794d7427b8ca45cfafa7187a1317dab SHA512 459334236d5614522dafa15c0144bbf9e9b5fe89ce73d61fde6b1bfbcc96c284d8f827069c4dd77f7a6c5fb2828923d60a9381c158123d5f6edd5ca50a471c21 WHIRLPOOL 7cd157ebe0a30099172c48ec774b8256825350a06b6ce0619dc99d465b82e210e6f5facda756743700fc054103af776f08f1d4809a014776e7dd914f07faf5ae
+AUX pbs_server-init.d-munge 1689 SHA256 9d1972d5fdbb31a7ab74a45a77631b96ac23d47e4b814b3fb31964fd1084863f SHA512 b9628241581fbed629d0edf83a3f987de894fb5711061239e737f63ef7dbe9033d35aa87a38b56dbd8da887a3058f9f284bfe101ee13db3464e6e814b537ea23 WHIRLPOOL b9fe25f9097f369e5a944a0e9d2efdf2a1c48bd0b0a6e9504a438956be5e4682ae44c7fc09dbbbffcf07bcbbfc786c2c7fe8f2dc34ac92d69b6f1c5268a9f39e
+AUX tcl8.6.patch 2396 SHA256 02905289c2707b2bc60b3aed513d9d4578cb597b346ee79deb89b1e72131af2b SHA512 a288526bf43cd39d0b5505938f02ee38ccd70481a1b6351a80c5cd151376604d5cdc925293d3bd7f2d4bbe50182993448da645ca42f58e3f1bdf59bce9363b4a WHIRLPOOL cbccee8ce08d3bf36bc30b49cf0740753f10d1d309558a702aa8df8f0d9ec5069e37cc3e7cb47caa686d69935f90c6b6f2dbdae55eba98864f3bbc22f4fa7ada
+AUX torque-4.1.5.1-tcl8.6.patch 2546 SHA256 3b03036181df73cee7e2dea6746b822368a92d4f76953018e226c4e7c26abe86 SHA512 0cd584784b5254daf11635e1d6252fa4fe3c5f2e46a0771452016f66ff0e3be01b91d154cef0a793cf0ab0df223ef5c51303d35c419f1d9addc64ea26a892521 WHIRLPOOL b335acece9491ecfa5adbb9a64122826f8e6944ac33aac862ac4c57c7cf73c0ed823b60228a3567c249f1710d1a8ab0fac8ce2fbb301500eeb0bf8d832c0f117
+AUX torque-4.2-dont-mess-with-cflags.patch 806 SHA256 e3f0028dc7c9ecd9df3d9c849159a980130af0db8859fb4e7c9624ffa64c8c56 SHA512 23aeb87fc75ec8b916817264501240b9f0fae7b3e81662496824dcccc21d1a07b2b58221ea22ca6551b6830e76347416a09da6c22de4aea173a32fe13c90c7ff WHIRLPOOL 0a45b03fffcd6fe9a64b207ab3e6a07b373476423a979012738b984ae999171f25bcef85188130af58181deb1e4ff4405ce8df494936b667b1730bb5146cfb77
+AUX torque-4.2.9-tcl8.6.patch 2702 SHA256 cd894a32a300b9b8b5fa343c79ac0ff9f44dc02e12eae9d7bb69d5f8799ead34 SHA512 9844a1f633f049a66cf31d3721f6a5e205ede26186da1357e0b0aa2c0c4d064cbdff45e2f7e685d6c4afd09d961e59ff1759163e4a2ae349fa866e960c1bcf77 WHIRLPOOL a4acb94a7d64e84b25c8ebb0898ab3c4523a141c17719f51eb19276604a3543041374de5e828664dcc1dc35269148512231628d3990c09a9872ade353aa7479f
+AUX torque-conf.d 649 SHA256 4139da44a55dbcb4a8227fd0aedede8e091971fd63c0e08644712f4a91e7b174 SHA512 b82f6c1d661bed03a32c3761530c4b303715167a317e467371091b11d3ae0e19e9784b1588577ee5f65397cb0699818ed5f621aeb66d3f2d218df12d0cf39bde WHIRLPOOL 0f0db60c037400ce87013d7639a5e126b65388e914e1f3bde81548ebc1e8fcefb17972c4deec03509973973a263c5006856699d3f51fad0133b8428e13e2e04c
+AUX torque-conf.d-munge 784 SHA256 7b8e47737211fd0d05dcc7938021ea5dbb1575010c53075440ef0b6b5d43d8b1 SHA512 a78634a6f2bdf3c24e8c99d3cd7a9634daa32d69244a9ddfcc26199f4d04e901abbfa79ad057f5a4e4c492c9e21bc0c65edd8465ac6935fb7c67c8c639e75d68 WHIRLPOOL 90ed407a5a98fb7b4509610c3c23dd1d38566886e4b02fa4db4a9708f8c45b500369e782c25b7b9f02fc685bdcb965049e681c829bad58206729690e6eeadbb9
+AUX torque-env.d 240 SHA256 d04eab3b1314645ee2014c718c4cf79ca74950dee1357d814b85c9faa5ef6002 SHA512 275ce5ccf9f138bcee504a9996c9d838cd34714d352d4b7ac2d631d0fca662bf38a2ef7e8745605d9b3847049015e0791c937340cfdacbf44800482ce73bb042 WHIRLPOOL b7cdc4d6752d00b315fb369f6382e1a6684c1cb8a3486545bd406270ed09811936c2735755fc01175fceed0422139e5d7d8dcd67868e2e40c8ebbb406c2eec57
+AUX trqauthd-init.d 477 SHA256 41d9dfdb64b2512b6da3a0e87fbaf9ac6d7a988ce398c63d918ccf069aa81e4e SHA512 55f19b5effc21444addb465967bbd44d6f67dc48945221753512216c4fc26878d90569cdee7b277676d157aa241c04dc08df65505d21f59f046fa5448d43b81d WHIRLPOOL f1b7f0429d77619099bac9e27c849cfb7fac2f1c0306e8ab6f878a452cf67db3adfb748684a43bc78d644d48f5681ae0e3d3d641ca2457825a40820b84bb36e6
+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.10.tar.gz 6294022 SHA256 46f1f319683af6d3820e18cda69ce59113c9a5c192e1f07826007be69385889b SHA512 898703fa1d02310c22e2a02b86d67ca52ebed46684597931944edebb39f8293746739c8dca9cd10e07c2e7274c3dd7f65a5664d1980817e3feec58952c4cf4d1 WHIRLPOOL e65be66b056a519ebd1c30c2c1ae2ddf43bc4e617a52d3caced1e6dfd2b0d8b2a83c26a0f2e6e41cfae791aca68b6f91424745b2baffa2085fccc8f6ae9b8e04
+DIST torque-4.2.9.tar.gz 6294022 SHA256 46f1f319683af6d3820e18cda69ce59113c9a5c192e1f07826007be69385889b SHA512 898703fa1d02310c22e2a02b86d67ca52ebed46684597931944edebb39f8293746739c8dca9cd10e07c2e7274c3dd7f65a5664d1980817e3feec58952c4cf4d1 WHIRLPOOL e65be66b056a519ebd1c30c2c1ae2ddf43bc4e617a52d3caced1e6dfd2b0d8b2a83c26a0f2e6e41cfae791aca68b6f91424745b2baffa2085fccc8f6ae9b8e04
+DIST torque-6.0.3-1485300822_19e79ad.tar.gz 41660338 SHA256 dcbc806379596848f9887ff3b518d4ca7031e888d29d0b12e4e270c0e677dd80 SHA512 40531f2e7732a11ffc224c536f61adc48ce5699a7caebb8aa1fbe7536b5ca4ed66c8436420bc918f7538ef980818141888aa26390a5a2c8185c8cc57373a0ac1 WHIRLPOOL f504106f33a031f9e578b5aa9992423ecc50fad88ec0b380e10284007d1271aeee10da494b32d9a3f7da5a012eeaadbbae2f91f0180ef0abcda9309942eb7777
+EBUILD torque-2.5.13-r1.ebuild 7741 SHA256 9de9ea394760c905c44572e12be1f3e1566d0298e4377031c72fddeda3434393 SHA512 d17389297c11f28c4f849e95d2f5c87f428d2b8d3c6a907d5863f4cbdd19a41532cb5abf5b9d78092f99b2838c2e1892b8fb7111b4dcb98338bfa11c4bbc5e5d WHIRLPOOL bba4e436413e131f1baa143501ff81f86ed2305104960a50490c516aff2874504aa01ea317880db498b4c5ae7f8bc738e8330b737d5cf0d1f62c7ecb6f89922e
+EBUILD torque-4.1.7-r1.ebuild 7491 SHA256 0e8dd567a22c62fd9c6b4869c9d1b7878bc6d33d8c539c5afffc3e7300d02f86 SHA512 e7213e0df29564fa24a48bf8b96e59a69fbd56abf5c470b794eb19fbdefe705ead880d9d908f006c9c79eeab325b0f6ccc3ae64973cb1e50061c2020c64aa816 WHIRLPOOL 6d8be71bae13d46ad27a4536c5b73685e53ed75a808f158faa47fd9cfca6ef15caa29b77b4fd1530c838c7b836c651f4dd4f37dc16497b182e11f592e17dd64f
+EBUILD torque-4.2.10.ebuild 5942 SHA256 d6379c131cf7dcb1b3c643d86c7ace72b65a93184aaec8592621a9cb7f74e937 SHA512 b31613ee3bbf1623180a55e20a61ef21909a520d9fe04f776a885b06ba3335a4f684c8b18017d658c36151663a6baecbe804d6750a954bb38fc90160b0e52ad6 WHIRLPOOL 62a672550d8a75342ffe9e71bd53f49b0474c1cb8c7ab7a2adbfeb5a28cfc6cabdf5b47d5bb06afd54f7cf8f7075bbb040d21d100b7babcf4725b385b02b3ffa
+EBUILD torque-4.2.9-r5.ebuild 5687 SHA256 d0ecd4e5dfa095ff14883b2ea0c0927c282dd2bbb6497c20d545219f91f8d041 SHA512 faa2b1e99265f1222123a4b30c0edeb512d67d2285cf56789c21dcf85d43daab2ebbf38a6d768614d9124b1b0b43ffec895da4010b4fab36574b79be461c8860 WHIRLPOOL b411d3f32ac0c286e3a3757b4cc7cab44bc4841ae400da69d6e25b2d8934cfca09368c99962849f5eeba612944d195e7121e1286c5ee9e701979f3594a37d114
+EBUILD torque-6.0.3.ebuild 5639 SHA256 8e3c74b82bcab83bd8914eaa871e8b9e188d987819908e616335e76c7510f678 SHA512 4043dce415db5d59743901c95a3b43301671b24515879ba5b67a98a712ba61bcce0434d607a861324c128378730b008b0c53afc9744360674c9ed9c3096f3147 WHIRLPOOL 873dd468bda5790b7b1d5a44e57d0b6b82f551aedf2da872af97097b51815527862e9c44c17b622be880b479b69794982e33aa4a5f788ff28555dde8478970d0
+MISC ChangeLog 4882 SHA256 47c534a744f898d4d7a9b6f3755dad6787f08fa35ab83be9782bc239e1fcc930 SHA512 903940262569bfe38fc67b2ad7238f449075e2c70ee9855875041eca59e7c912fa0803bc4afa23b1c83318e30a9e3e26cfcb9afb974286e2e8b66ebc5d52bccc WHIRLPOOL ca993f5e7712ffc8c8d8d3be553a9f2e1c120eeb7601a37d21d6068e644a5448684f5b313319baa95baf7374af6254a857711d22125bca48ba12b01012d93969
+MISC ChangeLog-2015 31920 SHA256 2007f50e617be4bdd277b65705450288d2eec8067f7dabf231dfedc9365094c3 SHA512 a5cc38230ce5ddc05770e7fe8b8eb19e9cfa707cedfed761d69fc2c9054942a8436860dea440b8a05830113dbf997f3649d15fd78d2c1d57484fbf0d7e560e72 WHIRLPOOL 8a2983c9e98a3dc0e434f4fb0e94e46048484f3ec1d44a3665463ff6d5047222050d8c5593f6af52e2199c5553c391aca3da3b98af0252c0ac6bdf8451f13ada
+MISC metadata.xml 988 SHA256 e27586f33abc567b80daafafc201613b99068c875849b4fee3957e845ca2d942 SHA512 46f2eb41303c17e84aacf5b8548b645772ab923bf9a4847892260cc5c6aaf354acc0bb0128186acf312ed77a24d9429c97f18914d759c7c5c97c19ad62489a43 WHIRLPOOL 9b06e825891730374b1ab286a8664a9648c5de91d60b59828b5e2e267d047845f342af9072b184b020bc7aeee0feb0c41f47f7ce08275e9af0131dd33529ee70
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-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..7f267838f693
--- /dev/null
+++ b/sys-cluster/torque/files/pbs_mom-init.d
@@ -0,0 +1,48 @@
+#!/sbin/openrc-run
+# 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..062645ed5dc0
--- /dev/null
+++ b/sys-cluster/torque/files/pbs_mom-init.d-munge
@@ -0,0 +1,48 @@
+#!/sbin/openrc-run
+# 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..006ef58b51cb
--- /dev/null
+++ b/sys-cluster/torque/files/pbs_sched-init.d
@@ -0,0 +1,48 @@
+#!/sbin/openrc-run
+# 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..1fafa8db336c
--- /dev/null
+++ b/sys-cluster/torque/files/pbs_server-init.d
@@ -0,0 +1,60 @@
+#!/sbin/openrc-run
+# 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..d5e303f955ac
--- /dev/null
+++ b/sys-cluster/torque/files/pbs_server-init.d-munge
@@ -0,0 +1,61 @@
+#!/sbin/openrc-run
+# 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-dont-mess-with-cflags.patch b/sys-cluster/torque/files/torque-4.2-dont-mess-with-cflags.patch
new file mode 100644
index 000000000000..aec54aff030f
--- /dev/null
+++ b/sys-cluster/torque/files/torque-4.2-dont-mess-with-cflags.patch
@@ -0,0 +1,27 @@
+--- a/configure.ac 2014-09-10 21:06:26.000000000 -0400
++++ b/configure.ac 2017-05-23 10:43:59.051759539 -0400
+@@ -703,24 +703,6 @@
+ AC_HELP_STRING([--with-debug], [compile with debugging symbols]),
+ DEBUG_SYMBOLS=$withval, DEBUG_SYMBOLS="yes")
+ AC_MSG_RESULT([DEBUG_SYMBOLS=$DEBUG_SYMBOLS])
+-dnl remove -O* and add -g
+-if test "$DEBUG_SYMBOLS" = 'yes'; then
+- AC_MSG_RESULT([before tweak CFLAGS=$CFLAGS])
+- CFLAGS=`echo $CFLAGS | sed 's/ \?-O[[^ ]]*//g'`
+- AC_MSG_RESULT([mid tweak CFLAGS=$CFLAGS])
+- case $CFLAGS in
+- *-g*)
+- ;;
+- *)
+- if test "$CFLAGS" = ''; then
+- CFLAGS="-g"
+- else
+- CFLAGS="-g $CFLAGS"
+- fi
+- ;;
+- esac
+- AC_MSG_RESULT([after tweak CFLAGS=$CFLAGS])
+-fi
+
+ dnl if using gcc, we can be very strict
+ AC_ARG_ENABLE(gcc_warnings, [
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..46565f655e49
--- /dev/null
+++ b/sys-cluster/torque/files/trqauthd-init.d
@@ -0,0 +1,26 @@
+#!/sbin/openrc-run
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+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..ce0da419e927
--- /dev/null
+++ b/sys-cluster/torque/metadata.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>cluster@gentoo.org</email>
+ <name>Gentoo Cluster Project</name>
+ </maintainer>
+ <maintainer type="person">
+ <email>axs@gentoo.org</email>
+ <name>Ian Stakenvicius</name>
+ </maintainer>
+ <use>
+ <flag name="autorun">Enable the AUTORUN_JOBS codebase</flag>
+ <flag name="cgroups">Enable pbs_mom to use linux cgroups to isolate jobs</flag>
+ <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="quickcommit">Enable the QUICKCOMMIT codebase</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-r1.ebuild b/sys-cluster/torque/torque-2.5.13-r1.ebuild
new file mode 100644
index 000000000000..7a45fb1c9002
--- /dev/null
+++ b/sys-cluster/torque/torque-2.5.13-r1.ebuild
@@ -0,0 +1,253 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+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/readline:0=
+ munge? ( sys-auth/munge )
+ tk? (
+ dev-lang/tk:0=
+ dev-lang/tcl:0=
+ )
+ syslog? ( virtual/logger )
+ !!games-util/qstat"
+
+# libncurses.so is just needed so that configure will pass for the readline check
+DEPEND="${DEPEND_COMMON}
+ sys-libs/ncurses:*
+ 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
+
+ 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 and ignoring."
+ 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
+ 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)
+ $(usex kernel_linux $(use_enable cpusets cpuset) --disable-cpuset)
+ --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
+ )
+ 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-r1.ebuild b/sys-cluster/torque/torque-4.1.7-r1.ebuild
new file mode 100644
index 000000000000..c3c2cac28b35
--- /dev/null
+++ b/sys-cluster/torque/torque-4.1.7-r1.ebuild
@@ -0,0 +1,233 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+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 libressl munge nvidia server +syslog tk"
+
+DEPEND_COMMON="
+ sys-libs/zlib
+ sys-libs/readline:0=
+ libressl? ( dev-libs/libressl:0= )
+ !libressl? ( dev-libs/openssl:0= )
+ cpusets? ( sys-apps/hwloc )
+ munge? ( sys-auth/munge )
+ nvidia? ( >=x11-drivers/nvidia-drivers-275 )
+ tk? (
+ dev-lang/tk:0=
+ dev-lang/tcl:0=
+ )
+ syslog? ( virtual/logger )
+ !!games-util/qstat"
+
+# libncurses.so is only needed for the configure check on readline to pass
+DEPEND="${DEPEND_COMMON}
+ sys-libs/ncurses:*
+ !!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
+
+ 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, and ignoring its state."
+ 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
+ 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) \
+ $(usex kernel_linux $(use_enable cpusets cpuset) --disable-cpuset) \
+ --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 \
+ ${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.10.ebuild b/sys-cluster/torque/torque-4.2.10.ebuild
new file mode 100644
index 000000000000..769264fd387c
--- /dev/null
+++ b/sys-cluster/torque/torque-4.2.10.ebuild
@@ -0,0 +1,196 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit autotools 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 libressl munge nvidia server +syslog tk"
+
+DEPEND_COMMON="
+ sys-libs/zlib
+ sys-libs/readline:0=
+ dev-libs/libxml2
+ !libressl? ( dev-libs/openssl:0= )
+ libressl? ( dev-libs/libressl:0= )
+ cpusets? ( sys-apps/hwloc )
+ munge? ( sys-auth/munge )
+ nvidia? ( >=x11-drivers/nvidia-drivers-275 )
+ tk? (
+ dev-lang/tk:0=
+ dev-lang/tcl:0=
+ )
+ syslog? ( virtual/logger )
+ !!games-util/qstat"
+
+# libncurses.so is only needed for configure check on readline
+DEPEND="${DEPEND_COMMON}
+ sys-libs/ncurses:*
+ !!sys-cluster/slurm"
+
+RDEPEND="${DEPEND_COMMON}
+ crypt? ( net-misc/openssh )
+ !crypt? ( net-misc/netkit-rsh )
+ !dev-libs/uthash"
+
+S="${WORKDIR}"/${PN}-4.2.9
+
+# 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
+
+ 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 and ignoring its state."
+ 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
+ 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
+
+ eapply "${FILESDIR}"/${PN}-4.2.9-tcl8.6.patch
+
+ # 524362
+ eapply "${FILESDIR}"/TRQ-2885-limit-tm_adopt-to-only-adopt-a-session-id-t.patch
+
+ eapply "${FILESDIR}"/${PN}-4.2-dont-mess-with-cflags.patch
+ eapply_user
+ mkdir -p "${S}"/m4
+ eautoconf
+}
+
+src_configure() {
+ econf \
+ $(use_enable tk gui) \
+ $(use_enable syslog) \
+ $(use_enable server) \
+ $(use_enable drmaa) \
+ $(use_enable munge munge-auth) \
+ $(use_enable nvidia nvidia-gpus) \
+ $(usex kernel_linux $(use_enable cpusets cpuset) --disable-cpuset) \
+ $(usex crypt --with-rcp=scp --with-rcp=mom_rcp) \
+ --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
+}
+
+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() {
+ local showmessage=1
+ if [[ -z "${REPLACING_VERSIONS}" ]] ; then
+ showmessage=0;
+ 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"
+ elog
+ else
+ for i in ${REPLACING_VERSIONS} ; do
+ if [[ ${i} == 4* ]]; then
+ showmessage=0; break;
+ fi
+ done
+ fi
+ if [[ ${showmessage} > 0 ]]; then
+ elog "Important v4.x changes:"
+ 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
+}
diff --git a/sys-cluster/torque/torque-4.2.9-r5.ebuild b/sys-cluster/torque/torque-4.2.9-r5.ebuild
new file mode 100644
index 000000000000..d972010f7c74
--- /dev/null
+++ b/sys-cluster/torque/torque-4.2.9-r5.ebuild
@@ -0,0 +1,183 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+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 libressl munge nvidia server +syslog tk"
+
+DEPEND_COMMON="
+ sys-libs/zlib
+ sys-libs/readline:0=
+ dev-libs/libxml2
+ !libressl? ( dev-libs/openssl:0= )
+ libressl? ( dev-libs/libressl:0= )
+ cpusets? ( sys-apps/hwloc )
+ munge? ( sys-auth/munge )
+ nvidia? ( >=x11-drivers/nvidia-drivers-275 )
+ tk? (
+ dev-lang/tk:0=
+ dev-lang/tcl:0=
+ )
+ syslog? ( virtual/logger )
+ !!games-util/qstat"
+
+# libncurses.so is only needed for configure check on readline
+DEPEND="${DEPEND_COMMON}
+ sys-libs/ncurses:*
+ !!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
+
+ 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 and ignoring its state."
+ 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
+ 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) \
+ $(usex kernel_linux $(use_enable cpusets cpuset) --disable-cpuset) \
+ --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 \
+ ${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
+}
diff --git a/sys-cluster/torque/torque-6.0.3.ebuild b/sys-cluster/torque/torque-6.0.3.ebuild
new file mode 100644
index 000000000000..74409b48eef8
--- /dev/null
+++ b/sys-cluster/torque/torque-6.0.3.ebuild
@@ -0,0 +1,178 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+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"
+DISTFILEHASH="1485300822_19e79ad"
+SRC_URI="http://wpfilebase.s3.amazonaws.com/torque/${P}-${DISTFILEHASH}.tar.gz"
+
+LICENSE="torque-2.5"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
+IUSE="autorun cgroups cpusets +crypt doc drmaa kernel_linux libressl munge nvidia quickcommit server +syslog tk"
+
+DEPEND_COMMON="
+ sys-libs/zlib
+ sys-libs/readline:0=
+ dev-libs/libxml2
+ >=dev-libs/boost-1.41
+ !libressl? ( dev-libs/openssl:0= )
+ libressl? ( dev-libs/libressl:0= )
+ cpusets? ( sys-apps/hwloc )
+ munge? ( sys-auth/munge )
+ nvidia? ( >=x11-drivers/nvidia-drivers-275 )
+ tk? (
+ dev-lang/tk:0=
+ dev-lang/tcl:0=
+ )
+ syslog? ( virtual/logger )
+ !!games-util/qstat"
+
+# libncurses.so is only needed for configure check on readline
+DEPEND="${DEPEND_COMMON}
+ sys-libs/ncurses:*
+ !!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
+
+S="${WORKDIR}"/${P}-${DISTFILEHASH}
+
+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
+
+ if use cpusets || use cgroups; then
+ if ! use kernel_linux; then
+ einfo
+ elog " Torque currently only has support for cpusets and cgroups in linux."
+ elog "Assuming you didn't really want this USE flag and ignoring its state."
+ 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
+ fi
+ fi
+}
+
+src_prepare() {
+ # 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
+}
+
+src_configure() {
+ econf \
+ $(use_enable tk gui) \
+ $(use_enable tk tcl-qstat) \
+ $(use_enable syslog) \
+ $(use_enable server) \
+ $(use_enable drmaa) \
+ $(use_enable munge munge-auth) \
+ $(use_enable nvidia nvidia-gpus) \
+ $(usex crypt "--with-rcp=scp" "--with-rcp=mom_rcp") \
+ $(usex kernel_linux $(use_enable cpusets cpuset) --disable-cpuset) \
+ $(usex kernel_linux $(use_enable cpusets geometry-request) --disable-geometry-request) \
+ $(usex kernel_linux $(use_enable cgroups) --disable-cgroups) \
+ $(use_enable autorun) \
+ $(use_enable quickcommit) \
+ --with-server-home=${PBS_SERVER_HOME} \
+ --with-environ=/etc/pbs_environment \
+ --with-default-server=${PBS_SERVER_NAME} \
+ --disable-gcc-warnings \
+ --disable-silent-rules \
+ --with-tcp-retry-limit=2 \
+ --without-loadlibfile
+}
+
+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
+}