1 |
< |
### RPM cms cms-common 1.0 |
1 |
> |
### RPM cms cms-common 1.0 |
2 |
> |
## REVISION 1050 |
3 |
> |
## NOCOMPILER |
4 |
|
Source: cmsos |
5 |
|
%prep |
6 |
|
%build |
9 |
|
|
10 |
|
mkdir -p %instroot/common %instroot/bin %{instroot}/%{cmsplatf}/etc/profile.d |
11 |
|
|
12 |
< |
# Do not create these common files if already exist |
12 |
> |
# Do not create these common files if already exist |
13 |
|
# 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 |
+ |
|
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 |
|
### Detects the SCRAM_ARCH to be used. |
25 |
|
cat << \EOF_CMSARCH_SH >%instroot/common/cmsarch |
26 |
|
#!/bin/sh |
44 |
|
fi |
45 |
|
|
46 |
|
EOF_CMSARCH_SH |
47 |
+ |
%else |
48 |
+ |
cat << \EOF_CMSARCH_ONL >%instroot/common/cmsarch |
49 |
+ |
#!/bin/sh |
50 |
+ |
echo %{cmsplatf} |
51 |
+ |
EOF_CMSARCH_ONL |
52 |
+ |
%endif |
53 |
+ |
|
54 |
|
chmod 755 %instroot/common/cmsarch |
55 |
|
|
56 |
|
### BASH code |
94 |
|
fi |
95 |
|
|
96 |
|
# aliases |
97 |
< |
alias cmsenv='eval `scram runtime -sh`' |
98 |
< |
alias cmsrel='scram project CMSSW' |
97 |
> |
alias cmsenv='eval `scramv1 runtime -sh`' |
98 |
> |
alias cmsrel='scramv1 project CMSSW' |
99 |
|
|
100 |
|
if [ -f $CMS_PATH/SITECONF/local/JobConfig/cmsset_local.sh ]; then |
101 |
|
. $CMS_PATH/SITECONF/local/JobConfig/cmsset_local.sh |
148 |
|
endif |
149 |
|
|
150 |
|
# aliases |
151 |
< |
alias cmsenv 'eval `scram runtime -csh`' |
152 |
< |
alias cmsrel 'scram project CMSSW' |
151 |
> |
alias cmsenv 'eval `scramv1 runtime -csh`' |
152 |
> |
alias cmsrel 'scramv1 project CMSSW' |
153 |
|
|
154 |
|
if( -e $CMS_PATH/SITECONF/local/JobConfig/cmsset_local.csh ) then |
155 |
|
source $CMS_PATH/SITECONF/local/JobConfig/cmsset_local.csh |
165 |
|
cat << \EOF_COMMON_SCRAM > %instroot/common/scram |
166 |
|
#!/bin/sh |
167 |
|
CMSARCH=`cmsarch` |
168 |
< |
srbase= |
169 |
< |
if [ "X$SCRAM_VERSION" = "X" ] ; then |
170 |
< |
sver=`cat %{instroot}/$CMSARCH/etc/default-scramv1-version` |
171 |
< |
dir=`/bin/pwd` |
172 |
< |
while [ ! -d ${dir}/.SCRAM -a "$dir" != "/" ] ; do |
173 |
< |
dir=`dirname $dir` |
174 |
< |
done |
175 |
< |
if [ -f ${dir}/config/scram_version ] ; then |
176 |
< |
ver=`cat ${dir}/config/scram_version` |
177 |
< |
case $ver in |
178 |
< |
V0_* ) srbase=lcg/SCRAM/${ver};; |
179 |
< |
* ) srbase=lcg/SCRAMV1/${ver};; |
180 |
< |
esac |
181 |
< |
if [ -f %{instroot}/$CMSARCH/${srbase}/etc/profile.d/init.sh ] ; then |
182 |
< |
sver=$ver |
183 |
< |
fi |
184 |
< |
fi |
168 |
< |
else |
169 |
< |
sver=$SCRAM_VERSION |
168 |
> |
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 |
|
fi |
186 |
|
scmd=scram |
187 |
+ |
srbase=%{instroot}/$CMSARCH/lcg/SCRAMV1 |
188 |
|
case $sver in |
189 |
< |
V0_* ) srbase=lcg/SCRAM/${sver}; scmd=scramv0;; |
190 |
< |
V1_0* ) srbase=lcg/SCRAMV1/${sver}; scmd=scramv1;; |
191 |
< |
* ) srbase=lcg/SCRAMV1/${sver};; |
189 |
> |
V0_* ) srbase=%{instroot}/$CMSARCH/lcg/SCRAM; scmd=scramv0;; |
190 |
> |
V1_0* ) scmd=scramv1;; |
191 |
> |
* ) ;; |
192 |
|
esac |
193 |
< |
source %{instroot}/$CMSARCH/${srbase}/etc/profile.d/init.sh |
194 |
< |
# In the case we are on ia32 we prepend the linux32 command to the actual |
195 |
< |
# scram command so that, no matter where the ia32 architecture is running |
196 |
< |
# (i686 or x84_64) scram detects it as ia32. |
193 |
> |
if [ ! -f ${srbase}/${sver}/etc/profile.d/init.sh ] ; then |
194 |
> |
echo "Unable to find SCRAM version $sver for $CMSARCH architecture." |
195 |
> |
exit 1 |
196 |
> |
fi |
197 |
> |
source ${srbase}/${sver}/etc/profile.d/init.sh |
198 |
> |
# 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 |
|
CMSPLAT=`echo $CMSARCH | cut -d_ -f 2` |
202 |
< |
if [ "$CMSPLAT" = "ia32" ] |
203 |
< |
then |
204 |
< |
USE_LINUX32=linux32 |
185 |
< |
else |
186 |
< |
USE_LINUX32= |
202 |
> |
USE_LINUX32= |
203 |
> |
if [ `uname` == Linux -a "$CMSPLAT" = "ia32" ] ; then |
204 |
> |
USE_LINUX32=linux32 |
205 |
|
fi |
206 |
< |
$USE_LINUX32 %{instroot}/$CMSARCH/${srbase}/bin/${scmd} $@ |
206 |
> |
$USE_LINUX32 ${srbase}/${sver}/bin/${scmd} $@ |
207 |
|
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 |
+ |
ln -sf ../common/cmsarch %instroot/bin/cmsarch |
213 |
+ |
ln -sf ../common/cmsarch %instroot/bin/cmsos |
214 |
+ |
ln -sf ../common/scramv1 %instroot/bin/scramv1 |
215 |
|
touch %instroot/common/.cms-common |
216 |
|
fi |
217 |
|
|
218 |
|
touch %instroot/%cmsplatf/etc/profile.d/dummy |
198 |
– |
ln -s ../common/cmsarch %instroot/bin/cmsarch |
199 |
– |
ln -s ../common/cmsarch %instroot/bin/cmsos |
219 |
|
|
220 |
|
%post |
221 |
|
echo $RPM_INSTALL_PREFIX |
234 |
|
%instroot/common/scram |
235 |
|
%instroot/common/scramv1 |
236 |
|
%instroot/common/scramv0 |
237 |
+ |
%instroot/common/.cms-common |
238 |
+ |
%instroot/bin/cmsos |
239 |
+ |
%instroot/bin/cmsarch |
240 |
+ |
%instroot/bin/scramv1 |
241 |
|
%instroot/%cmsplatf/etc/profile.d |
242 |
|
%exclude %instroot/%cmsplatf/etc/profile.d/* |