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.29 by eulisse, Wed Aug 2 19:17:11 2006 UTC vs.
Revision 1.52 by muzaffar, Tue Jan 1 11:01:22 2008 UTC

# Line 1 | Line 1
1 < ### RPM cms cms-env 1.0
2 < Source: cmsos
1 > ### RPM cms cms-env 1.0
2 > Source: none
3   %prep
4   %build
5 echo $SCRAM_ROOT
5   %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 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;;
28        osx104_ia32) compilerv=gcc400;;
29        osx104_pcc32) 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
43
44 if [ ! $SCRAM_ARCH ]
45 then
46    SCRAM_ARCH=`%instroot/bin/cmsarch`
47    export SCRAM_ARCH
48 fi
49
50 here=%{instroot}
51
52 if [ "$VO_CMS_SW_DIR" != ""  ]
53 then
54    here=$VO_CMS_SW_DIR
55 else
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. Either cd into the directory where it is or move to zsh"
65 fi
66
67 for pkg in `/bin/ls $here/${SCRAM_ARCH}/etc/profile.d/ | grep 'S.*[.]sh'`
68 do
69        source $here/${SCRAM_ARCH}/etc/profile.d/$pkg
70 done
71
72 if [ ! $CMS_PATH ]
73 then
74    export CMS_PATH=$here
75 fi
76 EOF_CMSSET_DEFAULT_SH
77
78
79 ### CSH code
80
81 cat << \EOF_CMSSET_DEFAULT_CSH > %instroot/cmsset_default.csh
82
83 if (${?PATH}) then
84    setenv PATH %instroot/bin:$PATH
85 else
86    setenv PATH %instroot/bin
87 endif
88
89 if ( ! ${?SCRAM_ARCH}) then
90    setenv SCRAM_ARCH `sh -c %instroot/bin/cmsarch`
91 endif
92
93 set here=%instroot
94
95 if ( ${?VO_CMS_SW_DIR} ) then
96    set here=$VO_CMS_SW_DIR
97 else
98    # OSG
99    if ( ${?OSG_APP} ) then
100        set here=$OSG_APP/cmssoft/cms
101    endif
102    # OSG                      
103 endif
104
105 if ( ! -e $here/cmsset_default.csh ) then
106    echo "Please cd into the directory where cmsset_default.csh is."
107 endif
108
109 foreach pkg ( `/bin/ls ${here}/${SCRAM_ARCH}/etc/profile.d/ | grep 'S.*[.]csh'` )
110        source ${here}/${SCRAM_ARCH}/etc/profile.d/$pkg
111 end
112 if ( ! ${?CMS_PATH} ) then
113    setenv CMS_PATH $here
114 endif
115 unset here
116 EOF_CMSSET_DEFAULT_CSH
117 touch %instroot/%cmsplatf/etc/profile.d/dummy
118 %pre
119 [ -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`
120 [ -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`
121 [ -d $RPM_INSTALL_PREFIX/bin ] && cp -r $RPM_INSTALL_PREFIX/bin $RPM_INSTALL_PREFIX/bin.old`date +%Y%m%d`
122 %post
123 echo $RPM_INSTALL_PREFIX
124 perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/cmsset_default.sh
125 perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/cmsset_default.csh
126 perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/bin/cmsos
127 perl -p -i -e "s|%{instroot}|$RPM_INSTALL_PREFIX|g" $RPM_INSTALL_PREFIX/bin/cmsarch
128 %files
129 %i
130 %instroot/cmsset_default.sh
131 %instroot/cmsset_default.csh
132 %instroot/bin/cmsos
133 %instroot/bin/cmsarch
134 %instroot/%cmsplatf/etc/profile.d
135 %exclude %instroot/%cmsplatf/etc/profile.d/*

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines