ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CMSDIST/cms-env.spec
(Generate patch)

Comparing COMP/CMSDIST/cms-env.spec (file contents):
Revision 1.3 by eulisse, Thu Jun 15 23:32:15 2006 UTC vs.
Revision 1.16 by eulisse, Tue Jul 18 07:59:11 2006 UTC

# Line 1 | Line 1
1   ### RPM cms cms-env 1.0
2   Source: cmsos
3 Requires: SCRAM SCRAMV1
3   %prep
4   %build
5   echo $SCRAM_ROOT
# Line 10 | Line 9 | echo $SCRAM_ROOT
9  
10   mkdir -p %instroot/bin
11   install -m 755 %_sourcedir/cmsos %instroot/bin/cmsos
12 + mkdir -p %{instroot}/%{cmsplatf}/etc/profile.d
13 +
14 + ### BASH code
15 +
16   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 < SCRAM_ARCH=$(cmsos); export SCRAM_ARCH
20 > SCRAM_ARCH=$(cmsos)
21  
22   # We need to assume 1 compiler per platform.
23   # There is no other way around this.
# Line 26 | Line 29 | case $SCRAM_ARCH in
29   esac
30   SCRAM_ARCH=${SCRAM_ARCH}_$compilerv
31  
32 < source %instroot/$SCRAM_ARCH/lcg/SCRAM/V0_20_0/etc/profile.d/init.sh
33 < source %instroot/$SCRAM_ARCH/lcg/SCRAMV1/V1_0_2/etc/profile.d/init.sh
32 > if [ $# -gt 0 ]
33 > then
34 >    SCRAM_ARCH=$1
35 > fi
36 >
37 > export SCRAM_ARCH
38 >
39 > here=%{instroot}
40 >
41 > if [ "$VO_CMS_SW_DIR" != ""  ]
42 > then
43 >    here=$VO_CMS_SW_DIR
44 > else
45 >    if [ "$OSG_APP" != "" ]
46 >    then
47 >        here=$OSG_APP/cmssoft/cms
48 >    fi
49 > fi
50 >
51 > if [ ! -d $here/${SCRAM_ARCH}/etc/profile.d ]
52 > then
53 >    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"
54 >    exit 1
55 > fi
56 >
57 > for pkg in `/bin/ls $here/${SCRAM_ARCH}/etc/profile.d/ | grep -e'^S.*[.]sh'`
58 > do
59 >        source $here/${SCRAM_ARCH}/etc/profile.d/$pkg
60 > done
61 > export CMS_PATH=$here
62   EOF_CMSSET_DEFAULT_SH
63  
64 +
65 + ### CSH code
66 +
67   cat << \EOF_CMSSET_DEFAULT_CSH > %instroot/cmsset_default.csh
68 < setenv PATH %instroot/bin:$PATH
69 < setenv LD_LIBRARY_PATH %instroot/lib:$LD_LIBRARY_PATH
70 < setenv DYLD_FALLBACK_LIBRARY_PATH %instroot/lib:$DYLD_FALLBACK_LIBRARY
71 < setenv SCRAM_ARCH `cmsos`
72 < sentenv compilerv gcc323
73 < switch ( $SCRAM_ARCH )
68 >
69 > if (${?PATH}) then
70 >    setenv PATH %instroot/bin:$PATH
71 > else
72 >    setenv PATH %instroot/bin
73 > endif
74 >
75 > if (${?LD_LIBRARY_PATH}) then
76 >    setenv LD_LIBRARY_PATH %instroot/lib:$LD_LIBRARY_PATH
77 > else
78 >    setenv LD_LIBRARY_PATH %instroot/lib
79 > endif
80 >
81 > if (${?DYLD_FALLBACK_LIBRARY_PATH}) then
82 >    setenv DYLD_FALLBACK_LIBRARY_PATH %instroot/lib:$DYLD_FALLBACK_LIBRARY_PATH
83 > else
84 >    setenv DYLD_FALLBACK_LIBRARY_PATH %instroot/lib
85 > endif
86 >
87 > setenv CMSOSCOMMAND `which cmsos`
88 > setenv SCRAM_ARCH `sh -c $CMSOSCOMMAND`
89 > setenv compilerv gcc323
90 > switch ( ${SCRAM_ARCH} )
91      case slc3_ia32:
92          setenv compilerv gcc323
93      breaksw
# Line 51 | Line 102 | switch ( $SCRAM_ARCH )
102      breaksw
103   endsw
104  
105 < . %instroot/$SCRAM_ARCH/lcg/SCRAM/V0_20_0/etc/profile.d/init.csh
106 < . %instroot/$SCRAM_ARCH/lcg/SCRAMV1/V1_0_2/etc/profile.d/init.csh
105 > setenv SCRAM_ARCH ${SCRAM_ARCH}_${compilerv}
106 >
107 > if ( $# -gt 0 ) then
108 >    setenv SCRAM_ARCH $1
109 > endif
110 >
111 > setenv here %instroot
112 >
113 > if ( ${?VO_CMS_SW_DIR} ) then
114 >    setenv here $VO_CMS_SW_DIR
115 > else
116 >    # OSG
117 >    if ( ${?OSG_APP} ) then
118 >        setenv here $OSG_APP/cmssoft/cms
119 >    endif
120 >    # OSG                      
121 > endif
122 >
123 > if ( ! -e $here/cmsset_default.csh ) then
124 >    echo "Please cd into the directory where cmsset_default.csh is."
125 > endif
126 >
127 > foreach pkg ( `/bin/ls ${here}/${SCRAM_ARCH}/etc/profile.d/ | grep -e'^S.*[.]csh'` )
128 >        source ${here}/${SCRAM_ARCH}/etc/profile.d/$pkg
129 > end
130 > setenv CMS_PATH $here
131   EOF_CMSSET_DEFAULT_CSH
132  
133 + %pre
134 + [ -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`
135 + [ -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`
136 + [ -d $RPM_INSTALL_PREFIX/bin ] && cp -r $RPM_INSTALL_PREFIX/bin $RPM_INSTALL_PREFIX/bin.old`date +%Y%m%d`
137   %post
138   echo $RPM_INSTALL_PREFIX
139   perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/cmsset_default.sh
# Line 65 | Line 144 | perl -p -i -e "s|%{instroot}|$RPM_INSTAL
144   %instroot/cmsset_default.sh
145   %instroot/cmsset_default.csh
146   %instroot/bin/cmsos
147 + %instroot/%cmsplatf/etc/profile.d
148 + %exclude %instroot/%cmsplatf/etc/profile.d/*

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines