File spacewalk-client-tools.spec of Package spacewalk-client-tools.4854

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


# package renaming fun :(
%define rhn_client_tools spacewalk-client-tools
%define rhn_setup	 spacewalk-client-setup
%define rhn_check	 spacewalk-check
%define rhnsd		 spacewalksd
#
%define without_rhn_register 1

%global rhnroot /usr/share/rhn

Name:           spacewalk-client-tools
Summary:        Support programs and libraries for Spacewalk
License:        GPL-2.0
Group:          System Environment/Base
Source0:        spacewalk-client-tools-git-0.7186094.tar.gz
Source1:        %{name}-rpmlintrc
Url:            https://fedorahosted.org/spacewalk
Version:        2.7.6.2
Release:        0
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
%if 0%{?suse_version}
BuildRequires:  update-desktop-files
%endif
Provides:       rhn-client-tools = %{version}-%{release}
Obsoletes:      rhn-client-tools < %{version}-%{release}
%if %{without_rhn_register}
Obsoletes:      rhn-setup-gnome
%endif
Requires:       gnupg
Requires:       rpm >= 4.2.3-24_nonptl
Requires:       rpm-python
Requires:       sh-utils
BuildRequires:  python-devel
%if 0%{?fedora} >= 23
Requires:       libgudev
Requires:       newt-python3
Requires:       python3-dmidecode
Requires:       python3-gobject-base
Requires:       python3-hwdata
Requires:       python3-netifaces
Requires:       python3-rhnlib >= 2.5.78
%else
%ifnarch s390 s390x
Requires:       python-dmidecode
%endif
Requires:       python-ethtool >= 0.4
Requires:       rhnlib >= 2.5.78
%if 0%{?fedora}
Requires:       libgudev1
Requires:       newt-python
Requires:       pygobject3-base
Requires:       python-hwdata
%else
%if 0%{?rhel} > 5 || 0%{?suse_version} >= 1140
Requires:       python-gudev
Requires:       python-hwdata
%else
Requires:       hal >= 0.5.8.1-52
%endif # 0%{?rhel} > 5 || 0%{?suse_version} >= 1140
%if 0%{?suse_version}
Requires:       python-newt
%endif
%if 0%{?rhel} == 5
Requires:       newt
%endif
%if 0%{?rhel} > 5
Requires:       newt-python
%endif
%endif # 0%{?fedora}
%endif # 0%{?fedora} >= 23
%if 0%{?suse_version}
Requires:       dbus-1-python
%else
Requires:       dbus-python
%endif
%if 0%{?suse_version}
Requires:       zypper
%else
%if 0%{?fedora} >= 22
Requires:       dnf
%else
Requires:       yum
%endif # 0%{?fedora} >= 22
%endif # 0%{?suse_version}

Requires:       logrotate
Requires:       suseRegisterInfo

Conflicts:      up2date < 5.0.0
Conflicts:      yum-rhn-plugin < 1.6.4-1
Conflicts:      rhncfg < 5.9.23-1
Conflicts:      spacewalk-koan < 0.2.7-1
Conflicts:      rhn-kickstart < 5.4.3-1
Conflicts:      rhn-virtualization-host < 5.4.36-2

BuildRequires:  desktop-file-utils
BuildRequires:  gettext
BuildRequires:  intltool

%if 0%{?fedora}
BuildRequires:  fedora-logos
%if 0%{?fedora} >= 22
BuildRequires:  dnf
%else
BuildRequires:  yum
%endif
%endif
%if 0%{?rhel}
BuildRequires:  redhat-logos
%endif

# The following BuildRequires are for check only
%if 0%{?fedora}
BuildRequires:  python-coverage
BuildRequires:  rpm-python
%endif
%if 0%{?fedora} >= 23
Requires:       python3-rhnlib >= 2.5.78
%else
Requires:       rhnlib >= 2.5.78
%endif

%description
Spacewalk Client Tools provides programs and libraries to allow your
system to receive software updates from Spacewalk.

%package -n spacewalk-check
Summary:        Check for Spacewalk actions
Group:          System Environment/Base
Provides:       rhn-check = %{version}-%{release}
Obsoletes:      rhn-check < %{version}-%{release}
Requires:       %{name} = %{version}-%{release}
%if 0%{?suse_version}
Requires:       zypp-plugin-spacewalk >= 0.4
%else
%if 0%{?fedora} >= 22
Requires:       dnf-plugin-spacewalk >= 2.4.0
%else
Requires:       yum-rhn-plugin >= 1.6.4-1
%endif
%endif

%description -n spacewalk-check
spacewalk-check polls a SUSE Manager or Spacewalk server to find and execute
scheduled actions.

%package -n spacewalk-client-setup
Summary:        Configure and register an Spacewalk client
Group:          System Environment/Base
Provides:       rhn-setup = %{version}-%{release}
Obsoletes:      rhn-setup < %{version}-%{release}
%if 0%{?fedora} || 0%{?rhel}
Requires:       usermode >= 1.36
%endif
Requires:       %{name} = %{version}-%{release}
Requires:       %{rhnsd}
Requires:       suseRegisterInfo

%if 0%{?rhel} == 5
Requires:       newt
%endif
%if 0%{?suse_version}
Requires:       python-newt
%endif
%if 0%{?fedora} || 0%{?rhel} > 5
Requires:       newt-python
%endif

%description -n spacewalk-client-setup
spacewalk-client-setup contains programs and utilities to configure a system to use
SUSE Manager or Spacewalk.

%if ! 0%{?without_rhn_register}
%package -n spacewalk-client-setup-gnome
Summary:        A GUI interface for SUSE Manager/Spacewalk Registration
Group:          System Environment/Base
Provides:       rhn-setup-gnome = %{version}-%{release}
Obsoletes:      rhn-setup-gnome < %{version}-%{release}
Requires:       %{name} = %{version}-%{release}
Requires:       %{rhn_setup} = %{version}-%{release}
Requires:       pam >= 0.72
%if 0%{?suse_version}
Requires:       python-gnome
Requires:       python-gtk
%else
Requires:       gnome-python2
Requires:       gnome-python2-canvas
Requires:       pygtk2
Requires:       pygtk2-libglade
Requires:       usermode-gtk
%endif
%if 0%{?fedora} || 0%{?rhel} > 5
Requires:       gnome-python2-bonobo
Requires:       gnome-python2-gnome
Requires:       liberation-sans-fonts
%endif

%description -n spacewalk-client-setup-gnome
spacewalk-setup-gnome contains a GTK+ graphical interface for configuring and
registering a system with a SUSE Manager server or Spacewalk server.
%endif

%prep
%setup -q -n spacewalk-client-tools-git-0.7186094
%if 0%{?rhel} && 0%{?rhel} <= 4
patch -p1 < patches/rhel4-static.dif
%endif

%build
%if 0%{?suse_version} < 1110
# SLE10 gettext does not work with context feature feature
# remove duplicate translation blocks
for i in po/*.po; do sed -i -n '/^msgctxt/,/^$/d;p' "$i"; done
%endif
make -f Makefile.rhn-client-tools
%if 0%{?fedora} >= 23
    sed -i 's|#!/usr/bin/python|#!/usr/bin/python3|' src/actions/*.py src/bin/*.py test/*.py
%endif

%install
rm -rf $RPM_BUILD_ROOT
make -f Makefile.rhn-client-tools install VERSION=%{version}-%{release} PREFIX=$RPM_BUILD_ROOT MANPATH=%{_mandir}

mkdir -p $RPM_BUILD_ROOT/var/lib/up2date
mkdir -pm700 $RPM_BUILD_ROOT%{_localstatedir}/spool/up2date
touch $RPM_BUILD_ROOT%{_localstatedir}/spool/up2date/loginAuth.pkl
%if 0%{?fedora}
mkdir -p $RPM_BUILD_ROOT/%{_presetdir}
install 50-spacewalk-client.preset $RPM_BUILD_ROOT/%{_presetdir}
%endif

%if 0%{?suse_version}
# zypp-plugin-spacewalk has its own action/errata.py
rm -f $RPM_BUILD_ROOT%{_datadir}/rhn/actions/errata.py*
%endif

%if 0%{?fedora} || 0%{?rhel} > 5 || 0%{?suse_version} >= 1140
rm $RPM_BUILD_ROOT%{_datadir}/rhn/up2date_client/hardware_hal.*
%else
rm $RPM_BUILD_ROOT%{_datadir}/rhn/up2date_client/hardware_gudev.*
%endif

%if 0%{?rhel} > 0
%if 0%{?rhel} < 6
rm -rf $RPM_BUILD_ROOT%{_datadir}/rhn/up2date_client/firstboot
rm -f $RPM_BUILD_ROOT%{_datadir}/firstboot/modules/rhn_register.*
%endif
%if 0%{?rhel} == 6
rm -rf $RPM_BUILD_ROOT%{_datadir}/firstboot/modules/rhn_*_*.*
%endif
%if 0%{?rhel} > 6
rm -rf $RPM_BUILD_ROOT%{_datadir}/rhn/up2date_client/firstboot
rm -rf $RPM_BUILD_ROOT%{_datadir}/firstboot/
%endif
%else
rm -rf $RPM_BUILD_ROOT%{_datadir}/firstboot/modules/rhn_*_*.*
%endif

%if 0%{?without_rhn_register}
rm -rf $RPM_BUILD_ROOT/etc/pam.d
rm -rf $RPM_BUILD_ROOT/etc/security/console.apps
rm -rf $RPM_BUILD_ROOT/usr/share/setuptool
rm -f $RPM_BUILD_ROOT/usr/bin/rhn_register
rm -f $RPM_BUILD_ROOT/usr/sbin/rhn_register
rm -f $RPM_BUILD_ROOT/usr/share/man/man8/rhn_register.8.gz
#spacewalk-client-setup-gnome
rm -rf $RPM_BUILD_ROOT/%{_datadir}/firstboot
rm -rf $RPM_BUILD_ROOT/%{_datadir}/pixmaps
rm -rf $RPM_BUILD_ROOT/%{_datadir}/icons
rm -rf $RPM_BUILD_ROOT/%{_datadir}/rhn/up2date_client/firstboot

rm -f $RPM_BUILD_ROOT/%{_datadir}/rhn/up2date_client/messageWindow.*
rm -f $RPM_BUILD_ROOT/%{_datadir}/rhn/up2date_client/rhnregGui.*
rm -f $RPM_BUILD_ROOT/%{_datadir}/rhn/up2date_client/rh_register.glade
rm -f $RPM_BUILD_ROOT/%{_datadir}/rhn/up2date_client/gui.*
rm -f $RPM_BUILD_ROOT/%{_datadir}/rhn/up2date_client/progress.*
rm -f $RPM_BUILD_ROOT/%{_datadir}/man/man8/rhn_register.*
%else
desktop-file-install --dir=${RPM_BUILD_ROOT}%{_datadir}/applications --vendor=rhn rhn_register.desktop
%if 0%{?suse_version}
%suse_update_desktop_file -r rhn_register "Settings;System;SystemSetup;"
# no usermod on SUSE
rm -f $RPM_BUILD_ROOT%{_bindir}/rhn_register
%endif
%endif

# create mgr_check symlink
ln -sf rhn_check $RPM_BUILD_ROOT/%{_sbindir}/mgr_check
ln -sf spacewalk-update-status $RPM_BUILD_ROOT/%{_sbindir}/mgr-update-status

# 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 -

%find_lang rhn-client-tools

%if 0%{?suse_version}
%py_compile %{buildroot}/%{rhnroot}
%py_compile -O %{buildroot}/%{rhnroot}
%endif

%post
rm -f %{_localstatedir}/spool/up2date/loginAuth.pkl

%if ! 0%{?without_rhn_register}
%post -n spacewalk-client-setup-gnome
touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :

%postun -n spacewalk-client-setup-gnome
if [ $1 -eq 0 ] ; then
    touch --no-create %{_datadir}/icons/hicolor &>/dev/null
    gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
fi

%posttrans -n spacewalk-client-setup-gnome
gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%endif

%clean
rm -rf $RPM_BUILD_ROOT

%if 0%{?fedora}
%check

make -f Makefile.rhn-client-tools test
%endif

%files -f rhn-client-tools.lang
%defattr(-,root,root,-)
# some info about mirrors
%doc doc/mirrors.txt
%doc doc/AUTHORS
%doc doc/LICENSE
%{_mandir}/man8/rhn-profile-sync.8*
%{_mandir}/man5/up2date.5*

%dir %{_sysconfdir}/sysconfig/rhn
%dir %{_sysconfdir}/sysconfig/rhn/clientCaps.d
%dir %{_sysconfdir}/sysconfig/rhn/allowed-actions
%dir %{_sysconfdir}/sysconfig/rhn/allowed-actions/configfiles
%dir %{_sysconfdir}/sysconfig/rhn/allowed-actions/script
%verify(not md5 mtime size) %config(noreplace) %{_sysconfdir}/sysconfig/rhn/up2date
%config(noreplace) %{_sysconfdir}/logrotate.d/up2date

# dirs
%dir %{_datadir}/rhn
%dir %{_datadir}/rhn/up2date_client
%dir %{_localstatedir}/spool/up2date

#files
%{_datadir}/rhn/up2date_client/__init__.*
%{_datadir}/rhn/up2date_client/config.*
%{_datadir}/rhn/up2date_client/haltree.*
%{_datadir}/rhn/up2date_client/hardware*
%{_datadir}/rhn/up2date_client/up2dateUtils.*
%{_datadir}/rhn/up2date_client/up2dateLog.*
%{_datadir}/rhn/up2date_client/up2dateErrors.*
%{_datadir}/rhn/up2date_client/up2dateAuth.*
%{_datadir}/rhn/up2date_client/rpcServer.*
%{_datadir}/rhn/up2date_client/rhnserver.*
%{_datadir}/rhn/up2date_client/pkgUtils.*
%{_datadir}/rhn/up2date_client/rpmUtils.*
%{_datadir}/rhn/up2date_client/debUtils.*
%{_datadir}/rhn/up2date_client/rhnPackageInfo.*
%{_datadir}/rhn/up2date_client/rhnChannel.*
%{_datadir}/rhn/up2date_client/rhnHardware.*
%{_datadir}/rhn/up2date_client/transaction.*
%{_datadir}/rhn/up2date_client/clientCaps.*
%{_datadir}/rhn/up2date_client/capabilities.*
%{_datadir}/rhn/up2date_client/rhncli.*
%{_datadir}/rhn/up2date_client/pkgplatform.*
%{_datadir}/rhn/__init__.*

%{_sbindir}/rhn-profile-sync

%ghost %attr(600,root,root) %verify(not md5 size mtime) %{_localstatedir}/spool/up2date/loginAuth.pkl

#public keys and certificates
%{_datadir}/rhn/RHNS-CA-CERT

%if 0%{?fedora}
%{_presetdir}/50-spacewalk-client.preset
%endif

%files -n spacewalk-check
%defattr(-,root,root,-)
%dir %{_datadir}/rhn/actions
%{_mandir}/man8/rhn_check.8*

%{_sbindir}/rhn_check
%{_sbindir}/mgr_check
%{_sbindir}/spacewalk-update-status
%{_sbindir}/mgr-update-status

%{_datadir}/rhn/up2date_client/getMethod.*

# actions for rhn_check to run
%{_datadir}/rhn/actions/__init__.*
%{_datadir}/rhn/actions/hardware.*
%{_datadir}/rhn/actions/systemid.*
%{_datadir}/rhn/actions/reboot.*
%{_datadir}/rhn/actions/rhnsd.*
%{_datadir}/rhn/actions/up2date_config.*

%files -n spacewalk-client-setup
%defattr(-,root,root,-)
%{_mandir}/man8/rhnreg_ks.8*
%{_mandir}/man8/spacewalk-channel.8*
%{_mandir}/man8/rhn-channel.8*

%{_sbindir}/rhnreg_ks
%{_sbindir}/spacewalk-channel
%{_sbindir}/rhn-channel

%{_datadir}/rhn/up2date_client/rhnreg.*
%{_datadir}/rhn/up2date_client/pmPlugin.*
%{_datadir}/rhn/up2date_client/tui.*
%{_datadir}/rhn/up2date_client/rhnreg_constants.*

%if ! 0%{?without_rhn_register}
%{_mandir}/man8/rhn_register.8*
%config(noreplace) %{_sysconfdir}/security/console.apps/rhn_register
%config(noreplace) %{_sysconfdir}/pam.d/rhn_register
%{_bindir}/rhn_register
%{_sbindir}/rhn_register
%{_datadir}/setuptool/setuptool.d/99rhn_register

%if 0%{?suse_version}
# on SUSE directories not owned by any package
%dir %{_sysconfdir}/security/console.apps
%dir %{_datadir}/setuptool
%dir %{_datadir}/setuptool/setuptool.d
%endif
%endif

%if ! 0%{?without_rhn_register}
%files -n spacewalk-client-setup-gnome
%defattr(-,root,root,-)
%{_datadir}/rhn/up2date_client/messageWindow.*
%{_datadir}/rhn/up2date_client/rhnregGui.*
%{_datadir}/rhn/up2date_client/rh_register.glade
%{_datadir}/rhn/up2date_client/gui.*
%{_datadir}/rhn/up2date_client/progress.*
%{_datadir}/pixmaps/*png
%{_datadir}/icons/hicolor/16x16/apps/up2date.png
%{_datadir}/icons/hicolor/24x24/apps/up2date.png
%{_datadir}/icons/hicolor/32x32/apps/up2date.png
%{_datadir}/icons/hicolor/48x48/apps/up2date.png
%if 0%{?rhel} > 6 || 0%{?fedora}
%{_datadir}/icons/hicolor/22x22/apps/up2date.png
%{_datadir}/icons/hicolor/256x256/apps/up2date.png
%endif
%{_datadir}/applications/rhn_register.desktop

%if 0%{?rhel} > 0 && 0%{?rhel} < 6
%{_datadir}/firstboot/modules/rhn_login_gui.*
%{_datadir}/firstboot/modules/rhn_choose_channel.*
%{_datadir}/firstboot/modules/rhn_register_firstboot_gui_window.*
%{_datadir}/firstboot/modules/rhn_start_gui.*
%{_datadir}/firstboot/modules/rhn_choose_server_gui.*
%{_datadir}/firstboot/modules/rhn_provide_certificate_gui.*
%{_datadir}/firstboot/modules/rhn_create_profile_gui.*
%{_datadir}/firstboot/modules/rhn_review_gui.*
%{_datadir}/firstboot/modules/rhn_finish_gui.*
%else
%if 0%{?rhel} < 7
%{_datadir}/firstboot/modules/rhn_register.*
%{_datadir}/rhn/up2date_client/firstboot/rhn_login_gui.*
%{_datadir}/rhn/up2date_client/firstboot/rhn_start_gui.*
%{_datadir}/rhn/up2date_client/firstboot/rhn_choose_server_gui.*
%{_datadir}/rhn/up2date_client/firstboot/rhn_choose_channel.*
%{_datadir}/rhn/up2date_client/firstboot/rhn_provide_certificate_gui.*
%{_datadir}/rhn/up2date_client/firstboot/rhn_create_profile_gui.*
%{_datadir}/rhn/up2date_client/firstboot/rhn_review_gui.*
%{_datadir}/rhn/up2date_client/firstboot/rhn_finish_gui.*
%endif
%endif

%if 0%{?suse_version}
# on SUSE these directories are part of packages not installed
# at buildtime. OBS failed with not owned by any package
%dir %{_datadir}/icons/hicolor
%dir %{_datadir}/icons/hicolor/16x16
%dir %{_datadir}/icons/hicolor/16x16/apps
%dir %{_datadir}/icons/hicolor/24x24
%dir %{_datadir}/icons/hicolor/24x24/apps
%dir %{_datadir}/icons/hicolor/32x32
%dir %{_datadir}/icons/hicolor/32x32/apps
%dir %{_datadir}/icons/hicolor/48x48
%dir %{_datadir}/icons/hicolor/48x48/apps
%dir %{_datadir}/rhn/up2date_client/firstboot
%dir %{_datadir}/firstboot
%dir %{_datadir}/firstboot/modules
%endif
%endif

%changelog
openSUSE Build Service is sponsored by