ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CMSDIST/webtools-base.spec
Revision: 1.8
Committed: Thu Oct 16 13:31:12 2008 UTC (16 years, 6 months ago) by valya
Branch: MAIN
CVS Tags: WEBTOOLS-APPS_20081016
Changes since 1.7: +2 -2 lines
Log Message:
New tag

File Contents

# User Rev Content
1 valya 1.8 ### RPM cms webtools-base 0.1.5
2 valya 1.1 ## INITENV +PATH PYTHONPATH %i/lib/python`echo $PYTHON_VERSION | cut -d. -f 1,2`/site-packages
3     %define moduleName WEBTOOLS
4     %define exportName WEBTOOLS
5 valya 1.8 %define cvstag V01-03-20
6 valya 1.1 %define cvsserver cvs://:pserver:anonymous@cmscvs.cern.ch:2401/cvs_server/repositories/CMSSW?passwd=AA_:yZZ3e
7     Source: %cvsserver&strategy=checkout&module=%{moduleName}&nocache=true&export=%{exportName}&tag=-r%{cvstag}&output=/%{moduleName}.tar.gz
8     Requires: python cherrypy py2-cheetah yui webtools
9     Provides: perl(CGI)
10     Provides: perl(Crypt::CBC)
11     Provides: perl(SecurityModule)
12     Provides: perl(DBI)
13     %prep
14     %setup -n %{moduleName}
15     %build
16    
17     rm -rf %i/etc/profile.d
18     mkdir -p %i/etc/profile.d
19     echo '#!/bin/sh' > %{i}/etc/profile.d/dependencies-setup.sh
20     echo '#!/bin/tcsh' > %{i}/etc/profile.d/dependencies-setup.csh
21     echo requiredtools `echo %{requiredtools} | sed -e's|\s+| |;s|^\s+||'`
22     for tool in `echo %{requiredtools} | sed -e's|\s+| |;s|^\s+||'`
23     do
24     case X$tool in
25     Xdistcc|Xccache )
26     ;;
27     * )
28     toolcap=`echo $tool | tr a-z- A-Z_`
29     eval echo ". $`echo ${toolcap}_ROOT`/etc/profile.d/init.sh" >> %{i}/etc/profile.d/dependencies-setup.sh
30     eval echo "source $`echo ${toolcap}_ROOT`/etc/profile.d/init.csh" >> %{i}/etc/profile.d/dependencies-setup.csh
31     ;;
32     esac
33     done
34    
35     perl -p -i -e 's|\. /etc/profile\.d/init\.sh||' %{i}/etc/profile.d/dependencies-setup.sh
36     perl -p -i -e 's|source /etc/profile\.d/init\.csh||' %{i}/etc/profile.d/dependencies-setup.csh
37    
38     %install
39     mkdir -p %i/etc
40     mkdir -p %i/bin
41     mkdir -p %i/lib/python`echo $PYTHON_VERSION | cut -d. -f1,2`/site-packages/Applications
42     cp -r Applications/base %i/lib/python`echo $PYTHON_VERSION | cut -d. -f1,2`/site-packages/Applications
43     cp cmsWeb %i/bin
44 valya 1.2
45    
46 valya 1.3 cat << \EOF > %i/bin/base_init
47 valya 1.2 #!/bin/bash
48     #
49     # dbs_discovery This script runs CMS DBS Data Discovery service
50     #
51     # chkconfig: 345 05 95
52    
53     if [ -z ${WEBTOOLS_BASE_ROOT} ]; then
54     echo $"The WEBTOOLS_BASE_ROOT environment is not set"
55     exit 1
56     fi
57    
58     RETVAL=$?
59    
60     port=7999
61     pid=`ps auxw | grep WSServer | grep -v grep | awk '{print $2}'`
62     base=base
63 valya 1.4 if [ -n "$WEBTOOLS_BASEURL" ]; then
64     url="$WEBTOOLS_BASEURL/$base"
65     else
66     url="http://cmsweb.cern.ch/$base"
67     fi
68     cmd="cmsWeb --base-url=$url --port $port --default-page /WSServer"
69 valya 1.2
70     case "$1" in
71     restart)
72     echo $"Checking for existing WSServer..."
73     if [ ! -z ${pid} ]; then
74     kill -9 ${pid}
75     fi
76     echo $"Restart WSServer..."
77     nohup ${cmd} 2>&1 1>& /dev/null < /dev/null &
78     ;;
79     start)
80     if [ ! -z ${pid} ]; then
81     kill -9 ${pid}
82     fi
83     nohup ${cmd} 2>&1 1>& /dev/null < /dev/null &
84     ;;
85     status)
86     if [ ! -z ${pid} ]; then
87     echo $"${base} is running, pid=${pid}"
88     exit 0
89     fi
90     echo $"${base} is stopped"
91     exit 3
92     ;;
93     stop)
94     if [ ! -z ${pid} ]; then
95     kill -9 ${pid}
96     fi
97     ;;
98     *)
99     echo $"Usage: $0 {start|stop|status|restart}"
100     exit 1
101     ;;
102     esac
103    
104     exit $RETVAL
105    
106     EOF
107 valya 1.4 chmod a+x %i/bin/base_init
108 valya 1.2
109 valya 1.1 %post
110     %{relocateConfig}etc/profile.d/dependencies-setup.sh
111     %{relocateConfig}etc/profile.d/dependencies-setup.csh
112     perl -p -i -e "s!\@RPM_INSTALL_PREFIX\@!$RPM_INSTALL_PREFIX/%pkgrel!" $RPM_INSTALL_PREFIX/%pkgrel/bin/cmsWeb
113