1 |
|
### RPM cms cms-common 1.0 |
2 |
< |
## REVISION 1050 |
2 |
> |
## REVISION 1100 |
3 |
|
## NOCOMPILER |
4 |
+ |
|
5 |
+ |
%define online %(case %cmsplatf in (*onl_*_*) echo true;; (*) echo false;; esac) |
6 |
+ |
%if "%{?cmsroot:set}" != "set" |
7 |
+ |
%define cmsroot %instroot |
8 |
+ |
%endif |
9 |
+ |
|
10 |
|
Source: cmsos |
11 |
+ |
|
12 |
|
%prep |
13 |
+ |
#Make sure that we always build cms-common with a different revision and |
14 |
+ |
#hardcoded version 1.0 because this is what bootstrap.sh is going to install |
15 |
+ |
%if "%v" != "1.0" |
16 |
+ |
echo "ERROR: Please do not change the version. We have to build this RPM with a different REVISION" |
17 |
+ |
echo " Please update the revision in %n.spec and make sure that version is set to 1.0" |
18 |
+ |
exit 1 |
19 |
+ |
%endif |
20 |
+ |
|
21 |
|
%build |
7 |
– |
echo $SCRAM_ROOT |
8 |
– |
%install |
22 |
|
|
23 |
< |
mkdir -p %instroot/common %instroot/bin %{instroot}/%{cmsplatf}/etc/profile.d |
23 |
> |
%install |
24 |
|
|
25 |
< |
# Do not create these common files if already exist |
26 |
< |
# This is to avoid different arch creating these files |
27 |
< |
if [ ! -f %instroot/common/.cms-common ]; then |
28 |
< |
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 |
25 |
> |
#Create all files in %i/%{pkgrevision} directory. |
26 |
> |
#This can be avoid if we move to --buildroot based builds |
27 |
> |
mkdir -p %i/%{pkgrevision}/common |
28 |
> |
cd %i/%{pkgrevision} |
29 |
|
|
30 |
+ |
cp %_sourcedir/cmsos ./common/cmsos |
31 |
|
|
32 |
< |
%if "%{?online_release:set}" != "set" |
33 |
< |
### Detects the SCRAM_ARCH to be used. |
25 |
< |
cat << \EOF_CMSARCH_SH >%instroot/common/cmsarch |
32 |
> |
%if "%online" != "true" |
33 |
> |
cat << \EOF_CMSARCH_SH > ./common/cmsarch |
34 |
|
#!/bin/sh |
35 |
|
osarch=`%instroot/common/cmsos` |
36 |
< |
compilerv=gcc323 |
36 |
> |
compilerv=gcc434 |
37 |
|
# We need to assume 1 compiler per platform. |
38 |
|
# There is no other way around this. |
39 |
|
if [ ! "$SCRAM_ARCH" ] |
40 |
|
then |
41 |
|
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;; |
42 |
|
osx104_ia32) compilerv=gcc401;; |
43 |
|
osx104_ppc32) compilerv=gcc400;; |
44 |
+ |
osx105_*) compilerv=gcc401;; |
45 |
+ |
osx106_*) compilerv=gcc421;; |
46 |
+ |
slc6_*) compilerv=gcc461; osarch=slc6_amd64;; |
47 |
+ |
slc5_*) compilerv=gcc434; osarch=slc5_amd64;; |
48 |
+ |
slc4_*) compilerv=gcc345; osarch=slc4_ia32;; |
49 |
+ |
*) compilerv=gcc434; osarch=slc5_ia32;; |
50 |
|
esac |
51 |
|
echo ${osarch}_${compilerv} |
52 |
|
else |
55 |
|
|
56 |
|
EOF_CMSARCH_SH |
57 |
|
%else |
58 |
< |
cat << \EOF_CMSARCH_ONL >%instroot/common/cmsarch |
58 |
> |
cat << \EOF_CMSARCH_SH > ./common/cmsarch |
59 |
|
#!/bin/sh |
60 |
< |
echo %{cmsplatf} |
61 |
< |
EOF_CMSARCH_ONL |
62 |
< |
%endif |
60 |
> |
if [ ! "$SCRAM_ARCH" ] ; then |
61 |
> |
echo %cmsplatf |
62 |
> |
else |
63 |
> |
echo $SCRAM_ARCH |
64 |
> |
fi |
65 |
|
|
66 |
< |
chmod 755 %instroot/common/cmsarch |
66 |
> |
EOF_CMSARCH_SH |
67 |
> |
%endif |
68 |
|
|
69 |
|
### BASH code |
70 |
|
|
71 |
< |
cat << \EOF_CMSSET_DEFAULT_SH > %instroot/cmsset_default.sh |
71 |
> |
cat << \EOF_CMSSET_DEFAULT_SH > ./cmsset_default.sh |
72 |
|
export PATH=%instroot/common:%instroot/bin:$PATH |
73 |
|
|
74 |
|
if [ ! $SCRAM_ARCH ] |
116 |
|
|
117 |
|
if [ ! $CVSROOT ] |
118 |
|
then |
119 |
< |
CVSROOT=:kserver:cmscvs.cern.ch:/cvs_server/repositories/CMSSW |
119 |
> |
CVSROOT=:gserver:cmssw.cvs.cern.ch:/cvs/CMSSW |
120 |
|
export CVSROOT |
121 |
|
fi |
122 |
|
|
125 |
|
|
126 |
|
### CSH code |
127 |
|
|
128 |
< |
cat << \EOF_CMSSET_DEFAULT_CSH > %instroot/cmsset_default.csh |
128 |
> |
cat << \EOF_CMSSET_DEFAULT_CSH > ./cmsset_default.csh |
129 |
|
|
130 |
|
if (${?PATH}) then |
131 |
|
setenv PATH %instroot/common:%instroot/bin:$PATH |
149 |
|
# OSG |
150 |
|
endif |
151 |
|
|
152 |
< |
if ( ! -e $here/cmsset_default.csh ) then |
153 |
< |
echo "Please cd into the directory where cmsset_default.csh is." |
152 |
> |
if ( ! -d $here/${SCRAM_ARCH}/etc/profile.d ) then |
153 |
> |
echo "Your shell is not able to find where cmsset_default.csh is located." |
154 |
> |
echo "Either you have not set VO_CMS_SW_DIR or OSG_APP correctly" |
155 |
> |
echo "or SCRAM_ARCH is not set to a valid architecture." |
156 |
|
endif |
157 |
|
|
158 |
|
foreach pkg ( `/bin/ls ${here}/${SCRAM_ARCH}/etc/profile.d/ | grep 'S.*[.]csh'` ) |
171 |
|
endif |
172 |
|
|
173 |
|
if ( ! ${?CVSROOT}) then |
174 |
< |
setenv CVSROOT :kserver:cmscvs.cern.ch:/cvs_server/repositories/CMSSW |
174 |
> |
setenv CVSROOT :gserver:cmssw.cvs.cern.ch:/cvs/CMSSW |
175 |
|
endif |
176 |
|
|
177 |
|
unset here |
178 |
|
EOF_CMSSET_DEFAULT_CSH |
179 |
|
|
180 |
< |
cat << \EOF_COMMON_SCRAM > %instroot/common/scram |
180 |
> |
cat << \EOF_COMMON_SCRAM > ./common/scram |
181 |
|
#!/bin/sh |
182 |
|
CMSARCH=`cmsarch` |
183 |
|
srbase=%{instroot}/$CMSARCH |
184 |
|
sver=$SCRAM_VERSION |
185 |
|
dir=`/bin/pwd` |
186 |
< |
while [ ! -d ${dir}/.SCRAM -a "$dir" != "/" ] ; do |
186 |
> |
while [ ! -d ${dir}/.SCRAM ] && [ "$dir" != "/" ] ; do |
187 |
|
dir=`dirname $dir` |
188 |
|
done |
189 |
|
if [ -f ${dir}/config/scram_version ] ; then |
190 |
|
sver=`cat ${dir}/config/scram_version` |
191 |
< |
elif [ "X$sver" == "X" ] ; then |
191 |
> |
elif [ "X$sver" = "X" ] ; then |
192 |
|
sver=`cat ${srbase}/etc/default-scramv1-version` |
193 |
|
fi |
194 |
< |
if [ "X$sver" = "XV1_0_3-p1" -a "X$CMSARCH" = "Xslc4_ia32_gcc345" ] ; then |
194 |
> |
if [ "X$sver" = "XV1_0_3-p1" ] && [ "X$CMSARCH" = "Xslc4_ia32_gcc345" ] ; then |
195 |
|
sver=V1_0_3-p2 |
196 |
|
fi |
197 |
< |
scram_rel_series=`echo $sver | grep '^V[0-9]\+_[0-9]\+_[0-9]\+' | sed 's|^\(V[0-9]\+_[0-9]\+\)_.*|\1|'` |
198 |
< |
if [ "X${scram_rel_series}" != "X" -a -f ${srbase}/etc/default-scram/${scram_rel_series} ] ; then |
197 |
> |
scram_rel_series=`echo $sver | grep '^V[0-9][0-9]*_[0-9][0-9]*_[0-9][0-9]*' | sed 's|^\(V[0-9][0-9]*_[0-9][0-9]*\)_.*|\1|'` |
198 |
> |
case $sver in |
199 |
> |
V[01]_*|V2_[012]_* ) ;; |
200 |
> |
* ) scram_rel_series=`echo $scram_rel_series | sed 's|_.*||'` ;; |
201 |
> |
esac |
202 |
> |
if [ "X${scram_rel_series}" != "X" ] && [ -f ${srbase}/etc/default-scram/${scram_rel_series} ] ; then |
203 |
|
sver=`cat ${srbase}/etc/default-scram/${scram_rel_series}` |
204 |
|
fi |
205 |
|
scmd=scram |
213 |
|
echo "Unable to find SCRAM version $sver for $CMSARCH architecture." |
214 |
|
exit 1 |
215 |
|
fi |
216 |
< |
source ${srbase}/${sver}/etc/profile.d/init.sh |
216 |
> |
. ${srbase}/${sver}/etc/profile.d/init.sh |
217 |
|
# In the case we are on linux ia32 we prepend the linux32 command to the |
218 |
|
# actual scram command so that, no matter where the ia32 architecture is |
219 |
|
# running (i686 or x84_64) scram detects it as ia32. |
220 |
|
CMSPLAT=`echo $CMSARCH | cut -d_ -f 2` |
221 |
|
USE_LINUX32= |
222 |
< |
if [ `uname` == Linux -a "$CMSPLAT" = "ia32" ] ; then |
222 |
> |
if [ `uname` = "Linux" ] && [ "$CMSPLAT" = "ia32" ] ; then |
223 |
|
USE_LINUX32=linux32 |
224 |
|
fi |
225 |
|
$USE_LINUX32 ${srbase}/${sver}/bin/${scmd} $@ |
226 |
|
EOF_COMMON_SCRAM |
227 |
|
|
228 |
< |
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 |
228 |
> |
find . -name "*" -type f | xargs chmod +x |
229 |
|
|
230 |
|
%post |
231 |
< |
echo $RPM_INSTALL_PREFIX |
232 |
< |
perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/cmsset_default.sh |
233 |
< |
perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/cmsset_default.csh |
234 |
< |
perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/common/cmsos |
235 |
< |
perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/common/cmsarch |
236 |
< |
perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/common/scram |
231 |
> |
cd $RPM_INSTALL_PREFIX/%{pkgrel}/%{pkgrevision} |
232 |
> |
%{relocateCmsFiles} `find . -name "*" -type f` |
233 |
> |
|
234 |
> |
mkdir -p $RPM_INSTALL_PREFIX/common $RPM_INSTALL_PREFIX/bin $RPM_INSTALL_PREFIX/etc/%{pkgname} $RPM_INSTALL_PREFIX/%{cmsplatf}/etc/profile.d |
235 |
> |
|
236 |
> |
#Check if a newer revision is already installed |
237 |
> |
#Also force installation if older revision has deleted cmsset_default.sh |
238 |
> |
if [ -f $RPM_INSTALL_PREFIX/cmsset_default.csh ] && [ -f $RPM_INSTALL_PREFIX/etc/%{pkgname}/revision ] ; then |
239 |
> |
oldrev=`cat $RPM_INSTALL_PREFIX/etc/%{pkgname}/revision` |
240 |
> |
if [ $oldrev -ge %{pkgrevision} ] ; then |
241 |
> |
exit 0 |
242 |
> |
fi |
243 |
> |
fi |
244 |
> |
|
245 |
> |
for file in `find . -name "*" -type f`; do |
246 |
> |
rm -f $RPM_INSTALL_PREFIX/$file |
247 |
> |
cp $file $RPM_INSTALL_PREFIX/$file |
248 |
> |
done |
249 |
> |
|
250 |
> |
cd $RPM_INSTALL_PREFIX |
251 |
> |
rm -f common/scramv1; ln -s scram common/scramv1 |
252 |
> |
rm -f common/scramv0; ln -s scram common/scramv0 |
253 |
> |
rm -f bin/cmsarch; ln -s ../common/cmsarch bin/cmsarch |
254 |
> |
rm -f bin/cmsos; ln -s ../common/cmsarch bin/cmsos |
255 |
> |
rm -f bin/scramv1; ln -s ../common/scramv1 bin/scramv1 |
256 |
> |
echo %{pkgrevision} > etc/%{pkgname}/revision |
257 |
|
|
258 |
|
%files |
259 |
< |
%i |
260 |
< |
%instroot/cmsset_default.sh |
261 |
< |
%instroot/cmsset_default.csh |
262 |
< |
%instroot/common/cmsos |
263 |
< |
%instroot/common/cmsarch |
264 |
< |
%instroot/common/scram |
265 |
< |
%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/* |
259 |
> |
%{cmsroot}/%{pkgrel}/etc |
260 |
> |
%{cmsroot}/%{pkgrel}/%{pkgrevision} |
261 |
> |
%dir %{cmsroot}/ |
262 |
> |
%dir %{cmsroot}/%{cmsplatf}/ |
263 |
> |
%dir %{cmsroot}/%{cmsplatf}/%{pkgcategory}/ |
264 |
> |
%dir %{cmsroot}/%{cmsplatf}/%{pkgcategory}/%{pkgname}/ |
265 |
> |
%dir %{cmsroot}/%{cmsplatf}/%{pkgcategory}/%{pkgname}/%{pkgversion}/ |