File yast2-dbus-server.spec of Package yast2-dbus-server

#
# spec file for package yast2-dbus-server
#
# Copyright (c) 2011 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/
#

# norootforbuild


Name:           yast2-dbus-server
Version:        2.20.0
Release:        3

BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Source0:        yast2-dbus-server-2.20.0.tar.bz2

Prefix:         /usr

Group:          System/YaST
License:        GPLv2+
# obviously
BuildRequires:  gcc-c++
# needed for all yast packages
BuildRequires:  yast2-core-devel yast2-devtools
# testsuite
BuildRequires:  dejagnu
# autodocs
BuildRequires:  doxygen
# docbook docs
BuildRequires:  docbook-xsl-stylesheets libxslt
# catalog: convert URIs to local filenames
BuildRequires:  sgml-skel

# for SCR DBus service
BuildRequires:  PolicyKit-devel dbus-1-devel dbus-1-x11 libxcrypt-devel
# its tests
BuildRequires:  dbus-1-python python-devel

Summary:        YaST2 - DBus Server

%description
This package contains YaST DBus service, it provides DBus access 
to YaST components.

%prep
%setup -n yast2-dbus-server-2.20.0

%build

%{prefix}/bin/y2tool y2autoconf
%{prefix}/bin/y2tool y2automake
autoreconf --force --install

export CFLAGS="$RPM_OPT_FLAGS -DNDEBUG"
export CXXFLAGS="$RPM_OPT_FLAGS -DNDEBUG"

%{?suse_update_config:%{suse_update_config -f}}
./configure --libdir=%{_libdir} --prefix=%{prefix} --mandir=%{_mandir}
# V=1: verbose build in case we used AM_SILENT_RULES(yes)
# so that RPM_OPT_FLAGS check works
make %{?jobs:-j%jobs} V=1

%install
make install DESTDIR="$RPM_BUILD_ROOT"
# temporarily disable tests - DBus may hang (see bnc#645381)
#[ -e "%{prefix}/share/YaST2/data/devtools/NO_MAKE_CHECK" ] || Y2DIR="$RPM_BUILD_ROOT/usr/share/YaST2" make check DESTDIR="$RPM_BUILD_ROOT"
for f in `find $RPM_BUILD_ROOT/%{prefix}/share/applications/YaST2/ -name "*.desktop"` ; do
    d=${f##*/}
    %suse_update_desktop_file -d ycc_${d%.desktop} ${d%.desktop}
done

# remove not needed development files
rm %{buildroot}/%{_libdir}/YaST2/plugin/liby2dbus.la
rm %{buildroot}/%{_libdir}/YaST2/plugin/liby2dbus.so

%clean
rm -rf "$RPM_BUILD_ROOT"

%post
/sbin/ldconfig
# This is a workaround for dbus reloading too soon. (bnc#502719#c4).
# In oS 11.2 there exists rcdbus reload, so this is for a SLE backport.
# The /dev/null is a workaround for http://bugs.freedesktop.org/show_bug.cgi?id=896#c23
# But if there is nothing to reload, don't fail.
dbus-send --print-reply --system --dest=org.freedesktop.DBus / org.freedesktop.DBus.ReloadConfig >/dev/null || true

%postun
/sbin/ldconfig
dbus-send --print-reply --system --dest=org.freedesktop.DBus / org.freedesktop.DBus.ReloadConfig >/dev/null || true

%files
%defattr(-,root,root)

%{_libdir}/YaST2/plugin/lib*.so.*

# DBus service
%{prefix}/lib/YaST2/bin/SCR_dbus_server
# DBus service config
/usr/share/dbus-1/system-services/org.opensuse.yast.SCR.service
%config /etc/dbus-1/system.d/org.opensuse.yast.SCR.conf
# PolicyKit default policies
/usr/share/PolicyKit/policy/org.opensuse.yast.scr.policy

# DBus namespace service
%{prefix}/lib/YaST2/bin/yast_modules_dbus_server
/usr/share/dbus-1/system-services/org.opensuse.YaST.modules.service
%config /etc/dbus-1/system.d/org.opensuse.YaST.modules.conf
/usr/share/PolicyKit/policy/org.opensuse.yast.module-manager.policy

%doc %{prefix}/share/doc/packages/yast2-dbus-server

%changelog