File system-config-printer.spec of Package system-config-printer

#
# spec file for package system-config-printer
#
# 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/
#


Name:           system-config-printer
Version:        1.4.5
Release:        0
Summary:        A printer administration tool
License:        GPL-2.0+
Group:          Hardware/Printing
Url:            http://cyberelk.net/tim/software/system-config-printer/
Source0:        http://cyberelk.net/tim/data/system-config-printer/1.4/%{name}-%{version}.tar.xz
# PATCH-FIX-OPENSUSE system-config-printer-icon-brp-friendly.patch vuntz@novell.com -- brp checks don't like the printer icon name, so we have to use something else
Patch13:        system-config-printer-icon-brp-friendly.patch
# PATCH-FIX-OPENSUSE system-config-printer-no-openprinting.patch bnc#733542 vuntz@opensuse.org -- Disable feature that downloads ppd from openprinting.org
Patch19:        system-config-printer-no-openprinting.patch
# PATCH-FIX-UPSTREAM system-config-printer-Gtk-introspect.patch bnc#852450 dimstar@opensuse.org -- Require Gtk 3.0 to be present
Patch20:        system-config-printer-Gtk-introspect.patch
# PATCH-FIX-UPSTREAM system-config-printer-no-applet-in-gnome.patch rh#677676 fcrozat@suse.com -- Do not start applet in GNOME
Patch21:        system-config-printer-no-applet-in-gnome.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Obsoletes:      gnome-cups-manager <= 0.33
BuildRequires:  cups-devel
# For directory ownership
BuildRequires:  dbus-1
BuildRequires:  desktop-file-utils
BuildRequires:  fdupes
BuildRequires:  glib2-devel
BuildRequires:  gnome-icon-theme
# Needed for typelib() requires
BuildRequires:  gobject-introspection
# For directory ownership
BuildRequires:  hicolor-icon-theme
BuildRequires:  intltool
BuildRequires:  python-devel
BuildRequires:  python-xml
BuildRequires:  systemd
BuildRequires:  update-desktop-files
BuildRequires:  xmlto
BuildRequires:  pkgconfig(libudev) >= 172
BuildRequires:  pkgconfig(libusb-1.0)
Requires:       %{name}-common = %{version}
Requires:       cups
# The applet is not strictly necessary, but it really makes sense
Recommends:     %{name}-applet
%py_requires

%description
system-config-printer is a graphical user interface that allows the
user to configure a CUPS print server.

%package common
Summary:        A printer administration tool -- Common Files
Group:          Hardware/Printing
Requires:       dbus-1-python
Requires:       python-cairo
Requires:       python-cups >= 1.9.60
Requires:       python-cupshelpers
Requires:       python-gobject
Requires:       python-smbc
Recommends:     %{name}-common-lang
Recommends:     cups-pk-helper
# As soon as this package is installed, it makes sense to have the
# autoconfiguration too
Recommends:     udev-configure-printer
BuildArch:      noarch

%description common
system-config-printer is a graphical user interface that allows the
user to configure a CUPS print server.

This package provides files common to various binaries.

%package applet
Summary:        A printer administration tool -- Notification Icon for Printing
Group:          Hardware/Printing
Requires:       %{name} = %{version}
# Uses the dbus service to interact with print jobs
Requires:       %{name}-dbus-service = %{version}
BuildArch:      noarch
%py_requires

%description applet
system-config-printer is a graphical user interface that allows the
user to configure a CUPS print server.

This package provides a notification icon to configure new printers and
monitor print jobs.

%package dbus-service
Summary:        A printer administration tool -- D-Bus Service to Configure Printing
Group:          Hardware/Printing
Requires:       %{name}-common = %{version}
BuildArch:      noarch
%py_requires

%description dbus-service
system-config-printer is a graphical user interface that allows the
user to configure a CUPS print server.

This packages provides a D-Bus service to configure printers and manage
print jobs.

%package -n python-cupshelpers
Summary:        High-level Python Bindings for CUPS
Group:          Hardware/Printing
Requires:       python-cups >= 1.9.60
Requires:       python-pycurl
BuildArch:      noarch
%py_requires

%description -n python-cupshelpers
This package provides high-level python bindings for CUPS, and can be
used on top of python-cups.

%package -n udev-configure-printer
Summary:        Utility to autoconfigure printers when plugged
Group:          Hardware/Printing
Obsoletes:      cups-autoconfig <= 0.1.0
Requires:       dbus-1-python
Requires:       python-cups >= 1.9.60
Requires:       python-cupshelpers
Recommends:     %{name}-applet
%systemd_requires
%py_requires

%description -n udev-configure-printer
This package contains an utility that will ensure printers get
automatically configured when plugged on the computer.

%lang_package -n system-config-printer-common
%prep
%setup -q
%patch13 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1

%build
%configure \
        --with-udev-rules \
        --with-systemdsystemunitdir=%{_unitdir}

%install
%makeinstall udevrulesdir=/usr/lib/udev/rules.d udevhelperdir=/usr/lib/udev
for size in 8x8 16x16 22x22 24x24 32x32 48x48 256x256; do
	if test -f %{_datadir}/icons/gnome/$size/devices/printer.png; then
		mkdir -p $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/$size/apps
		cp -a %{_datadir}/icons/gnome/$size/devices/printer.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/$size/apps/%{name}.png
	fi
done
%suse_update_desktop_file print-applet
%suse_update_desktop_file -r system-config-printer GTK System HardwareSettings
%fdupes $RPM_BUILD_ROOT/%{py_sitedir}
%find_lang %{name} %{?no_lang_C}

%clean
rm -rf $RPM_BUILD_ROOT

%post
%desktop_database_post
%icon_theme_cache_post

%postun
%desktop_database_postun
%icon_theme_cache_postun

%pre -n udev-configure-printer
%service_add_pre configure-printer@.service

%post -n udev-configure-printer
%service_add_post configure-printer@.service

%preun -n udev-configure-printer
%service_del_preun configure-printer@.service

%postun -n udev-configure-printer
%service_del_postun configure-printer@.service

%files
%defattr(-,root,root,-)
%doc ChangeLog COPYING README
%{_bindir}/%{name}
%{_bindir}/install-printerdriver
%{_datadir}/applications/system-config-printer.desktop
%{_mandir}/man1/system-config-printer.1%{?ext_man}

%files common
%defattr(-,root,root,-)
%{_datadir}/%{name}/
%{_datadir}/icons/hicolor/*/apps/system-config-printer.png

%files applet
%defattr(-,root,root,-)
%{_bindir}/%{name}-applet
%{_mandir}/man1/system-config-printer-applet.1%{?ext_man}
# The dbus service is provided by applet.py
%config(noreplace) %{_sysconfdir}/dbus-1/system.d/com.redhat.NewPrinterNotification.conf
%{_sysconfdir}/xdg/autostart/print-applet.desktop

%files dbus-service
%defattr(-,root,root,-)
%{_bindir}/scp-dbus-service
%{_datadir}/dbus-1/interfaces/org.fedoraproject.Config.Printing.xml
%{_datadir}/dbus-1/services/org.fedoraproject.Config.Printing.service

%files -n python-cupshelpers
%defattr(-,root,root,-)
%dir %{_sysconfdir}/cupshelpers
%config(noreplace) %{_sysconfdir}/cupshelpers/preferreddrivers.xml
%exclude %{python_sitelib}/cupshelpers/*.pyc
# The dbus service is provided by cupshelpers/installdriver.py
%config(noreplace) %{_sysconfdir}/dbus-1/system.d/com.redhat.PrinterDriversInstaller.conf
%{python_sitelib}/cupshelpers
%{python_sitelib}/cupshelpers*.egg-info

%files -n udev-configure-printer
%defattr(-,root,root,-)
%{_unitdir}/configure-printer@.service
%dir /usr/lib/udev
%dir /usr/lib/udev/rules.d
/usr/lib/udev/rules.d/*.rules
/usr/lib/udev/udev-add-printer
/usr/lib/udev/udev-configure-printer

%files common-lang -f %{name}.lang

%changelog