11 |
|
install -m 755 %_sourcedir/cmsos %instroot/bin/cmsos |
12 |
|
mkdir -p %{instroot}/%{cmsplatf}/etc/profile.d |
13 |
|
|
14 |
+ |
### Detects the SCRAM_ARCH to be used. |
15 |
+ |
cat << \EOF_CMSARCH_SH >%instroot/bin/cmsarch |
16 |
+ |
#!/bin/sh |
17 |
+ |
osarch=`%instroot/bin/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/bin/cmsarch |
38 |
+ |
|
39 |
|
### BASH code |
40 |
|
|
41 |
|
cat << \EOF_CMSSET_DEFAULT_SH > %instroot/cmsset_default.sh |
42 |
|
export PATH=%instroot/bin:$PATH |
18 |
– |
#export LD_LIBRARY_PATH=%instroot/lib:$LD_LIBRARY_PATH |
19 |
– |
#export DYLD_FALLBACK_LIBRARY_PATH=%instroot/lib:$DYLD_FALLBACK_LIBRARY |
43 |
|
|
44 |
|
if [ ! $SCRAM_ARCH ] |
45 |
|
then |
46 |
< |
SCRAM_ARCH=$(cmsos) |
24 |
< |
|
25 |
< |
# We need to assume 1 compiler per platform. |
26 |
< |
# There is no other way around this. |
27 |
< |
case $SCRAM_ARCH in |
28 |
< |
slc3_ia32) compilerv=gcc323;; |
29 |
< |
slc3_amd64) compilerv=gcc344;; |
30 |
< |
slc4_ia32) compilerv=gcc345;; |
31 |
< |
slc4_amd64) compilerv=gcc345;; |
32 |
< |
osx104_ia32) compilerv=gcc400;; |
33 |
< |
osx104_pcc32) compilerv=gcc400;; |
34 |
< |
esac |
35 |
< |
SCRAM_ARCH=${SCRAM_ARCH}_$compilerv |
36 |
< |
|
37 |
< |
if [ $# -gt 0 ] |
38 |
< |
then |
39 |
< |
SCRAM_ARCH=$1 |
40 |
< |
fi |
46 |
> |
SCRAM_ARCH=`%instroot/bin/cmsarch` |
47 |
|
export SCRAM_ARCH |
48 |
|
fi |
49 |
|
|
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. Either cd into the directory where it is or move to zsh" |
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 -e'^S.*[.]sh'` |
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 |
75 |
|
then |
76 |
|
export CMS_PATH=$here |
77 |
|
fi |
78 |
+ |
|
79 |
+ |
if [ -f $CMS_PATH/SITECONF/local/JobConfig/cmsset_local.sh ]; then |
80 |
+ |
. $CMS_PATH/SITECONF/local/JobConfig/cmsset_local.sh |
81 |
+ |
fi |
82 |
|
EOF_CMSSET_DEFAULT_SH |
83 |
|
|
84 |
|
|
92 |
|
setenv PATH %instroot/bin |
93 |
|
endif |
94 |
|
|
83 |
– |
#if (${?LD_LIBRARY_PATH}) then |
84 |
– |
# setenv LD_LIBRARY_PATH %instroot/lib:$LD_LIBRARY_PATH |
85 |
– |
#else |
86 |
– |
# setenv LD_LIBRARY_PATH %instroot/lib |
87 |
– |
#endif |
88 |
– |
|
89 |
– |
#if (${?DYLD_FALLBACK_LIBRARY_PATH}) then |
90 |
– |
# setenv DYLD_FALLBACK_LIBRARY_PATH %instroot/lib:$DYLD_FALLBACK_LIBRARY_PATH |
91 |
– |
#else |
92 |
– |
# setenv DYLD_FALLBACK_LIBRARY_PATH %instroot/lib |
93 |
– |
#endif |
94 |
– |
|
95 |
– |
set CMSOSCOMMAND=`which cmsos` |
95 |
|
if ( ! ${?SCRAM_ARCH}) then |
96 |
< |
setenv SCRAM_ARCH `sh -c $CMSOSCOMMAND` |
98 |
< |
set compilerv=gcc323 |
99 |
< |
switch ( ${SCRAM_ARCH} ) |
100 |
< |
case slc3_ia32: |
101 |
< |
set compilerv=gcc323 |
102 |
< |
breaksw |
103 |
< |
case slc3_amd64: |
104 |
< |
set compilerv=gcc344 |
105 |
< |
breaksw |
106 |
< |
case slc4_ia32: |
107 |
< |
set compilerv=gcc345 |
108 |
< |
breaksw |
109 |
< |
case slc4_amd64: |
110 |
< |
set compilerv=gcc345 |
111 |
< |
breaksw |
112 |
< |
case osx104_ia32: |
113 |
< |
set compilerv=gcc400 |
114 |
< |
breaksw |
115 |
< |
case osx104_pcc32: |
116 |
< |
set compilerv=gcc400 |
117 |
< |
breaksw |
118 |
< |
endsw |
119 |
< |
|
120 |
< |
setenv SCRAM_ARCH ${SCRAM_ARCH}_${compilerv} |
121 |
< |
|
122 |
< |
if ( $# > 0 ) then |
123 |
< |
setenv SCRAM_ARCH $1 |
124 |
< |
endif |
96 |
> |
setenv SCRAM_ARCH `sh -c %instroot/bin/cmsarch` |
97 |
|
endif |
98 |
+ |
|
99 |
|
set here=%instroot |
100 |
|
|
101 |
|
if ( ${?VO_CMS_SW_DIR} ) then |
112 |
|
echo "Please cd into the directory where cmsset_default.csh is." |
113 |
|
endif |
114 |
|
|
115 |
< |
foreach pkg ( `/bin/ls ${here}/${SCRAM_ARCH}/etc/profile.d/ | grep -e'^S.*[.]csh'` ) |
115 |
> |
foreach pkg ( `/bin/ls ${here}/${SCRAM_ARCH}/etc/profile.d/ | grep 'S.*[.]csh'` ) |
116 |
|
source ${here}/${SCRAM_ARCH}/etc/profile.d/$pkg |
117 |
|
end |
118 |
|
if ( ! ${?CMS_PATH} ) then |
119 |
|
setenv CMS_PATH $here |
120 |
|
endif |
121 |
+ |
|
122 |
+ |
if( -e $CMS_PATH/SITECONF/local/JobConfig/cmsset_local.csh ) then |
123 |
+ |
source $CMS_PATH/SITECONF/local/JobConfig/cmsset_local.csh |
124 |
+ |
endif |
125 |
|
unset here |
149 |
– |
unset CMSOSCOMMAND |
150 |
– |
unset compilerv |
126 |
|
EOF_CMSSET_DEFAULT_CSH |
127 |
< |
|
127 |
> |
touch %instroot/%cmsplatf/etc/profile.d/dummy |
128 |
|
%pre |
129 |
|
[ -f $RPM_INSTALL_PREFIX/cmsset_default.sh ] && cp $RPM_INSTALL_PREFIX/cmsset_default.sh $RPM_INSTALL_PREFIX/cmsset_default.sh.old`date +%Y%m%d` |
130 |
|
[ -f $RPM_INSTALL_PREFIX/cmsset_default.csh ] && cp $RPM_INSTALL_PREFIX/cmsset_default.csh $RPM_INSTALL_PREFIX/cmsset_default.csh.old`date +%Y%m%d` |
134 |
|
perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/cmsset_default.sh |
135 |
|
perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/cmsset_default.csh |
136 |
|
perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/bin/cmsos |
137 |
+ |
perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/bin/cmsarch |
138 |
|
%files |
139 |
|
%i |
140 |
|
%instroot/cmsset_default.sh |
141 |
|
%instroot/cmsset_default.csh |
142 |
|
%instroot/bin/cmsos |
143 |
+ |
%instroot/bin/cmsarch |
144 |
|
%instroot/%cmsplatf/etc/profile.d |
145 |
|
%exclude %instroot/%cmsplatf/etc/profile.d/* |