Updated ninja spyc test package to require http-api
[ninja.git] / op5build / monitor-ninja.spec
blob1535acd535d84b18501231a75c9996f44a009b1d
1 %define daemon_user monitor
2 %if 0%{?suse_version}
3 %define htmlroot /srv/www/htdocs
4 %define httpconfdir apache2/conf.d
5 %define phpdir /usr/share/php5
6 %define daemon_group www
7 %else
8 %define htmlroot /var/www/html
9 %define httpconfdir httpd/conf.d
10 %define phpdir /usr/share/php
11 %define daemon_group apache
12 %endif
14 Name: monitor-ninja
15 Version: %{op5version}
16 Release: %{op5release}%{?dist}
17 License: GPLv2 and LGPLv2 and ASL 2.0 and BSD and MIT and (MIT or GPL+) and (MIT or GPLv2+)
18 Vendor: op5 AB
19 BuildRoot: %{_tmppath}/%{name}-%{version}
20 Summary: op5 monitor ninja
21 Group: op5/monitor
22 Prefix: /opt/monitor/op5/ninja
23 Requires: monitor-gui-core
24 Requires: merlin-apps >= 0.8.0
25 Requires: merlin
26 Requires: monitor-merlin
27 Requires: php-op5lib >= 1.1.0
28 Requires: wkhtmltopdf
29 Requires: op5-mysql
30 Requires: op5-monitor-supported-webserver
31 Requires: monitor-livestatus
32 Requires: monitor-nacoma
33 Requires: monitor-backup
34 Requires: op5-bootstrap
35 BuildRequires: php-op5lib >= 1.1.0-beta14
36 BuildRequires: rubygem(compass)
37 BuildRequires: doxygen
38 BuildRequires: graphviz
39 %if 0%{?suse_version}
40 Requires: php53
41 Requires: php53-gettext
42 Requires: php53-json
43 Requires: php53-posix
44 Requires: php53-ctype
45 Requires: php53-iconv
46 Requires: php53-mbstring
47 BuildRequires: php53-json
48 BuildRequires: php53-posix
49 BuildRequires: php53-ctype
50 BuildRequires: util-linux
51 BuildRequires: pwdutils
52 BuildRequires: graphviz-gnome
53 BuildRequires: ghostscript-fonts-std
54 %else
55 Requires: php >= 5.3
56 BuildRequires: php >= 5.3
57 BuildRequires: shadow-utils
58 %if 0%{?rhel} >= 6 || 0%{?rhel_version} >=600 || 0%{?centos_version} >=600
59 Requires: php-process
60 Requires: php-mbstring
61 BuildRequires: php-process
62 %else
63 Requires: php-json
64 %endif
65 %endif
67 Source: %name-%version.tar.gz
68 %description
69 Webgui for Nagios.
71 %package test
72 Summary: Test files for ninja
73 Group: op5/Monitor
74 Requires: monitor-ninja = %version
75 Requires: merlin monitor-merlin op5-nagios
76 Requires: merlin-apps
77 Requires: monitor-http-api
78 Requires: monitor-livestatus monitor-nagvis
79 Requires: rubygem20-op5cucumber
80 Requires: portal
81 Requires: op5license-generator
82 Requires: op5-phpunit
83 # For performance graph links on extinfo
84 Requires: monitor-pnp
86 %description test
87 Additional test files for ninja
89 %package devel
90 Summary: Development files for ninja
91 Group: op5/monitor
92 Requires: monitor-ninja = %version
94 %description devel
95 Development files files for ninja
97 %prep
98 %setup -q
99 %if 0%{?suse_version}
100 find -type f -exec %{__sed} '{}' -i -e 's#var/www/html#srv/www/htdocs#g' \;
101 find -type f -exec %{__sed} '{}' -i -e 's#var/www#srv/www#g' \;
102 %endif
104 %build
105 pushd cli-helpers
106 make
107 popd
108 make
109 make docs
112 %install
113 rm -rf %buildroot
114 mkdir -p -m 755 %buildroot%prefix
115 mkdir -p -m 775 %buildroot%prefix/upload
116 mkdir -p -m 775 %buildroot%prefix/application/logs
118 make install-devel SYSCONFDIR=%buildroot%_sysconfdir PREFIX=%buildroot%prefix PHPDIR=%buildroot%phpdir ETC_USER=$(id -un) ETC_GROUP=$(id -gn)
120 # copy everything and then remove what we don't want to ship
121 cp -r * %buildroot%prefix
122 for d in op5build monitor-ninja.spec ninja.doxy \
123 php2doxy.sh example.htaccess cli-helpers/apr_md5_validate.c \
124 README docs/README xdoc
126 rm -rf %buildroot%prefix/$d
127 done
129 sed -i "s/\(IN_PRODUCTION', \)FALSE/\1TRUE/" \
130 %buildroot%prefix/index.php
131 sed -i \
132 -e 's,^\(.config..site_domain.. = .\)/ninja/,\1/monitor/,' \
133 -e 's/^\(.config..product_name.. = .\)Nagios/\1op5 Monitor/' \
134 -e 's/^\(.config..version_info.. = .\)\/etc\/ninja-release/\1\/etc\/op5-monitor-release/' \
135 %buildroot%prefix/application/config/config.php
137 cp op5build/login.png \
138 %buildroot%prefix/application/views/css/default/images
139 cp op5build/favicon.ico \
140 %buildroot%prefix/application/views/icons/16x16/
141 cp op5build/icon.png \
142 %buildroot%prefix/application/views/icons/
144 find %buildroot -print0 | xargs -0 chmod a+r
145 find %buildroot -type d -print0 | xargs -0 chmod a+x
147 mkdir -p %buildroot/etc/cron.d/
148 install -m 644 install_scripts/scheduled_reports.crontab %buildroot/etc/cron.d/scheduled-reports
149 install -m 644 install_scripts/recurring_downtime.crontab %buildroot/etc/cron.d/recurring-downtime
151 # executables
152 for f in cli-helpers/apr_md5_validate \
153 install_scripts/ninja_db_init.sh; do
154 chmod 755 %buildroot%prefix/$f
155 done
157 # The custom_widgets dir need to be writable by the apache user
158 chmod 775 %buildroot%prefix/application/custom_widgets
160 mkdir -p %buildroot/opt/monitor/op5/nacoma/hooks/save
161 install -m 755 install_scripts/nacoma_hooks.py %buildroot/opt/monitor/op5/nacoma/hooks/save/ninja_hooks.py
162 %if 0%{?sles_version}
163 %{py_compile %buildroot/opt/monitor/op5/nacoma/hooks/save}
164 %{py_compile -O %buildroot/opt/monitor/op5/nacoma/hooks/save}
165 %endif
167 mkdir -p %buildroot%_sysconfdir/%{httpconfdir}
168 install -m 640 op5build/ninja.httpd-conf %buildroot/etc/%{httpconfdir}/monitor-ninja.conf
170 # we don't need the git directories
171 rm -rf %buildroot%prefix/application/vendor/phptap/.git
173 sed -i 's/Ninja/op5 Monitor/' %buildroot%prefix/application/media/report_footer.html
175 mkdir -p %buildroot%prefix/application/config/custom
176 install -m 755 test/configs/kohana-configs/exception.php %buildroot%prefix/application/config/custom/exception.php
177 rm %buildroot%prefix/test/configs/kohana-configs/exception.php
179 %pre
180 # This needs to be removed for us to be able to upgrade ninja 2.0.7
181 # for some reason.
182 if test -d %buildroot%prefix/application/vendor/phptap/.git; then
183 rm -rf %buildroot%prefix/application/vendor/phptap/.git
187 %post
188 # Verify that mysql-server is installed and running before executing sql scripts
189 $(mysql -Be "quit" 2>/dev/null) && MYSQL_AVAILABLE=1
190 if [ -n "$MYSQL_AVAILABLE" ]; then
191 pushd %prefix
192 sh install_scripts/ninja_db_init.sh
193 popd
194 else
195 echo "WARNING: mysql-server is not installed or not running."
196 echo "If Oracle database is to be used this is ok."
197 echo "If MySQL database is to be used you need to maually run:"
198 echo " %prefix/install_scripts/ninja_db_init.sh"
199 echo "to complete the setup of %name"
202 $(php %prefix/index.php cli/save_widget --page 'tac/index' --name nagvis --friendly_name "Nagvis" &> /dev/null)
203 $(php %prefix/index.php cli/save_widget --page 'tac/index' --name listview --friendly_name "List view" &> /dev/null)
204 if [ "$?" -ne 0 ]; then
205 echo "WARNING: mysql-server is not installed or not running."
206 echo "If Oracle database is to be used this is ok."
207 echo "If MySQL database is to be used you need to maually"
208 echo "setup the merlin database to complete the setup of %name"
211 # Cleanup symlinks we don't use anymore
212 for link in %{htmlroot}/monitor %{htmlroot}/ninja /op5/monitor/op5/ninja/op5 /opt/monitor/op5/ninja/css /opt/monitor/op5/ninja/js /opt/monitor/op5/ninja/images /opt/monitor/op5/ninja/stylesheets
214 if [ -f $link ]; then
215 rm -f $link
217 done
219 %files
220 %defattr(-,%daemon_user,%daemon_group)
221 %prefix
222 %attr(644,root,root) /etc/cron.d/*
223 %attr(755,root,root) /opt/monitor/op5/nacoma/hooks/save/ninja_hooks.py
224 %attr(644,root,root) /opt/monitor/op5/nacoma/hooks/save/ninja_hooks.pyc
225 %attr(644,root,root) /opt/monitor/op5/nacoma/hooks/save/ninja_hooks.pyo
226 %attr(-,root,%daemon_group) /etc/%{httpconfdir}/monitor-ninja.conf
227 %exclude %prefix/src
228 %exclude %prefix/test
229 %exclude %prefix/modules/test
230 %exclude %prefix/Makefile
231 %exclude %prefix/features
232 %exclude %prefix/application/config/custom/exception.php
234 %files devel
235 %defattr(-,root,root)
236 %phpdir/op5/ninja_sdk
239 %files test
240 %defattr(-,monitor,%daemon_group)
241 %prefix/src
242 %prefix/features
243 %prefix/test
244 %prefix/modules/test
245 %prefix/Makefile
246 %prefix/application/config/custom/exception.php
248 %clean
249 rm -rf %buildroot