# Copyright (C) 2007 Platform Computing Inc # This program is free software; you can redistribute it and/or modify # it under the terms of version 2 of the GNU General Public License as # published by the Free Software Foundation. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA %define _unpackaged_files_terminate_build 0 %define debug_package %{nil} %define _name hpc Summary: kit-hpc package Name: kit-%{_name} Version: 0.1 Release: 3 License: LGPL Group: System Environment/Base Vendor: Platform Computing Corporation BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot %define comp1 component-benchmarking-tools %define comp2 component-hpc-libraries %define comp3 component-mpich1-libraries %define comp4 component-mpich2-libraries %define comp5 component-mvapich1-libraries %define comp6 component-mvapich2-libraries %define comp7 component-openmpi-libraries %define SQLRUNNER /opt/kusu/sbin/sqlrunner %description HPC kit. %prep %install rm -rf %{buildroot} %pre %post if [ -e /var/lock/subsys/kusu-installer ]; then exit 0; fi PATH=$PATH:/opt/kusu/sbin export PATH if [ -d /opt/kusu/lib ]; then PYTHONPATH=/opt/kusu/lib64/python:/opt/kusu/lib/python export PYTHONPATH fi logfile=/var/log/kusu/%{_name}.log # include Node group creation and component association echo "POST Start" > $logfile KID=`%{SQLRUNNER} -q "SELECT kid FROM kits WHERE rname='%{_name}' and version='%{version}'"` if [ $? -ne 0 ]; then exit 0 fi # Setup the components %{SQLRUNNER} -q "DELETE FROM components WHERE kid=$KID" >> $logfile %{SQLRUNNER} -q "INSERT INTO components (cname, cdesc, os, kid) VALUES ('%{comp1}', 'RHEL HPC benchmarking tool packages', 'rhel-5-x86_64', $KID)" >> $logfile %{SQLRUNNER} -q "INSERT INTO components (cname, cdesc, os, kid) VALUES ('%{comp2}', 'RHEL HPC core library packages', 'rhel-5-x86_64', $KID)" >> $logfile %{SQLRUNNER} -q "INSERT INTO components (cname, cdesc, os, kid) VALUES ('%{comp3}', 'RHEL HPC MPICH1 library packages', 'rhel-5-x86_64', $KID)" >> $logfile %{SQLRUNNER} -q "INSERT INTO components (cname, cdesc, os, kid) VALUES ('%{comp4}', 'RHEL HPC MPICH2 library packages', 'rhel-5-x86_64', $KID)" >> $logfile %{SQLRUNNER} -q "INSERT INTO components (cname, cdesc, os, kid) VALUES ('%{comp5}', 'RHEL HPC MVAPICH1 library packages', 'rhel-5-x86_64', $KID)" >> $logfile %{SQLRUNNER} -q "INSERT INTO components (cname, cdesc, os, kid) VALUES ('%{comp6}', 'RHEL HPC MVAPICH2 library packages', 'rhel-5-x86_64', $KID)" >> $logfile %{SQLRUNNER} -q "INSERT INTO components (cname, cdesc, os, kid) VALUES ('%{comp7}', 'RHEL HPC Open MPI library packages', 'rhel-5-x86_64', $KID)" >> $logfile # Associate components to installer and # compute node groups CID1=`%{SQLRUNNER} -q "SELECT cid from components where kid=$KID and cname='%{comp1}' and os=(select repos.ostype from repos, nodegroups WHERE nodegroups.ngid=1 AND nodegroups.repoid=repos.repoid)"` CID2=`%{SQLRUNNER} -q "SELECT cid from components where kid=$KID and cname='%{comp2}' and os=(select repos.ostype from repos, nodegroups WHERE nodegroups.ngid=1 AND nodegroups.repoid=repos.repoid)"` CID3=`%{SQLRUNNER} -q "SELECT cid from components where kid=$KID and cname='%{comp3}' and os=(select repos.ostype from repos, nodegroups WHERE nodegroups.ngid=1 AND nodegroups.repoid=repos.repoid)"` CID4=`%{SQLRUNNER} -q "SELECT cid from components where kid=$KID and cname='%{comp4}' and os=(select repos.ostype from repos, nodegroups WHERE nodegroups.ngid=1 AND nodegroups.repoid=repos.repoid)"` CID5=`%{SQLRUNNER} -q "SELECT cid from components where kid=$KID and cname='%{comp5}' and os=(select repos.ostype from repos, nodegroups WHERE nodegroups.ngid=1 AND nodegroups.repoid=repos.repoid)"` CID6=`%{SQLRUNNER} -q "SELECT cid from components where kid=$KID and cname='%{comp6}' and os=(select repos.ostype from repos, nodegroups WHERE nodegroups.ngid=1 AND nodegroups.repoid=repos.repoid)"` CID7=`%{SQLRUNNER} -q "SELECT cid from components where kid=$KID and cname='%{comp7}' and os=(select repos.ostype from repos, nodegroups WHERE nodegroups.ngid=1 AND nodegroups.repoid=repos.repoid)"` %{SQLRUNNER} -q "INSERT into ng_has_comp (ngid, cid) VALUES (1, $CID1)" >> $logfile %{SQLRUNNER} -q "INSERT into ng_has_comp (ngid, cid) VALUES (2, $CID1)" >> $logfile %{SQLRUNNER} -q "INSERT into ng_has_comp (ngid, cid) VALUES (1, $CID2)" >> $logfile %{SQLRUNNER} -q "INSERT into ng_has_comp (ngid, cid) VALUES (2, $CID2)" >> $logfile %{SQLRUNNER} -q "INSERT into ng_has_comp (ngid, cid) VALUES (1, $CID3)" >> $logfile %{SQLRUNNER} -q "INSERT into ng_has_comp (ngid, cid) VALUES (2, $CID3)" >> $logfile %{SQLRUNNER} -q "INSERT into ng_has_comp (ngid, cid) VALUES (1, $CID4)" >> $logfile %{SQLRUNNER} -q "INSERT into ng_has_comp (ngid, cid) VALUES (2, $CID4)" >> $logfile %{SQLRUNNER} -q "INSERT into ng_has_comp (ngid, cid) VALUES (1, $CID5)" >> $logfile %{SQLRUNNER} -q "INSERT into ng_has_comp (ngid, cid) VALUES (2, $CID5)" >> $logfile %{SQLRUNNER} -q "INSERT into ng_has_comp (ngid, cid) VALUES (1, $CID6)" >> $logfile %{SQLRUNNER} -q "INSERT into ng_has_comp (ngid, cid) VALUES (2, $CID6)" >> $logfile %{SQLRUNNER} -q "INSERT into ng_has_comp (ngid, cid) VALUES (1, $CID7)" >> $logfile %{SQLRUNNER} -q "INSERT into ng_has_comp (ngid, cid) VALUES (2, $CID7)" >> $logfile # End post echo "Stop post" >> $logfile %preun %postun PATH=$PATH:/opt/kusu/sbin export PATH if [ -d /opt/kusu/lib ]; then PYTHONPATH=/opt/kusu/lib64/python:/opt/kusu/lib/python: export PYTHONPATH fi KID=`%{SQLRUNNER} -q "SELECT kid FROM kits WHERE rname='%{_name}' and version='%{version}'"` if [ $? -ne 0 ]; then echo "Database is down. Unable to remove kit." exit 1 fi logfile=/var/log/kusu/%{_name}.log touch $logfile echo "Start postun" >> $logfile # Remove all kit component associations if [ ! -z $KID ]; then %{SQLRUNNER} -q "DELETE from ng_has_comp WHERE cid in (select cid from components where kid=$KID)" fi exit 0 %clean %files #/depot/kits/hpc/%{version}/%{_arch}/kitinfo %changelog * Mon Jan 12 2009 Mehdi Bozzo-Rey 0.1-3 - db operations done in post * Tue Apr 15 2008 Mike Frisch 0.1-2 - Resync'd kitinfo file with kit-hpc package version * Thu Mar 20 2008 Mike Frisch 0.1-1 - Change location of Kusu installer lock file