Revision: | 1.28 |
Committed: | Tue Oct 25 13:19:43 2011 UTC (13 years, 6 months ago) by muzaffar |
Branch: | MAIN |
CVS Tags: | CMSSW_4_4_4-ports, CMSSW_4_4_4, sm20120309, sm20120309-ports, sm20120228-44X-ports, sm20120228-44X, sm120220-ports, sm120220, CMSSW_4_4_3_patch1-ports, CMSSW_4_4_3_patch1, vs20120215-50X, vs20120215-50X-ports, vs20120215-44X, vs20120215-44X-ports, da20120214-50X-ports, da20120214-50X, CMSSW_5_0_1_patch3, daForCMSSW_5_0_1_patch3b-slc5_amd64_gcc434, daForCMSSW_5_0_1_patch3-slc5_amd64_gcc434, CMSSW_5_0_1_patch2, daForCMSSW_5_0_1_patch2c-slc5_amd64_gcc434, daForCMSSW_5_0_1_patch2b-slc5_amd64_gcc434, daForCMSSW_5_0_1_patch2-slc5_amd64_gcc434, da20120206-50X, da20120206-50X-ports, da20120205-44X-ports, da20120205-44X, da20120205-50X-ports, da20120205-50X, CMSSW_5_0_1_patch1, da20120201-42X-ports, da20120201-42X, CMSSW_5_0_0_patch2, CMSSW_5_0_1-ports, CMSSW_5_0_1, da20120129-50X-ports, da20120129-50X, CMSSW_4_4_3-ports, CMSSW_4_4_3, sm120124-ports, da20120123-50X-ports, da20120123-50X, da20120123-44X-ports, da20120123-44X, CMSSW_5_0_0_patch1, CMSSW_4_4_2_p10JEmalloc, da20120112-50X-ports, da20120112-50X, da20120110-50X-ports, da20120110-50X, da20120108-52X-ports, da20120108-52X, da20120106-52X-ports, da20120106-52X, CMSSW_5_0_0_g4emtest, CMSSW_4_4_2_patch10-ports, CMSSW_4_4_2_patch10, CMSSW_5_0_0-ports, azFor442patch10gcc451, azFor442patch10, da20111220-50X-ports, da20111220-50X, da20111219-50X-ports, da20111219-50X, sjgFor510pre1, sjgFor500-ports, CMSSW_5_0_0, sjgFor500, az20111214-50X-ports, az20111214-50X, CMSSW_4_4_2_patch9-ports, CMSSW_4_4_2_patch9, vsFor442patch9gcc451, vsFor442patch9, vs20111213-50X-ports, vs20111213-50X, sjgFor510pre1-gcc461-ports, fwFor500pre7-online, CMSSW_4_4_2_patch8-ports, CMSSW_4_4_2_patch8, CMSSW_5_0_0_pre7pythia424, sjgFor500pre7p424b, sjgFor500pre7p424, CMSSW_5_0_0_pre7, CMSSW_5_0_0_pre7-gcc461-ports, sjgFor500pre7-ports, sjgFor500pre7-gcc461-ports, sjgFor500pre7, da20111206b-50X-gcc461-ports, da20111206-50X-gcc461-ports, da20111205-50X-ports, da20111205-50X-gcc461-ports, da20111205-50X, sjg20111204b-50X, sjg20111204-50X, da20111202-50X-ports, da20111202-50X-gcc461-ports, da20111202-50X, vs20111201-50X-ports, da20111201f-50X-gcc461-ports, da20111201e-50X-gcc461-ports, vs20111201c-50X, vs20111201temp-50X, da20111201d-50X-gcc461-ports, vs20111201b-50X, da20111201c-50X-gcc461-ports, vs20111201-50X, da20111201c-50X-ports, da20111201b-50X-ports, da20111201b-50X-gcc461-ports, da20111201b-50X, da20111201-50X-gcc461-ports, da20111201-50X, vs20111130-42X-ports, vs20111130-42X, vs20111130-44X-ports, vs20111130-44X, da20111130-50X-ports, da20111130-50X-gcc461-ports, da20111130-50X, CMSSW_5_0_0_pre6g494, da20111128-50X-ports, da20111128-50X-gcc461-ports, da20111128-50X, sjgFor500pre6gcc494, az20111126-50X-gcc461-ports, az20111126-50X-ports, az20111126-50X, sm20111126-50X-gcc461-ports, sm20111126-50X-ports, sm20111126-50X, az20111125-50X-ports, az20111125-50X-gcc461-ports, az20111125-50X, az20111124-50X-ports, az20111124-50X-gcc461-ports, az20111124-50X, az20111123-50X-gcc461-ports, az20111123-50X-ports, az20111123-50X, CMSSW_4_4_2_patch7-ports, CMSSW_4_4_2_patch7, azFor442patch7gcc451, azFor442patch7gcc434, CMSSW_5_0_0_pre6, CMSSW_5_0_0_pre6-ports, CMSSW_5_0_0_pre6-gcc461-ports, sjgFor500pre6-ports, sjgFor500pre6-gcc461-ports, sjgFor500pre6, sm20111121-50X-gcc461-ports, sm20111121-50X, sm20111121-50X-ports, az20111121-50X-ports, CMSSW_4_4_2_patch6-ports, CMSSW_4_4_2_patch6, az20111118b-50X-gcc461-ports, az20111118b-50X-ports, az20111118-50X-ports, azFor442patch6gcc451, azFor442patch6gcc434, sm20111118-50X-gcc461-ports, az20111117b-50X-gcc461-ports, az20111117b-50X-ports, az20111117b-50X, az20111117-50X-gcc461-ports, az20111117-50X-ports, az20111117-50X, az20111116-50X-gcc461-ports, az20111116-50X-ports, az20111116-50X, az20111115b-50X-gcc461-ports, az20111115b-50X-ports, az20111115-50X-gcc461-ports, az20111115-50X-ports, sm111115-onlgcc461, az20111115-50X, az20111110-42X-ports, CMSSW_5_0_0_pre5_root532rc1, azFor500pre5r532rc1, az20111111b-50X, az20111111-50X, CMSSW_4_4_2_patch5-ports, CMSSW_4_4_2_patch5, azFor442patch5gcc451, azFor442patch5gcc434, CMSSW_4_4_2_patch4-ports, CMSSW_4_4_2_patch4, azFor442patch4gcc451, azFor442patch4gcc434, az20111110-42X, az20111109b-44X, az20111109b-44X-ports, az20111109-44X-ports, az20111109-44X, CMSSW_4_4_2_patch3-ports, CMSSW_4_4_2_patch3, azFor442patch3gcc451, azFor442patch3gcc434, sjg111108-50X-gcc461-ports, az20111108-50X-gcc461-ports, az20111108-50X-ports, az20111108-50X, CMSSW_4_4_2_patch2-ports, CMSSW_4_4_2_patch2, CMSSW_5_0_0_pre5-ports, CMSSW_5_0_0_pre5, CMSSW_5_0_0_pre5-gcc461-ports, sjgFor500pre5-50X-gcc461-ports, sjgFor500pre5-ports, sjgFor500pre5, CMSSW_4_4_2_patch1-ports, CMSSW_4_4_2_patch1, azFor442patch1gcc451, azFor442patch1gcc434, fwFor500pre4-online, az20111102b-50X-ports, az20111102b-50X-gcc461-ports, az20111102b-50X, az20111102-50X, az20111031-42X-ports, az20111031-42X, az20111031c-50X-gcc461-ports, az20111031c-50X-ports, az20111031c-50X, az20111031b-50X, az20111031-50X, CMSSW_4_4_2-ports, CMSSW_4_4_2, az20111027c-50X-gcc461-ports, azFor442gcc451, azFor442gcc434, az20111027b-50X-gcc461-ports, az20111027b-50X-ports, az20111027b-50X, az20111027-50X-gcc461-ports, az20111027-50X-ports, az20111027-50X, sm20111025-50X-ports, sm20111025-50X-gcc461-ports, sm20111025-50X |
Changes since 1.27: | +70 -47 lines |
Log Message: | new cms-common which does not override common files |
# | Content |
---|---|
1 | ### RPM cms cms-common 1.0 |
2 | ## REVISION 1100 |
3 | ## NOCOMPILER |
4 | |
5 | %define online %(case %cmsplatf in (*onl_*_*) echo true;; (*) echo false;; esac) |
6 | %if "%{?cmsroot:set}" != "set" |
7 | %define cmsroot %instroot |
8 | %endif |
9 | |
10 | Source: cmsos |
11 | |
12 | %prep |
13 | #Make sure that we always build cms-common with a different revision and |
14 | #hardcoded version 1.0 because this is what bootstrap.sh is going to install |
15 | %if "%v" != "1.0" |
16 | echo "ERROR: Please do not change the version. We have to build this RPM with a different REVISION" |
17 | echo " Please update the revision in %n.spec and make sure that version is set to 1.0" |
18 | exit 1 |
19 | %endif |
20 | |
21 | %build |
22 | |
23 | %install |
24 | |
25 | #Create all files in %i/%{pkgrevision} directory. |
26 | #This can be avoid if we move to --buildroot based builds |
27 | mkdir -p %i/%{pkgrevision}/common |
28 | cd %i/%{pkgrevision} |
29 | |
30 | cp %_sourcedir/cmsos ./common/cmsos |
31 | |
32 | %if "%online" != "true" |
33 | cat << \EOF_CMSARCH_SH > ./common/cmsarch |
34 | #!/bin/sh |
35 | osarch=`%instroot/common/cmsos` |
36 | compilerv=gcc434 |
37 | # We need to assume 1 compiler per platform. |
38 | # There is no other way around this. |
39 | if [ ! "$SCRAM_ARCH" ] |
40 | then |
41 | case $osarch in |
42 | osx104_ia32) compilerv=gcc401;; |
43 | osx104_ppc32) compilerv=gcc400;; |
44 | osx105_*) compilerv=gcc401;; |
45 | osx106_*) compilerv=gcc421;; |
46 | slc6_*) compilerv=gcc461; osarch=slc6_amd64;; |
47 | slc5_*) compilerv=gcc434; osarch=slc5_amd64;; |
48 | slc4_*) compilerv=gcc345; osarch=slc4_ia32;; |
49 | *) compilerv=gcc434; osarch=slc5_ia32;; |
50 | esac |
51 | echo ${osarch}_${compilerv} |
52 | else |
53 | echo $SCRAM_ARCH |
54 | fi |
55 | |
56 | EOF_CMSARCH_SH |
57 | %else |
58 | cat << \EOF_CMSARCH_SH > ./common/cmsarch |
59 | #!/bin/sh |
60 | if [ ! "$SCRAM_ARCH" ] ; then |
61 | echo %cmsplatf |
62 | else |
63 | echo $SCRAM_ARCH |
64 | fi |
65 | |
66 | EOF_CMSARCH_SH |
67 | %endif |
68 | |
69 | ### BASH code |
70 | |
71 | cat << \EOF_CMSSET_DEFAULT_SH > ./cmsset_default.sh |
72 | export PATH=%instroot/common:%instroot/bin:$PATH |
73 | |
74 | if [ ! $SCRAM_ARCH ] |
75 | then |
76 | SCRAM_ARCH=`%instroot/common/cmsarch` |
77 | export SCRAM_ARCH |
78 | fi |
79 | |
80 | here=%{instroot} |
81 | |
82 | if [ "$VO_CMS_SW_DIR" != "" ] |
83 | then |
84 | here=$VO_CMS_SW_DIR |
85 | else |
86 | if [ "$OSG_APP" != "" ] |
87 | then |
88 | here=$OSG_APP/cmssoft/cms |
89 | fi |
90 | fi |
91 | |
92 | if [ ! -d $here/${SCRAM_ARCH}/etc/profile.d ] |
93 | then |
94 | echo "Your shell is not able to find where cmsset_default.sh is located." |
95 | echo "Either you have not set VO_CMS_SW_DIR or OSG_APP correctly" |
96 | echo "or SCRAM_ARCH is not set to a valid architecture." |
97 | fi |
98 | |
99 | for pkg in `/bin/ls $here/${SCRAM_ARCH}/etc/profile.d/ | grep 'S.*[.]sh'` |
100 | do |
101 | source $here/${SCRAM_ARCH}/etc/profile.d/$pkg |
102 | done |
103 | |
104 | if [ ! $CMS_PATH ] |
105 | then |
106 | export CMS_PATH=$here |
107 | fi |
108 | |
109 | # aliases |
110 | alias cmsenv='eval `scramv1 runtime -sh`' |
111 | alias cmsrel='scramv1 project CMSSW' |
112 | |
113 | if [ -f $CMS_PATH/SITECONF/local/JobConfig/cmsset_local.sh ]; then |
114 | . $CMS_PATH/SITECONF/local/JobConfig/cmsset_local.sh |
115 | fi |
116 | |
117 | if [ ! $CVSROOT ] |
118 | then |
119 | CVSROOT=:gserver:cmssw.cvs.cern.ch:/cvs/CMSSW |
120 | export CVSROOT |
121 | fi |
122 | |
123 | EOF_CMSSET_DEFAULT_SH |
124 | |
125 | |
126 | ### CSH code |
127 | |
128 | cat << \EOF_CMSSET_DEFAULT_CSH > ./cmsset_default.csh |
129 | |
130 | if (${?PATH}) then |
131 | setenv PATH %instroot/common:%instroot/bin:$PATH |
132 | else |
133 | setenv PATH %instroot/common:%instroot/bin |
134 | endif |
135 | |
136 | if ( ! ${?SCRAM_ARCH}) then |
137 | setenv SCRAM_ARCH `sh -c %instroot/common/cmsarch` |
138 | endif |
139 | |
140 | set here=%instroot |
141 | |
142 | if ( ${?VO_CMS_SW_DIR} ) then |
143 | set here=$VO_CMS_SW_DIR |
144 | else |
145 | # OSG |
146 | if ( ${?OSG_APP} ) then |
147 | set here=$OSG_APP/cmssoft/cms |
148 | endif |
149 | # OSG |
150 | endif |
151 | |
152 | if ( ! -d $here/${SCRAM_ARCH}/etc/profile.d ) then |
153 | echo "Your shell is not able to find where cmsset_default.csh is located." |
154 | echo "Either you have not set VO_CMS_SW_DIR or OSG_APP correctly" |
155 | echo "or SCRAM_ARCH is not set to a valid architecture." |
156 | endif |
157 | |
158 | foreach pkg ( `/bin/ls ${here}/${SCRAM_ARCH}/etc/profile.d/ | grep 'S.*[.]csh'` ) |
159 | source ${here}/${SCRAM_ARCH}/etc/profile.d/$pkg |
160 | end |
161 | if ( ! ${?CMS_PATH} ) then |
162 | setenv CMS_PATH $here |
163 | endif |
164 | |
165 | # aliases |
166 | alias cmsenv 'eval `scramv1 runtime -csh`' |
167 | alias cmsrel 'scramv1 project CMSSW' |
168 | |
169 | if( -e $CMS_PATH/SITECONF/local/JobConfig/cmsset_local.csh ) then |
170 | source $CMS_PATH/SITECONF/local/JobConfig/cmsset_local.csh |
171 | endif |
172 | |
173 | if ( ! ${?CVSROOT}) then |
174 | setenv CVSROOT :gserver:cmssw.cvs.cern.ch:/cvs/CMSSW |
175 | endif |
176 | |
177 | unset here |
178 | EOF_CMSSET_DEFAULT_CSH |
179 | |
180 | cat << \EOF_COMMON_SCRAM > ./common/scram |
181 | #!/bin/sh |
182 | CMSARCH=`cmsarch` |
183 | srbase=%{instroot}/$CMSARCH |
184 | sver=$SCRAM_VERSION |
185 | dir=`/bin/pwd` |
186 | while [ ! -d ${dir}/.SCRAM ] && [ "$dir" != "/" ] ; do |
187 | dir=`dirname $dir` |
188 | done |
189 | if [ -f ${dir}/config/scram_version ] ; then |
190 | sver=`cat ${dir}/config/scram_version` |
191 | elif [ "X$sver" = "X" ] ; then |
192 | sver=`cat ${srbase}/etc/default-scramv1-version` |
193 | fi |
194 | if [ "X$sver" = "XV1_0_3-p1" ] && [ "X$CMSARCH" = "Xslc4_ia32_gcc345" ] ; then |
195 | sver=V1_0_3-p2 |
196 | fi |
197 | scram_rel_series=`echo $sver | grep '^V[0-9][0-9]*_[0-9][0-9]*_[0-9][0-9]*' | sed 's|^\(V[0-9][0-9]*_[0-9][0-9]*\)_.*|\1|'` |
198 | case $sver in |
199 | V[01]_*|V2_[012]_* ) ;; |
200 | * ) scram_rel_series=`echo $scram_rel_series | sed 's|_.*||'` ;; |
201 | esac |
202 | if [ "X${scram_rel_series}" != "X" ] && [ -f ${srbase}/etc/default-scram/${scram_rel_series} ] ; then |
203 | sver=`cat ${srbase}/etc/default-scram/${scram_rel_series}` |
204 | fi |
205 | scmd=scram |
206 | srbase=%{instroot}/$CMSARCH/lcg/SCRAMV1 |
207 | case $sver in |
208 | V0_* ) srbase=%{instroot}/$CMSARCH/lcg/SCRAM; scmd=scramv0;; |
209 | V1_0* ) scmd=scramv1;; |
210 | * ) ;; |
211 | esac |
212 | if [ ! -f ${srbase}/${sver}/etc/profile.d/init.sh ] ; then |
213 | echo "Unable to find SCRAM version $sver for $CMSARCH architecture." |
214 | exit 1 |
215 | fi |
216 | . ${srbase}/${sver}/etc/profile.d/init.sh |
217 | # In the case we are on linux ia32 we prepend the linux32 command to the |
218 | # actual scram command so that, no matter where the ia32 architecture is |
219 | # running (i686 or x84_64) scram detects it as ia32. |
220 | CMSPLAT=`echo $CMSARCH | cut -d_ -f 2` |
221 | USE_LINUX32= |
222 | if [ `uname` = "Linux" ] && [ "$CMSPLAT" = "ia32" ] ; then |
223 | USE_LINUX32=linux32 |
224 | fi |
225 | $USE_LINUX32 ${srbase}/${sver}/bin/${scmd} $@ |
226 | EOF_COMMON_SCRAM |
227 | |
228 | find . -name "*" -type f | xargs chmod +x |
229 | |
230 | %post |
231 | cd $RPM_INSTALL_PREFIX/%{pkgrel}/%{pkgrevision} |
232 | %{relocateCmsFiles} `find . -name "*" -type f` |
233 | |
234 | mkdir -p $RPM_INSTALL_PREFIX/common $RPM_INSTALL_PREFIX/bin $RPM_INSTALL_PREFIX/etc/%{pkgname} $RPM_INSTALL_PREFIX/%{cmsplatf}/etc/profile.d |
235 | |
236 | #Check if a newer revision is already installed |
237 | #Also force installation if older revision has deleted cmsset_default.sh |
238 | if [ -f $RPM_INSTALL_PREFIX/cmsset_default.csh ] && [ -f $RPM_INSTALL_PREFIX/etc/%{pkgname}/revision ] ; then |
239 | oldrev=`cat $RPM_INSTALL_PREFIX/etc/%{pkgname}/revision` |
240 | if [ $oldrev -ge %{pkgrevision} ] ; then |
241 | exit 0 |
242 | fi |
243 | fi |
244 | |
245 | for file in `find . -name "*" -type f`; do |
246 | rm -f $RPM_INSTALL_PREFIX/$file |
247 | cp $file $RPM_INSTALL_PREFIX/$file |
248 | done |
249 | |
250 | cd $RPM_INSTALL_PREFIX |
251 | rm -f common/scramv1; ln -s scram common/scramv1 |
252 | rm -f common/scramv0; ln -s scram common/scramv0 |
253 | rm -f bin/cmsarch; ln -s ../common/cmsarch bin/cmsarch |
254 | rm -f bin/cmsos; ln -s ../common/cmsarch bin/cmsos |
255 | rm -f bin/scramv1; ln -s ../common/scramv1 bin/scramv1 |
256 | echo %{pkgrevision} > etc/%{pkgname}/revision |
257 | |
258 | %files |
259 | %{cmsroot}/%{pkgrel}/etc |
260 | %{cmsroot}/%{pkgrel}/%{pkgrevision} |
261 | %dir %{cmsroot}/ |
262 | %dir %{cmsroot}/%{cmsplatf}/ |
263 | %dir %{cmsroot}/%{cmsplatf}/%{pkgcategory}/ |
264 | %dir %{cmsroot}/%{cmsplatf}/%{pkgcategory}/%{pkgname}/ |
265 | %dir %{cmsroot}/%{cmsplatf}/%{pkgcategory}/%{pkgname}/%{pkgversion}/ |