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.1 by eulisse, Tue Jun 13 09:48:18 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 < Requires: SCRAM SCRAMV1
3 >
4   %prep
5   %build
6 echo $SCRAM_ROOT
6   %install
8 %define scramroot %(echo $SCRAM_ROOT)
9 %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
55 < export LD_LIBRARY_PATH=%instroot/lib:$LD_LIBRARY_PATH
56 < export DYLD_FALLBACK_LIBRARY_PATH=%instroot/lib:$DYLD_FALLBACK_LIBRARY
57 < SCRAM_ARCH=$(cmsos); export SCRAM_ARCH
58 < source %instroot/lcg/SCRAM/V0_20_0/etc/profile.d/init.sh
59 < source %instroot/lcg/SCRAMV1/V1_0_2/etc/profile.d/init.sh
55 >
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" != ""  ]
65 > then
66 >    here=$VO_CMS_SW_DIR
67 > else
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 `/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 +
101 + ### CSH code
102 +
103   cat << \EOF_CMSSET_DEFAULT_CSH > %instroot/cmsset_default.csh
23 setenv PATH %instroot/bin:$PATH
24 setenv LD_LIBRARY_PATH %instroot/lib:$LD_LIBRARY_PATH
25 setenv DYLD_FALLBACK_LIBRARY_PATH %instroot/lib:$DYLD_FALLBACK_LIBRARY
26 setenv SCRAM_ARCH `cmsos`
27 . %instroot/lcg/SCRAM/V0_20_0/etc/profile.d/init.csh
28 . %instroot/lcg/SCRAMV1/V1_0_2/etc/profile.d/init.csh
29 EOF_CMSSET_DEFAULT_CSH
104  
105 + if (${?PATH}) then
106 +    setenv PATH %instroot/bin:$PATH
107 + else
108 +    setenv PATH %instroot/bin
109 + endif
110 +
111 + if ( ! ${?SCRAM_ARCH}) then
112 +    setenv SCRAM_ARCH `sh -c %instroot/bin/cmsarch`
113 + endif
114 +
115 + set here=%instroot
116 +
117 + if ( ${?VO_CMS_SW_DIR} ) then
118 +    set here=$VO_CMS_SW_DIR
119 + else
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 ( `/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 + # 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 + 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" %instroot/cmsset_default.sh
166 < perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" %instroot/cmsset_default.csh
167 < perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" %instroot/bin/cmsos
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