ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CMSDIST/cms-env.spec
Revision: 1.40
Committed: Tue Apr 24 23:22:27 2007 UTC (18 years ago) by elmer
Branch: MAIN
CVS Tags: pe20070428a-ports
Changes since 1.39: +1 -1 lines
Log Message:
Fix typo (osx104_ppc32 instead of osx104_pcc32)

File Contents

# User Rev Content
1 eulisse 1.1 ### RPM cms cms-env 1.0
2 ratnik 1.39 Requires: gcc-wrapper
3 eulisse 1.1 Source: cmsos
4     %prep
5     %build
6 ratnik 1.39 ## IMPORT gcc-wrapper
7 eulisse 1.1 echo $SCRAM_ROOT
8     %install
9     %define scramroot %(echo $SCRAM_ROOT)
10     %define scramv1root %(echo $SCRAMV1_ROOT)
11    
12     mkdir -p %instroot/bin
13     install -m 755 %_sourcedir/cmsos %instroot/bin/cmsos
14 eulisse 1.5 mkdir -p %{instroot}/%{cmsplatf}/etc/profile.d
15    
16 eulisse 1.28 ### Detects the SCRAM_ARCH to be used.
17     cat << \EOF_CMSARCH_SH >%instroot/bin/cmsarch
18     #!/bin/sh
19     osarch=`%instroot/bin/cmsos`
20     compilerv=gcc323
21     # We need to assume 1 compiler per platform.
22     # There is no other way around this.
23 eulisse 1.31 if [ ! "$SCRAM_ARCH" ]
24 eulisse 1.29 then
25     case $osarch in
26     slc3_ia32) compilerv=gcc323;;
27     slc3_amd64) compilerv=gcc344;;
28     slc4_ia32) compilerv=gcc345;;
29 ratnik 1.37 slc4_amd64) compilerv=gcc345; osarch=slc4_ia32;;
30 eulisse 1.33 osx104_ia32) compilerv=gcc401;;
31 elmer 1.40 osx104_ppc32) compilerv=gcc400;;
32 eulisse 1.29 esac
33     echo ${osarch}_${compilerv}
34     else
35     echo $SCRAM_ARCH
36     fi
37    
38 eulisse 1.28 EOF_CMSARCH_SH
39     chmod 755 %instroot/bin/cmsarch
40    
41 eulisse 1.9 ### BASH code
42    
43 eulisse 1.1 cat << \EOF_CMSSET_DEFAULT_SH > %instroot/cmsset_default.sh
44     export PATH=%instroot/bin:$PATH
45 eulisse 1.2
46 eulisse 1.22 if [ ! $SCRAM_ARCH ]
47 eulisse 1.19 then
48 eulisse 1.28 SCRAM_ARCH=`%instroot/bin/cmsarch`
49 eulisse 1.19 export SCRAM_ARCH
50 eulisse 1.15 fi
51    
52 eulisse 1.16 here=%{instroot}
53    
54 eulisse 1.10 if [ "$VO_CMS_SW_DIR" != "" ]
55     then
56 eulisse 1.9 here=$VO_CMS_SW_DIR
57     else
58 eulisse 1.12 if [ "$OSG_APP" != "" ]
59     then
60     here=$OSG_APP/cmssoft/cms
61     fi
62 eulisse 1.10 fi
63 eulisse 1.9
64 eulisse 1.14 if [ ! -d $here/${SCRAM_ARCH}/etc/profile.d ]
65 eulisse 1.13 then
66 elmer 1.38 echo "Your shell is not able to find where cmsset_default.sh is located."
67     echo "Either you have not set VO_CMS_SW_DIR or OSG_APP correctly"
68     echo "or SCRAM_ARCH is not set to a valid architecture."
69 eulisse 1.13 fi
70 eulisse 1.9
71 eulisse 1.27 for pkg in `/bin/ls $here/${SCRAM_ARCH}/etc/profile.d/ | grep 'S.*[.]sh'`
72 eulisse 1.5 do
73     source $here/${SCRAM_ARCH}/etc/profile.d/$pkg
74     done
75 eulisse 1.21
76 eulisse 1.22 if [ ! $CMS_PATH ]
77 eulisse 1.21 then
78     export CMS_PATH=$here
79     fi
80 metson 1.32
81     if [ -f $CMS_PATH/SITECONF/local/JobConfig/cmsset_local.sh ]; then
82     . $CMS_PATH/SITECONF/local/JobConfig/cmsset_local.sh
83     fi
84 eulisse 1.1 EOF_CMSSET_DEFAULT_SH
85    
86 eulisse 1.9
87     ### CSH code
88    
89 eulisse 1.1 cat << \EOF_CMSSET_DEFAULT_CSH > %instroot/cmsset_default.csh
90 eulisse 1.7
91 eulisse 1.4 if (${?PATH}) then
92     setenv PATH %instroot/bin:$PATH
93     else
94     setenv PATH %instroot/bin
95     endif
96    
97 eulisse 1.19 if ( ! ${?SCRAM_ARCH}) then
98 eulisse 1.28 setenv SCRAM_ARCH `sh -c %instroot/bin/cmsarch`
99 eulisse 1.25 endif
100 eulisse 1.15
101 eulisse 1.22 set here=%instroot
102 eulisse 1.16
103 eulisse 1.7 if ( ${?VO_CMS_SW_DIR} ) then
104 eulisse 1.23 set here=$VO_CMS_SW_DIR
105 eulisse 1.7 else
106 eulisse 1.12 # OSG
107     if ( ${?OSG_APP} ) then
108 eulisse 1.23 set here=$OSG_APP/cmssoft/cms
109 eulisse 1.12 endif
110     # OSG
111 eulisse 1.7 endif
112    
113     if ( ! -e $here/cmsset_default.csh ) then
114     echo "Please cd into the directory where cmsset_default.csh is."
115     endif
116 eulisse 1.5
117 eulisse 1.27 foreach pkg ( `/bin/ls ${here}/${SCRAM_ARCH}/etc/profile.d/ | grep 'S.*[.]csh'` )
118 eulisse 1.5 source ${here}/${SCRAM_ARCH}/etc/profile.d/$pkg
119     end
120 eulisse 1.21 if ( ! ${?CMS_PATH} ) then
121     setenv CMS_PATH $here
122     endif
123 metson 1.32
124     if( -e $CMS_PATH/SITECONF/local/JobConfig/cmsset_local.csh ) then
125     source $CMS_PATH/SITECONF/local/JobConfig/cmsset_local.csh
126     endif
127 eulisse 1.22 unset here
128 eulisse 1.1 EOF_CMSSET_DEFAULT_CSH
129 eulisse 1.28 touch %instroot/%cmsplatf/etc/profile.d/dummy
130 eulisse 1.8 %pre
131     [ -f $RPM_INSTALL_PREFIX/cmsset_default.sh ] && cp $RPM_INSTALL_PREFIX/cmsset_default.sh $RPM_INSTALL_PREFIX/cmsset_default.sh.old`date +%Y%m%d`
132     [ -f $RPM_INSTALL_PREFIX/cmsset_default.csh ] && cp $RPM_INSTALL_PREFIX/cmsset_default.csh $RPM_INSTALL_PREFIX/cmsset_default.csh.old`date +%Y%m%d`
133     [ -d $RPM_INSTALL_PREFIX/bin ] && cp -r $RPM_INSTALL_PREFIX/bin $RPM_INSTALL_PREFIX/bin.old`date +%Y%m%d`
134 eulisse 1.1 %post
135     echo $RPM_INSTALL_PREFIX
136 eulisse 1.3 perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/cmsset_default.sh
137     perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/cmsset_default.csh
138     perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/bin/cmsos
139 eulisse 1.28 perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/bin/cmsarch
140 eulisse 1.3 %files
141     %i
142     %instroot/cmsset_default.sh
143     %instroot/cmsset_default.csh
144     %instroot/bin/cmsos
145 eulisse 1.28 %instroot/bin/cmsarch
146 eulisse 1.5 %instroot/%cmsplatf/etc/profile.d
147 eulisse 1.6 %exclude %instroot/%cmsplatf/etc/profile.d/*