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.51 by elmer, Thu Dec 27 20:57:09 2007 UTC

# Line 1 | Line 1
1 < ### RPM cms cms-env 1.0
1 > ### RPM cms cms-env 1.0
2   Source: cmsos
3 +
4   %prep
5   %build
5 echo $SCRAM_ROOT
6   %install
7 %define scramroot %(echo $SCRAM_ROOT)
8 %define scramv1root %(echo $SCRAMV1_ROOT)
7  
8   mkdir -p %instroot/bin
9 +
10 + %if "%{?online_release:set}" != "set"
11   install -m 755 %_sourcedir/cmsos %instroot/bin/cmsos
12 + %else
13 + echo echo %{cmsos} >  %instroot/bin/cmsos
14 + chmod 755 %instroot/bin/cmsos
15 + %endif
16 +
17   mkdir -p %{instroot}/%{cmsplatf}/etc/profile.d
18  
19 + %if "%{?online_release:set}" != "set"
20 + ### Detects the SCRAM_ARCH to be used.
21 + cat << \EOF_CMSARCH_SH >%instroot/bin/cmsarch
22 + #!/bin/sh
23 + osarch=`%instroot/bin/cmsos`
24 + compilerv=gcc323
25 + # We need to assume 1 compiler per platform.
26 + # There is no other way around this.
27 + if [ ! "$SCRAM_ARCH" ]
28 + then
29 +    case $osarch in
30 +        slc3_ia32) compilerv=gcc323;;
31 +        slc3_amd64) compilerv=gcc344;;
32 +        slc4_ia32) compilerv=gcc345;;
33 +        slc4_amd64) compilerv=gcc345; osarch=slc4_ia32;;
34 +        osx104_ia32) compilerv=gcc401;;
35 +        osx104_ppc32) compilerv=gcc400;;
36 +    esac
37 +    echo ${osarch}_${compilerv}
38 + else
39 +    echo $SCRAM_ARCH
40 + fi
41 + EOF_CMSARCH_SH
42 + %else
43 + cat << \EOF_CMSARCH_ONL >%instroot/bin/cmsarch
44 + #!/bin/sh
45 + echo %{cmsplatf}
46 + EOF_CMSARCH_ONL
47 + %endif
48 +
49 + chmod 755 %instroot/bin/cmsarch
50 +
51   ### BASH code
52  
53   cat << \EOF_CMSSET_DEFAULT_SH > %instroot/cmsset_default.sh
54   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)
55  
56 < # We need to assume 1 compiler per platform.
57 < # There is no other way around this.
58 < case $SCRAM_ARCH in
59 <    slc3_ia32) compilerv=gcc323;;
60 <    slc3_amd64) compilerv=gcc345;;
61 <    osx104_ia32) compilerv=gcc400;;
62 <    osx104_pcc32) compilerv=gcc400;;
29 < esac
30 < SCRAM_ARCH=${SCRAM_ARCH}_$compilerv
31 < export SCRAM_ARCH
56 > if [ ! $SCRAM_ARCH ]
57 > then
58 >    SCRAM_ARCH=`%instroot/bin/cmsarch`
59 >    export SCRAM_ARCH
60 > fi
61 >
62 > here=%{instroot}
63  
64 < if [ "$VO_CMS_SW_DIR" != ""  ] then
64 > if [ "$VO_CMS_SW_DIR" != ""  ]
65 > then
66      here=$VO_CMS_SW_DIR
67   else
68 <    here=`dirname $0`
69 < endif
70 <
71 < [ -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".
68 >    if [ "$OSG_APP" != "" ]
69 >    then
70 >        here=$OSG_APP/cmssoft/cms
71 >    fi
72 > fi
73 >
74 > if [ ! -d $here/${SCRAM_ARCH}/etc/profile.d ]
75 > then
76 >    echo "Your shell is not able to find where cmsset_default.sh is located."
77 >    echo "Either you have not set VO_CMS_SW_DIR or OSG_APP correctly"
78 >    echo "or SCRAM_ARCH is not set to a valid architecture."
79 > fi
80  
81 < for pkg in `ls $here/${SCRAM_ARCH}/etc/profile.d/ | grep -e'^S.*[.]sh'`
81 > for pkg in `/bin/ls $here/${SCRAM_ARCH}/etc/profile.d/ | grep 'S.*[.]sh'`
82   do
83          source $here/${SCRAM_ARCH}/etc/profile.d/$pkg
84   done
85  
86 + if [ ! $CMS_PATH ]
87 + then
88 +    export CMS_PATH=$here
89 + fi
90 +
91 + # aliases
92 + alias cmsenv='eval `scramv1 runtime -sh`'
93 + alias cmsrel='scramv1 project CMSSW'
94 +
95 + if [ -f $CMS_PATH/SITECONF/local/JobConfig/cmsset_local.sh ]; then
96 +        . $CMS_PATH/SITECONF/local/JobConfig/cmsset_local.sh
97 + fi
98   EOF_CMSSET_DEFAULT_SH
99  
100  
# Line 56 | Line 108 | else
108      setenv PATH %instroot/bin
109   endif
110  
111 < if (${?LD_LIBRARY_PATH}) then
112 <    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
111 > if ( ! ${?SCRAM_ARCH}) then
112 >    setenv SCRAM_ARCH `sh -c %instroot/bin/cmsarch`
113   endif
114  
115 < 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
115 > set here=%instroot
116  
89 setenv SCRAM_ARCH ${SCRAM_ARCH}_${compilerv}
117   if ( ${?VO_CMS_SW_DIR} ) then
118 <    setenv here $VO_CMS_SW_DIR
118 >    set here=$VO_CMS_SW_DIR
119   else
120 <    setenv here .
120 >    # OSG
121 >    if ( ${?OSG_APP} ) then
122 >        set here=$OSG_APP/cmssoft/cms
123 >    endif
124 >    # OSG                      
125   endif
126  
127   if ( ! -e $here/cmsset_default.csh ) then
128      echo "Please cd into the directory where cmsset_default.csh is."
129   endif
130  
131 < foreach pkg ( `ls ${here}/${SCRAM_ARCH}/etc/profile.d/ | grep -e'^S.*[.]csh'` )
131 > foreach pkg ( `/bin/ls ${here}/${SCRAM_ARCH}/etc/profile.d/ | grep 'S.*[.]csh'` )
132          source ${here}/${SCRAM_ARCH}/etc/profile.d/$pkg
133   end
134 + if ( ! ${?CMS_PATH} ) then
135 +    setenv CMS_PATH $here
136 + endif
137  
138 < EOF_CMSSET_DEFAULT_CSH
138 > # aliases
139 > alias cmsenv 'eval `scramv1 runtime -csh`'
140 > alias cmsrel 'scramv1 project CMSSW'
141  
142 + if ( -e $CMS_PATH/SITECONF/local/JobConfig/cmsset_local.csh ) then
143 +        source $CMS_PATH/SITECONF/local/JobConfig/cmsset_local.csh
144 + endif
145 + unset here
146 + EOF_CMSSET_DEFAULT_CSH
147 + touch %instroot/%cmsplatf/etc/profile.d/dummy
148   %pre
149 < [ -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`
150 < [ -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`
151 < [ -d $RPM_INSTALL_PREFIX/bin ] && cp -r $RPM_INSTALL_PREFIX/bin $RPM_INSTALL_PREFIX/bin.old`date +%Y%m%d`
149 > if [ -f $RPM_INSTALL_PREFIX/cmsset_default.sh ]
150 > then
151 >  cp $RPM_INSTALL_PREFIX/cmsset_default.sh $RPM_INSTALL_PREFIX/cmsset_default.sh.old`date +%Y%m%d`
152 > fi
153 > if [ -f $RPM_INSTALL_PREFIX/cmsset_default.csh ]
154 > then
155 >  cp $RPM_INSTALL_PREFIX/cmsset_default.csh $RPM_INSTALL_PREFIX/cmsset_default.csh.old`date +%Y%m%d`
156 > fi
157 > if [ -d $RPM_INSTALL_PREFIX/bin ]
158 > then
159 >  cp -r $RPM_INSTALL_PREFIX/bin $RPM_INSTALL_PREFIX/bin.old`date +%Y%m%d`
160 > else
161 >  mkdir -p $RPM_INSTALL_PREFIX/bin
162 > fi
163   %post
164   echo $RPM_INSTALL_PREFIX
165   perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/cmsset_default.sh
166   perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/cmsset_default.csh
167   perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/bin/cmsos
168 + perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/bin/cmsarch
169   %files
170   %i
171   %instroot/cmsset_default.sh
172   %instroot/cmsset_default.csh
173   %instroot/bin/cmsos
174 + %instroot/bin/cmsarch
175   %instroot/%cmsplatf/etc/profile.d
176   %exclude %instroot/%cmsplatf/etc/profile.d/*

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines