1 |
< |
### RPM cms overview 4.6.2 |
1 |
> |
### RPM cms overview 5.1.6 |
2 |
|
|
3 |
+ |
# 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 |
|
%define cvsserver cvs://:pserver:anonymous@cmscvs.cern.ch:2401/cvs_server/repositories/CMSSW?passwd=AA_:yZZ3e |
9 |
+ |
%define scram $SCRAMV1_ROOT/bin/scram --arch %cmsplatf |
10 |
+ |
%define cmssw CMSSW_3_3_1 |
11 |
+ |
%define vcfg V03-26-04-01 |
12 |
|
%define initenv export ZZPATH=$PATH ZZLD_LIBRARY_PATH=$LD_LIBRARY_PATH ZZPYTHONPATH=$PYTHONPATH; %initenv_all |
13 |
|
|
14 |
< |
Source0: %{cvsserver}&strategy=checkout&module=CMSSW/VisMonitoring/DQMServer&export=VisMonitoring/DQMServer&tag=-rR04-06-02&output=/DQMServer.tar.gz |
15 |
< |
Requires: cherrypy py2-cheetah yui py2-pysqlite py2-cx-oracle py2-pil py2-matplotlib |
16 |
< |
Provides: /usr/bin/python |
14 |
> |
Source0: %{cvsserver}&strategy=checkout&module=config&export=config&tag=-r%{vcfg}&output=/config.tar.gz |
15 |
> |
Source1: %{cvsserver}&strategy=checkout&module=CMSSW/VisMonitoring/DQMServer&export=VisMonitoring/DQMServer&tag=-rR05-01-06&output=/DQMServer.tar.gz |
16 |
> |
Requires: cherrypy py2-cheetah yui py2-cx-oracle py2-pil py2-matplotlib overview-conf SCRAMV1 |
17 |
|
|
18 |
+ |
# Set up minimal SCRAM project build area with our sources. |
19 |
|
%prep |
20 |
< |
%setup -c -T -n src -a 0 |
21 |
< |
tar -jcvf ../distsrc.tar.bz2 . |
20 |
> |
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 |
|
|
28 |
< |
%build |
29 |
< |
for f in */*/scripts/visDQM*; do |
16 |
< |
mv $f $(echo $f | sed s/visDQM/ov/g) |
17 |
< |
done |
18 |
< |
|
19 |
< |
%install |
20 |
< |
# Relocate code to normal %i/{lib,bin,python} directories. Save the |
21 |
< |
# runtime environment needed for later use, but avoid excess values. |
22 |
< |
mkdir -p %i/etc/profile.d %i/{x,}bin %i/{x,}lib %i/{x,}python %i/data |
23 |
< |
cp -p %_builddir/distsrc.tar.bz2 %i/data |
24 |
< |
export PYTHONPATH=%i/python${PYTHONPATH+":$PYTHONPATH"}; |
25 |
< |
|
26 |
< |
cd %_builddir/src |
27 |
< |
for d in */*; do |
28 |
< |
if [ -d $d/python ]; then |
29 |
< |
cp -p $d/python/*.{py,js,css,gif,png,tmpl} %i/python |
30 |
< |
rm -f %i/python/GuiDQM.py |
31 |
< |
fi |
32 |
< |
|
33 |
< |
for f in $d/scripts/*; do |
34 |
< |
if [ -f $f ]; then cp -p $f %i/bin; fi |
35 |
< |
done |
36 |
< |
done |
28 |
> |
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 |
< |
for mod in %i/python/*.py; do |
32 |
< |
python -c "import $(basename $mod | sed 's/\.py$//')" |
33 |
< |
done |
34 |
< |
|
35 |
< |
# Now generate server start-up environment. Eliminate non-existent and |
36 |
< |
# duplicate path components and convert back to format that only adds to |
37 |
< |
# user's one, not one that uses RPM-builder's environment. Finally munge |
38 |
< |
# in patch directories. |
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 |
> |
%build |
38 |
> |
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 |
|
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 |
< |
perl -w -i -e \ |
59 |
< |
'open(SH, "> %i/etc/profile.d/env.sh") || die; |
60 |
< |
open(CSH, "> %i/etc/profile.d/env.csh") || die; |
61 |
< |
$ENV{PATH} = "%i/xbin:%i/bin:$ENV{PATH}"; |
62 |
< |
$ENV{LD_LIBRARY_PATH} = "%i/xlib:%i/lib:$ENV{LD_LIBRARY_PATH}"; |
63 |
< |
$ENV{PYTHONPATH} = "%i/xpython:%i/python:$ENV{PYTHONPATH}"; |
58 |
> |
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 |
|
foreach $p ("PATH", "LD_LIBRARY_PATH", "PYTHONPATH") { |
69 |
< |
%%seen = (); |
59 |
< |
$ENV{"ZZ$p"} = join(":", grep($_ && -d $_ && scalar(@{[<$_/*>]}) > 0, split(/:/,$ENV{"ZZ$p"}))); |
60 |
< |
$ENV{"$p"} = join(":", grep($_ && -d $_ && scalar(@{[<$_/*>]}) > 0, split(/:/,$ENV{"$p"}))); |
61 |
< |
$ENV{$p} =~ s<([ :=])$ENV{"ZZ$p"}([ :;"]|$)><$1\${$p}$2>g if $ENV{"ZZ$p"}; |
62 |
< |
$ENV{$p} = join(":", map { ($seen{$_} ? () : do { $seen{$_} = 1; ($_) }) } split(/:/, $ENV{$p})); |
63 |
< |
print SH "export $p=$ENV{$p};\n"; |
64 |
< |
print CSH "setenv $p $ENV{$p};\n"; |
69 |
> |
s<([ :=])$ENV{"ZZ$p"}([ :;"]|$)><$1\${$p}$2>g if $ENV{"ZZ$p"}; |
70 |
|
} |
71 |
< |
print SH "export YUI_ROOT=$ENV{YUI_ROOT};\n"; |
72 |
< |
print CSH "setenv YUI_ROOT $ENV{YUI_ROOT};\n"; |
73 |
< |
close(SH); close(CSH);' |
71 |
> |
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 |
|
|
119 |
|
# Script to record what sources went into this package so user can |
120 |
|
# check them out conveniently. |
133 |
|
xargs $doit sed -i -e "s|.*|$cvs|" |
134 |
|
END_OF_SCRIPT |
135 |
|
|
136 |
+ |
# 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 |
|
# 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 |
245 |
|
%{relocateConfig}etc/crontab |
246 |
|
%{relocateConfig}etc/profile.d/env.sh |
247 |
|
%{relocateConfig}etc/profile.d/env.csh |
248 |
+ |
%{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/* |