ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CMSDIST/cms-common.spec
Revision: 1.13
Committed: Mon Jul 28 04:11:50 2008 UTC (16 years, 9 months ago) by dlange
Branch: MAIN
CVS Tags: MotT0_1_0_2, MotT0_1_0_1, MotT0_1_0_0, MotT0_100531_1, MotT0_100528_1, T0Mon_100518_1, T0Mon_100503_1, T0Mon_100316_1, T0Mon_100308_2, T0Mon_100308_1, T0Mon_100216_1, T0Mon_100210_1, T0Mon_100204_4, T0Mon_100204_3, T0Mon_100204_1, T0Mon_100127_1, T0Mon_091111_1, T0Mon_090828_1, T0Mon_090822_1, T0Mon_090715_1, T0Mon_090612_1, T0Mon_090611_1, T0Mon_090610_1, T0Mon_090601_1, T0Mon_090527_2, T0Mon_090527_1, T0Mon_090522_1, T0Mon_090519_2, T0Mon_090519_1, T0Mon_090517_1, T0Mon_090516_1, T0Mon_090515_4, T0Mon_090515_3, T0Mon_090515_2, T0Mon_090515_1, T0Mon_090510_1, T0Mon_090406_1, T0Mon_090326_1, T0Mon_090325_1, T0Mon_090318_1, T0Mon_090315_1, T0Mon_090303_1, WEBTOOLS-APPS_20090130, WEBTOOLS-APPS_20090129, PRODAGENT_0_12_10_pre3, PRODAGENT_0_12_10_pre2_20090127_V2, PRODAGENT_0_12_10_20090122, PRODAGENT_0_12_10_pre1_MISC, sw_20090115a, sw_20090115, testofc, T0Mon_081107_1, T0Mon_081105_1, PRODAGENT_0_12_2, T0Mon_080926_1, T0Mon_080920_2, T0Mon_080920_1, T0Mon_080916_2, T0Mon_080905_1, T0Mon_080905_01, T0Mon_080902_2, T0Mon_080902_1, T0Mon_080824_1, T0Mon_080823_1, buildset_V2_8, dl080727_bootstrap
Changes since 1.12: +2 -0 lines
Log Message:
cmscommon version using revisions/nocompiler (still in progress...)

File Contents

# User Rev Content
1 muzaffar 1.11 ### RPM cms cms-common 1.0
2 dlange 1.13 ## REVISION 1050
3     ## NOCOMPILER
4 muzaffar 1.1 Source: cmsos
5     %prep
6     %build
7     echo $SCRAM_ROOT
8     %install
9    
10     mkdir -p %instroot/common %instroot/bin %{instroot}/%{cmsplatf}/etc/profile.d
11    
12 elmer 1.6 # Do not create these common files if already exist
13 muzaffar 1.1 # This is to avoid different arch creating these files
14     if [ ! -f %instroot/common/.cms-common ]; then
15     install -m 755 %_sourcedir/cmsos %instroot/common/cmsos
16 ratnik 1.12
17     %if "%{?online_release:set}" == "set"
18     echo echo %{cmsos} > %instroot/common/cmsos
19     chmod 755 %instroot/common/cmsos
20     %endif
21    
22    
23     %if "%{?online_release:set}" != "set"
24 muzaffar 1.1 ### Detects the SCRAM_ARCH to be used.
25     cat << \EOF_CMSARCH_SH >%instroot/common/cmsarch
26     #!/bin/sh
27     osarch=`%instroot/common/cmsos`
28     compilerv=gcc323
29     # We need to assume 1 compiler per platform.
30     # There is no other way around this.
31     if [ ! "$SCRAM_ARCH" ]
32     then
33     case $osarch in
34     slc3_ia32) compilerv=gcc323;;
35     slc3_amd64) compilerv=gcc344;;
36     slc4_ia32) compilerv=gcc345;;
37     slc4_amd64) compilerv=gcc345; osarch=slc4_ia32;;
38     osx104_ia32) compilerv=gcc401;;
39     osx104_ppc32) compilerv=gcc400;;
40     esac
41     echo ${osarch}_${compilerv}
42     else
43     echo $SCRAM_ARCH
44     fi
45    
46     EOF_CMSARCH_SH
47 ratnik 1.12 %else
48     cat << \EOF_CMSARCH_ONL >%instroot/common/cmsarch
49     #!/bin/sh
50     echo %{cmsplatf}
51     EOF_CMSARCH_ONL
52     %endif
53    
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     CVSROOT=:kserver:cmscvs.cern.ch:/cvs_server/repositories/CMSSW
107     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     setenv CVSROOT :kserver:cmscvs.cern.ch:/cvs_server/repositories/CMSSW
160     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     while [ ! -d ${dir}/.SCRAM -a "$dir" != "/" ] ; do
172     dir=`dirname $dir`
173     done
174     if [ -f ${dir}/config/scram_version ] ; then
175     sver=`cat ${dir}/config/scram_version`
176     elif [ "X$sver" == "X" ] ; then
177     sver=`cat ${srbase}/etc/default-scramv1-version`
178     fi
179     if [ "X$sver" = "XV1_0_3-p1" -a "X$CMSARCH" = "Xslc4_ia32_gcc345" ] ; then
180     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     if [ "X${scram_rel_series}" != "X" -a -f ${srbase}/etc/default-scram/${scram_rel_series} ] ; then
184     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.10 source ${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.10 if [ `uname` == Linux -a "$CMSPLAT" = "ia32" ] ; then
204     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     echo $RPM_INSTALL_PREFIX
222     perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/cmsset_default.sh
223     perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/cmsset_default.csh
224     perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/common/cmsos
225     perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/common/cmsarch
226     perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/common/scram
227    
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/*