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.20 by eulisse, Fri Jul 21 06:39:13 2006 UTC vs.
Revision 1.49 by ratnik, Wed Nov 7 19:55:33 2007 UTC

# Line 1 | Line 1
1 < ### RPM cms cms-env 1.0
1 > ### RPM cms cms-env 1.0
2   Source: cmsos
3   %prep
4   %build
# Line 11 | Line 11 | 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 <
21 < if [ "$SCRAM_ARCH" == "" ]
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 <    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
23 >    case $osarch in
24          slc3_ia32) compilerv=gcc323;;
25          slc3_amd64) compilerv=gcc344;;
26          slc4_ia32) compilerv=gcc345;;
27 <        slc4_amd64) compilerv=gcc345;;
28 <        osx104_ia32) compilerv=gcc400;;
29 <        osx104_pcc32) compilerv=gcc400;;
27 >        slc4_amd64) compilerv=gcc345; osarch=slc4_ia32;;
28 >        osx104_ia32) compilerv=gcc401;;
29 >        osx104_ppc32) compilerv=gcc400;;
30      esac
31 <    SCRAM_ARCH=${SCRAM_ARCH}_$compilerv
31 >    echo ${osarch}_${compilerv}
32 > else
33 >    echo $SCRAM_ARCH
34 > fi
35  
36 <    if [ $# -gt 0 ]
37 <    then
38 <        SCRAM_ARCH=$1
39 <    fi
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
43 >
44 > if [ ! $SCRAM_ARCH ]
45 > then
46 >    SCRAM_ARCH=`%instroot/bin/cmsarch`
47      export SCRAM_ARCH
48   fi
49  
# Line 55 | Line 61 | fi
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"
65 <    exit 1
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
73 < export CMS_PATH=$here
73 >
74 > if [ ! $CMS_PATH ]
75 > then
76 >    export CMS_PATH=$here
77 > fi
78 >
79 > # aliases
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
85 > fi
86   EOF_CMSSET_DEFAULT_SH
87  
88  
# Line 77 | Line 96 | else
96      setenv PATH %instroot/bin
97   endif
98  
80 if (${?LD_LIBRARY_PATH}) then
81    setenv LD_LIBRARY_PATH %instroot/lib:$LD_LIBRARY_PATH
82 else
83    setenv LD_LIBRARY_PATH %instroot/lib
84 endif
85
86 if (${?DYLD_FALLBACK_LIBRARY_PATH}) then
87    setenv DYLD_FALLBACK_LIBRARY_PATH %instroot/lib:$DYLD_FALLBACK_LIBRARY_PATH
88 else
89    setenv DYLD_FALLBACK_LIBRARY_PATH %instroot/lib
90 endif
91
92 setenv CMSOSCOMMAND `which cmsos`
99   if ( ! ${?SCRAM_ARCH}) then
100 <    setenv SCRAM_ARCH `sh -c $CMSOSCOMMAND`
95 <    setenv compilerv gcc323
96 <    switch ( ${SCRAM_ARCH} )
97 <        case slc3_ia32:
98 <            setenv compilerv gcc323
99 <        breaksw
100 <        case slc3_amd64:
101 <            setenv compilerv gcc344
102 <        breaksw
103 <        case slc4_ia32:
104 <            setenv compilerv gcc345
105 <        breaksw
106 <        case slc4_amd64:
107 <            setenv compilerv gcc345
108 <        breaksw
109 <        case osx104_ia32:
110 <            setenv compilerv gcc400
111 <        breaksw
112 <        case osx104_pcc32:
113 <            setenv compilerv gcc400
114 <        breaksw
115 <    endsw
116 <
117 <    setenv SCRAM_ARCH ${SCRAM_ARCH}_${compilerv}
118 <
119 <    if ( $# > 0 ) then
120 <        setenv SCRAM_ARCH $1
121 <    endif
100 >    setenv SCRAM_ARCH `sh -c %instroot/bin/cmsarch`
101   endif
102 < setenv here %instroot
102 >
103 > set here=%instroot
104  
105   if ( ${?VO_CMS_SW_DIR} ) then
106 <    setenv here $VO_CMS_SW_DIR
106 >    set here=$VO_CMS_SW_DIR
107   else
108      # OSG
109      if ( ${?OSG_APP} ) then
110 <        setenv here $OSG_APP/cmssoft/cms
110 >        set here=$OSG_APP/cmssoft/cms
111      endif
112      # OSG                      
113   endif
# Line 136 | Line 116 | if ( ! -e $here/cmsset_default.csh ) the
116      echo "Please cd into the directory where cmsset_default.csh is."
117   endif
118  
119 < foreach pkg ( `/bin/ls ${here}/${SCRAM_ARCH}/etc/profile.d/ | grep -e'^S.*[.]csh'` )
119 > foreach pkg ( `/bin/ls ${here}/${SCRAM_ARCH}/etc/profile.d/ | grep 'S.*[.]csh'` )
120          source ${here}/${SCRAM_ARCH}/etc/profile.d/$pkg
121   end
122 < setenv CMS_PATH $here
123 < EOF_CMSSET_DEFAULT_CSH
122 > if ( ! ${?CMS_PATH} ) then
123 >    setenv CMS_PATH $here
124 > endif
125 >
126 > # aliases
127 > alias cmsenv 'eval `scramv1 runtime -csh`'
128 > alias cmsrel 'scramv1 project CMSSW'
129  
130 + if ( -e $CMS_PATH/SITECONF/local/JobConfig/cmsset_local.csh ) then
131 +        source $CMS_PATH/SITECONF/local/JobConfig/cmsset_local.csh
132 + endif
133 + unset here
134 + EOF_CMSSET_DEFAULT_CSH
135 + touch %instroot/%cmsplatf/etc/profile.d/dummy
136   %pre
137 < [ -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`
138 < [ -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`
139 < [ -d $RPM_INSTALL_PREFIX/bin ] && cp -r $RPM_INSTALL_PREFIX/bin $RPM_INSTALL_PREFIX/bin.old`date +%Y%m%d`
137 > if [ -f $RPM_INSTALL_PREFIX/cmsset_default.sh ]
138 > then
139 >  cp $RPM_INSTALL_PREFIX/cmsset_default.sh $RPM_INSTALL_PREFIX/cmsset_default.sh.old`date +%Y%m%d`
140 > fi
141 > if [ -f $RPM_INSTALL_PREFIX/cmsset_default.csh ]
142 > then
143 >  cp $RPM_INSTALL_PREFIX/cmsset_default.csh $RPM_INSTALL_PREFIX/cmsset_default.csh.old`date +%Y%m%d`
144 > fi
145 > if [ -d $RPM_INSTALL_PREFIX/bin ]
146 > then
147 >  cp -r $RPM_INSTALL_PREFIX/bin $RPM_INSTALL_PREFIX/bin.old`date +%Y%m%d`
148 > else
149 >  mkdir -p $RPM_INSTALL_PREFIX/bin
150 > fi
151   %post
152   echo $RPM_INSTALL_PREFIX
153   perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/cmsset_default.sh
154   perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/cmsset_default.csh
155   perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/bin/cmsos
156 + perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/bin/cmsarch
157   %files
158   %i
159   %instroot/cmsset_default.sh
160   %instroot/cmsset_default.csh
161   %instroot/bin/cmsos
162 + %instroot/bin/cmsarch
163   %instroot/%cmsplatf/etc/profile.d
164   %exclude %instroot/%cmsplatf/etc/profile.d/*

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines