File rhncfg.spec of Package rhncfg.539

#
# spec file for package rhncfg
#
# Copyright (c) 2015 SUSE LINUX 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/
#


# package renaming fun :(
%define rhn_client_tools spacewalk-client-tools
%define rhn_setup	 spacewalk-client-setup
%define rhn_check	 spacewalk-check
%define rhnsd		 spacewalksd
#
%global rhnroot %{_datadir}/rhn
%global rhnconf %{_sysconfdir}/sysconfig/rhn
%global client_caps_dir %{rhnconf}/clientCaps.d

Name:           rhncfg
Summary:        Spacewalk Configuration Client Libraries
License:        GPL-2.0
Group:          Applications/System
Url:            https://fedorahosted.org/spacewalk
Source0:        rhncfg-git-0.852b4c0.tar.gz
Version:        5.10.65.11
Release:        0
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
BuildRequires:  docbook-utils
BuildRequires:  python
Requires:       python
Requires:       rhnlib
%if 0%{?rhel} && 0%{?rhel} < 6
Requires:       rhn-client-tools >= 0.4.20-86
%else
%if 0%{?el6}
Requires:       rhn-client-tools >= 1.0.0-51
%else
# who knows what version we need? Let's just hope it's up to date enough.
Requires:       %{rhn_client_tools}
%endif
%endif

%if 0%{?suse_version}
# provide rhn directories and no selinux on suse
BuildRequires:  spacewalk-client-tools
%if %{suse_version} >= 1110
# Only on SLES11
Requires:       python-selinux
%endif
%else
Requires:       libselinux-python
%endif

%description
The base libraries and functions needed by all rhncfg-* packages.

%package client
Summary:        Spacewalk Configuration Client
Group:          Applications/System
Requires:       %{name} = %{version}-%{release}

%description client
A command line interface to the client features of the Spacewalk Configuration
Management system.

%package management
Summary:        Spacewalk Configuration Management Client
Group:          Applications/System
Requires:       %{name} = %{version}-%{release}

%description management
A command line interface used to manage Spacewalk configuration.

%package actions
Summary:        Spacewalk Configuration Client Actions
Group:          Applications/System
Requires:       %{name} = %{version}-%{release}
Requires:       %{name}-client

%description actions
The code required to run configuration actions scheduled via Spacewalk.

%prep
%setup -q -n rhncfg-git-0.852b4c0

%build
make -f Makefile.rhncfg all

%install
rm -rf $RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT/%{rhnroot}
make -f Makefile.rhncfg install PREFIX=$RPM_BUILD_ROOT ROOT=%{rhnroot} \
    MANDIR=%{_mandir}
mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/spool/rhn
mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/log
touch $RPM_BUILD_ROOT/%{_localstatedir}/log/rhncfg-actions

%if 0%{?suse_version}
ln -s rhncfg-manager $RPM_BUILD_ROOT/%{_bindir}/mgrcfg-manager
ln -s rhncfg-client $RPM_BUILD_ROOT/%{_bindir}/mgrcfg-client
ln -s rhn-actions-control $RPM_BUILD_ROOT/%{_bindir}/mgr-actions-control
%py_compile %{buildroot}/%{rhnroot}
%py_compile -O %{buildroot}/%{rhnroot}
%endif

%clean
rm -rf $RPM_BUILD_ROOT

%post
if [ -f %{_localstatedir}/log/rhncfg-actions ]
then 
chown root %{_localstatedir}/log/rhncfg-actions
chmod 600 %{_localstatedir}/log/rhncfg-actions
fi

%files
%defattr(-,root,root,-)
%dir %{_localstatedir}/spool/rhn
%{rhnroot}/config_common
%doc LICENSE

%files client
%defattr(-,root,root,-)
%{rhnroot}/config_client
%{_bindir}/rhncfg-client
%if 0%{?suse_version}
%{_bindir}/mgrcfg-client
%endif
%attr(644,root,root) %config(noreplace) %{rhnconf}/rhncfg-client.conf
%{_mandir}/man8/rhncfg-client.8*

%files management
%defattr(-,root,root,-)
%{rhnroot}/config_management
%if 0%{?suse_version}
%{_bindir}/mgrcfg-manager
%endif
%{_bindir}/rhncfg-manager
%attr(644,root,root) %config(noreplace) %{rhnconf}/rhncfg-manager.conf
%{_mandir}/man8/rhncfg-manager.8*

%files actions
%defattr(-,root,root,-)
%{rhnroot}/actions
%if 0%{?suse_version}
%{_bindir}/mgr-actions-control
%endif
%{_bindir}/rhn-actions-control
%config(noreplace) %{client_caps_dir}/*
%{_mandir}/man8/rhn-actions-control.8*
%ghost %attr(600,root,root) %{_localstatedir}/log/rhncfg-actions

%changelog
openSUSE Build Service is sponsored by