ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CMSDIST/cms-common.spec
Revision: 1.12
Committed: Mon Mar 31 17:58:46 2008 UTC (17 years, 1 month ago) by ratnik
Branch: MAIN
CVS Tags: nr080714_forCRAB, nr080626_for1612flt, CMSSW_1_6_12, apFor1612v0, apFor1612p3v0, SiteDB_030608_1, SiteDB_300508_1, SiteDB_280508_1, CMSSW_1_6_12_pre2, apFor1612p2v1, apFor1612p2v0, CMSSW_1_6_12_pre1, zx20080509, pe20080508-testcvs, dl080505, dl080425_for21x, nr080408for200p9, CMSSW_2_0_0_pre7_ONLINE1, nr080331for200p7onl1
Changes since 1.11: +15 -0 lines
Log Message:
Added support for online release

File Contents

# User Rev Content
1 muzaffar 1.11 ### RPM cms cms-common 1.0
2 muzaffar 1.1 Source: cmsos
3     %prep
4     %build
5     echo $SCRAM_ROOT
6     %install
7    
8     mkdir -p %instroot/common %instroot/bin %{instroot}/%{cmsplatf}/etc/profile.d
9    
10 elmer 1.6 # Do not create these common files if already exist
11 muzaffar 1.1 # This is to avoid different arch creating these files
12     if [ ! -f %instroot/common/.cms-common ]; then
13     install -m 755 %_sourcedir/cmsos %instroot/common/cmsos
14 ratnik 1.12
15     %if "%{?online_release:set}" == "set"
16     echo echo %{cmsos} > %instroot/common/cmsos
17     chmod 755 %instroot/common/cmsos
18     %endif
19    
20    
21     %if "%{?online_release:set}" != "set"
22 muzaffar 1.1 ### Detects the SCRAM_ARCH to be used.
23     cat << \EOF_CMSARCH_SH >%instroot/common/cmsarch
24     #!/bin/sh
25     osarch=`%instroot/common/cmsos`
26     compilerv=gcc323
27     # We need to assume 1 compiler per platform.
28     # There is no other way around this.
29     if [ ! "$SCRAM_ARCH" ]
30     then
31     case $osarch in
32     slc3_ia32) compilerv=gcc323;;
33     slc3_amd64) compilerv=gcc344;;
34     slc4_ia32) compilerv=gcc345;;
35     slc4_amd64) compilerv=gcc345; osarch=slc4_ia32;;
36     osx104_ia32) compilerv=gcc401;;
37     osx104_ppc32) compilerv=gcc400;;
38     esac
39     echo ${osarch}_${compilerv}
40     else
41     echo $SCRAM_ARCH
42     fi
43    
44     EOF_CMSARCH_SH
45 ratnik 1.12 %else
46     cat << \EOF_CMSARCH_ONL >%instroot/common/cmsarch
47     #!/bin/sh
48     echo %{cmsplatf}
49     EOF_CMSARCH_ONL
50     %endif
51    
52 muzaffar 1.1 chmod 755 %instroot/common/cmsarch
53    
54     ### BASH code
55    
56     cat << \EOF_CMSSET_DEFAULT_SH > %instroot/cmsset_default.sh
57     export PATH=%instroot/common:%instroot/bin:$PATH
58    
59     if [ ! $SCRAM_ARCH ]
60     then
61     SCRAM_ARCH=`%instroot/common/cmsarch`
62     export SCRAM_ARCH
63     fi
64    
65     here=%{instroot}
66    
67     if [ "$VO_CMS_SW_DIR" != "" ]
68     then
69     here=$VO_CMS_SW_DIR
70     else
71     if [ "$OSG_APP" != "" ]
72     then
73     here=$OSG_APP/cmssoft/cms
74     fi
75     fi
76    
77     if [ ! -d $here/${SCRAM_ARCH}/etc/profile.d ]
78     then
79     echo "Your shell is not able to find where cmsset_default.sh is located."
80     echo "Either you have not set VO_CMS_SW_DIR or OSG_APP correctly"
81     echo "or SCRAM_ARCH is not set to a valid architecture."
82     fi
83    
84     for pkg in `/bin/ls $here/${SCRAM_ARCH}/etc/profile.d/ | grep 'S.*[.]sh'`
85     do
86     source $here/${SCRAM_ARCH}/etc/profile.d/$pkg
87     done
88    
89     if [ ! $CMS_PATH ]
90     then
91     export CMS_PATH=$here
92     fi
93    
94     # aliases
95 muzaffar 1.9 alias cmsenv='eval `scramv1 runtime -sh`'
96     alias cmsrel='scramv1 project CMSSW'
97 muzaffar 1.1
98     if [ -f $CMS_PATH/SITECONF/local/JobConfig/cmsset_local.sh ]; then
99     . $CMS_PATH/SITECONF/local/JobConfig/cmsset_local.sh
100     fi
101    
102     if [ ! $CVSROOT ]
103     then
104     CVSROOT=:kserver:cmscvs.cern.ch:/cvs_server/repositories/CMSSW
105     export CVSROOT
106     fi
107    
108     EOF_CMSSET_DEFAULT_SH
109    
110    
111     ### CSH code
112    
113     cat << \EOF_CMSSET_DEFAULT_CSH > %instroot/cmsset_default.csh
114    
115     if (${?PATH}) then
116     setenv PATH %instroot/common:%instroot/bin:$PATH
117     else
118     setenv PATH %instroot/common:%instroot/bin
119     endif
120    
121     if ( ! ${?SCRAM_ARCH}) then
122     setenv SCRAM_ARCH `sh -c %instroot/common/cmsarch`
123     endif
124    
125     set here=%instroot
126    
127     if ( ${?VO_CMS_SW_DIR} ) then
128     set here=$VO_CMS_SW_DIR
129     else
130     # OSG
131     if ( ${?OSG_APP} ) then
132     set here=$OSG_APP/cmssoft/cms
133     endif
134     # OSG
135     endif
136    
137     if ( ! -e $here/cmsset_default.csh ) then
138     echo "Please cd into the directory where cmsset_default.csh is."
139     endif
140    
141     foreach pkg ( `/bin/ls ${here}/${SCRAM_ARCH}/etc/profile.d/ | grep 'S.*[.]csh'` )
142     source ${here}/${SCRAM_ARCH}/etc/profile.d/$pkg
143     end
144     if ( ! ${?CMS_PATH} ) then
145     setenv CMS_PATH $here
146     endif
147    
148     # aliases
149 muzaffar 1.9 alias cmsenv 'eval `scramv1 runtime -csh`'
150     alias cmsrel 'scramv1 project CMSSW'
151 muzaffar 1.1
152     if( -e $CMS_PATH/SITECONF/local/JobConfig/cmsset_local.csh ) then
153     source $CMS_PATH/SITECONF/local/JobConfig/cmsset_local.csh
154     endif
155    
156     if ( ! ${?CVSROOT}) then
157     setenv CVSROOT :kserver:cmscvs.cern.ch:/cvs_server/repositories/CMSSW
158     endif
159    
160     unset here
161     EOF_CMSSET_DEFAULT_CSH
162    
163     cat << \EOF_COMMON_SCRAM > %instroot/common/scram
164     #!/bin/sh
165     CMSARCH=`cmsarch`
166 muzaffar 1.10 srbase=%{instroot}/$CMSARCH
167     sver=$SCRAM_VERSION
168     dir=`/bin/pwd`
169     while [ ! -d ${dir}/.SCRAM -a "$dir" != "/" ] ; do
170     dir=`dirname $dir`
171     done
172     if [ -f ${dir}/config/scram_version ] ; then
173     sver=`cat ${dir}/config/scram_version`
174     elif [ "X$sver" == "X" ] ; then
175     sver=`cat ${srbase}/etc/default-scramv1-version`
176     fi
177     if [ "X$sver" = "XV1_0_3-p1" -a "X$CMSARCH" = "Xslc4_ia32_gcc345" ] ; then
178     sver=V1_0_3-p2
179     fi
180     scram_rel_series=`echo $sver | grep '^V[0-9]\+_[0-9]\+_[0-9]\+' | sed 's|^\(V[0-9]\+_[0-9]\+\)_.*|\1|'`
181     if [ "X${scram_rel_series}" != "X" -a -f ${srbase}/etc/default-scram/${scram_rel_series} ] ; then
182     sver=`cat ${srbase}/etc/default-scram/${scram_rel_series}`
183 muzaffar 1.1 fi
184     scmd=scram
185 muzaffar 1.10 srbase=%{instroot}/$CMSARCH/lcg/SCRAMV1
186 muzaffar 1.1 case $sver in
187 muzaffar 1.10 V0_* ) srbase=%{instroot}/$CMSARCH/lcg/SCRAM; scmd=scramv0;;
188     V1_0* ) scmd=scramv1;;
189     * ) ;;
190 muzaffar 1.1 esac
191 muzaffar 1.10 if [ ! -f ${srbase}/${sver}/etc/profile.d/init.sh ] ; then
192 muzaffar 1.8 echo "Unable to find SCRAM version $sver for $CMSARCH architecture."
193     exit 1
194     fi
195 muzaffar 1.10 source ${srbase}/${sver}/etc/profile.d/init.sh
196 elmer 1.2 # In the case we are on linux ia32 we prepend the linux32 command to the
197     # actual scram command so that, no matter where the ia32 architecture is
198     # running (i686 or x84_64) scram detects it as ia32.
199 muzaffar 1.1 CMSPLAT=`echo $CMSARCH | cut -d_ -f 2`
200 elmer 1.2 USE_LINUX32=
201 muzaffar 1.10 if [ `uname` == Linux -a "$CMSPLAT" = "ia32" ] ; then
202     USE_LINUX32=linux32
203 muzaffar 1.1 fi
204 muzaffar 1.10 $USE_LINUX32 ${srbase}/${sver}/bin/${scmd} $@
205 muzaffar 1.1 EOF_COMMON_SCRAM
206    
207     chmod +x %{instroot}/common/scram
208     ln -sf scram %{instroot}/common/scramv1
209     ln -sf scram %{instroot}/common/scramv0
210 muzaffar 1.5 ln -sf ../common/cmsarch %instroot/bin/cmsarch
211     ln -sf ../common/cmsarch %instroot/bin/cmsos
212     ln -sf ../common/scramv1 %instroot/bin/scramv1
213 muzaffar 1.1 touch %instroot/common/.cms-common
214     fi
215    
216     touch %instroot/%cmsplatf/etc/profile.d/dummy
217    
218     %post
219     echo $RPM_INSTALL_PREFIX
220     perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/cmsset_default.sh
221     perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/cmsset_default.csh
222     perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/common/cmsos
223     perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/common/cmsarch
224     perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/common/scram
225    
226     %files
227     %i
228     %instroot/cmsset_default.sh
229     %instroot/cmsset_default.csh
230     %instroot/common/cmsos
231     %instroot/common/cmsarch
232     %instroot/common/scram
233     %instroot/common/scramv1
234     %instroot/common/scramv0
235 muzaffar 1.4 %instroot/common/.cms-common
236     %instroot/bin/cmsos
237     %instroot/bin/cmsarch
238     %instroot/bin/scramv1
239 muzaffar 1.1 %instroot/%cmsplatf/etc/profile.d
240     %exclude %instroot/%cmsplatf/etc/profile.d/*