ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CMSDIST/cms-env.spec
Revision: 1.44
Committed: Sat Sep 15 19:28:18 2007 UTC (17 years, 7 months ago) by dlange
Branch: MAIN
Changes since 1.43: +2 -2 lines
Log Message:
getting 64 bit cms-env back to head. Why do we need this hardwired ia32 anyway - dont we have SCRAM_BUILD?

File Contents

# User Rev Content
1 dlange 1.44 ### RPM cms cms-env 1.0
2 eulisse 1.1 Source: cmsos
3     %prep
4     %build
5     echo $SCRAM_ROOT
6     %install
7     %define scramroot %(echo $SCRAM_ROOT)
8     %define scramv1root %(echo $SCRAMV1_ROOT)
9    
10     mkdir -p %instroot/bin
11     install -m 755 %_sourcedir/cmsos %instroot/bin/cmsos
12 eulisse 1.5 mkdir -p %{instroot}/%{cmsplatf}/etc/profile.d
13    
14 eulisse 1.28 ### 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 eulisse 1.31 if [ ! "$SCRAM_ARCH" ]
22 eulisse 1.29 then
23     case $osarch in
24     slc3_ia32) compilerv=gcc323;;
25     slc3_amd64) compilerv=gcc344;;
26     slc4_ia32) compilerv=gcc345;;
27 dlange 1.44 slc4_amd64) compilerv=gcc345;
28 eulisse 1.33 osx104_ia32) compilerv=gcc401;;
29 elmer 1.40 osx104_ppc32) compilerv=gcc400;;
30 eulisse 1.29 esac
31     echo ${osarch}_${compilerv}
32     else
33     echo $SCRAM_ARCH
34     fi
35    
36 eulisse 1.28 EOF_CMSARCH_SH
37     chmod 755 %instroot/bin/cmsarch
38    
39 eulisse 1.9 ### BASH code
40    
41 eulisse 1.1 cat << \EOF_CMSSET_DEFAULT_SH > %instroot/cmsset_default.sh
42     export PATH=%instroot/bin:$PATH
43 eulisse 1.2
44 eulisse 1.22 if [ ! $SCRAM_ARCH ]
45 eulisse 1.19 then
46 eulisse 1.28 SCRAM_ARCH=`%instroot/bin/cmsarch`
47 eulisse 1.19 export SCRAM_ARCH
48 eulisse 1.15 fi
49    
50 eulisse 1.16 here=%{instroot}
51    
52 eulisse 1.10 if [ "$VO_CMS_SW_DIR" != "" ]
53     then
54 eulisse 1.9 here=$VO_CMS_SW_DIR
55     else
56 eulisse 1.12 if [ "$OSG_APP" != "" ]
57     then
58     here=$OSG_APP/cmssoft/cms
59     fi
60 eulisse 1.10 fi
61 eulisse 1.9
62 eulisse 1.14 if [ ! -d $here/${SCRAM_ARCH}/etc/profile.d ]
63 eulisse 1.13 then
64 elmer 1.38 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 eulisse 1.13 fi
68 eulisse 1.9
69 eulisse 1.27 for pkg in `/bin/ls $here/${SCRAM_ARCH}/etc/profile.d/ | grep 'S.*[.]sh'`
70 eulisse 1.5 do
71     source $here/${SCRAM_ARCH}/etc/profile.d/$pkg
72     done
73 eulisse 1.21
74 eulisse 1.22 if [ ! $CMS_PATH ]
75 eulisse 1.21 then
76     export CMS_PATH=$here
77     fi
78 metson 1.32
79     if [ -f $CMS_PATH/SITECONF/local/JobConfig/cmsset_local.sh ]; then
80     . $CMS_PATH/SITECONF/local/JobConfig/cmsset_local.sh
81     fi
82 eulisse 1.1 EOF_CMSSET_DEFAULT_SH
83    
84 eulisse 1.9
85     ### CSH code
86    
87 eulisse 1.1 cat << \EOF_CMSSET_DEFAULT_CSH > %instroot/cmsset_default.csh
88 eulisse 1.7
89 eulisse 1.4 if (${?PATH}) then
90     setenv PATH %instroot/bin:$PATH
91     else
92     setenv PATH %instroot/bin
93     endif
94    
95 eulisse 1.19 if ( ! ${?SCRAM_ARCH}) then
96 eulisse 1.28 setenv SCRAM_ARCH `sh -c %instroot/bin/cmsarch`
97 eulisse 1.25 endif
98 eulisse 1.15
99 eulisse 1.22 set here=%instroot
100 eulisse 1.16
101 eulisse 1.7 if ( ${?VO_CMS_SW_DIR} ) then
102 eulisse 1.23 set here=$VO_CMS_SW_DIR
103 eulisse 1.7 else
104 eulisse 1.12 # OSG
105     if ( ${?OSG_APP} ) then
106 eulisse 1.23 set here=$OSG_APP/cmssoft/cms
107 eulisse 1.12 endif
108     # OSG
109 eulisse 1.7 endif
110    
111     if ( ! -e $here/cmsset_default.csh ) then
112     echo "Please cd into the directory where cmsset_default.csh is."
113     endif
114 eulisse 1.5
115 eulisse 1.27 foreach pkg ( `/bin/ls ${here}/${SCRAM_ARCH}/etc/profile.d/ | grep 'S.*[.]csh'` )
116 eulisse 1.5 source ${here}/${SCRAM_ARCH}/etc/profile.d/$pkg
117     end
118 eulisse 1.21 if ( ! ${?CMS_PATH} ) then
119     setenv CMS_PATH $here
120     endif
121 metson 1.32
122     if( -e $CMS_PATH/SITECONF/local/JobConfig/cmsset_local.csh ) then
123     source $CMS_PATH/SITECONF/local/JobConfig/cmsset_local.csh
124     endif
125 eulisse 1.22 unset here
126 eulisse 1.1 EOF_CMSSET_DEFAULT_CSH
127 eulisse 1.28 touch %instroot/%cmsplatf/etc/profile.d/dummy
128 eulisse 1.8 %pre
129     [ -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`
130     [ -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`
131     [ -d $RPM_INSTALL_PREFIX/bin ] && cp -r $RPM_INSTALL_PREFIX/bin $RPM_INSTALL_PREFIX/bin.old`date +%Y%m%d`
132 eulisse 1.1 %post
133     echo $RPM_INSTALL_PREFIX
134 eulisse 1.3 perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/cmsset_default.sh
135     perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/cmsset_default.csh
136     perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/bin/cmsos
137 eulisse 1.28 perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/bin/cmsarch
138 eulisse 1.3 %files
139     %i
140     %instroot/cmsset_default.sh
141     %instroot/cmsset_default.csh
142     %instroot/bin/cmsos
143 eulisse 1.28 %instroot/bin/cmsarch
144 eulisse 1.5 %instroot/%cmsplatf/etc/profile.d
145 eulisse 1.6 %exclude %instroot/%cmsplatf/etc/profile.d/*