1 |
diego |
1.4 |
### RPM cms dbs3 DBS_3_S1_0_pre1
|
2 |
diego |
1.1 |
## INITENV +PATH PYTHONPATH %i/Server/Python/src
|
3 |
|
|
## INITENV SET DBS3_SERVER_ROOT %i/Server/Python
|
4 |
|
|
|
5 |
diego |
1.4 |
%define cvsver %v
|
6 |
diego |
1.1 |
%define configdir Config
|
7 |
|
|
%define instance cms_dbs
|
8 |
|
|
%define serverlogsdir Logs
|
9 |
|
|
%define service DBS
|
10 |
|
|
%define dburl oracle://user:passwd@db
|
11 |
|
|
%define dbowner schemaowner
|
12 |
diego |
1.2 |
%define dbsver DBS_3_0_0
|
13 |
diego |
1.1 |
|
14 |
|
|
Requires: wmcore-webtools wmcore-db-oracle py2-cjson
|
15 |
|
|
Source: cvs://:pserver:anonymous@cmscvs.cern.ch:2401/cvs_server/repositories/CMSSW?passwd=AA_:yZZ3e&strategy=export&nocache=true&module=COMP/DBS/DBS3&export=%{n}&tag=-r%{cvsver}&output=/%{n}.tar.gz
|
16 |
|
|
|
17 |
|
|
%prep
|
18 |
|
|
%setup -n %{n}
|
19 |
|
|
|
20 |
|
|
%build
|
21 |
|
|
|
22 |
|
|
%install
|
23 |
|
|
cp -rp %_builddir/%{n}/* %i/
|
24 |
|
|
mkdir -p %{i}/%{configdir}
|
25 |
|
|
mkdir -p %{i}/%{serverlogsdir}
|
26 |
|
|
|
27 |
|
|
#----------------------------------------
|
28 |
|
|
# Generates the script used to start dbs3
|
29 |
diego |
1.3 |
cat << \EOF > %i/setup.sh
|
30 |
diego |
1.1 |
|
31 |
|
|
if [ -z "$DBS3_ROOT" ]; then
|
32 |
|
|
source ./etc/profile.d/init.sh
|
33 |
|
|
fi
|
34 |
|
|
|
35 |
|
|
dbs3_start1(){
|
36 |
|
|
if [ -z "$1" ]
|
37 |
|
|
then
|
38 |
|
|
$WMCORE_ROOT/src/python/WMCore/WebTools/Root.py -i $DBS3_ROOT/%{configdir}/%{instance}.py
|
39 |
|
|
else
|
40 |
|
|
$WMCORE_ROOT/src/python/WMCore/WebTools/Root.py -i $DBS3_ROOT/%{configdir}/$1.py
|
41 |
|
|
fi
|
42 |
|
|
}
|
43 |
|
|
|
44 |
|
|
dbs3start(){
|
45 |
|
|
if [ -z "$1" ]
|
46 |
|
|
then
|
47 |
|
|
dbs3_start1 1>/dev/null 2>&1 &
|
48 |
|
|
else
|
49 |
|
|
dbs3_start1 $1 1>/dev/null 2>&1 &
|
50 |
|
|
fi
|
51 |
|
|
}
|
52 |
|
|
|
53 |
diego |
1.2 |
EOF
|
54 |
diego |
1.1 |
|
55 |
|
|
#---------------------------
|
56 |
|
|
# Generates DBS config file
|
57 |
diego |
1.3 |
cat << \EOF > %{i}/%{configdir}/%{instance}.py
|
58 |
diego |
1.1 |
"""
|
59 |
|
|
DBS Server configuration file
|
60 |
|
|
"""
|
61 |
|
|
import os, logging
|
62 |
|
|
from WMCore.Configuration import Configuration
|
63 |
|
|
|
64 |
|
|
config = Configuration()
|
65 |
|
|
|
66 |
|
|
config.component_('Webtools')
|
67 |
|
|
config.Webtools.port = 8585
|
68 |
|
|
config.Webtools.host = '::'
|
69 |
|
|
config.Webtools.access_log_file = os.environ['DBS3_ROOT'] +"/%{serverlogsdir}/%{instance}.log"
|
70 |
|
|
config.Webtools.error_log_file = os.environ['DBS3_ROOT'] +"/%{serverlogsdir}/%{instance}.log"
|
71 |
|
|
config.Webtools.log_screen = True
|
72 |
|
|
config.Webtools.application = '%{instance}'
|
73 |
|
|
|
74 |
|
|
config.component_('%{instance}')
|
75 |
diego |
1.3 |
config.%{instance}.templates = os.environ['WMCORE_ROOT'] + '/src/templates/WMCore/WebTools'
|
76 |
diego |
1.1 |
config.%{instance}.title = 'DBS Server'
|
77 |
|
|
config.%{instance}.description = 'CMS DBS Service'
|
78 |
diego |
1.4 |
config.%{instance}.admin = 'yourname'
|
79 |
diego |
1.1 |
|
80 |
|
|
config.%{instance}.section_('views')
|
81 |
|
|
|
82 |
|
|
active=config.%{instance}.views.section_('active')
|
83 |
|
|
active.section_('%{service}')
|
84 |
|
|
active.%{service}.object = 'WMCore.WebTools.RESTApi'
|
85 |
|
|
active.%{service}.section_('model')
|
86 |
|
|
active.%{service}.model.object = 'dbs.web.DBSReaderModel'
|
87 |
|
|
active.%{service}.section_('formatter')
|
88 |
|
|
active.%{service}.formatter.object = 'WMCore.WebTools.RESTFormatter'
|
89 |
|
|
|
90 |
|
|
active.%{service}.database = '%{dburl}'
|
91 |
|
|
active.%{service}.dbowner = '%{dbowner}'
|
92 |
diego |
1.2 |
active.%{service}.version = '%{dbsver}'
|
93 |
diego |
1.1 |
|
94 |
diego |
1.2 |
EOF
|
95 |
diego |
1.1 |
|
96 |
|
|
#-----------------------------------
|
97 |
|
|
# Generates DBS config file (writer)
|
98 |
|
|
sed -e 's/%{instance}.log/%{instance}_writer.log/g' -e 's/DBSReaderModel/DBSWriterModel/g' \
|
99 |
|
|
< %{i}/%{configdir}/%{instance}.py > %{i}/%{configdir}/%{instance}_writer.py
|
100 |
|
|
|
101 |
|
|
#--------------------------------------------------------------------
|
102 |
|
|
# The following lines (including relocation ones in the post section)
|
103 |
|
|
# are necessary to correctly setup the environment.
|
104 |
|
|
rm -rf %i/etc/profile.d
|
105 |
|
|
# Copy dependencies to dependencies-setup.sh
|
106 |
|
|
mkdir -p %i/etc/profile.d
|
107 |
|
|
for x in %pkgreqs; do
|
108 |
|
|
case $x in /* ) continue ;; esac
|
109 |
|
|
p=%{instroot}/%{cmsplatf}/$(echo $x | sed 's/\([^+]*\)+\(.*\)+\([A-Z0-9].*\)/\1 \2 \3/' | tr ' ' '/')
|
110 |
|
|
echo ". $p/etc/profile.d/init.sh" >> %i/etc/profile.d/dependencies-setup.sh
|
111 |
|
|
echo "source $p/etc/profile.d/init.csh" >> %i/etc/profile.d/dependencies-setup.csh
|
112 |
|
|
done
|
113 |
|
|
|
114 |
|
|
%post
|
115 |
|
|
%{relocateConfig}etc/profile.d/dependencies-setup.sh
|
116 |
|
|
%{relocateConfig}etc/profile.d/dependencies-setup.csh
|
117 |
|
|
|