ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CMSDIST/cms-env.spec
Revision: 1.51
Committed: Thu Dec 27 20:57:09 2007 UTC (17 years, 4 months ago) by elmer
Branch: MAIN
CVS Tags: pe20080108c-ports, ge20080108-wt, pe20080108b-ports, pe20080108a-ports, pe20080105a-ports, pe20080104a-ports, pe20080103a-ports-gcc422, pe20080103a-ports, pe20070103a-ports, pe20080101a-ports, pe20071128b-ports, pe20071128a-ports, pe20071127b-ports
Changes since 1.50: +1 -0 lines
Log Message:
Force a revision update (for 19X, until this thing goes away)

File Contents

# User Rev Content
1 dlange 1.44 ### RPM cms cms-env 1.0
2 eulisse 1.1 Source: cmsos
3 elmer 1.51
4 eulisse 1.1 %prep
5     %build
6     %install
7    
8     mkdir -p %instroot/bin
9 ratnik 1.50
10     %if "%{?online_release:set}" != "set"
11 eulisse 1.1 install -m 755 %_sourcedir/cmsos %instroot/bin/cmsos
12 ratnik 1.50 %else
13     echo echo %{cmsos} > %instroot/bin/cmsos
14     chmod 755 %instroot/bin/cmsos
15     %endif
16    
17 eulisse 1.5 mkdir -p %{instroot}/%{cmsplatf}/etc/profile.d
18    
19 ratnik 1.50 %if "%{?online_release:set}" != "set"
20 eulisse 1.28 ### 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 eulisse 1.31 if [ ! "$SCRAM_ARCH" ]
28 eulisse 1.29 then
29     case $osarch in
30     slc3_ia32) compilerv=gcc323;;
31     slc3_amd64) compilerv=gcc344;;
32     slc4_ia32) compilerv=gcc345;;
33 elmer 1.46 slc4_amd64) compilerv=gcc345; osarch=slc4_ia32;;
34 eulisse 1.33 osx104_ia32) compilerv=gcc401;;
35 elmer 1.40 osx104_ppc32) compilerv=gcc400;;
36 eulisse 1.29 esac
37     echo ${osarch}_${compilerv}
38     else
39     echo $SCRAM_ARCH
40     fi
41 ratnik 1.50 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 eulisse 1.29
49 eulisse 1.28 chmod 755 %instroot/bin/cmsarch
50    
51 eulisse 1.9 ### BASH code
52    
53 eulisse 1.1 cat << \EOF_CMSSET_DEFAULT_SH > %instroot/cmsset_default.sh
54     export PATH=%instroot/bin:$PATH
55 eulisse 1.2
56 eulisse 1.22 if [ ! $SCRAM_ARCH ]
57 eulisse 1.19 then
58 eulisse 1.28 SCRAM_ARCH=`%instroot/bin/cmsarch`
59 eulisse 1.19 export SCRAM_ARCH
60 eulisse 1.15 fi
61    
62 eulisse 1.16 here=%{instroot}
63    
64 eulisse 1.10 if [ "$VO_CMS_SW_DIR" != "" ]
65     then
66 eulisse 1.9 here=$VO_CMS_SW_DIR
67     else
68 eulisse 1.12 if [ "$OSG_APP" != "" ]
69     then
70     here=$OSG_APP/cmssoft/cms
71     fi
72 eulisse 1.10 fi
73 eulisse 1.9
74 eulisse 1.14 if [ ! -d $here/${SCRAM_ARCH}/etc/profile.d ]
75 eulisse 1.13 then
76 elmer 1.38 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 eulisse 1.13 fi
80 eulisse 1.9
81 eulisse 1.27 for pkg in `/bin/ls $here/${SCRAM_ARCH}/etc/profile.d/ | grep 'S.*[.]sh'`
82 eulisse 1.5 do
83     source $here/${SCRAM_ARCH}/etc/profile.d/$pkg
84     done
85 eulisse 1.21
86 eulisse 1.22 if [ ! $CMS_PATH ]
87 eulisse 1.21 then
88     export CMS_PATH=$here
89     fi
90 metson 1.32
91 elmer 1.46 # aliases
92 elmer 1.48 alias cmsenv='eval `scramv1 runtime -sh`'
93 elmer 1.47 alias cmsrel='scramv1 project CMSSW'
94 elmer 1.46
95 metson 1.32 if [ -f $CMS_PATH/SITECONF/local/JobConfig/cmsset_local.sh ]; then
96     . $CMS_PATH/SITECONF/local/JobConfig/cmsset_local.sh
97     fi
98 eulisse 1.1 EOF_CMSSET_DEFAULT_SH
99    
100 eulisse 1.9
101     ### CSH code
102    
103 eulisse 1.1 cat << \EOF_CMSSET_DEFAULT_CSH > %instroot/cmsset_default.csh
104 eulisse 1.7
105 eulisse 1.4 if (${?PATH}) then
106     setenv PATH %instroot/bin:$PATH
107     else
108     setenv PATH %instroot/bin
109     endif
110    
111 eulisse 1.19 if ( ! ${?SCRAM_ARCH}) then
112 eulisse 1.28 setenv SCRAM_ARCH `sh -c %instroot/bin/cmsarch`
113 eulisse 1.25 endif
114 eulisse 1.15
115 eulisse 1.22 set here=%instroot
116 eulisse 1.16
117 eulisse 1.7 if ( ${?VO_CMS_SW_DIR} ) then
118 eulisse 1.23 set here=$VO_CMS_SW_DIR
119 eulisse 1.7 else
120 eulisse 1.12 # OSG
121     if ( ${?OSG_APP} ) then
122 eulisse 1.23 set here=$OSG_APP/cmssoft/cms
123 eulisse 1.12 endif
124     # OSG
125 eulisse 1.7 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 eulisse 1.5
131 eulisse 1.27 foreach pkg ( `/bin/ls ${here}/${SCRAM_ARCH}/etc/profile.d/ | grep 'S.*[.]csh'` )
132 eulisse 1.5 source ${here}/${SCRAM_ARCH}/etc/profile.d/$pkg
133     end
134 eulisse 1.21 if ( ! ${?CMS_PATH} ) then
135     setenv CMS_PATH $here
136     endif
137 metson 1.32
138 elmer 1.46 # aliases
139 elmer 1.48 alias cmsenv 'eval `scramv1 runtime -csh`'
140 elmer 1.47 alias cmsrel 'scramv1 project CMSSW'
141 elmer 1.46
142 ratnik 1.49 if ( -e $CMS_PATH/SITECONF/local/JobConfig/cmsset_local.csh ) then
143 metson 1.32 source $CMS_PATH/SITECONF/local/JobConfig/cmsset_local.csh
144     endif
145 eulisse 1.22 unset here
146 eulisse 1.1 EOF_CMSSET_DEFAULT_CSH
147 eulisse 1.28 touch %instroot/%cmsplatf/etc/profile.d/dummy
148 eulisse 1.8 %pre
149 ratnik 1.49 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 eulisse 1.1 %post
164     echo $RPM_INSTALL_PREFIX
165 eulisse 1.3 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 eulisse 1.28 perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/bin/cmsarch
169 eulisse 1.3 %files
170     %i
171     %instroot/cmsset_default.sh
172     %instroot/cmsset_default.csh
173     %instroot/bin/cmsos
174 eulisse 1.28 %instroot/bin/cmsarch
175 eulisse 1.5 %instroot/%cmsplatf/etc/profile.d
176 eulisse 1.6 %exclude %instroot/%cmsplatf/etc/profile.d/*