Revision: | 1.27 |
Committed: | Sat Oct 8 21:56:56 2011 UTC (13 years, 6 months ago) by lat |
Branch: | MAIN |
CVS Tags: | bld_1364477047_CmsTC_slc5_amd64_gcc434, bld_1363597235_CmsTC_slc5_amd64_gcc434, bld_1361358843_CmsTC_slc5_amd64_gcc434, bld_1360935597_CmsTC_slc5_amd64_gcc434, bld_1358942699_CmsTC_slc5_amd64_gcc434, bld_1358853292_CmsTC_slc5_amd64_gcc434, TW20120428p, bld_1334854417_PHEDEX-combined-agents_slc5_amd64_gcc461, bld_1334681121_PHEDEX-combined-agents_slc5_amd64_gcc461, TW20120417a, TW20120416a, TW20120410b, TW20120410a, HG1204h, HG1204g, TW20120327b, TW20120327a, TW20120326a, HG1204f, TW20120322a, HG1203i, HG1204e, TW20120321c, TW20120321b, TW20120321a, HG1204d, TW20120320b, TW20120320a, dieHG1204d, TW20120319k, TW20120319j, TW20120319i, TW20120319h, TW20120319g, TW20120319f, TW20120319e, TW20120319d, TW20120319c, TW20120319b, TW20120319a, HG1204c, TW20120313a, HG1204b, TW20120309h, TW20120309g, TW20120309f, TW20120309e, TW20120309d, TW20120309c, TW20120309b, TW20120309a, HG1204a, TW20120308b, TW20120308a, TW20120307a, HG1203h, TW20120305b, TW20120305a, HG1203g, HG1203f, HG1203e, HG1203d, HG1203c, HG1203b, TW20120217a, TW20120216b, TW20120216a, HG1201d, HG1203a, TW20120210a, TW20120209a, TW20120207b, TW20120207a, HG1201c, bld_1328198772_crab_slc5_amd64_gcc461, TW20120130b, TW20120130a, TW20120127b, TW20120127a, TW20120125a, bld_1327424666_crab-client3_slc5_amd64_gcc461, HG1201b, bld_1327416353_crab-server3_slc5_amd64_gcc461, bld_1327397075_cmsbuilder_slc5_amd64_gcc461, TW20120123a, TW20120120a, TW20120119b, TW20120119a, bld_1326980038_cmsbuild_slc5_amd64_gcc461, TW20120118a, bld_1326280382_cmsBuilder_slc5_amd64_gcc461, bld_1326274893_cmsBuilder_slc5_amd64_gcc461, bld_1326273864_asyncstageout_slc5_amd64_gcc461, bld_1324281658_cmsweb_osx106_amd64_gcc461, HG1201a, HG1112d, bld_1323333807_CmsTC_slc5_amd64_gcc461, HG1112c, TW20111129e, TW20111129d, TW20111129c, TW20111129a, TW20111128c, TW20111128b, TW20111128a, HG1112b, TW20111122a, TW20111120a, TW20111118c, TW20111118b, TW20111118a, HG1111e, bld_1321455789_happyface_slc5_amd64_gcc461, bld_1321454935_happyface_slc5_amd64_gcc461, TW20111115d, TW20111115c, TW20111115b, TW20111115a, HG1112a, TW20111103a, TW20111101e, TW20111101d, TW20111101c, TW20111101b, TW20111101a, TW20111028a, bld_1319551575_PHEDEX-combined-agents_slc5_amd64_gcc461, HG1111d, TW20111017d, TW20111017c, TW20111017b, TW20111017a, TW20111016a, TW20111015a, TW20111014a, bld_1318523430_cmsweb_slc5_amd64_gcc434, HG1111c-gcc434, HG1111c, HG1111c-bootstrap-gcc461, HG1111c-bootstrap-gcc434, LT20111012a-434, LT20111012a-461, LT20111012a, HG1111b, HG1111b-bootstrap-gcc461 |
Changes since 1.26: | +3 -3 lines |
Log Message: | Recognise SL6, and clean up case brace style. Bump REVISION. |
# | User | Rev | Content |
---|---|---|---|
1 | muzaffar | 1.11 | ### RPM cms cms-common 1.0 |
2 | lat | 1.27 | ## REVISION 1058 |
3 | muzaffar | 1.15 | ## NOCOMPILER |
4 | lat | 1.27 | %define online %(case %cmsplatf in (*onl_*_*) echo true;; (*) echo false;; esac) |
5 | muzaffar | 1.1 | Source: cmsos |
6 | %prep | ||
7 | %build | ||
8 | echo $SCRAM_ROOT | ||
9 | %install | ||
10 | |||
11 | muzaffar | 1.17 | mkdir -p %instroot/common %instroot/bin %instroot/%{cmsplatf}/etc/profile.d |
12 | muzaffar | 1.1 | |
13 | elmer | 1.6 | # Do not create these common files if already exist |
14 | muzaffar | 1.1 | # This is to avoid different arch creating these files |
15 | if [ ! -f %instroot/common/.cms-common ]; then | ||
16 | install -m 755 %_sourcedir/cmsos %instroot/common/cmsos | ||
17 | ### Detects the SCRAM_ARCH to be used. | ||
18 | muzaffar | 1.17 | %if "%online" != "true" |
19 | muzaffar | 1.1 | cat << \EOF_CMSARCH_SH >%instroot/common/cmsarch |
20 | #!/bin/sh | ||
21 | osarch=`%instroot/common/cmsos` | ||
22 | elmer | 1.20 | compilerv=gcc434 |
23 | muzaffar | 1.1 | # We need to assume 1 compiler per platform. |
24 | # There is no other way around this. | ||
25 | if [ ! "$SCRAM_ARCH" ] | ||
26 | then | ||
27 | case $osarch in | ||
28 | osx104_ia32) compilerv=gcc401;; | ||
29 | osx104_ppc32) compilerv=gcc400;; | ||
30 | muzaffar | 1.16 | osx105_*) compilerv=gcc401;; |
31 | dsr | 1.21 | osx106_*) compilerv=gcc421;; |
32 | lat | 1.27 | slc6_*) compilerv=gcc461; osarch=slc6_amd64;; |
33 | elmer | 1.26 | slc5_*) compilerv=gcc434; osarch=slc5_amd64;; |
34 | elmer | 1.18 | slc4_*) compilerv=gcc345; osarch=slc4_ia32;; |
35 | elmer | 1.20 | *) compilerv=gcc434; osarch=slc5_ia32;; |
36 | muzaffar | 1.1 | esac |
37 | echo ${osarch}_${compilerv} | ||
38 | else | ||
39 | echo $SCRAM_ARCH | ||
40 | fi | ||
41 | |||
42 | EOF_CMSARCH_SH | ||
43 | muzaffar | 1.17 | %else |
44 | cat << \EOF_CMSARCH_SH >%instroot/common/cmsarch | ||
45 | #!/bin/sh | ||
46 | if [ ! "$SCRAM_ARCH" ] ; then | ||
47 | echo %cmsplatf | ||
48 | else | ||
49 | echo $SCRAM_ARCH | ||
50 | fi | ||
51 | |||
52 | EOF_CMSARCH_SH | ||
53 | %endif | ||
54 | muzaffar | 1.1 | chmod 755 %instroot/common/cmsarch |
55 | |||
56 | ### BASH code | ||
57 | |||
58 | cat << \EOF_CMSSET_DEFAULT_SH > %instroot/cmsset_default.sh | ||
59 | export PATH=%instroot/common:%instroot/bin:$PATH | ||
60 | |||
61 | if [ ! $SCRAM_ARCH ] | ||
62 | then | ||
63 | SCRAM_ARCH=`%instroot/common/cmsarch` | ||
64 | export SCRAM_ARCH | ||
65 | fi | ||
66 | |||
67 | here=%{instroot} | ||
68 | |||
69 | if [ "$VO_CMS_SW_DIR" != "" ] | ||
70 | then | ||
71 | here=$VO_CMS_SW_DIR | ||
72 | else | ||
73 | if [ "$OSG_APP" != "" ] | ||
74 | then | ||
75 | here=$OSG_APP/cmssoft/cms | ||
76 | fi | ||
77 | fi | ||
78 | |||
79 | if [ ! -d $here/${SCRAM_ARCH}/etc/profile.d ] | ||
80 | then | ||
81 | echo "Your shell is not able to find where cmsset_default.sh is located." | ||
82 | echo "Either you have not set VO_CMS_SW_DIR or OSG_APP correctly" | ||
83 | echo "or SCRAM_ARCH is not set to a valid architecture." | ||
84 | fi | ||
85 | |||
86 | for pkg in `/bin/ls $here/${SCRAM_ARCH}/etc/profile.d/ | grep 'S.*[.]sh'` | ||
87 | do | ||
88 | source $here/${SCRAM_ARCH}/etc/profile.d/$pkg | ||
89 | done | ||
90 | |||
91 | if [ ! $CMS_PATH ] | ||
92 | then | ||
93 | export CMS_PATH=$here | ||
94 | fi | ||
95 | |||
96 | # aliases | ||
97 | muzaffar | 1.9 | alias cmsenv='eval `scramv1 runtime -sh`' |
98 | alias cmsrel='scramv1 project CMSSW' | ||
99 | muzaffar | 1.1 | |
100 | if [ -f $CMS_PATH/SITECONF/local/JobConfig/cmsset_local.sh ]; then | ||
101 | . $CMS_PATH/SITECONF/local/JobConfig/cmsset_local.sh | ||
102 | fi | ||
103 | |||
104 | if [ ! $CVSROOT ] | ||
105 | then | ||
106 | muzaffar | 1.23 | CVSROOT=:gserver:cmssw.cvs.cern.ch:/cvs/CMSSW |
107 | muzaffar | 1.1 | export CVSROOT |
108 | fi | ||
109 | |||
110 | EOF_CMSSET_DEFAULT_SH | ||
111 | |||
112 | |||
113 | ### CSH code | ||
114 | |||
115 | cat << \EOF_CMSSET_DEFAULT_CSH > %instroot/cmsset_default.csh | ||
116 | |||
117 | if (${?PATH}) then | ||
118 | setenv PATH %instroot/common:%instroot/bin:$PATH | ||
119 | else | ||
120 | setenv PATH %instroot/common:%instroot/bin | ||
121 | endif | ||
122 | |||
123 | if ( ! ${?SCRAM_ARCH}) then | ||
124 | setenv SCRAM_ARCH `sh -c %instroot/common/cmsarch` | ||
125 | endif | ||
126 | |||
127 | set here=%instroot | ||
128 | |||
129 | if ( ${?VO_CMS_SW_DIR} ) then | ||
130 | set here=$VO_CMS_SW_DIR | ||
131 | else | ||
132 | # OSG | ||
133 | if ( ${?OSG_APP} ) then | ||
134 | set here=$OSG_APP/cmssoft/cms | ||
135 | endif | ||
136 | # OSG | ||
137 | endif | ||
138 | |||
139 | if ( ! -e $here/cmsset_default.csh ) then | ||
140 | echo "Please cd into the directory where cmsset_default.csh is." | ||
141 | endif | ||
142 | |||
143 | foreach pkg ( `/bin/ls ${here}/${SCRAM_ARCH}/etc/profile.d/ | grep 'S.*[.]csh'` ) | ||
144 | source ${here}/${SCRAM_ARCH}/etc/profile.d/$pkg | ||
145 | end | ||
146 | if ( ! ${?CMS_PATH} ) then | ||
147 | setenv CMS_PATH $here | ||
148 | endif | ||
149 | |||
150 | # aliases | ||
151 | muzaffar | 1.9 | alias cmsenv 'eval `scramv1 runtime -csh`' |
152 | alias cmsrel 'scramv1 project CMSSW' | ||
153 | muzaffar | 1.1 | |
154 | if( -e $CMS_PATH/SITECONF/local/JobConfig/cmsset_local.csh ) then | ||
155 | source $CMS_PATH/SITECONF/local/JobConfig/cmsset_local.csh | ||
156 | endif | ||
157 | |||
158 | if ( ! ${?CVSROOT}) then | ||
159 | muzaffar | 1.23 | setenv CVSROOT :gserver:cmssw.cvs.cern.ch:/cvs/CMSSW |
160 | muzaffar | 1.1 | endif |
161 | |||
162 | unset here | ||
163 | EOF_CMSSET_DEFAULT_CSH | ||
164 | |||
165 | cat << \EOF_COMMON_SCRAM > %instroot/common/scram | ||
166 | #!/bin/sh | ||
167 | CMSARCH=`cmsarch` | ||
168 | muzaffar | 1.10 | srbase=%{instroot}/$CMSARCH |
169 | sver=$SCRAM_VERSION | ||
170 | dir=`/bin/pwd` | ||
171 | muzaffar | 1.17 | while [ ! -d ${dir}/.SCRAM ] && [ "$dir" != "/" ] ; do |
172 | muzaffar | 1.10 | dir=`dirname $dir` |
173 | done | ||
174 | if [ -f ${dir}/config/scram_version ] ; then | ||
175 | sver=`cat ${dir}/config/scram_version` | ||
176 | muzaffar | 1.17 | elif [ "X$sver" = "X" ] ; then |
177 | muzaffar | 1.10 | sver=`cat ${srbase}/etc/default-scramv1-version` |
178 | fi | ||
179 | muzaffar | 1.17 | if [ "X$sver" = "XV1_0_3-p1" ] && [ "X$CMSARCH" = "Xslc4_ia32_gcc345" ] ; then |
180 | muzaffar | 1.10 | sver=V1_0_3-p2 |
181 | fi | ||
182 | scram_rel_series=`echo $sver | grep '^V[0-9]\+_[0-9]\+_[0-9]\+' | sed 's|^\(V[0-9]\+_[0-9]\+\)_.*|\1|'` | ||
183 | muzaffar | 1.17 | if [ "X${scram_rel_series}" != "X" ] && [ -f ${srbase}/etc/default-scram/${scram_rel_series} ] ; then |
184 | muzaffar | 1.10 | sver=`cat ${srbase}/etc/default-scram/${scram_rel_series}` |
185 | muzaffar | 1.1 | fi |
186 | scmd=scram | ||
187 | muzaffar | 1.10 | srbase=%{instroot}/$CMSARCH/lcg/SCRAMV1 |
188 | muzaffar | 1.1 | case $sver in |
189 | muzaffar | 1.10 | V0_* ) srbase=%{instroot}/$CMSARCH/lcg/SCRAM; scmd=scramv0;; |
190 | V1_0* ) scmd=scramv1;; | ||
191 | * ) ;; | ||
192 | muzaffar | 1.1 | esac |
193 | muzaffar | 1.10 | if [ ! -f ${srbase}/${sver}/etc/profile.d/init.sh ] ; then |
194 | muzaffar | 1.8 | echo "Unable to find SCRAM version $sver for $CMSARCH architecture." |
195 | exit 1 | ||
196 | fi | ||
197 | muzaffar | 1.17 | . ${srbase}/${sver}/etc/profile.d/init.sh |
198 | elmer | 1.2 | # In the case we are on linux ia32 we prepend the linux32 command to the |
199 | # actual scram command so that, no matter where the ia32 architecture is | ||
200 | # running (i686 or x84_64) scram detects it as ia32. | ||
201 | muzaffar | 1.1 | CMSPLAT=`echo $CMSARCH | cut -d_ -f 2` |
202 | elmer | 1.2 | USE_LINUX32= |
203 | muzaffar | 1.17 | if [ `uname` = "Linux" ] && [ "$CMSPLAT" = "ia32" ] ; then |
204 | muzaffar | 1.10 | USE_LINUX32=linux32 |
205 | muzaffar | 1.1 | fi |
206 | muzaffar | 1.10 | $USE_LINUX32 ${srbase}/${sver}/bin/${scmd} $@ |
207 | muzaffar | 1.1 | EOF_COMMON_SCRAM |
208 | |||
209 | chmod +x %{instroot}/common/scram | ||
210 | ln -sf scram %{instroot}/common/scramv1 | ||
211 | ln -sf scram %{instroot}/common/scramv0 | ||
212 | muzaffar | 1.5 | ln -sf ../common/cmsarch %instroot/bin/cmsarch |
213 | ln -sf ../common/cmsarch %instroot/bin/cmsos | ||
214 | ln -sf ../common/scramv1 %instroot/bin/scramv1 | ||
215 | muzaffar | 1.1 | touch %instroot/common/.cms-common |
216 | fi | ||
217 | |||
218 | touch %instroot/%cmsplatf/etc/profile.d/dummy | ||
219 | |||
220 | %post | ||
221 | muzaffar | 1.22 | echo $CMS_INSTALL_PREFIX |
222 | %{relocateCmsFiles} $RPM_INSTALL_PREFIX/cmsset_default.sh | ||
223 | %{relocateCmsFiles} $RPM_INSTALL_PREFIX/cmsset_default.csh | ||
224 | %{relocateCmsFiles} $RPM_INSTALL_PREFIX/common/cmsos | ||
225 | %{relocateCmsFiles} $RPM_INSTALL_PREFIX/common/cmsarch | ||
226 | %{relocateCmsFiles} $RPM_INSTALL_PREFIX/common/scram | ||
227 | muzaffar | 1.1 | |
228 | %files | ||
229 | %i | ||
230 | %instroot/cmsset_default.sh | ||
231 | %instroot/cmsset_default.csh | ||
232 | %instroot/common/cmsos | ||
233 | %instroot/common/cmsarch | ||
234 | %instroot/common/scram | ||
235 | %instroot/common/scramv1 | ||
236 | %instroot/common/scramv0 | ||
237 | muzaffar | 1.4 | %instroot/common/.cms-common |
238 | %instroot/bin/cmsos | ||
239 | %instroot/bin/cmsarch | ||
240 | %instroot/bin/scramv1 | ||
241 | muzaffar | 1.1 | %instroot/%cmsplatf/etc/profile.d |
242 | %exclude %instroot/%cmsplatf/etc/profile.d/* |