ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CMSDIST/cms-common.spec
Revision: 1.7
Committed: Tue Feb 5 15:51:59 2008 UTC (17 years, 2 months ago) by muzaffar
Branch: MAIN
CVS Tags: pe20080205b-ports-lcg54pre2-412, pe20080205b-ports-lcg54pre2
Changes since 1.6: +5 -0 lines
Log Message:
fixed to switch to a working version of SCRAM i.e 1_0_3-p2 instead of 1_0_3-p1 for slc4_ia32_gcc345 arch

File Contents

# User Rev Content
1 muzaffar 1.1 ### RPM cms cms-common 1.0
2     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     alias cmsenv='eval `scram runtime -sh`'
81     alias cmsrel='scram project CMSSW'
82    
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     CVSROOT=:kserver:cmscvs.cern.ch:/cvs_server/repositories/CMSSW
90     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     alias cmsenv 'eval `scram runtime -csh`'
135     alias cmsrel 'scram project CMSSW'
136    
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     setenv CVSROOT :kserver:cmscvs.cern.ch:/cvs_server/repositories/CMSSW
143     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     srbase=
152     if [ "X$SCRAM_VERSION" = "X" ] ; then
153     sver=`cat %{instroot}/$CMSARCH/etc/default-scramv1-version`
154     dir=`/bin/pwd`
155     while [ ! -d ${dir}/.SCRAM -a "$dir" != "/" ] ; do
156     dir=`dirname $dir`
157     done
158     if [ -f ${dir}/config/scram_version ] ; then
159     ver=`cat ${dir}/config/scram_version`
160 muzaffar 1.7 if [ "X$ver" = "XV1_0_3-p1" ] ; then
161     if [ "X$CMSARCH" = "Xslc4_ia32_gcc345" ] ; then
162     ver=V1_0_3-p2
163     fi
164     fi
165 muzaffar 1.1 case $ver in
166     V0_* ) srbase=lcg/SCRAM/${ver};;
167     * ) srbase=lcg/SCRAMV1/${ver};;
168     esac
169     if [ -f %{instroot}/$CMSARCH/${srbase}/etc/profile.d/init.sh ] ; then
170     sver=$ver
171     fi
172     fi
173     else
174     sver=$SCRAM_VERSION
175     fi
176     scmd=scram
177     case $sver in
178     V0_* ) srbase=lcg/SCRAM/${sver}; scmd=scramv0;;
179     V1_0* ) srbase=lcg/SCRAMV1/${sver}; scmd=scramv1;;
180     * ) srbase=lcg/SCRAMV1/${sver};;
181     esac
182     source %{instroot}/$CMSARCH/${srbase}/etc/profile.d/init.sh
183 elmer 1.2 # In the case we are on linux ia32 we prepend the linux32 command to the
184     # actual scram command so that, no matter where the ia32 architecture is
185     # running (i686 or x84_64) scram detects it as ia32.
186 muzaffar 1.1 CMSPLAT=`echo $CMSARCH | cut -d_ -f 2`
187 elmer 1.2 USE_LINUX32=
188 elmer 1.3 if [ `uname` == Linux ]; then
189 elmer 1.2 if [ "$CMSPLAT" = "ia32" ]
190     then
191     USE_LINUX32=linux32
192     fi
193 muzaffar 1.1 fi
194     $USE_LINUX32 %{instroot}/$CMSARCH/${srbase}/bin/${scmd} $@
195     EOF_COMMON_SCRAM
196    
197     chmod +x %{instroot}/common/scram
198     ln -sf scram %{instroot}/common/scramv1
199     ln -sf scram %{instroot}/common/scramv0
200 muzaffar 1.5 ln -sf ../common/cmsarch %instroot/bin/cmsarch
201     ln -sf ../common/cmsarch %instroot/bin/cmsos
202     ln -sf ../common/scramv1 %instroot/bin/scramv1
203 muzaffar 1.1 touch %instroot/common/.cms-common
204     fi
205    
206     touch %instroot/%cmsplatf/etc/profile.d/dummy
207    
208     %post
209     echo $RPM_INSTALL_PREFIX
210     perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/cmsset_default.sh
211     perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/cmsset_default.csh
212     perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/common/cmsos
213     perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/common/cmsarch
214     perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/common/scram
215    
216     %files
217     %i
218     %instroot/cmsset_default.sh
219     %instroot/cmsset_default.csh
220     %instroot/common/cmsos
221     %instroot/common/cmsarch
222     %instroot/common/scram
223     %instroot/common/scramv1
224     %instroot/common/scramv0
225 muzaffar 1.4 %instroot/common/.cms-common
226     %instroot/bin/cmsos
227     %instroot/bin/cmsarch
228     %instroot/bin/scramv1
229 muzaffar 1.1 %instroot/%cmsplatf/etc/profile.d
230     %exclude %instroot/%cmsplatf/etc/profile.d/*