ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CMSDIST/cms-common.spec
Revision: 1.5
Committed: Sat Feb 2 00:08:55 2008 UTC (17 years, 3 months ago) by muzaffar
Branch: MAIN
Changes since 1.4: +3 -7 lines
Log Message:
fixed cms-common so that It does not create links for scram and scramv0 which are owned by SCRAM

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     # Do not create these common files if already exist
11     # 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     case $ver in
161     V0_* ) srbase=lcg/SCRAM/${ver};;
162     * ) srbase=lcg/SCRAMV1/${ver};;
163     esac
164     if [ -f %{instroot}/$CMSARCH/${srbase}/etc/profile.d/init.sh ] ; then
165     sver=$ver
166     fi
167     fi
168     else
169     sver=$SCRAM_VERSION
170     fi
171     scmd=scram
172     case $sver in
173     V0_* ) srbase=lcg/SCRAM/${sver}; scmd=scramv0;;
174     V1_0* ) srbase=lcg/SCRAMV1/${sver}; scmd=scramv1;;
175     * ) srbase=lcg/SCRAMV1/${sver};;
176     esac
177     source %{instroot}/$CMSARCH/${srbase}/etc/profile.d/init.sh
178 elmer 1.2 # In the case we are on linux ia32 we prepend the linux32 command to the
179     # actual scram command so that, no matter where the ia32 architecture is
180     # running (i686 or x84_64) scram detects it as ia32.
181 muzaffar 1.1 CMSPLAT=`echo $CMSARCH | cut -d_ -f 2`
182 elmer 1.2 USE_LINUX32=
183 elmer 1.3 if [ `uname` == Linux ]; then
184 elmer 1.2 if [ "$CMSPLAT" = "ia32" ]
185     then
186     USE_LINUX32=linux32
187     fi
188 muzaffar 1.1 fi
189     $USE_LINUX32 %{instroot}/$CMSARCH/${srbase}/bin/${scmd} $@
190     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/*