ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CMSDIST/cms-env.spec
Revision: 1.9
Committed: Wed Jul 12 20:32:02 2006 UTC (18 years, 9 months ago) by eulisse
Branch: MAIN
Changes since 1.8: +13 -1 lines
Log Message:
Fixes the problem with cmsset_default.sh under bash.

File Contents

# User Rev Content
1 eulisse 1.1 ### RPM cms cms-env 1.0
2     Source: cmsos
3     %prep
4     %build
5     echo $SCRAM_ROOT
6     %install
7     %define scramroot %(echo $SCRAM_ROOT)
8     %define scramv1root %(echo $SCRAMV1_ROOT)
9    
10     mkdir -p %instroot/bin
11     install -m 755 %_sourcedir/cmsos %instroot/bin/cmsos
12 eulisse 1.5 mkdir -p %{instroot}/%{cmsplatf}/etc/profile.d
13    
14 eulisse 1.9 ### BASH code
15    
16 eulisse 1.1 cat << \EOF_CMSSET_DEFAULT_SH > %instroot/cmsset_default.sh
17     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
20 eulisse 1.4 SCRAM_ARCH=$(cmsos)
21 eulisse 1.2
22     # We need to assume 1 compiler per platform.
23     # There is no other way around this.
24     case $SCRAM_ARCH in
25     slc3_ia32) compilerv=gcc323;;
26     slc3_amd64) compilerv=gcc345;;
27     osx104_ia32) compilerv=gcc400;;
28     osx104_pcc32) compilerv=gcc400;;
29     esac
30     SCRAM_ARCH=${SCRAM_ARCH}_$compilerv
31 eulisse 1.4 export SCRAM_ARCH
32 eulisse 1.2
33 eulisse 1.9 if [ "$VO_CMS_SW_DIR" != "" ] then
34     here=$VO_CMS_SW_DIR
35     else
36     here=`dirname $0`
37     endif
38    
39     [ -d $here/${SCRAM_ARCH}/etc/profile.d ] || 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".
40    
41 eulisse 1.5 for pkg in `ls $here/${SCRAM_ARCH}/etc/profile.d/ | grep -e'^S.*[.]sh'`
42     do
43     source $here/${SCRAM_ARCH}/etc/profile.d/$pkg
44     done
45    
46 eulisse 1.1 EOF_CMSSET_DEFAULT_SH
47    
48 eulisse 1.9
49     ### CSH code
50    
51 eulisse 1.1 cat << \EOF_CMSSET_DEFAULT_CSH > %instroot/cmsset_default.csh
52 eulisse 1.7
53 eulisse 1.4 if (${?PATH}) then
54     setenv PATH %instroot/bin:$PATH
55     else
56     setenv PATH %instroot/bin
57     endif
58    
59     if (${?LD_LIBRARY_PATH}) then
60     setenv LD_LIBRARY_PATH %instroot/lib:$LD_LIBRARY_PATH
61     else
62     setenv LD_LIBRARY_PATH %instroot/lib
63     endif
64    
65     if (${?DYLD_FALLBACK_LIBRARY_PATH}) then
66     setenv DYLD_FALLBACK_LIBRARY_PATH %instroot/lib:$DYLD_FALLBACK_LIBRARY_PATH
67     else
68     setenv DYLD_FALLBACK_LIBRARY_PATH %instroot/lib
69     endif
70    
71     setenv CMSOSCOMMAND `which cmsos`
72     setenv SCRAM_ARCH `sh -c $CMSOSCOMMAND`
73     setenv compilerv gcc323
74     switch ( ${SCRAM_ARCH} )
75 eulisse 1.2 case slc3_ia32:
76     setenv compilerv gcc323
77     breaksw
78     case slc3_amd64:
79     setenv compilerv gcc345
80     breaksw
81     case osx104_ia32:
82     setenv compilerv gcc400
83     breaksw
84     case osx104_pcc32:
85     setenv compilerv gcc400
86     breaksw
87     endsw
88    
89 eulisse 1.4 setenv SCRAM_ARCH ${SCRAM_ARCH}_${compilerv}
90 eulisse 1.7 if ( ${?VO_CMS_SW_DIR} ) then
91     setenv here $VO_CMS_SW_DIR
92     else
93     setenv here .
94     endif
95    
96     if ( ! -e $here/cmsset_default.csh ) then
97     echo "Please cd into the directory where cmsset_default.csh is."
98     endif
99 eulisse 1.5
100     foreach pkg ( `ls ${here}/${SCRAM_ARCH}/etc/profile.d/ | grep -e'^S.*[.]csh'` )
101     source ${here}/${SCRAM_ARCH}/etc/profile.d/$pkg
102     end
103 eulisse 1.4
104 eulisse 1.1 EOF_CMSSET_DEFAULT_CSH
105    
106 eulisse 1.8 %pre
107     [ -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`
108     [ -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`
109     [ -d $RPM_INSTALL_PREFIX/bin ] && cp -r $RPM_INSTALL_PREFIX/bin $RPM_INSTALL_PREFIX/bin.old`date +%Y%m%d`
110 eulisse 1.1 %post
111     echo $RPM_INSTALL_PREFIX
112 eulisse 1.3 perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/cmsset_default.sh
113     perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/cmsset_default.csh
114     perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/bin/cmsos
115     %files
116     %i
117     %instroot/cmsset_default.sh
118     %instroot/cmsset_default.csh
119     %instroot/bin/cmsos
120 eulisse 1.5 %instroot/%cmsplatf/etc/profile.d
121 eulisse 1.6 %exclude %instroot/%cmsplatf/etc/profile.d/*