ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CMSDIST/overview.spec
Revision: 1.4
Committed: Thu Jul 30 08:48:50 2009 UTC (15 years, 9 months ago) by gfball
Branch: MAIN
CVS Tags: MotT0_1_0_2, MotT0_1_0_1, MotT0_1_0_0, MotT0_100531_1, MotT0_100528_1, T0Mon_100518_1, T0Mon_100503_1, T0Mon_100316_1, T0Mon_100308_2, T0Mon_100308_1, T0Mon_100216_1, T0Mon_100210_1, T0Mon_100204_4, T0Mon_100204_3, T0Mon_100204_1, T0Mon_100127_1, dg20091203-comp-base, DQMGUI_5_1_4, DAS_20091117, T0Mon_091111_1, BUILDBOT_01, DQMGUI_5_1_3, DQMGUI_5_1_2, CERNOIDv02, DQMGUI_5_1_1, DQMGUI_5_1_0, CouchDB_0_10_0, CERNOIDv01, WMCORE-before-refactor, PerfSuiteDB_20090930, PerfSuiteDB_20090916, PerfSuiteDB_20090904_almost_stable, PerfSuiteDB_20090904, PerfSuiteDB_20090901, forHEARTBEATr04, RPMVERIFY_0_2, forHEARTBEATr01
Changes since 1.3: +3 -2 lines
Log Message:
Overview 4.6.2

File Contents

# User Rev Content
1 gfball 1.4 ### RPM cms overview 4.6.2
2 lat 1.1
3     %define cvsserver cvs://:pserver:anonymous@cmscvs.cern.ch:2401/cvs_server/repositories/CMSSW?passwd=AA_:yZZ3e
4     %define initenv export ZZPATH=$PATH ZZLD_LIBRARY_PATH=$LD_LIBRARY_PATH ZZPYTHONPATH=$PYTHONPATH; %initenv_all
5    
6 gfball 1.4 Source0: %{cvsserver}&strategy=checkout&module=CMSSW/VisMonitoring/DQMServer&export=VisMonitoring/DQMServer&tag=-rR04-06-02&output=/DQMServer.tar.gz
7 lat 1.1 Requires: cherrypy py2-cheetah yui py2-pysqlite py2-cx-oracle py2-pil py2-matplotlib
8 gfball 1.4 Provides: /usr/bin/python
9 lat 1.1
10     %prep
11     %setup -c -T -n src -a 0
12     tar -jcvf ../distsrc.tar.bz2 .
13    
14     %build
15     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 lat 1.2 cp -p $d/python/*.{py,js,css,gif,png,tmpl} %i/python
30     rm -f %i/python/GuiDQM.py
31 lat 1.1 fi
32    
33     for f in $d/scripts/*; do
34     if [ -f $f ]; then cp -p $f %i/bin; fi
35     done
36     done
37    
38 lat 1.2 for mod in %i/python/*.py; do
39     python -c "import $(basename $mod | sed 's/\.py$//')"
40     done
41    
42 lat 1.1 # Now generate server start-up environment. Eliminate non-existent and
43     # duplicate path components and convert back to format that only adds to
44     # user's one, not one that uses RPM-builder's environment. Finally munge
45     # in patch directories.
46     for p in PATH LD_LIBRARY_PATH PYTHONPATH; do
47     for z in "" ZZ; do
48     eval export $z$p=$(perl -e 'print join(":", grep($_ && -d $_ && scalar(@{[<$_/*>]}) > 0, split(/:/,$ENV{'$z$p'})))')
49     done
50     done
51     perl -w -i -e \
52     'open(SH, "> %i/etc/profile.d/env.sh") || die;
53     open(CSH, "> %i/etc/profile.d/env.csh") || die;
54     $ENV{PATH} = "%i/xbin:%i/bin:$ENV{PATH}";
55     $ENV{LD_LIBRARY_PATH} = "%i/xlib:%i/lib:$ENV{LD_LIBRARY_PATH}";
56     $ENV{PYTHONPATH} = "%i/xpython:%i/python:$ENV{PYTHONPATH}";
57     foreach $p ("PATH", "LD_LIBRARY_PATH", "PYTHONPATH") {
58     %%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";
65     }
66     print SH "export YUI_ROOT=$ENV{YUI_ROOT};\n";
67     print CSH "setenv YUI_ROOT $ENV{YUI_ROOT};\n";
68     close(SH); close(CSH);'
69    
70     # Script to record what sources went into this package so user can
71     # check them out conveniently.
72     sed 's/^ //' > %i/bin/ovDistSource << \END_OF_SCRIPT
73     #!/bin/sh
74     doit= shopt=-ex cvs=${CVSROOT:-":pserver:anonymous@cmscvs.cern.ch:/cvs/CMSSW"}
75     while [ $# -gt 0 ]; do
76     case $1 in
77     -n ) doit=echo shopt=-e; shift ;;
78     * ) echo "$0: unrecognised parameter: $1" 1>&2; exit 1 ;;
79     esac
80     done
81     set $shopt
82     $doit tar -jxf %i/data/distsrc.tar.bz2
83     tar -jtf %i/data/distsrc.tar.bz2 '*/CVS/Root' |
84     xargs $doit sed -i -e "s|.*|$cvs|"
85     END_OF_SCRIPT
86    
87     # Script to patch the server from the local developer area. The user's
88     # stuff goes into xbin/xlib/xpython directories, which are in front of
89     # the server's own bin/lib/python directories. So anything in x* will
90     # be picked up in preference to the server-distributed files.
91     sed 's/^ //' > %i/bin/ovDistPatch << \END_OF_SCRIPT
92     #!/bin/sh
93    
94     if [ X"$CMSSW_BASE" = X ]; then
95     echo "scram runtime not set, will use one from $PWD" 1>&2
96     eval `scram runtime -sh`
97     fi
98    
99     if [ X"$CMSSW_BASE" = X ] || [ X"$SCRAM_ARCH" = X ] || \
100     [ ! -f "$CMSSW_BASE/src/VisMonitoring/DQMServer/python/GuiCore.py" ]; then
101     echo "error: could not locate local scram developer area, exiting" 1>&2
102     exit 1;
103     fi
104    
105     set -e
106     rm -fr %i/x{lib,bin,python}/{*,.??*}
107    
108     echo "copying $CMSSW_BASE/lib/$SCRAM_ARCH into %i/xlib"
109     (cd $CMSSW_BASE/lib/$SCRAM_ARCH && tar -cf - .) | (cd %i/xlib && tar -xf -)
110    
111     echo "copying $CMSSW_BASE/bin/$SCRAM_ARCH into %i/xbin"
112     (cd $CMSSW_BASE/bin/$SCRAM_ARCH && tar -cf - .) | (cd %i/xbin && tar -xf -)
113    
114     echo "copying $CMSSW_BASE/src/VisMonitoring/DQMServer/python into %i/xpython"
115     (cd $CMSSW_BASE/src/VisMonitoring/DQMServer/python && tar -cf - *.*) | (cd %i/xpython && tar -xf -)
116    
117     echo "renaming utility scripts"
118     for f in %i/xbin/visDQM*; do
119     mv $f $(echo $f | sed s/visDQM/ov/g)
120     done
121     exit 0
122     END_OF_SCRIPT
123    
124     # Script to unpatch the server area. Simply clears out xbin/xlib/xpython
125     # so the server will then pick up the files distributed with the RPM.
126     sed 's/^ //' > %i/bin/ovDistUnpatch << \END_OF_SCRIPT
127     #!/bin/sh
128     echo "removing local overrides from %i"
129     rm -fr %i/x{lib,bin,python}/{*,.??*}
130     exit 0
131     END_OF_SCRIPT
132    
133     # CRON script to purge sessions abandoned by users.
134     sed 's/^ //' > %i/etc/purge-old-sessions << \END_OF_SCRIPT
135     #!/bin/sh
136     . %instroot/cmsset_default.sh
137     . %i/etc/profile.d/env.sh
138     for opt; do
139     [ -d "$opt/gui/www/sessions" ] || continue
140     ovPurgeSessions $opt/gui/www/sessions
141     done
142     END_OF_SCRIPT
143    
144     # Utility script to update CRONTAB entries to this server version.
145     # Accounts for changes in the server configurations. For details
146     # of use see DQMGuiProduction twiki page.
147     sed 's/^ //' > %i/etc/update-crontab << \END_OF_SCRIPT
148     #!/bin/sh
149     purge= defpurge=$(dirname %instroot)
150     while [ $# -gt 0 ]; do
151     case $1 in
152     --purge )
153     purge="$purge $2"
154     shift; shift ;;
155     * )
156     echo "$(basename $0): unrecognised option $1" 1>&2
157     exit 1 ;;
158     esac
159     done
160    
161     set -x
162     (crontab -l | fgrep -v /overview/;
163     sed -e "s|#PURGE|${purge:-$defpurge}|g" <%i/etc/crontab) |
164     crontab -
165     END_OF_SCRIPT
166    
167     # CRONTAB entries for this server. This will be modified by the
168     # update-crontab script and merged to other crontab rules.
169     sed 's/^ //' > %i/etc/crontab << \END_OF_SCRIPT
170     5 */2 * * * %i/etc/purge-old-sessions #PURGE
171     END_OF_SCRIPT
172    
173     chmod a+x %i/bin/ovDist*
174     chmod a+x %i/etc/*-*
175    
176     # Post installation rules. Relocate the various scripts.
177     # Relocate SCRAM-generated external link "database".
178     %post
179     %{relocateConfig}bin/ovDist*
180     %{relocateConfig}etc/*-*
181     %{relocateConfig}etc/crontab
182     %{relocateConfig}etc/profile.d/env.sh
183     %{relocateConfig}etc/profile.d/env.csh