File spacewalk-backend.spec of Package spacewalk-backend

#
# spec file for package spacewalk-backend
#
# Copyright (c) 2014 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/
#


%global rhnroot %{_prefix}/share/rhn
%global rhnconfigdefaults %{rhnroot}/config-defaults
%global rhnconf %{_sysconfdir}/rhn
%if 0%{?suse_version}
%global apacheconfd %{_sysconfdir}/apache2/conf.d
%global apache_user wwwrun
%global apache_group www
%else
%global apacheconfd %{_sysconfdir}/httpd/conf.d
%global apache_user apache
%global apache_group apache
%endif
%if 0%{?rhel} || 0%{?suse_version}
%{!?py_ver:     %define py_ver     %(python -c "import sys; v=sys.version_info[:2]; print '%%d.%%d'%%v" 2>/dev/null || echo PYTHON-NOT-FOUND)}
%{!?py_prefix:  %define py_prefix  %(python -c "import sys; print sys.prefix" 2>/dev/null || echo PYTHON-NOT-FOUND)}
%{!?py_libdir:  %define py_libdir  %{py_prefix}/%{_lib}/python%{py_ver}}
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%endif
%global pythonrhnroot %{python_sitelib}/spacewalk

Name:           spacewalk-backend
Summary:        Common programs needed to be installed on the Spacewalk servers/proxies
License:        GPL-2.0
Group:          Applications/Internet
Version:        2.1.55.7
Release:        0
Url:            https://fedorahosted.org/spacewalk
Source0:        spacewalk-backend-git-0.01ff841.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%if !0%{?suse_version} || 0%{?suse_version} >= 1120
BuildArch:      noarch
%endif

%if 0%{?suse_version} >= 1100
# these are only needed for running the unittests in %check
BuildRequires:  python-mock
%if 0%{?suse_version} <= 1310
BuildRequires:  python-unittest2
%endif
BuildRequires:  suseRegisterInfo
BuildRequires:  yum

%else
BuildRequires:  python-hashlib
%endif

%if 0%{?suse_version}
Requires(pre): apache2
%else
Requires(pre): httpd
%endif

Requires:       python
Requires:       rpm-python
# /etc/rhn is provided by spacewalk-proxy-common or by spacewalk-config
Requires:       /etc/rhn
Requires:       rhnlib >= 2.5.57
# for Debian support
Requires:       %{name}-libs >= 1.1.16-1
Requires:       python-debian
%if 0%{?suse_version}
BuildRequires:  gettext
%else
BuildRequires:  /usr/bin/msgfmt
%endif
BuildRequires:  /usr/bin/docbook2man
BuildRequires:  docbook-utils
%if 0%{?fedora} > 15 || 0%{?rhel} > 5 || 0%{?suse_version} >= 1100
%if 0%{?suse_version} != 1315
BuildRequires:  spacewalk-pylint
%endif
BuildRequires:  rhnlib >= 2.5.57
BuildRequires:  rpm-python
#BuildRequires: python-crypto
BuildRequires:  python-debian
%endif
# we don't really want to require this redhat-release, so we protect
# against installations on other releases using conflicts...
Obsoletes:      rhns < 5.3.0
Obsoletes:      rhns-common < 5.3.0
Provides:       rhns = 1:%{version}-%{release}
Provides:       rhns-common = 1:%{version}-%{release}
Obsoletes:      spacewalk-backend-upload-server < 1.2.28
Provides:       spacewalk-backend-upload-server = 1:%{version}-%{release}

%description
Generic program files needed by the Spacewalk server machines.
This package includes the common code required by all servers/proxies.

%package sql
Summary:        Core functions providing SQL connectivity for the Spacewalk backend modules
Group:          Applications/Internet
Requires(pre): %{name} = %{version}-%{release}
Requires:       %{name} = %{version}-%{release}
Obsoletes:      rhns-sql < 5.3.0
Provides:       rhns-sql = 1:%{version}-%{release}
Requires:       %{name}-sql-virtual = %{version}

%description sql
This package contains the basic code that provides SQL connectivity for
the Spacewalk backend modules.

%if 0%{?fedora} < 17 || 0%{?suse_version}
%package sql-oracle
Summary:        Oracle backend for Spacewalk
Group:          Applications/Internet
Requires:       python(:DBAPI:oracle)
Provides:       %{name}-sql-virtual = %{version}

%description sql-oracle
This package contains provides Oracle connectivity for the Spacewalk backend
modules.
%endif

%package sql-postgresql
Summary:        Postgresql backend for Spacewalk
Group:          Applications/Internet
Requires:       python-psycopg2 >= 2.0.14-2
Provides:       %{name}-sql-virtual = %{version}

%description sql-postgresql
This package contains provides PostgreSQL connectivity for the Spacewalk
backend modules.

%package server
Summary:        Basic code that provides Spacewalk Server functionality
Group:          Applications/Internet
Requires(pre): %{name}-sql = %{version}-%{release}
Requires:       %{name}-sql = %{version}-%{release}
# /etc/rhn/rhn.conf should be available before run this %post script
%if 0%{?suse_version} == 1315
# no pre yet for SLE12. We only need -libs package for the client tools
# and do not want to build the whole chain. A pre-requires is a buildrequire
Requires:       spacewalk-config
%else
Requires(pre): spacewalk-config
%endif
Requires:       PyPAM
Obsoletes:      rhns-server < 5.3.0
Provides:       rhns-server = 1:%{version}-%{release}

#this exists only on rhel5 and rhel6
Conflicts:      python-sgmlop
# cobbler-web is known to break our configuration
Conflicts:      cobbler-web

Requires:       mod_wsgi

%description server
This package contains the basic code that provides server/backend
functionality for a variety of XML-RPC receivers. The architecture is
modular so that you can plug/install additional modules for XML-RPC
receivers and get them enabled automatically.

%package xmlrpc
Summary:        Handler for /XMLRPC
Group:          Applications/Internet
Requires:       %{name}-server = %{version}-%{release}
%if 0%{?fedora} >= 20
# temporary workaround for bug BZ#1067443
Requires:       rpm-python < 4.11.2
%endif
Obsoletes:      rhns-server-xmlrpc < 5.3.0
Obsoletes:      rhns-xmlrpc < 5.3.0
Provides:       rhns-server-xmlrpc = 1:%{version}-%{release}
Provides:       rhns-xmlrpc = 1:%{version}-%{release}

%description xmlrpc
These are the files required for running the /XMLRPC handler, which
provide the basic support for the registration client (rhn_register)
and the up2date clients.

%package applet
Summary:        Handler for /APPLET
Group:          Applications/Internet
Requires:       %{name}-server = %{version}-%{release}
Obsoletes:      rhns-applet < 5.3.0
Provides:       rhns-applet = 1:%{version}-%{release}

%description applet
These are the files required for running the /APPLET handler, which
provides the functions for the Spacewalk applet.

%package app
Summary:        Handler for /APP
Group:          Applications/Internet
Requires:       %{name}-server = %{version}-%{release}
Obsoletes:      rhns-app < 5.3.0
Obsoletes:      rhns-server-app < 5.3.0
Provides:       rhns-app = 1:%{version}-%{release}
Provides:       rhns-server-app = 1:%{version}-%{release}
Obsoletes:      spacewalk-backend-xp < 1.8.38
Provides:       spacewalk-backend-xp = %{version}-%{release}
Obsoletes:      rhns-server-xp < 5.3.0
Obsoletes:      rhns-xp < 5.3.0
Provides:       rhns-server-xp = 1:%{version}-%{release}
Provides:       rhns-xp = 1:%{version}-%{release}

%description app
These are the files required for running the /APP handler.
Calls to /APP are used by internal maintenance tools (rhnpush).

%package iss
Summary:        Handler for /SAT
Group:          Applications/Internet
Requires:       %{name}-server = %{version}-%{release}
Obsoletes:      rhns-sat < 5.3.0
Provides:       rhns-sat = 1:%{version}-%{release}

%description iss
%{name} contains the basic code that provides server/backend
functionality for a variety of XML-RPC receivers. The architecture is
modular so that you can plug/install additional modules for XML-RPC
receivers and get them enabled automatically.

This package contains /SAT handler, which provide Inter Spacewalk Sync
capability.

%package iss-export
Summary:        Listener for the Server XML dumper
Group:          Applications/Internet
Requires:       %{name}-xml-export-libs = %{version}-%{release}
Requires:       rpm-python

%description iss-export
%{name} contains the basic code that provides server/backend
functionality for a variety of XML-RPC receivers. The architecture is
modular so that you can plug/install additional modules for XML-RPC
receivers and get them enabled automatically.

This package contains listener for the Server XML dumper.

%package libs
Summary:        Spacewalk server and client tools libraries
Group:          Applications/Internet
%if 0%{?suse_version}
BuildRequires:  python-devel
%if 0%{?suse_version} >= 1110
Requires:       python-base
%else
Requires:       python
Requires:       python-hashlib
%endif
%else
BuildRequires:  python2-devel
Conflicts:      %{name} < 1.7.0
Requires:       python-hashlib
BuildRequires:  python-hashlib
%endif

%description libs
Libraries required by both Spacewalk server and Spacewalk client tools.

%package config-files-common
Summary:        Common files for the Configuration Management project
Group:          Applications/Internet
Requires:       %{name}-server = %{version}-%{release}
Obsoletes:      rhns-config-files-common < 5.3.0
Provides:       rhns-config-files-common = 1:%{version}-%{release}

%description config-files-common
Common files required by the Configuration Management project

%package config-files
Summary:        Handler for /CONFIG-MANAGEMENT
Group:          Applications/Internet
Requires:       %{name}-config-files-common = %{version}-%{release}
Obsoletes:      rhns-config-files < 5.3.0
Provides:       rhns-config-files = 1:%{version}-%{release}

%description config-files
This package contains the server-side code for configuration management.

%package config-files-tool
Summary:        Handler for /CONFIG-MANAGEMENT-TOOL
Group:          Applications/Internet
Requires:       %{name}-config-files-common = %{version}-%{release}
Obsoletes:      rhns-config-files-tool < 5.3.0
Provides:       rhns-config-files-tool = 1:%{version}-%{release}

%description config-files-tool
This package contains the server-side code for configuration management tool.

%package package-push-server
Summary:        Listener for rhnpush (non-XMLRPC version)
Group:          Applications/Internet
Requires:       %{name}-server = %{version}-%{release}
Obsoletes:      rhns-package-push-server < 5.3.0
Provides:       rhns-package-push-server = 1:%{version}-%{release}

%description package-push-server
Listener for rhnpush (non-XMLRPC version)

%package tools
Summary:        Spacewalk Services Tools
Group:          Applications/Internet
Requires:       %{name}
Requires:       %{name}-app = %{version}-%{release}
Requires:       %{name}-xmlrpc = %{version}-%{release}
Requires:       python-gzipstream
Requires:       spacewalk-admin >= 0.1.1-0
Requires:       spacewalk-certs-tools
Requires:       susemanager-tools
%if 0%{?suse_version}
Requires:       apache2-prefork
Requires:       python-base
%else
Requires:       mod_ssl
Requires:       python-hashlib
%endif
Requires:       %{name}-xml-export-libs
Requires:       cobbler >= 2.0.0
Requires:       rhnlib  >= 2.5.57
Obsoletes:      rhns-satellite-tools < 5.3.0
Obsoletes:      spacewalk-backend-satellite-tools <= 0.2.7
Provides:       rhns-satellite-tools = 1:%{version}-%{release}
Provides:       spacewalk-backend-satellite-tools = %{version}-%{release}

%description tools
Various utilities for the Spacewalk Server.

%package xml-export-libs
Summary:        Spacewalk XML data exporter
Group:          Applications/Internet
Requires:       %{name}-server = %{version}-%{release}
Obsoletes:      rhns-xml-export-libs < 5.3.0
Provides:       rhns-xml-export-libs = 1:%{version}-%{release}

%description xml-export-libs
Libraries required by various exporting tools

%prep
%setup -q -n spacewalk-backend-git-0.01ff841

%build
%if !0%{?suse_version}
sed -i 's/^INSTALL_DEST.*/INSTALL_DEST = \/etc\/httpd\/conf.d/' apache-conf/Makefile
%endif
make -f Makefile.backend all

%install
rm -rf $RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT%{rhnroot}
install -d $RPM_BUILD_ROOT%{pythonrhnroot}
make -f Makefile.backend install PREFIX=$RPM_BUILD_ROOT \
    MANDIR=%{_mandir}
export PYTHON_MODULE_NAME=%{name}
export PYTHON_MODULE_VERSION=%{version}

# remove all unsupported translations
cd $RPM_BUILD_ROOT
for d in usr/share/locale/*; do
  if [ ! -d "/$d" ]; then
    rm -rfv "./$d"
  fi
done
cd -
ln -s satellite-sync $RPM_BUILD_ROOT/usr/bin/mgr-inter-sync
ln -s rhn-satellite-exporter $RPM_BUILD_ROOT/usr/bin/mgr-exporter

%find_lang %{name}-server

%if 0%{?fedora} || 0%{?rhel} > 6
sed -i 's/#LOGROTATE-3.8#//' $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/spacewalk-backend-*
%endif

%clean
rm -rf $RPM_BUILD_ROOT

%check
export PYTHONPATH=%{buildroot}%{python_sitelib}:%{_datadir}/rhn
# only run our unittests on versions where we have all the right BuildRequires
%if 0%{?suse_version} >= 1100
make -f Makefile.backend unittest
%endif
make -f Makefile.backend test || :
%if 0%{?fedora} > 15 || 0%{?rhel} > 5 || 0%{?suse_version} >= 1100
%if 0%{?suse_version} != 1315
# check coding style
export PYTHONPATH=$RPM_BUILD_ROOT%{python_sitelib}:/usr/lib/rhn
spacewalk-pylint $RPM_BUILD_ROOT%{pythonrhnroot}/common \
                 $RPM_BUILD_ROOT%{pythonrhnroot}/satellite_exporter \
                 $RPM_BUILD_ROOT%{pythonrhnroot}/upload_server \
                 $RPM_BUILD_ROOT%{pythonrhnroot}/wsgi
%endif
%endif

pushd %{buildroot}
find -name '*.py' -print0 | xargs -0 python %py_libdir/py_compile.py
popd

%pre server
OLD_SECRET_FILE=%{_var}/www/rhns/server/secret/rhnSecret.py
if [ -f $OLD_SECRET_FILE ]; then
    install -d -m 750 -o root -g %{apache_group} %{rhnconf}
    mv ${OLD_SECRET_FILE}*  %{rhnconf}
fi

%post server
%if 0%{?suse_version}
sysconf_addword /etc/sysconfig/apache2 APACHE_MODULES wsgi
sysconf_addword /etc/sysconfig/apache2 APACHE_MODULES perl
%endif

# Is secret key in our config file?
regex="^[[:space:]]*(server\.|)secret_key[[:space:]]*=.*$"

%if 0%{?suse_version} == 1315
if [ ! -d %{rhnconf} ]; then
    # happens if we do not pre-require spacewalk-config
    exit 0
fi
%endif

if grep -E -i $regex %{rhnconf}/rhn.conf > /dev/null 2>&1 ; then
    # secret key already there
    rm -f %{rhnconf}/rhnSecret.py*
    exit 0
fi

# Generate a secret key if old one is not present
if [ -f %{rhnconf}/rhnSecret.py ]; then
    secret_key=$(PYTHONPATH=%{rhnconf} %{__python} -c \
        "from rhnSecret import SECRET_KEY; print SECRET_KEY")
else
    secret_key=$(dd if=/dev/urandom bs=1024 count=1 2>/dev/null | sha1sum - |
        awk '{print $1}')
fi

echo "server.secret_key = $secret_key" >> %{rhnconf}/rhn.conf
rm -f %{rhnconf}/rhnSecret.py*

%files
%defattr(-,root,root)
%doc LICENSE
%dir %{pythonrhnroot}
%dir %{pythonrhnroot}/common
%{pythonrhnroot}/common/suseLib.py*
%{pythonrhnroot}/common/apache.py*
%{pythonrhnroot}/common/byterange.py*
%{pythonrhnroot}/common/rhnApache.py*
%{pythonrhnroot}/common/rhnCache.py*
%{pythonrhnroot}/common/rhnConfig.py*
%{pythonrhnroot}/common/rhnException.py*
%{pythonrhnroot}/common/rhnFlags.py*
%{pythonrhnroot}/common/rhnLib.py*
%{pythonrhnroot}/common/rhnLog.py*
%{pythonrhnroot}/common/rhnMail.py*
%{pythonrhnroot}/common/rhnTB.py*
%{pythonrhnroot}/common/rhnRepository.py*
%{pythonrhnroot}/common/rhnTranslate.py*
%{pythonrhnroot}/common/RPC_Base.py*
%attr(770,root,%{apache_group}) %dir %{_var}/log/rhn
# config files
%attr(755,root,%{apache_group}) %dir %{rhnconfigdefaults}
%attr(644,root,%{apache_group}) %{rhnconfigdefaults}/rhn.conf
%attr(755,root,root) %{_bindir}/spacewalk-cfg-get
%{_mandir}/man8/spacewalk-cfg-get.8.gz
# wsgi stuff
%dir %{rhnroot}/wsgi
%{rhnroot}/wsgi/__init__.py*
%{rhnroot}/wsgi/wsgiHandler.py*
%{rhnroot}/wsgi/wsgiRequest.py*
%if 0%{?suse_version}
%dir %{rhnroot}
%endif

%files sql
%defattr(-,root,root)
%doc LICENSE
%if 0%{?suse_version}
%dir %{rhnroot}/server
%endif
# Need __init__ = share it with rhns-server
%dir %{pythonrhnroot}/server
%{pythonrhnroot}/server/__init__.py*
%{rhnroot}/server/__init__.py*
%dir %{pythonrhnroot}/server/rhnSQL
%{pythonrhnroot}/server/rhnSQL/const.py*
%{pythonrhnroot}/server/rhnSQL/dbi.py*
%{pythonrhnroot}/server/rhnSQL/__init__.py*
%{pythonrhnroot}/server/rhnSQL/sql_*.py*

%if 0%{?fedora} < 17 || 0%{?suse_version}
%files sql-oracle
%defattr(-,root,root)
%doc LICENSE
%{pythonrhnroot}/server/rhnSQL/driver_cx_Oracle.py*
%endif

%files sql-postgresql
%defattr(-,root,root)
%doc LICENSE
%{pythonrhnroot}/server/rhnSQL/driver_postgresql.py*

%files server -f %{name}-server.lang
%defattr(-,root,root)
%doc LICENSE
%if 0%{?suse_version}
%dir %{rhnroot}/server
%endif
# modules
%{pythonrhnroot}/server/apacheAuth.py*
%{pythonrhnroot}/server/apacheHandler.py*
%{pythonrhnroot}/server/apacheRequest.py*
%{pythonrhnroot}/server/apacheServer.py*
%{pythonrhnroot}/server/apacheUploadServer.py*
%{pythonrhnroot}/server/rhnAction.py*
%{pythonrhnroot}/server/rhnAuthPAM.py*
%{pythonrhnroot}/server/rhnCapability.py*
%{pythonrhnroot}/server/rhnChannel.py*
%{pythonrhnroot}/server/rhnDependency.py*
%{pythonrhnroot}/server/rhnPackage.py*
%{pythonrhnroot}/server/rhnPackageUpload.py*
%{pythonrhnroot}/server/basePackageUpload.py*
%{pythonrhnroot}/server/rhnHandler.py*
%{pythonrhnroot}/server/rhnImport.py*
%{pythonrhnroot}/server/rhnLib.py*
%{pythonrhnroot}/server/rhnMapping.py*
%{pythonrhnroot}/server/rhnRepository.py*
%{pythonrhnroot}/server/rhnSession.py*
%{pythonrhnroot}/server/rhnUser.py*
%{pythonrhnroot}/server/rhnVirtualization.py*
%{pythonrhnroot}/server/taskomatic.py*
%{pythonrhnroot}/server/mgrSync.py*
%{pythonrhnroot}/server/repoindexHandler.py*
%{pythonrhnroot}/server/suseEula.py*
%dir %{pythonrhnroot}/server/rhnServer
%{pythonrhnroot}/server/rhnServer/*
%dir %{pythonrhnroot}/server/importlib
%{pythonrhnroot}/server/importlib/__init__.py*
%{pythonrhnroot}/server/importlib/archImport.py*
%{pythonrhnroot}/server/importlib/backend.py*
%{pythonrhnroot}/server/importlib/backendLib.py*
%{pythonrhnroot}/server/importlib/backendOracle.py*
%{pythonrhnroot}/server/importlib/backend_checker.py*
%{pythonrhnroot}/server/importlib/channelImport.py*
%{pythonrhnroot}/server/importlib/debPackage.py*
%{pythonrhnroot}/server/importlib/errataCache.py*
%{pythonrhnroot}/server/importlib/errataImport.py*
%{pythonrhnroot}/server/importlib/headerSource.py*
%{pythonrhnroot}/server/importlib/importLib.py*
%{pythonrhnroot}/server/importlib/kickstartImport.py*
%{pythonrhnroot}/server/importlib/mpmSource.py*
%{pythonrhnroot}/server/importlib/packageImport.py*
%{pythonrhnroot}/server/importlib/packageUpload.py*
%{pythonrhnroot}/server/importlib/productNamesImport.py*
%{pythonrhnroot}/server/importlib/userAuth.py*
%{pythonrhnroot}/server/importlib/orgImport.py*
%{pythonrhnroot}/server/importlib/supportInformationImport.py*
%{rhnroot}/server/handlers/__init__.py*

# Repomd stuff
%dir %{pythonrhnroot}/server/repomd
%{pythonrhnroot}/server/repomd/__init__.py*
%{pythonrhnroot}/server/repomd/domain.py*
%{pythonrhnroot}/server/repomd/mapper.py*
%{pythonrhnroot}/server/repomd/repository.py*
%{pythonrhnroot}/server/repomd/view.py*

# the cache
%attr(755,%{apache_user},%{apache_group}) %dir %{_var}/cache/rhn
# config files
%attr(644,root,%{apache_group}) %{rhnconfigdefaults}/rhn_server.conf
# main httpd config
%attr(644,root,%{apache_group}) %config %{apacheconfd}/zz-spacewalk-server.conf

# wsgi stuff
%attr(644,root,%{apache_group}) %config %{apacheconfd}/zz-spacewalk-server-wsgi.conf
%{rhnroot}/wsgi/app.py*
%{rhnroot}/wsgi/applet.py*
%{rhnroot}/wsgi/config.py*
%{rhnroot}/wsgi/config_tool.py*
%{rhnroot}/wsgi/package_push.py*
%{rhnroot}/wsgi/sat.py*
%{rhnroot}/wsgi/sat_dump.py*
%{rhnroot}/wsgi/xmlrpc.py*
%{rhnroot}/wsgi/mgr.py*
%{rhnroot}/wsgi/repoindex.py*

# logs and other stuff
%config(noreplace) %{_sysconfdir}/logrotate.d/spacewalk-backend-server

%files xmlrpc
%defattr(-,root,root)
%doc LICENSE
%dir %{rhnroot}/server/handlers/xmlrpc
%{rhnroot}/server/handlers/xmlrpc/*
%dir %{pythonrhnroot}/server/action
%{pythonrhnroot}/server/action/*
%dir %{pythonrhnroot}/server/action_extra_data
%{pythonrhnroot}/server/action_extra_data/*
%{pythonrhnroot}/server/auditlog.py*
# config files
%attr(644,root,%{apache_group}) %{rhnconfigdefaults}/rhn_server_xmlrpc.conf
%config(noreplace) %{_sysconfdir}/logrotate.d/spacewalk-backend-xmlrpc
%if 0%{?suse_version}
%dir %{rhnroot}/server
%dir %{rhnroot}/server/handlers
%endif

%files applet
%defattr(-,root,root)
%doc LICENSE
%if 0%{?suse_version}
%dir %{rhnroot}/server
%endif
%dir %{rhnroot}/server/handlers/applet
%{rhnroot}/server/handlers/applet/*
# config files
%attr(644,root,%{apache_group}) %{rhnconfigdefaults}/rhn_server_applet.conf
%config(noreplace) %{_sysconfdir}/logrotate.d/spacewalk-backend-applet

%files app
%defattr(-,root,root)
%doc LICENSE
%if 0%{?suse_version}
%dir %{rhnroot}/server
%endif
%dir %{rhnroot}/server/handlers/app
%{rhnroot}/server/handlers/app/*
# config files
%attr(644,root,%{apache_group}) %{rhnconfigdefaults}/rhn_server_app.conf
%config(noreplace) %{_sysconfdir}/logrotate.d/spacewalk-backend-app

%files iss
%defattr(-,root,root)
%doc LICENSE
%if 0%{?suse_version}
%dir %{rhnroot}/server
%endif
%dir %{rhnroot}/server/handlers/sat
%{rhnroot}/server/handlers/sat/*
%config(noreplace) %{_sysconfdir}/logrotate.d/spacewalk-backend-iss

%files iss-export
%defattr(-,root,root)
%doc LICENSE
%dir %{pythonrhnroot}/satellite_exporter
%{pythonrhnroot}/satellite_exporter/__init__.py*
%{pythonrhnroot}/satellite_exporter/satexport.py*

%dir %{rhnroot}/satellite_exporter
%dir %{rhnroot}/satellite_exporter/handlers
%{rhnroot}/satellite_exporter/__init__.py*
%{rhnroot}/satellite_exporter/handlers/__init__.py*
%{rhnroot}/satellite_exporter/handlers/non_auth_dumper.py*
# config files
%config(noreplace) %{_sysconfdir}/logrotate.d/spacewalk-backend-iss-export

%files libs
%defattr(-,root,root)
%doc LICENSE
%{pythonrhnroot}/__init__.py*
%dir %{pythonrhnroot}/common
%{pythonrhnroot}/common/__init__.py*
%{pythonrhnroot}/common/checksum.py*
%{pythonrhnroot}/common/cli.py*
%{pythonrhnroot}/common/fileutils.py*
%{pythonrhnroot}/common/rhn_deb.py*
%{pythonrhnroot}/common/rhn_mpm.py*
%{pythonrhnroot}/common/rhn_pkg.py*
%{pythonrhnroot}/common/rhn_rpm.py*
%{pythonrhnroot}/common/stringutils.py*

%files config-files-common
%defattr(-,root,root)
%doc LICENSE
%{pythonrhnroot}/server/configFilesHandler.py*
%dir %{pythonrhnroot}/server/config_common
%{pythonrhnroot}/server/config_common/*

%files config-files
%defattr(-,root,root)
%doc LICENSE
%if 0%{?suse_version}
%dir %{rhnroot}/server
%endif
%dir %{rhnroot}/server/handlers/config
%{rhnroot}/server/handlers/config/*
%attr(644,root,%{apache_group}) %{rhnconfigdefaults}/rhn_server_config-management.conf
%config(noreplace) %{_sysconfdir}/logrotate.d/spacewalk-backend-config-files

%files config-files-tool
%defattr(-,root,root)
%doc LICENSE
%if 0%{?suse_version}
%dir %{rhnroot}/server
%endif
%dir %{rhnroot}/server/handlers/config_mgmt
%{rhnroot}/server/handlers/config_mgmt/*
%attr(644,root,%{apache_group}) %{rhnconfigdefaults}/rhn_server_config-management-tool.conf
%config(noreplace) %{_sysconfdir}/logrotate.d/spacewalk-backend-config-files-tool

%files package-push-server
%defattr(-,root,root)
%doc LICENSE
%dir %{rhnroot}/upload_server
%{rhnroot}/upload_server/__init__.py*
%dir %{rhnroot}/upload_server/handlers
%{rhnroot}/upload_server/handlers/__init__.py*
%{rhnroot}/upload_server/handlers/package_push
%attr(644,root,%{apache_group}) %{rhnconfigdefaults}/rhn_server_upload.conf
%attr(644,root,%{apache_group}) %{rhnconfigdefaults}/rhn_server_upload_package-push.conf
%config(noreplace) %{_sysconfdir}/logrotate.d/spacewalk-backend-package-push-server

%files tools
%defattr(-,root,root)
%doc LICENSE
%attr(644,root,%{apache_group}) %{rhnconfigdefaults}/rhn_server_satellite.conf
%config(noreplace) %{_sysconfdir}/logrotate.d/spacewalk-backend-tools
%attr(755,root,root) %{_bindir}/rhn-charsets
%attr(755,root,root) %{_bindir}/rhn-satellite-activate
%attr(755,root,root) %{_bindir}/rhn-schema-version
%attr(755,root,root) %{_bindir}/rhn-ssl-dbstore
%attr(755,root,root) %{_bindir}/satellite-sync
%attr(755,root,root) %{_bindir}/mgr-inter-sync
%attr(755,root,root) %{_bindir}/mgr-exporter
%attr(755,root,root) %{_bindir}/spacewalk-debug
%attr(755,root,root) %{_bindir}/rhn-satellite-exporter
%attr(755,root,root) %{_bindir}/update-packages
%attr(755,root,root) %{_bindir}/spacewalk-repo-sync
%attr(755,root,root) %{_bindir}/rhn-db-stats
%attr(755,root,root) %{_bindir}/rhn-schema-stats
%attr(755,root,root) %{_bindir}/satpasswd
%attr(755,root,root) %{_bindir}/satwho
%attr(755,root,root) %{_bindir}/spacewalk-remove-channel*
%attr(755,root,root) %{_bindir}/rhn-entitlement-report
%attr(755,root,root) %{_bindir}/spacewalk-update-signatures
%attr(755,root,root) %{_bindir}/spacewalk-data-fsck
%{pythonrhnroot}/satellite_tools/SequenceServer.py*
%{pythonrhnroot}/satellite_tools/messages.py*
%{pythonrhnroot}/satellite_tools/progress_bar.py*
%{pythonrhnroot}/satellite_tools/req_channels.py*
%{pythonrhnroot}/satellite_tools/satsync.py*
%{pythonrhnroot}/satellite_tools/satCerts.py*
%{pythonrhnroot}/satellite_tools/satComputePkgHeaders.py*
%{pythonrhnroot}/satellite_tools/syncCache.py*
%{pythonrhnroot}/satellite_tools/sync_handlers.py*
%{pythonrhnroot}/satellite_tools/rhn_satellite_activate.py*
%{pythonrhnroot}/satellite_tools/rhn_ssl_dbstore.py*
%{pythonrhnroot}/satellite_tools/xmlWireSource.py*
%{pythonrhnroot}/satellite_tools/updatePackages.py*
%{pythonrhnroot}/satellite_tools/reposync.py*
%{pythonrhnroot}/satellite_tools/constants.py*
%dir %{pythonrhnroot}/satellite_tools/disk_dumper
%{pythonrhnroot}/satellite_tools/disk_dumper/__init__.py*
%{pythonrhnroot}/satellite_tools/disk_dumper/iss.py*
%{pythonrhnroot}/satellite_tools/disk_dumper/iss_ui.py*
%{pythonrhnroot}/satellite_tools/disk_dumper/iss_isos.py*
%{pythonrhnroot}/satellite_tools/disk_dumper/iss_actions.py*
%{pythonrhnroot}/satellite_tools/disk_dumper/dumper.py*
%{pythonrhnroot}/satellite_tools/disk_dumper/string_buffer.py*
%dir %{pythonrhnroot}/satellite_tools/repo_plugins
%attr(755,root,%{apache_group}) %dir %{_var}/log/rhn/reposync
%{pythonrhnroot}/satellite_tools/repo_plugins/__init__.py*
%{pythonrhnroot}/satellite_tools/repo_plugins/yum_src.py*
%config %attr(644,root,%{apache_group}) %{rhnconfigdefaults}/rhn_server_iss.conf
%{_mandir}/man8/rhn-satellite-exporter.8*
%{_mandir}/man8/rhn-charsets.8*
%{_mandir}/man8/rhn-satellite-activate.8*
%{_mandir}/man8/rhn-schema-version.8*
%{_mandir}/man8/rhn-ssl-dbstore.8*
%{_mandir}/man8/rhn-db-stats.8*
%{_mandir}/man8/rhn-schema-stats.8*
%{_mandir}/man8/satellite-sync.8*
%{_mandir}/man8/spacewalk-debug.8*
%{_mandir}/man8/satpasswd.8*
%{_mandir}/man8/satwho.8*
%{_mandir}/man8/spacewalk-remove-channel.8*
%{_mandir}/man8/spacewalk-repo-sync.8*
%{_mandir}/man8/spacewalk-data-fsck.8*
%{_mandir}/man8/spacewalk-update-signatures.8*
%{_mandir}/man8/update-packages.8*
%{_mandir}/man8/rhn-entitlement-report.8*

%files xml-export-libs
%defattr(-,root,root)
%doc LICENSE
%dir %{pythonrhnroot}/satellite_tools
%{pythonrhnroot}/satellite_tools/__init__.py*
%{pythonrhnroot}/satellite_tools/geniso.py*
# A bunch of modules shared with satellite-tools
%{pythonrhnroot}/satellite_tools/connection.py*
%{pythonrhnroot}/satellite_tools/diskImportLib.py*
%{pythonrhnroot}/satellite_tools/syncLib.py*
%{pythonrhnroot}/satellite_tools/xmlDiskSource.py*
%{pythonrhnroot}/satellite_tools/xmlSource.py*
%dir %{pythonrhnroot}/satellite_tools/exporter
%{pythonrhnroot}/satellite_tools/exporter/__init__.py*
%{pythonrhnroot}/satellite_tools/exporter/exportLib.py*
%{pythonrhnroot}/satellite_tools/exporter/xmlWriter.py*

%changelog