File rhnpush.spec of Package rhnpush.5439

#
# spec file for package rhnpush
#
# Copyright (c) 2017 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/
#


%define rhn_client_tools spacewalk-client-tools
%define rhnroot %{_datadir}/rhn

%if (0%{?fedora} && 0%{?fedora} < 26) || 0%{?rhel} >= 7
%{!?pylint_check: %global pylint_check 0}
%endif

Name:           rhnpush
Url:            https://github.com/spacewalkproject/spacewalk
Version:        5.5.104.3
Release:        0
Source0:        rhnpush-git-0.225598a.tar.gz
Source1:        %{name}-rpmlintrc
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
Requires:       rpm-python
BuildRequires:  python-devel
BuildRequires:  spacewalk-backend-libs > 1.8.33

%if 0%{?fedora} >= 23
Requires:       python3-rhnlib
Requires:       python3-spacewalk-backend-libs
Requires:       python3-spacewalk-usix
%else
Requires:       rhnlib >= 2.5.74
Requires:       spacewalk-backend-libs >= 1.7.17
Requires:       spacewalk-usix
%endif

Requires:       %{rhn_client_tools}
%if 0%{?pylint_check}
BuildRequires:  spacewalk-pylint >= 0.6
%endif
%if 0%{?suse_version}
# provides rhn directories for filelist check in OBS
BuildRequires:  %{rhn_client_tools}
%endif
BuildRequires:  docbook-utils
BuildRequires:  gettext

%if 0%{?fedora} || 0%{?rhel} > 5
BuildRequires:  rhn-client-tools

%endif

Summary:        Package uploader for the Spacewalk Server
License:        GPL-2.0
Group:          Applications/System

%description
rhnpush uploads package headers to the Spacewalk
servers into specified channels and allows for several other channel
management operations relevant to controlling what packages are available
per channel.

%prep
%setup -q -n rhnpush-git-0.225598a

%build
make -f Makefile.rhnpush all

%install
rm -rf $RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT/%{rhnroot}
make -f Makefile.rhnpush install PREFIX=$RPM_BUILD_ROOT ROOT=%{rhnroot} \
    MANDIR=%{_mandir}
%if 0%{?suse_version}
ln -s rhnpush $RPM_BUILD_ROOT/%{_bindir}/mgrpush
%endif

%if 0%{?fedora} >= 23
sed -i 's|#!/usr/bin/python|#!/usr/bin/python3|' $RPM_BUILD_ROOT%{_bindir}/rhnpush
%endif

%clean
rm -rf $RPM_BUILD_ROOT

%check
%if 0%{?pylint_check} && 0%{?fedora} >= 25
# check coding style
export PYTHONPATH=$RPM_BUILD_ROOT%{python_sitelib}:/usr/share/rhn
spacewalk-pylint $RPM_BUILD_ROOT%{rhnroot}
%endif

%files
%defattr(-,root,root)
%dir %{rhnroot}
%dir %{_sysconfdir}/sysconfig/rhn
%dir %{rhnroot}/rhnpush
%{rhnroot}/rhnpush/*
%attr(755,root,root) %{_bindir}/rhnpush
%if 0%{?suse_version}
%{_bindir}/mgrpush
%endif
%attr(755,root,root) %{_bindir}/rpm2mpm
%config(noreplace) %attr(644,root,root) %{_sysconfdir}/sysconfig/rhn/rhnpushrc
%{_mandir}/man8/rhnpush.8*
%doc COPYING

%changelog
openSUSE Build Service is sponsored by