1 |
lat |
1.19 |
### RPM cms dqmgui 4.2.6c
|
2 |
lat |
1.1 |
%define cvsserver cvs://:pserver:anonymous@cmscvs.cern.ch:2401/cvs_server/repositories/CMSSW?passwd=AA_:yZZ3e
|
3 |
lat |
1.17 |
Source0: %cvsserver&strategy=checkout&module=CMSSW/VisMonitoring/DQMServer&nocache=true&export=VisMonitoring/DQMServer&tag=-rV04-02-06&output=/VisMonitoring_DQMServer.tar.gz
|
4 |
lat |
1.2 |
Source1: %cvsserver&strategy=checkout&module=CMSSW/DQMServices/Core&nocache=true&export=DQMServices/Core&tag=-rV03-03-06&output=/DQMServices_Core.tar.gz
|
5 |
lat |
1.1 |
Source2: %cvsserver&strategy=checkout&module=CMSSW/DQMServices/Components&nocache=true&export=DQMServices/Components&tag=-rV03-03-03&output=/DQMServices_Components.tar.gz
|
6 |
lat |
1.19 |
Source3: %cvsserver&strategy=checkout&module=CMSSW/DQM/RenderPlugins&nocache=true&export=DQM/RenderPlugins&tag=-rV04-00-03&output=/DQM_RenderPlugins.tar.gz
|
7 |
|
|
Requires: cmssw cherrypy py2-cheetah yui py2-pysqlite py2-cx-oracle py2-pil py2-matplotlib
|
8 |
lat |
1.1 |
|
9 |
|
|
%prep
|
10 |
|
|
# Note on requiring "xsrc": using $CMSSW_VERSION/src in the setup
|
11 |
|
|
# stanzas with -n options won't work because then build rule will
|
12 |
|
|
# try to do a "cd" into $CMSSW_VERSION/src before the preamble has
|
13 |
|
|
# sourced the init scripts. We use "xsrc" as a "constant-value"
|
14 |
|
|
# hack so we don't need to hard-code CMSSW version in this RPM.
|
15 |
|
|
rm -fr CMSSW_$VERSION xsrc
|
16 |
|
|
scram p CMSSW $CMSSW_VERSION
|
17 |
|
|
ln -s $CMSSW_VERSION/src xsrc
|
18 |
|
|
%setup -D -T -a 0 -c -n xsrc
|
19 |
|
|
%setup -D -T -a 1 -c -n xsrc
|
20 |
|
|
%setup -D -T -a 2 -c -n xsrc
|
21 |
|
|
%setup -D -T -a 3 -c -n xsrc
|
22 |
|
|
|
23 |
|
|
%build
|
24 |
|
|
# Build the code as a scram project area, then relocate it to more
|
25 |
|
|
# normal directories (%i/{bin,lib,python}). Save the scram runtime
|
26 |
|
|
# environment plus extra externals for later use, but manipulate
|
27 |
|
|
# the scram environment to point to the installation directories.
|
28 |
|
|
# Avoid generating excess environment.
|
29 |
|
|
cd %_builddir/$CMSSW_VERSION/src
|
30 |
|
|
scram build %makeprocesses
|
31 |
|
|
|
32 |
|
|
mkdir -p %i/etc/profile.d
|
33 |
|
|
scram runtime -sh | grep -v SCRAMRT > %i/etc/profile.d/env.sh
|
34 |
|
|
scram runtime -csh | grep -v SCRAMRT > %i/etc/profile.d/env.csh
|
35 |
|
|
perl -p -i -e \
|
36 |
|
|
"s<%_builddir/$CMSSW_VERSION/bin/%cmsplatf><%i/bin>g;
|
37 |
|
|
s<%_builddir/$CMSSW_VERSION/(lib|module)/%cmsplatf><%i/lib>g;
|
38 |
|
|
s<%_builddir/$CMSSW_VERSION/python><%i/python>g;
|
39 |
|
|
s<%_builddir/$CMSSW_VERSION><%i>g;" \
|
40 |
|
|
%i/etc/profile.d/env.sh %i/etc/profile.d/env.csh
|
41 |
lat |
1.10 |
|
42 |
lat |
1.12 |
(echo "export PATH=%i/xbin:\$PATH;"
|
43 |
lat |
1.13 |
echo "export PYTHONPATH=%i/xlib:%i/xpython:\$PYTHONPATH;"
|
44 |
lat |
1.12 |
echo "export LD_LIBRARY_PATH=%i/xlib:\$LD_LIBRARY_PATH;"
|
45 |
|
|
echo "export YUI_ROOT='$YUI_ROOT';"
|
46 |
|
|
echo "export DQM_CMSSW_VERSION='$CMSSW_VERSION';") >> %i/etc/profile.d/env.sh
|
47 |
|
|
|
48 |
|
|
(echo "setenv PATH %i/xbin:\$PATH;"
|
49 |
lat |
1.13 |
echo "setenv PYTHONPATH %i/xlib:%i/xpython:\$PYTHONPATH;"
|
50 |
lat |
1.12 |
echo "setenv LD_LIBRARY_PATH %i/xlib:\$LD_LIBRARY_PATH;"
|
51 |
|
|
echo "setenv YUI_ROOT '$YUI_ROOT';"
|
52 |
|
|
echo "setenv DQM_CMSSW_VERSION '$CMSSW_VERSION';") >> %i/etc/profile.d/env.csh
|
53 |
lat |
1.1 |
|
54 |
|
|
%install
|
55 |
lat |
1.10 |
mkdir -p %i/etc %i/{,x}bin %i/{,x}lib %i/{,x}python
|
56 |
|
|
cp -p %_builddir/$CMSSW_VERSION/lib/%cmsplatf/*.{so,edm,ig}* %i/lib
|
57 |
|
|
cp -p %_builddir/$CMSSW_VERSION/bin/%cmsplatf/{vis*,DQMCollector} %i/bin
|
58 |
|
|
cp -p %_builddir/$CMSSW_VERSION/src/VisMonitoring/DQMServer/python/*.* %i/python
|
59 |
|
|
|
60 |
|
|
(echo '#!/bin/sh';
|
61 |
|
|
echo 'doit= shopt=-ex'
|
62 |
|
|
echo 'while [ $# -gt 0 ]; do'
|
63 |
|
|
echo ' case $1 in'
|
64 |
|
|
echo ' -n ) doit=echo shopt=-e; shift ;;'
|
65 |
|
|
echo ' * ) echo "$0: unrecognised parameter: $1" 1>&2; exit 1 ;;'
|
66 |
|
|
echo ' esac'
|
67 |
|
|
echo 'done'
|
68 |
|
|
echo 'set $shopt'
|
69 |
|
|
cd %_builddir/$CMSSW_VERSION/src
|
70 |
lat |
1.11 |
for f in */*/CVS/Tag; do
|
71 |
lat |
1.10 |
[ -f $f ] || continue
|
72 |
|
|
tag=$(cat $f | sed 's/^N//')
|
73 |
lat |
1.11 |
pkg=$(echo $f | sed 's|/CVS/Tag||')
|
74 |
lat |
1.10 |
echo "\$doit cvs -Q co -r $tag $pkg"
|
75 |
|
|
done) > %i/bin/visDQMDistSource
|
76 |
|
|
|
77 |
lat |
1.11 |
sed 's/^ //' > %i/bin/visDQMDistPatch << \END_OF_SCRIPT
|
78 |
lat |
1.10 |
#!/bin/sh
|
79 |
|
|
|
80 |
|
|
if [ X"$CMSSW_BASE" = X%i ]; then
|
81 |
|
|
unset CMSSW_BASE
|
82 |
|
|
fi
|
83 |
|
|
|
84 |
|
|
if [ X"$CMSSW_BASE" = X ]; then
|
85 |
|
|
echo "warning: local scram runtime environment not set, sourcing now" 1>&2
|
86 |
|
|
eval `scram runtime -sh`
|
87 |
|
|
fi
|
88 |
|
|
|
89 |
|
|
if [ X"$CMSSW_BASE" = X ] || [ X"$SCRAM_ARCH" = X ] || \
|
90 |
|
|
[ ! -f "$CMSSW_BASE/lib/$SCRAM_ARCH/.iglets" ]; then
|
91 |
|
|
echo "error: could not locate local scram developer area, exiting" 1>&2
|
92 |
|
|
exit 1;
|
93 |
|
|
fi
|
94 |
|
|
|
95 |
|
|
set -e
|
96 |
lat |
1.11 |
rm -fr %i/x{lib,bin,python}/{*,.??*}
|
97 |
|
|
|
98 |
|
|
echo "copying $CMSSW_BASE/lib/$SCRAM_ARCH into %i/xlib"
|
99 |
lat |
1.10 |
(cd $CMSSW_BASE/lib/$SCRAM_ARCH && tar -cf - .) | (cd %i/xlib && tar -xvvf -)
|
100 |
lat |
1.11 |
|
101 |
|
|
echo "copying $CMSSW_BASE/bin/$SCRAM_ARCH into %i/xbin"
|
102 |
lat |
1.10 |
(cd $CMSSW_BASE/bin/$SCRAM_ARCH && tar -cf - .) | (cd %i/xbin && tar -xvvf -)
|
103 |
lat |
1.11 |
|
104 |
|
|
echo "copying $CMSSW_BASE/src/VisMonitoring/DQMServer/python into %i/xpython"
|
105 |
lat |
1.10 |
(cd $CMSSW_BASE/src/VisMonitoring/DQMServer/python && tar -cf - *.*) | (cd %i/xpython && tar -xvvf -)
|
106 |
|
|
exit 0
|
107 |
|
|
END_OF_SCRIPT
|
108 |
|
|
|
109 |
lat |
1.11 |
sed 's/^ //' > %i/bin/visDQMDistUnpatch << \END_OF_SCRIPT
|
110 |
lat |
1.10 |
#!/bin/sh
|
111 |
|
|
echo "removing local overrides from %i"
|
112 |
lat |
1.11 |
rm -fr %i/x{lib,bin,python}/{*,.??*}
|
113 |
lat |
1.10 |
exit 0
|
114 |
|
|
END_OF_SCRIPT
|
115 |
|
|
|
116 |
lat |
1.2 |
sed 's/^ //' > %i/etc/restart-collector << \END_OF_SCRIPT
|
117 |
|
|
#!/bin/sh
|
118 |
|
|
. %instroot/cmsset_default.sh
|
119 |
|
|
. %i/etc/profile.d/env.sh
|
120 |
|
|
killall -9 DQMCollector
|
121 |
|
|
set -e
|
122 |
lat |
1.10 |
for opt; do
|
123 |
lat |
1.5 |
case $opt in
|
124 |
|
|
:* ) port= dir=$(echo $opt | sed 's/.*://') ;;
|
125 |
|
|
*:* ) dir=$(echo $opt | sed 's/.*://')
|
126 |
|
|
port=$(echo $opt | sed 's/:.*//') ;;
|
127 |
|
|
* ) port= dir=$opt ;;
|
128 |
|
|
esac
|
129 |
|
|
|
130 |
|
|
mkdir -p $dir/collector
|
131 |
|
|
cd $dir/collector
|
132 |
|
|
[ ! -f collector.out ] || mv -f collector.out collector.out.$(date +%%Y%%m%%d%%H%%M%%S)
|
133 |
|
|
DQMCollector ${port:+ --listen $port} > collector.out 2>&1 </dev/null &
|
134 |
|
|
done
|
135 |
lat |
1.2 |
END_OF_SCRIPT
|
136 |
|
|
|
137 |
|
|
sed 's/^ //' > %i/etc/archive-collector-logs << \END_OF_SCRIPT
|
138 |
|
|
#!/bin/sh
|
139 |
lat |
1.10 |
for opt; do
|
140 |
lat |
1.5 |
dir=$(echo $opt | sed 's/.*://')
|
141 |
|
|
cd $dir/collector
|
142 |
|
|
for month in $(ls | fgrep collector.out. | sed 's/.*out.\(......\).*/\1/' | sort | uniq); do
|
143 |
|
|
zip -rm collector-$month.zip collector.out.$month*
|
144 |
|
|
done
|
145 |
lat |
1.2 |
done
|
146 |
|
|
END_OF_SCRIPT
|
147 |
|
|
|
148 |
|
|
sed 's/^ //' > %i/etc/purge-old-sessions << \END_OF_SCRIPT
|
149 |
|
|
#!/bin/sh
|
150 |
|
|
. %instroot/cmsset_default.sh
|
151 |
|
|
. %i/etc/profile.d/env.sh
|
152 |
lat |
1.10 |
for opt; do
|
153 |
lat |
1.5 |
[ -d "$opt/gui/www/sessions" ] || continue
|
154 |
|
|
visDQMPurgeSessions $opt/gui/www/sessions
|
155 |
|
|
done
|
156 |
lat |
1.2 |
END_OF_SCRIPT
|
157 |
|
|
|
158 |
|
|
sed 's/^ //' > %i/etc/update-crontab << \END_OF_SCRIPT
|
159 |
|
|
#!/bin/sh
|
160 |
lat |
1.5 |
collector= defcollector=9090:$(dirname %instroot)
|
161 |
|
|
purge= defpurge=$(dirname %instroot)
|
162 |
|
|
while [ $# -gt 0 ]; do
|
163 |
|
|
case $1 in
|
164 |
|
|
--collector )
|
165 |
|
|
collector="$collector $2"
|
166 |
|
|
shift; shift ;;
|
167 |
|
|
--purge )
|
168 |
|
|
purge="$purge $2"
|
169 |
|
|
shift; shift ;;
|
170 |
|
|
* )
|
171 |
|
|
echo "$(basename $0): unrecognised option $1" 1>&2
|
172 |
|
|
exit 1 ;;
|
173 |
|
|
esac
|
174 |
|
|
done
|
175 |
|
|
|
176 |
lat |
1.2 |
set -x
|
177 |
lat |
1.5 |
(crontab -l | fgrep -v /dqmgui/;
|
178 |
|
|
sed -e "s|#COLLECTOR|${collector:-$defcollector}|g" \
|
179 |
|
|
-e "s|#PURGE|${purge:-$defpurge}|g" <%i/etc/crontab) |
|
180 |
|
|
crontab -
|
181 |
lat |
1.2 |
END_OF_SCRIPT
|
182 |
|
|
|
183 |
|
|
sed 's/^ //' > %i/etc/crontab << \END_OF_SCRIPT
|
184 |
lat |
1.5 |
5 */2 * * * %i/etc/purge-old-sessions #PURGE
|
185 |
|
|
0 0 * * * %i/etc/restart-collector #COLLECTOR
|
186 |
|
|
20 0 1 * * %i/etc/archive-collector-logs #COLLECTOR
|
187 |
lat |
1.2 |
END_OF_SCRIPT
|
188 |
|
|
|
189 |
lat |
1.10 |
chmod a+x %i/bin/visDQMDist*
|
190 |
|
|
chmod a+x %i/etc/*-*
|
191 |
lat |
1.2 |
|
192 |
lat |
1.1 |
%post
|
193 |
lat |
1.10 |
%{relocateConfig}bin/visDQMDist*
|
194 |
|
|
%{relocateConfig}etc/*-*
|
195 |
lat |
1.2 |
%{relocateConfig}etc/crontab
|
196 |
lat |
1.1 |
%{relocateConfig}etc/profile.d/env.sh
|
197 |
|
|
%{relocateConfig}etc/profile.d/env.csh
|