1 |
lat |
1.9 |
### RPM cms overview 5.1.7b
|
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.9 |
%define cmssw CMSSW_3_5_0
|
11 |
|
|
%define vcfg V03-29-06
|
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.8 |
Source1: %{cvsserver}&strategy=checkout&module=CMSSW/VisMonitoring/DQMServer&export=VisMonitoring/DQMServer&tag=-rR05-01-07&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.5 |
rm -fr %_builddir/{config,src,THE_BUILD}
|
21 |
|
|
%setup -T -b 0 -n config
|
22 |
|
|
%setup -c -T -a 1 -n src
|
23 |
|
|
|
24 |
|
|
cd %_builddir
|
25 |
|
|
rm -fr src/Vis*/*/{src,bin,interface,plugins,test}
|
26 |
|
|
tar -jcvf distsrc.tar.bz2 -C src .
|
27 |
lat |
1.1 |
|
28 |
lat |
1.5 |
config/updateConfig.pl -p CMSSW -v THE_BUILD -s $SCRAMV1_VERSION -t ${OVERVIEW_CONF_ROOT}
|
29 |
|
|
%scram project -d $PWD -b config/bootsrc.xml </dev/null
|
30 |
|
|
|
31 |
|
|
%build
|
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.5 |
cd %_builddir/THE_BUILD/src
|
39 |
|
|
export BUILD_LOG=yes
|
40 |
|
|
export SCRAM_NOPLUGINREFRESH=yes
|
41 |
|
|
export SCRAM_NOLOADCHECK=true
|
42 |
|
|
export SCRAM_NOSYMCHECK=true
|
43 |
|
|
(%scram build -v -f %makeprocesses </dev/null) || { %scram build outputlog </dev/null && false; }
|
44 |
|
|
|
45 |
|
|
# Now clean up environment. First eliminate non-existent directories
|
46 |
|
|
# from the paths. Then capture the SCRAM run-time environment, and
|
47 |
|
|
# eliminate duplicate path components (from cmsbuild vs. scram), and
|
48 |
|
|
# convert it back to a format that is additive to the user environment
|
49 |
|
|
# (you want the init script to modify your $PATH, not to change it to
|
50 |
|
|
# mine, right!?). Finally munge SCRAM directories to finall install
|
51 |
|
|
# area directories.
|
52 |
|
|
mkdir -p %i/etc/profile.d
|
53 |
lat |
1.1 |
for p in PATH LD_LIBRARY_PATH PYTHONPATH; do
|
54 |
|
|
for z in "" ZZ; do
|
55 |
|
|
eval export $z$p=$(perl -e 'print join(":", grep($_ && -d $_ && scalar(@{[<$_/*>]}) > 0, split(/:/,$ENV{'$z$p'})))')
|
56 |
|
|
done
|
57 |
|
|
done
|
58 |
lat |
1.5 |
removeenv='LOCALRT|CMSSW_(RELEASE_)*(BASE|VERSION|(FWLITE|SEARCH)_[A-Z_]*)|(COIN|IGUANA|SEAL)_[A-Z_]*'
|
59 |
|
|
scram runtime -sh | grep -v SCRAMRT | egrep -v "^export ($removeenv)=" > %i/etc/profile.d/env.sh
|
60 |
|
|
scram runtime -csh | grep -v SCRAMRT | egrep -v "^setenv ($removeenv) " > %i/etc/profile.d/env.csh
|
61 |
|
|
perl -w -i -p -e \
|
62 |
|
|
'BEGIN {
|
63 |
|
|
%%linked = map { s|/+[^/]+$||; ($_ => 1) }
|
64 |
|
|
grep(defined $_, map { readlink $_ }
|
65 |
|
|
<%_builddir/THE_BUILD/external/%cmsplatf/lib/*>);
|
66 |
|
|
}
|
67 |
|
|
foreach $dir (keys %%linked) { s<:$dir([ :;"]|$)><$1>g; }
|
68 |
lat |
1.1 |
foreach $p ("PATH", "LD_LIBRARY_PATH", "PYTHONPATH") {
|
69 |
lat |
1.5 |
s<([ :=])$ENV{"ZZ$p"}([ :;"]|$)><$1\${$p}$2>g if $ENV{"ZZ$p"};
|
70 |
lat |
1.1 |
}
|
71 |
lat |
1.5 |
s<:'"$SCRAMV1_ROOT"'/[a-z]+:><:>g;
|
72 |
|
|
s<:%instroot/common:><:>g;
|
73 |
|
|
s<%_builddir/THE_BUILD/bin/%cmsplatf><%i/bin>g;
|
74 |
|
|
s<%_builddir/THE_BUILD/(lib|module)/%cmsplatf><%i/lib>g;
|
75 |
|
|
s<%_builddir/THE_BUILD/external/%cmsplatf/lib><%i/external>g;
|
76 |
|
|
s<%_builddir/THE_BUILD/python><%i/python>g;
|
77 |
|
|
s<%_builddir/THE_BUILD><%i>g;' \
|
78 |
|
|
%i/etc/profile.d/env.sh %i/etc/profile.d/env.csh
|
79 |
|
|
|
80 |
|
|
(echo "export PATH=%i/xbin:\$PATH;"
|
81 |
|
|
echo "export PYTHONPATH=%i/xlib:%i/xpython:\$PYTHONPATH;"
|
82 |
|
|
echo "export LD_LIBRARY_PATH=%i/xlib:\$LD_LIBRARY_PATH;"
|
83 |
|
|
echo "export YUI_ROOT='$YUI_ROOT';"
|
84 |
|
|
echo "export OVERVIEW_ROOT='%i';"
|
85 |
|
|
echo "export OVERVIEW_CMSSW_VERSION='%{cmssw}';") >> %i/etc/profile.d/env.sh
|
86 |
|
|
|
87 |
|
|
(echo "setenv PATH %i/xbin:\$PATH;"
|
88 |
|
|
echo "setenv PYTHONPATH %i/xlib:%i/xpython:\$PYTHONPATH;"
|
89 |
|
|
echo "setenv LD_LIBRARY_PATH %i/xlib:\$LD_LIBRARY_PATH;"
|
90 |
|
|
echo "setenv YUI_ROOT '$YUI_ROOT';"
|
91 |
|
|
echo "setenv OVERVIEW_ROOT '%i';"
|
92 |
|
|
echo "setenv OVERVIEW_CMSSW_VERSION '%{cmssw}';") >> %i/etc/profile.d/env.csh
|
93 |
|
|
|
94 |
|
|
# Install the project files. Copies from SCRAM area to final install
|
95 |
|
|
# area. Creates scripts to patch and unpatch the server area from a
|
96 |
|
|
# local SCRAM developer area. Creates scripts for server management.
|
97 |
|
|
# Usage at https://twiki.cern.ch/twiki/bin/view/CMS/DQMTest and
|
98 |
|
|
# https://twiki.cern.ch/twiki//bin/view/CMS/DQMGuiProduction.
|
99 |
|
|
%install
|
100 |
|
|
mkdir -p %i/etc/profile.d %i/etc/scramconfig %i/external %i/{,x}bin %i/{,x}lib %i/{,x}python %i/data
|
101 |
|
|
cp -p %_builddir/distsrc.tar.bz2 %i/data
|
102 |
|
|
cp -p %_builddir/THE_BUILD/bin/%cmsplatf/* %i/bin
|
103 |
|
|
cp -p %_builddir/THE_BUILD/src/VisMonitoring/DQMServer/python/*.* %i/python
|
104 |
|
|
tar -C %_builddir/THE_BUILD/external/%cmsplatf/lib -cf - . | tar -C %i/external -xvvf -
|
105 |
|
|
cp -p %_builddir/THE_BUILD/config/toolbox/%cmsplatf/tools/selected/*.xml %i/etc/scramconfig
|
106 |
|
|
rm -f %i/python/GuiDQM.py
|
107 |
|
|
|
108 |
|
|
# Rename executable scripts.
|
109 |
|
|
for f in %i/bin/visDQM*; do
|
110 |
|
|
mv $f $(echo $f | sed s/visDQM/ov/g)
|
111 |
|
|
done
|
112 |
|
|
|
113 |
|
|
(set -e; eval `scram runtime -sh`;
|
114 |
|
|
export PYTHONPATH=%i/python${PYTHONPATH+":$PYTHONPATH"};
|
115 |
|
|
for mod in %i/python/*.py; do
|
116 |
|
|
python -c "import $(basename $mod | sed 's/\.py$//')"
|
117 |
|
|
done)
|
118 |
lat |
1.1 |
|
119 |
|
|
# Script to record what sources went into this package so user can
|
120 |
|
|
# check them out conveniently.
|
121 |
|
|
sed 's/^ //' > %i/bin/ovDistSource << \END_OF_SCRIPT
|
122 |
|
|
#!/bin/sh
|
123 |
|
|
doit= shopt=-ex cvs=${CVSROOT:-":pserver:anonymous@cmscvs.cern.ch:/cvs/CMSSW"}
|
124 |
|
|
while [ $# -gt 0 ]; do
|
125 |
|
|
case $1 in
|
126 |
|
|
-n ) doit=echo shopt=-e; shift ;;
|
127 |
|
|
* ) echo "$0: unrecognised parameter: $1" 1>&2; exit 1 ;;
|
128 |
|
|
esac
|
129 |
|
|
done
|
130 |
|
|
set $shopt
|
131 |
|
|
$doit tar -jxf %i/data/distsrc.tar.bz2
|
132 |
|
|
tar -jtf %i/data/distsrc.tar.bz2 '*/CVS/Root' |
|
133 |
|
|
xargs $doit sed -i -e "s|.*|$cvs|"
|
134 |
|
|
END_OF_SCRIPT
|
135 |
|
|
|
136 |
lat |
1.5 |
# Script to update SCRAM tool definitions in CMSSW to our versions.
|
137 |
|
|
sed 's/^ //' > %i/bin/ovDistTools << \END_OF_SCRIPT
|
138 |
|
|
#!/bin/sh
|
139 |
|
|
[ X"$CMSSW_BASE" = X ] && { echo '$CMSSW_BASE not set'; exit 1; }
|
140 |
|
|
[ X"$SCRAM_ARCH" = X ] && { echo '$SCRAM_ARCH not set'; exit 1; }
|
141 |
|
|
|
142 |
|
|
set -e
|
143 |
|
|
for tool in %i/etc/scramconfig/*.xml; do
|
144 |
|
|
toolname=$(basename $tool | sed 's/\.xml$//')
|
145 |
|
|
(set -x; scram tool remove $toolname)
|
146 |
|
|
cp -p $tool $CMSSW_BASE/config/toolbox/$SCRAM_ARCH/tools/selected
|
147 |
|
|
(set -x; scram setup -f $tool $toolname)
|
148 |
|
|
done
|
149 |
|
|
END_OF_SCRIPT
|
150 |
|
|
|
151 |
lat |
1.1 |
# Script to patch the server from the local developer area. The user's
|
152 |
|
|
# stuff goes into xbin/xlib/xpython directories, which are in front of
|
153 |
|
|
# the server's own bin/lib/python directories. So anything in x* will
|
154 |
|
|
# be picked up in preference to the server-distributed files.
|
155 |
|
|
sed 's/^ //' > %i/bin/ovDistPatch << \END_OF_SCRIPT
|
156 |
|
|
#!/bin/sh
|
157 |
|
|
|
158 |
|
|
if [ X"$CMSSW_BASE" = X ]; then
|
159 |
|
|
echo "scram runtime not set, will use one from $PWD" 1>&2
|
160 |
|
|
eval `scram runtime -sh`
|
161 |
|
|
fi
|
162 |
|
|
|
163 |
|
|
if [ X"$CMSSW_BASE" = X ] || [ X"$SCRAM_ARCH" = X ] || \
|
164 |
|
|
[ ! -f "$CMSSW_BASE/src/VisMonitoring/DQMServer/python/GuiCore.py" ]; then
|
165 |
|
|
echo "error: could not locate local scram developer area, exiting" 1>&2
|
166 |
|
|
exit 1;
|
167 |
|
|
fi
|
168 |
|
|
|
169 |
|
|
set -e
|
170 |
|
|
rm -fr %i/x{lib,bin,python}/{*,.??*}
|
171 |
|
|
|
172 |
|
|
echo "copying $CMSSW_BASE/lib/$SCRAM_ARCH into %i/xlib"
|
173 |
|
|
(cd $CMSSW_BASE/lib/$SCRAM_ARCH && tar -cf - .) | (cd %i/xlib && tar -xf -)
|
174 |
|
|
|
175 |
|
|
echo "copying $CMSSW_BASE/bin/$SCRAM_ARCH into %i/xbin"
|
176 |
|
|
(cd $CMSSW_BASE/bin/$SCRAM_ARCH && tar -cf - .) | (cd %i/xbin && tar -xf -)
|
177 |
|
|
|
178 |
|
|
echo "copying $CMSSW_BASE/src/VisMonitoring/DQMServer/python into %i/xpython"
|
179 |
|
|
(cd $CMSSW_BASE/src/VisMonitoring/DQMServer/python && tar -cf - *.*) | (cd %i/xpython && tar -xf -)
|
180 |
|
|
|
181 |
|
|
echo "renaming utility scripts"
|
182 |
|
|
for f in %i/xbin/visDQM*; do
|
183 |
|
|
mv $f $(echo $f | sed s/visDQM/ov/g)
|
184 |
|
|
done
|
185 |
|
|
exit 0
|
186 |
|
|
END_OF_SCRIPT
|
187 |
|
|
|
188 |
|
|
# Script to unpatch the server area. Simply clears out xbin/xlib/xpython
|
189 |
|
|
# so the server will then pick up the files distributed with the RPM.
|
190 |
|
|
sed 's/^ //' > %i/bin/ovDistUnpatch << \END_OF_SCRIPT
|
191 |
|
|
#!/bin/sh
|
192 |
|
|
echo "removing local overrides from %i"
|
193 |
|
|
rm -fr %i/x{lib,bin,python}/{*,.??*}
|
194 |
|
|
exit 0
|
195 |
|
|
END_OF_SCRIPT
|
196 |
|
|
|
197 |
|
|
# CRON script to purge sessions abandoned by users.
|
198 |
|
|
sed 's/^ //' > %i/etc/purge-old-sessions << \END_OF_SCRIPT
|
199 |
|
|
#!/bin/sh
|
200 |
|
|
. %instroot/cmsset_default.sh
|
201 |
|
|
. %i/etc/profile.d/env.sh
|
202 |
|
|
for opt; do
|
203 |
|
|
[ -d "$opt/gui/www/sessions" ] || continue
|
204 |
|
|
ovPurgeSessions $opt/gui/www/sessions
|
205 |
|
|
done
|
206 |
|
|
END_OF_SCRIPT
|
207 |
|
|
|
208 |
|
|
# Utility script to update CRONTAB entries to this server version.
|
209 |
|
|
# Accounts for changes in the server configurations. For details
|
210 |
|
|
# of use see DQMGuiProduction twiki page.
|
211 |
|
|
sed 's/^ //' > %i/etc/update-crontab << \END_OF_SCRIPT
|
212 |
|
|
#!/bin/sh
|
213 |
|
|
purge= defpurge=$(dirname %instroot)
|
214 |
|
|
while [ $# -gt 0 ]; do
|
215 |
|
|
case $1 in
|
216 |
|
|
--purge )
|
217 |
|
|
purge="$purge $2"
|
218 |
|
|
shift; shift ;;
|
219 |
|
|
* )
|
220 |
|
|
echo "$(basename $0): unrecognised option $1" 1>&2
|
221 |
|
|
exit 1 ;;
|
222 |
|
|
esac
|
223 |
|
|
done
|
224 |
|
|
|
225 |
|
|
set -x
|
226 |
|
|
(crontab -l | fgrep -v /overview/;
|
227 |
|
|
sed -e "s|#PURGE|${purge:-$defpurge}|g" <%i/etc/crontab) |
|
228 |
|
|
crontab -
|
229 |
|
|
END_OF_SCRIPT
|
230 |
|
|
|
231 |
|
|
# CRONTAB entries for this server. This will be modified by the
|
232 |
|
|
# update-crontab script and merged to other crontab rules.
|
233 |
|
|
sed 's/^ //' > %i/etc/crontab << \END_OF_SCRIPT
|
234 |
|
|
5 */2 * * * %i/etc/purge-old-sessions #PURGE
|
235 |
|
|
END_OF_SCRIPT
|
236 |
|
|
|
237 |
|
|
chmod a+x %i/bin/ovDist*
|
238 |
|
|
chmod a+x %i/etc/*-*
|
239 |
|
|
|
240 |
|
|
# Post installation rules. Relocate the various scripts.
|
241 |
|
|
# Relocate SCRAM-generated external link "database".
|
242 |
|
|
%post
|
243 |
|
|
%{relocateConfig}bin/ovDist*
|
244 |
|
|
%{relocateConfig}etc/*-*
|
245 |
|
|
%{relocateConfig}etc/crontab
|
246 |
|
|
%{relocateConfig}etc/profile.d/env.sh
|
247 |
|
|
%{relocateConfig}etc/profile.d/env.csh
|
248 |
lat |
1.5 |
%{relocateConfig}etc/scramconfig/*.xml
|
249 |
|
|
perl -w -e '
|
250 |
|
|
($oldroot, $newroot, @files) = @ARGV;
|
251 |
|
|
foreach $f (@files) {
|
252 |
|
|
next if !defined($old = readlink $f);
|
253 |
|
|
($new = $old) =~ s|\Q$oldroot\E|$newroot|;
|
254 |
|
|
if ($new ne $old) { unlink($f); symlink($new, $f); }
|
255 |
|
|
}' %instroot $RPM_INSTALL_PREFIX $RPM_INSTALL_PREFIX/%pkgrel/external/*
|