ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CMSDIST/cms-common.spec
Revision: 1.14
Committed: Fri Jan 30 10:32:10 2009 UTC (16 years, 2 months ago) by andreasp
Branch: MAIN
CVS Tags: CMSSW_2_2_13_offpatch1, apFor2213offpatch1v0, CMSSW_2_2_13_FWLITE, apFor2213fwlitev0, CMSSW_2_2_13_HLT, apFor2213hltv0, CMSSW_2_2_13, apFor2213v0, CMSSW_2_2_12_HLT, CMSSW_2_2_12, apFor2212hltv0, apFor2212v2, apFor2212v1, apFor2212v0, apFor2211off1v0, CMSSW_2_2_11_offpatch1, CMSSW_2_2_11, CMSSW_2_2_11_HLT, apFor2211v1, apFor2211hltv0, apFor2211v0, CMSSW_2_2_10_HLT, apFor2210hltv0, CMSSW_2_2_10, apFor2210v0, CMSSW_2_2_9, apFor229v2, apFor229v1, apFor229v0, CMSSW_2_2_8, apFor228v0, CMSSW_2_2_7, apFor227v2, CMSSW_2_2_6_HLT_ONLINE1, nr090319_for226hltonl1, CMSSW_2_2_6_HLT_ONLINE, apFor227v1, apFor227v0, CMSSW_2_2_6_onlpatch1_ONLINE, CMSSW_2_2_6_ONLINE, CMSSW_2_2_6_HLT, apFor226HLTv0, CMSSW_2_2_6, nr090307for226_onlpatch1, apFor226v3, nr090306onl226_tkonlsw_too_new, apFor226v2, apFor226v1, apFor226v0, apFor226, nr20090224_for226, T0M_0_0_5, WEBTOOLS-APPS_20090217_1, WEBTOOLS-APPS_20090217, WEBTOOLS-APPS_20090216, WEBTOOLS-APPS_20090212, CMSSW_2_2_5, apFor225v0, WEBTOOLS-APPS_20090209_64bit, zx20090209, WEBTOOLS-APPS_20090206, T0M_0_0_4, T0M_0_0_3, CMSSW_2_2_4, WEBTOOLS-APPS_20090203_1, WEBTOOLS-APPS_20090203, apFor224v4, T0M_0_0_2, apFor224v3, zx20090201, apFor224v2
Changes since 1.13: +2 -19 lines
Log Message:
updated to gserver instead of kserver for CVSROOT

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