ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CMSDIST/overview.spec
Revision: 1.13
Committed: Wed Jan 19 00:11:29 2011 UTC (14 years, 3 months ago) by lat
Branch: MAIN
Changes since 1.12: +3 -1 lines
Log Message:
Initial version of build in comp repo. Catch up with SCRAM,
toolfile and classlib updates.

File Contents

# User Rev Content
1 lat 1.12 ### RPM cms overview 5.2.1c
2 lat 1.1
3 lat 1.5 # This is a RPM spec file for building the Overview. This is a very
4     # minimal SCRAM build area with highly reduced set of dependencies.
5     # Building Overview does not in fact require SCRAM at all, but this
6     # arrangment makes it easier for a developer with CMSSW work area.
7     # See DQM GUI spec file for more commentary on what goes on here.
8 lat 1.1 %define cvsserver cvs://:pserver:anonymous@cmscvs.cern.ch:2401/cvs_server/repositories/CMSSW?passwd=AA_:yZZ3e
9 lat 1.5 %define scram $SCRAMV1_ROOT/bin/scram --arch %cmsplatf
10 lat 1.12 %define cmssw CMSSW_3_6_1
11     %define vcfg V03-29-09
12 lat 1.1 %define initenv export ZZPATH=$PATH ZZLD_LIBRARY_PATH=$LD_LIBRARY_PATH ZZPYTHONPATH=$PYTHONPATH; %initenv_all
13    
14 lat 1.5 Source0: %{cvsserver}&strategy=checkout&module=config&export=config&tag=-r%{vcfg}&output=/config.tar.gz
15 lat 1.10 Source1: %{cvsserver}&strategy=checkout&module=CMSSW/VisMonitoring/DQMServer&export=VisMonitoring/DQMServer&tag=-rR05-01-08&output=/DQMServer.tar.gz
16 lat 1.7 Requires: cherrypy py2-cheetah yui py2-cx-oracle py2-pil py2-matplotlib overview-conf SCRAMV1
17 lat 1.1
18 lat 1.5 # Set up minimal SCRAM project build area with our sources.
19 lat 1.1 %prep
20 lat 1.13 export SCRAM_ARCH=%cmsplatf
21 lat 1.5 rm -fr %_builddir/{config,src,THE_BUILD}
22     %setup -T -b 0 -n config
23     %setup -c -T -a 1 -n src
24    
25     cd %_builddir
26     rm -fr src/Vis*/*/{src,bin,interface,plugins,test}
27     tar -jcvf distsrc.tar.bz2 -C src .
28 lat 1.1
29 lat 1.5 config/updateConfig.pl -p CMSSW -v THE_BUILD -s $SCRAMV1_VERSION -t ${OVERVIEW_CONF_ROOT}
30     %scram project -d $PWD -b config/bootsrc.xml </dev/null
31    
32     # Build the code as a scram project area, then relocate it to more
33     # normal directories (%i/{bin,lib,python}). Save the scram runtime
34     # environment plus extra externals for later use, but manipulate
35     # the scram environment to point to the installation directories.
36     # Avoid generating excess environment.
37 lat 1.1 %build
38 lat 1.13 export SCRAM_ARCH=%cmsplatf
39 lat 1.5 cd %_builddir/THE_BUILD/src
40     export BUILD_LOG=yes
41     export SCRAM_NOPLUGINREFRESH=yes
42     export SCRAM_NOLOADCHECK=true
43     export SCRAM_NOSYMCHECK=true
44     (%scram build -v -f %makeprocesses </dev/null) || { %scram build outputlog </dev/null && false; }
45    
46     # Now clean up environment. First eliminate non-existent directories
47     # from the paths. Then capture the SCRAM run-time environment, and
48     # eliminate duplicate path components (from cmsbuild vs. scram), and
49     # convert it back to a format that is additive to the user environment
50     # (you want the init script to modify your $PATH, not to change it to
51     # mine, right!?). Finally munge SCRAM directories to finall install
52     # area directories.
53     mkdir -p %i/etc/profile.d
54 lat 1.1 for p in PATH LD_LIBRARY_PATH PYTHONPATH; do
55     for z in "" ZZ; do
56     eval export $z$p=$(perl -e 'print join(":", grep($_ && -d $_ && scalar(@{[<$_/*>]}) > 0, split(/:/,$ENV{'$z$p'})))')
57     done
58     done
59 lat 1.5 removeenv='LOCALRT|CMSSW_(RELEASE_)*(BASE|VERSION|(FWLITE|SEARCH)_[A-Z_]*)|(COIN|IGUANA|SEAL)_[A-Z_]*'
60     scram runtime -sh | grep -v SCRAMRT | egrep -v "^export ($removeenv)=" > %i/etc/profile.d/env.sh
61     scram runtime -csh | grep -v SCRAMRT | egrep -v "^setenv ($removeenv) " > %i/etc/profile.d/env.csh
62     perl -w -i -p -e \
63     'BEGIN {
64     %%linked = map { s|/+[^/]+$||; ($_ => 1) }
65     grep(defined $_, map { readlink $_ }
66     <%_builddir/THE_BUILD/external/%cmsplatf/lib/*>);
67     }
68     foreach $dir (keys %%linked) { s<:$dir([ :;"]|$)><$1>g; }
69 lat 1.1 foreach $p ("PATH", "LD_LIBRARY_PATH", "PYTHONPATH") {
70 lat 1.5 s<([ :=])$ENV{"ZZ$p"}([ :;"]|$)><$1\${$p}$2>g if $ENV{"ZZ$p"};
71 lat 1.1 }
72 lat 1.5 s<:'"$SCRAMV1_ROOT"'/[a-z]+:><:>g;
73     s<:%instroot/common:><:>g;
74     s<%_builddir/THE_BUILD/bin/%cmsplatf><%i/bin>g;
75     s<%_builddir/THE_BUILD/(lib|module)/%cmsplatf><%i/lib>g;
76     s<%_builddir/THE_BUILD/external/%cmsplatf/lib><%i/external>g;
77     s<%_builddir/THE_BUILD/python><%i/python>g;
78     s<%_builddir/THE_BUILD><%i>g;' \
79     %i/etc/profile.d/env.sh %i/etc/profile.d/env.csh
80    
81     (echo "export PATH=%i/xbin:\$PATH;"
82     echo "export PYTHONPATH=%i/xlib:%i/xpython:\$PYTHONPATH;"
83     echo "export LD_LIBRARY_PATH=%i/xlib:\$LD_LIBRARY_PATH;"
84     echo "export YUI_ROOT='$YUI_ROOT';"
85     echo "export OVERVIEW_ROOT='%i';"
86     echo "export OVERVIEW_CMSSW_VERSION='%{cmssw}';") >> %i/etc/profile.d/env.sh
87    
88     (echo "setenv PATH %i/xbin:\$PATH;"
89     echo "setenv PYTHONPATH %i/xlib:%i/xpython:\$PYTHONPATH;"
90     echo "setenv LD_LIBRARY_PATH %i/xlib:\$LD_LIBRARY_PATH;"
91     echo "setenv YUI_ROOT '$YUI_ROOT';"
92     echo "setenv OVERVIEW_ROOT '%i';"
93     echo "setenv OVERVIEW_CMSSW_VERSION '%{cmssw}';") >> %i/etc/profile.d/env.csh
94    
95     # Install the project files. Copies from SCRAM area to final install
96     # area. Creates scripts to patch and unpatch the server area from a
97     # local SCRAM developer area. Creates scripts for server management.
98     # Usage at https://twiki.cern.ch/twiki/bin/view/CMS/DQMTest and
99     # https://twiki.cern.ch/twiki//bin/view/CMS/DQMGuiProduction.
100     %install
101 lat 1.13 export SCRAM_ARCH=%cmsplatf
102 lat 1.5 mkdir -p %i/etc/profile.d %i/etc/scramconfig %i/external %i/{,x}bin %i/{,x}lib %i/{,x}python %i/data
103     cp -p %_builddir/distsrc.tar.bz2 %i/data
104     cp -p %_builddir/THE_BUILD/bin/%cmsplatf/* %i/bin
105     cp -p %_builddir/THE_BUILD/src/VisMonitoring/DQMServer/python/*.* %i/python
106     tar -C %_builddir/THE_BUILD/external/%cmsplatf/lib -cf - . | tar -C %i/external -xvvf -
107     cp -p %_builddir/THE_BUILD/config/toolbox/%cmsplatf/tools/selected/*.xml %i/etc/scramconfig
108     rm -f %i/python/GuiDQM.py
109    
110     # Rename executable scripts.
111 lat 1.10 perl -p -i -e 's/DQMGUI\_ROOT/OVERVIEW_ROOT/g' %i/bin/visDQM*
112 lat 1.5 for f in %i/bin/visDQM*; do
113     mv $f $(echo $f | sed s/visDQM/ov/g)
114     done
115    
116     (set -e; eval `scram runtime -sh`;
117     export PYTHONPATH=%i/python${PYTHONPATH+":$PYTHONPATH"};
118     for mod in %i/python/*.py; do
119     python -c "import $(basename $mod | sed 's/\.py$//')"
120     done)
121 lat 1.1
122     # Post installation rules. Relocate the various scripts.
123     # Relocate SCRAM-generated external link "database".
124     %post
125     %{relocateConfig}etc/profile.d/env.sh
126     %{relocateConfig}etc/profile.d/env.csh
127 lat 1.5 %{relocateConfig}etc/scramconfig/*.xml
128     perl -w -e '
129     ($oldroot, $newroot, @files) = @ARGV;
130     foreach $f (@files) {
131     next if !defined($old = readlink $f);
132     ($new = $old) =~ s|\Q$oldroot\E|$newroot|;
133     if ($new ne $old) { unlink($f); symlink($new, $f); }
134     }' %instroot $RPM_INSTALL_PREFIX $RPM_INSTALL_PREFIX/%pkgrel/external/*