1 |
< |
### RPM cms cms-common 1.0 |
1 |
> |
### RPM cms cms-common 1.1 |
2 |
|
Source: cmsos |
3 |
|
%prep |
4 |
|
%build |
7 |
|
|
8 |
|
mkdir -p %instroot/common %instroot/bin %{instroot}/%{cmsplatf}/etc/profile.d |
9 |
|
|
10 |
< |
# Do not create these common files if already exist |
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 |
77 |
|
fi |
78 |
|
|
79 |
|
# aliases |
80 |
< |
alias cmsenv='eval `scram runtime -sh`' |
81 |
< |
alias cmsrel='scram project CMSSW' |
80 |
> |
alias cmsenv='eval `scramv1 runtime -sh`' |
81 |
> |
alias cmsrel='scramv1 project CMSSW' |
82 |
|
|
83 |
|
if [ -f $CMS_PATH/SITECONF/local/JobConfig/cmsset_local.sh ]; then |
84 |
|
. $CMS_PATH/SITECONF/local/JobConfig/cmsset_local.sh |
131 |
|
endif |
132 |
|
|
133 |
|
# aliases |
134 |
< |
alias cmsenv 'eval `scram runtime -csh`' |
135 |
< |
alias cmsrel 'scram project CMSSW' |
134 |
> |
alias cmsenv 'eval `scramv1 runtime -csh`' |
135 |
> |
alias cmsrel 'scramv1 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 |
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 |
151 |
> |
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 |
|
fi |
169 |
|
scmd=scram |
170 |
+ |
srbase=%{instroot}/$CMSARCH/lcg/SCRAMV1 |
171 |
|
case $sver in |
172 |
< |
V0_* ) srbase=lcg/SCRAM/${sver}; scmd=scramv0;; |
173 |
< |
V1_0* ) srbase=lcg/SCRAMV1/${sver}; scmd=scramv1;; |
174 |
< |
* ) srbase=lcg/SCRAMV1/${sver};; |
172 |
> |
V0_* ) srbase=%{instroot}/$CMSARCH/lcg/SCRAM; scmd=scramv0;; |
173 |
> |
V1_0* ) scmd=scramv1;; |
174 |
> |
* ) ;; |
175 |
|
esac |
176 |
< |
source %{instroot}/$CMSARCH/${srbase}/etc/profile.d/init.sh |
176 |
> |
if [ ! -f ${srbase}/${sver}/etc/profile.d/init.sh ] ; then |
177 |
> |
echo "Unable to find SCRAM version $sver for $CMSARCH architecture." |
178 |
> |
exit 1 |
179 |
> |
fi |
180 |
> |
source ${srbase}/${sver}/etc/profile.d/init.sh |
181 |
|
# 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 |
|
CMSPLAT=`echo $CMSARCH | cut -d_ -f 2` |
185 |
|
USE_LINUX32= |
186 |
< |
if [ `uname` == Linux ]; then |
187 |
< |
if [ "$CMSPLAT" = "ia32" ] |
185 |
< |
then |
186 |
< |
USE_LINUX32=linux32 |
187 |
< |
fi |
186 |
> |
if [ `uname` == Linux -a "$CMSPLAT" = "ia32" ] ; then |
187 |
> |
USE_LINUX32=linux32 |
188 |
|
fi |
189 |
< |
$USE_LINUX32 %{instroot}/$CMSARCH/${srbase}/bin/${scmd} $@ |
189 |
> |
$USE_LINUX32 ${srbase}/${sver}/bin/${scmd} $@ |
190 |
|
EOF_COMMON_SCRAM |
191 |
|
|
192 |
|
chmod +x %{instroot}/common/scram |