LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File hawk.spec of Package hawk (Project openSUSE:Factory)

# spec file for package hawk
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/

%define	www_base	/srv/www
%define	vendor_ruby	vendor_ruby
%define	init_style	suse
%define	pkg_group	Productivity/Clustering/HA

%define	gname		haclient
%define	uname		hacluster

Name:           hawk
Summary:        HA Web Konsole
License:        GPL-2.0
Group:          Productivity/Clustering/HA
Version:        0.5.2
Release:        0
Url:            http://www.clusterlabs.org/wiki/Hawk
Source:         %{name}-%{version}.tar.bz2
Source1:        filter-requires.sh
Source100:      hawk-rpmlintrc
Patch2:         require-rack-1.1.patch
Patch5:         fix-rails-freeze-version_requirements.patch
Patch10:        ruby-1.9-when.patch
Patch11:        ruby-1.9-hash.patch
%define		_use_internal_dependency_generator 0
%define		__find_requires /bin/sh %{SOURCE1}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Requires:       hawk-templates >= %{version}-%{release}
%if 0%{?suse_version}
Requires:       pacemaker-ticket-support >= 2.0
Requires:       pacemaker
Requires:       graphviz
Requires:       graphviz-gd
Requires:       lighttpd >= 1.4.20
Requires:       ruby
%if 0%{?suse_version} < 1220
BuildRequires:  ruby-fcgi
Requires:       rubygem-rack-1_1
Requires:       rubygem-ruby-fcgi
Recommends:     graphviz-gnome
BuildRequires:  glib2-devel
BuildRequires:  libxml2-devel
BuildRequires:  pam-devel
BuildRequires:  rubygem-gettext_rails
BuildRequires:  rubygem-rake
BuildRequires:  rubygems
PreReq:         permissions
BuildRequires:  fdupes
BuildRequires:  libpacemaker-devel
BuildRequires:  rubygem-rails-2_3
# Temporary, prevents confusion between rubygem-rack and rubygem-rack-1_3
BuildRequires:  rubygem-rack < 1.3
# Require startproc respecting -p, bnc#559534#c44
%if 0%{?suse_version} > 1110
# 11.2 or newer; 
Requires:       sysvinit > 2.86-215.2
# 11.1 or SLES11
Requires:       sysvinit > 2.86-195.3.1

A web-based GUI for managing and monitoring the Pacemaker
High-Availability cluster resource manager.

Authors: Tim Serong <tserong@suse.com>

%package templates
Summary:        Hawk Setup Wizard Templates
Group:          Productivity/Clustering/HA

%description templates
Template files for Hawk's cluster setup wizard.

Authors: Tim Serong <tserong@suse.com>

%patch2 -p0
%patch5 -p0
%patch10 -p1
%patch11 -p1

export CFLAGS
make WWW_BASE=%{www_base} INIT_STYLE=%{init_style} LIBDIR=%{_libdir} BINDIR=%{_bindir} SBINDIR=%{_sbindir}

make WWW_BASE=%{www_base} INIT_STYLE=%{init_style} DESTDIR=%{buildroot} install
# copy of GPL
cp COPYING %{buildroot}%{www_base}/hawk/
%if 0%{?suse_version} < 1220
# note: only doing evil magic pre-openSUSE 12.2
# evil magic to get ruby-fcgi into the vendor directory
for f in $(rpm -ql ruby-fcgi|grep %{vendor_ruby}); do
	# gives something simliar to:
	#  /usr/lib64/ruby/vendor_ruby/1.8/fcgi.rb
	#  /usr/lib64/ruby/vendor_ruby/1.8/x86_64-linux/fcgi.so
	r=$(echo $f | sed 's/.*%{vendor_ruby}\/[^\/]*\///')
	mkdir -p %{buildroot}%{www_base}/hawk/vendor/$(dirname $r)
	cp $f %{buildroot}%{www_base}/hawk/vendor/$r
# even more evil magic to get rubygems into the vendor directory
for f in $(rpm -ql rubygems|grep %{vendor_ruby}); do
	# gives something simliar to:
	#  /usr/lib64/ruby/vendor_ruby/1.8/rubygems.rb
	#  /usr/lib64/ruby/vendor_ruby/1.8/rubygems/...
	[ -f $f ] || continue
	r=$(echo $f | sed 's/.*%{vendor_ruby}\/[^\/]*\///')
	mkdir -p %{buildroot}%{www_base}/hawk/vendor/$(dirname $r)
	cp $f %{buildroot}%{www_base}/hawk/vendor/$r
# get rid of gem sample and test cruft
rm -rf %{buildroot}%{www_base}/hawk/vendor/gems/*/sample
rm -rf %{buildroot}%{www_base}/hawk/vendor/gems/*/samples
rm -rf %{buildroot}%{www_base}/hawk/vendor/gems/*/test
rm -rf %{buildroot}%{www_base}/hawk/vendor/gems/*/doc
# mark .mo files as such (works on SUSE but not FC12, as the latter wants directory to
# be "share/locale", not just "locale", and it also doesn't support appending to %%{name}.lang)
%find_lang %{name} %{name}.lang
%find_lang rgettext %{name}.lang
%find_lang gettext_rails %{name}.lang
# hard link duplicate files
%fdupes %{buildroot}
# more cruft to clean up (WTF?)
rm -f %{buildroot}%{www_base}/hawk/log/*
find %{buildroot}%{www_base}/hawk/vendor/rails -type f -name '*.css' -o -name '*.js' -o -name '*LICENSE' | xargs chmod a-x
# get rid of packed gem specification files
rm -f %{buildroot}%{www_base}/hawk/vendor/gems/*/.specification
# likewise emtpy files (again, I say, WTF?)
find %{buildroot}%{www_base}/hawk/vendor -type f -empty | xargs rm
# init script
%{__install} -d -m 0755 \
%{__install} -D -m 0755 scripts/hawk.%{init_style} \
%{__ln_s} -f %{_sysconfdir}/init.d/hawk %{buildroot}%{_sbindir}/rchawk

rm -rf %{buildroot}

%verify_permissions -e %{_sbindir}/hawk_chkpwd
%verify_permissions -e %{_sbindir}/hawk_invoke

%set_permissions %{_sbindir}/hawk_chkpwd
%set_permissions %{_sbindir}/hawk_invoke
%fillup_and_insserv hawk

%stop_on_removal hawk

%restart_on_update hawk

%triggerin -- lighttpd
%restart_on_update hawk

%files -f %{name}.lang
%attr(4750, root, %{gname})%{_sbindir}/hawk_chkpwd
%attr(4750, root, %{gname})%{_sbindir}/hawk_invoke
%dir %{www_base}/hawk
# Packaged in hawk-templates
%exclude %{www_base}/hawk/config/wizard
%attr(0750, %{uname},%{gname})%{www_base}/hawk/log
%dir %attr(0750, %{uname},%{gname})%{www_base}/hawk/tmp
%attr(0750, %{uname},%{gname})%{www_base}/hawk/tmp/cache
%attr(0770, %{uname},%{gname})%{www_base}/hawk/tmp/home
%attr(0750, %{uname},%{gname})%{www_base}/hawk/tmp/pids
%attr(0750, %{uname},%{gname})%{www_base}/hawk/tmp/sessions
%attr(0750, %{uname},%{gname})%{www_base}/hawk/tmp/sockets
# itemizing content in %%{www_base}/hawk/vendor and locale to avoid
# duplicate files that would otherwise be the result of including hawk.lang
%dir %{www_base}/hawk/locale
%dir %{www_base}/hawk/locale/*
%dir %{www_base}/hawk/locale/*/*
%dir %{www_base}/hawk/vendor
%if 0%{?suse_version} < 1220
# architecture-specific .so files
# this is moderatly disgusting - the intent is to get everything except
# the content of "data/locale" which is covered by files in hawk.lang
%dir %{www_base}/hawk/vendor/gems
%dir %{www_base}/hawk/vendor/gems/*
%dir %{www_base}/hawk/vendor/gems/*/data
%dir %{www_base}/hawk/vendor/gems/*/data/locale
%dir %{www_base}/hawk/vendor/gems/*/data/locale/*
%dir %{www_base}/hawk/vendor/gems/*/data/locale/*/*
%if 0%{?suse_version} < 1220
%config(noreplace) %attr(-,root,root) %{_sysconfdir}/init.d/hawk
%attr(-,root,root) %{_sbindir}/rchawk

%files templates