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.9 by eulisse, Wed Jul 12 20:32:02 2006 UTC vs.
Revision 1.46 by elmer, Sat Nov 3 07:56:12 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 + ### 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
20 SCRAM_ARCH=$(cmsos)
43  
44 < # We need to assume 1 compiler per platform.
45 < # There is no other way around this.
46 < case $SCRAM_ARCH in
47 <    slc3_ia32) compilerv=gcc323;;
48 <    slc3_amd64) compilerv=gcc345;;
27 <    osx104_ia32) compilerv=gcc400;;
28 <    osx104_pcc32) compilerv=gcc400;;
29 < esac
30 < SCRAM_ARCH=${SCRAM_ARCH}_$compilerv
31 < export SCRAM_ARCH
44 > if [ ! $SCRAM_ARCH ]
45 > then
46 >    SCRAM_ARCH=`%instroot/bin/cmsarch`
47 >    export SCRAM_ARCH
48 > fi
49  
50 < if [ "$VO_CMS_SW_DIR" != ""  ] then
50 > here=%{instroot}
51 >
52 > if [ "$VO_CMS_SW_DIR" != ""  ]
53 > then
54      here=$VO_CMS_SW_DIR
55   else
56 <    here=`dirname $0`
57 < endif
56 >    if [ "$OSG_APP" != "" ]
57 >    then
58 >        here=$OSG_APP/cmssoft/cms
59 >    fi
60 > 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 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 < [ -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 < for pkg in `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  
74 + if [ ! $CMS_PATH ]
75 + then
76 +    export CMS_PATH=$here
77 + fi
78 +
79 + # aliases
80 + alias cmssetup='eval `scramv1 runtime -sh`'
81 +
82 + if [ -f $CMS_PATH/SITECONF/local/JobConfig/cmsset_local.sh ]; then
83 +        . $CMS_PATH/SITECONF/local/JobConfig/cmsset_local.sh
84 + fi
85   EOF_CMSSET_DEFAULT_SH
86  
87  
# Line 56 | Line 95 | else
95      setenv PATH %instroot/bin
96   endif
97  
98 < if (${?LD_LIBRARY_PATH}) then
99 <    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
98 > if ( ! ${?SCRAM_ARCH}) then
99 >    setenv SCRAM_ARCH `sh -c %instroot/bin/cmsarch`
100   endif
101  
102 < setenv CMSOSCOMMAND `which cmsos`
72 < setenv SCRAM_ARCH `sh -c $CMSOSCOMMAND`
73 < setenv compilerv gcc323
74 < switch ( ${SCRAM_ARCH} )
75 <    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
102 > set here=%instroot
103  
89 setenv SCRAM_ARCH ${SCRAM_ARCH}_${compilerv}
104   if ( ${?VO_CMS_SW_DIR} ) then
105 <    setenv here $VO_CMS_SW_DIR
105 >    set here=$VO_CMS_SW_DIR
106   else
107 <    setenv here .
107 >    # OSG
108 >    if ( ${?OSG_APP} ) then
109 >        set here=$OSG_APP/cmssoft/cms
110 >    endif
111 >    # OSG                      
112   endif
113  
114   if ( ! -e $here/cmsset_default.csh ) then
115      echo "Please cd into the directory where cmsset_default.csh is."
116   endif
117  
118 < foreach pkg ( `ls ${here}/${SCRAM_ARCH}/etc/profile.d/ | grep -e'^S.*[.]csh'` )
118 > foreach pkg ( `/bin/ls ${here}/${SCRAM_ARCH}/etc/profile.d/ | grep 'S.*[.]csh'` )
119          source ${here}/${SCRAM_ARCH}/etc/profile.d/$pkg
120   end
121 + if ( ! ${?CMS_PATH} ) then
122 +    setenv CMS_PATH $here
123 + endif
124  
125 < EOF_CMSSET_DEFAULT_CSH
125 > # aliases
126 > alias cmssetup 'eval `scramv1 runtime -csh`'
127  
128 + if( -e $CMS_PATH/SITECONF/local/JobConfig/cmsset_local.csh ) then
129 +        source $CMS_PATH/SITECONF/local/JobConfig/cmsset_local.csh
130 + endif
131 + unset here
132 + EOF_CMSSET_DEFAULT_CSH
133 + touch %instroot/%cmsplatf/etc/profile.d/dummy
134   %pre
135   [ -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`
136   [ -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`
# Line 112 | Line 140 | echo $RPM_INSTALL_PREFIX
140   perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/cmsset_default.sh
141   perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/cmsset_default.csh
142   perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/bin/cmsos
143 + perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/bin/cmsarch
144   %files
145   %i
146   %instroot/cmsset_default.sh
147   %instroot/cmsset_default.csh
148   %instroot/bin/cmsos
149 + %instroot/bin/cmsarch
150   %instroot/%cmsplatf/etc/profile.d
151   %exclude %instroot/%cmsplatf/etc/profile.d/*

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines