Sophie

Sophie

distrib > Mageia > 1 > i586 > by-pkgid > eb43c1639e63ce8e8e66d43dc2d5039c > files > 52

hplip-3.11.7-1.1.mga1.src.rpm

# Define if you want to build the sane backend (default)
%define sane_backend		1
%{?_with_sane:			%global sane_backend 1}
%{?_without_sane:		%global sane_backend 0}

%define hpip_major		0
%define hpip_libname		%mklibname hpip %{hpip_major}

%define sane_hpaio_major	1
%define sane_hpaio_libname	%mklibname sane-hpaio %{sane_hpaio_major}

# Suppress automatically generated Requires for devel packages
%define _requires_exceptions devel\(.*\)

#define extraversion -RC1
%define extraversion %nil

%define subrel 1

Summary:	HP printer/all-in-one driver infrastructure
Name:		hplip
Version:	3.11.7
Release:	%mkrel 1
License:	GPLv2+ and MIT
Group:		System/Printing
Source:		http://heanet.dl.sourceforge.net/sourceforge/hplip/%{name}-%{version}%{extraversion}.tar.gz
Source1:	hpcups-update-ppds.sh
Source2:	copy-deviceids.py


# (doktor5000) fix linking with python and libsane
# taken from mandriva
Patch1: hplip-3.11.3-mdv-link.patch

# Fedora patches
Patch101: hplip-pstotiff-is-rubbish.patch
Patch102: hplip-strstr-const.patch
Patch103: hplip-ui-optional.patch
Patch104: hplip-no-asm.patch
Patch105: hplip-deviceIDs-drv.patch
Patch106: hplip-mucks-with-spooldir.patch
Patch107: hplip-udev-rules.patch
Patch108: hplip-retry-open.patch
Patch109: hplip-snmp-quirks.patch
Patch110: hplip-discovery-method.patch
Patch111: hplip-hpijs-marker-supply.patch
Patch112: hplip-clear-old-state-reasons.patch
Patch114: hplip-hpcups-sigpipe.patch
Patch115: hplip-fax-ppd.patch
Patch116: hplip-bad-low-ink-warning.patch
Patch117: hplip-deviceIDs-ppd.patch
Patch118: hplip-skip-blank-lines.patch
Patch119: hplip-dbglog-newline.patch
Patch120: hplip-no-system-tray.patch
Patch122: hplip-ppd-ImageableArea.patch
Patch125: hplip-raw_deviceID-traceback.patch
Patch126: hplip-UnicodeDecodeError.patch
Patch127: hplip-emit-SIGNAL.patch
Patch128: hplip-fab-root-crash.patch
Patch129: hplip-addprinter.patch
Patch130: hplip-dbus-exception.patch
Patch131: hplip-hpaio-segfault.patch
Patch132: hplip-newline.patch
Patch133: hplip-dbus-threads.patch
Patch134: hplip-notification-exception.patch
Patch135: hplip-CVE-2010-4267.patch
Patch136: hplip-wifisetup.patch
Patch137: hplip-CVE-2011-2722.patch

# Debian/Ubuntu patches
# taken from http://patch-tracker.debian.org/package/hplip/3.11.5-2
Patch201: 01_rss.dpatch
Patch202: 10_shebang_fixes.dpatch
Patch203: 14_charsign_fixes.dpatch
Patch204: 85_rebuild_python_ui.dpatch
Patch205: 87_move_documentation.dpatch
Patch206: hplip-photosmart_b9100_support.patch
Patch207: hplip-pjl-duplex-binding.patch
Patch208: mga-kde4-kdesudo-support.dpatch
Patch209: hp-check-groups.dpatch
Patch210: hp-check_debian.dpatch
Patch211: hp-setup-prompt-for-custom-PPD.dpatch
# (doktor5000) rediff original debian patch for hplip 3.11.7
Patch212: mga-udev-rules-use-attrs-not-sysfs-and-hp-mkuri-call-fix.patch
Patch213: hp-mkuri-take-into-account-already-installed-plugin-also-for-exit-value.dpatch
Patch214: ubuntu-hp-mkuri-notification-text.dpatch
Patch215: simple-scan-as-default.dpatch
Patch216: make-commafy-correctly-work-with-python-2.dpatch
# (doktor5000) rediff original debian patch for hplip 3.11.7
Patch217: mga-remove-duplicate-entry-for-cp1700-in-drv-files.patch
#already applied
Patch218: black-stripes-on-pcl5c-printouts.dpatch
Patch219: try_libhpmud.so.0.dpatch
Patch220: add-lidil-two-cartridge-modes.dpatch
Patch221: add_missing_newline_for_error_log.dpatch
Patch222: large-sizes-borderless-on-photosmart-pro-b-series.dpatch
Patch223: more-user-friendly-choice-names-for-installed-cartridges.dpatch

Url:		http://hplip.sourceforge.net/
%if %{sane_backend}
BuildRequires:	libsane-devel, xsane
%endif
%py_requires -d
BuildRequires:	python-sip >= 4.1.1
BuildRequires:	net-snmp-devel
BuildRequires:	libusb-devel >= 0.1.8
BuildRequires:	imagemagick
BuildRequires:	autoconf
BuildRequires:	libcups-devel
BuildRequires:	libjpeg-devel
BuildRequires:	python-devel
BuildRequires:	desktop-file-utils
BuildRequires:	libdbus-devel
BuildRequires:	udev-devel
BuildRequires:	polkit
BuildRequires:	gphoto2-devel
BuildRequires:  libv4l-devel
Requires:	cups
# For dynamic ppd generation.
Requires:	cupsddk-drivers >= 1.2.3-2mdv
Requires:	foomatic-filters
Requires:	hplip-model-data hplip-hpijs
Requires:	hplip-hpijs-ppds
Requires:	python-sip >= 4.1.1
# Needed for communicating with ethernet-connected printers
Requires:	net-snmp-mibs
# Needed to generate fax cover pages
Requires:	python-reportlab
# Needed since 2.8.4 for IPC
Requires:	python-dbus
Requires:	polkit-agent
Requires:	usermode-consoleonly
Requires:	python-gobject
# Required by hp-scan for command line scanning
Requires:	python-imaging
Requires:	sane-backends-hpaio
# Needed to avoid misleading errors about network connectivity (RH bug #705843)
Requires:	wget
# Some HP ppds are in foomatic-db and foomatic-db-hpijs (mdv bug #47415)
Suggests:	foomatic-db-hpijs

# foomatic-db-hpijs drivers are provided by hp and by this package now
# NOTE: remove the foomatic-db-hpijs deps sometime in 2010-10-?? ?
Provides:	foomatic-db-hpijs = %{version}-%{release}
Obsoletes:	foomatic-db-hpijs


%description
This is the HP driver package to supply Linux support for most
Hewlett-Packard DeskJet, LaserJet, PSC, OfficeJet, and PhotoSmart
printers and all-in-one peripherals (also known as Multi-Function
Peripherals or MFPs), which can print, scan, copy, fax, and/or access
flash memory cards.

It is work in progress, but printing, scanning, memory card access,
ink/toner/battery/consumable level checking, and inkjet printer
maintenance are supported on most models, when either connected to the
USB or LAN (built-in interfaces or selected HP JetDirect models) on a
Linux workstation with CUPS printing system.

For status and consumable checking and also for inkjet maintenance
there is the graphical tool "hp-toolbox" available (Menu:
"System"/"Monitoring"/"HP Printer Toolbox").

%package -n %{hpip_libname}
Summary: Dynamic library for the "hplip" HP printer/all-in-one drivers
Group: System/Printing

%description -n %{hpip_libname}
Library needed for the "hplip" HP printer/all-in-one drivers

%package -n %{hpip_libname}-devel
Summary: Headers and links to compile against the "%{hpip_libname}" ("hplip") library
Group: Development/C
Requires: %{hpip_libname} >= %{version}-%{release}
Provides: libhpip-devel = %{version}-%{release}

%description -n %{hpip_libname}-devel
This package contains all files which one needs to compile programs using
the "%{hpip_libname}" library.

%if %{sane_backend}
%package -n %{sane_hpaio_libname}
Summary: SANE driver for scanners in HP's multi-function devices (from HPLIP)
Group: System/Printing
Requires: sane-backends
Provides: sane-backends-hpaio = %{version}-%{release}
# (cjw) for system-config-printer
Provides: libsane-hpaio
%define _requires_exceptions devel(libcrypto)\\|devel(libdl)\\|devel(libhpip)\\|devel(libm)\\|devel(libsnmp)
%endif

%if %{sane_backend}
%description -n %{sane_hpaio_libname}
SANE driver for scanners in HP's multi-function devices (from HPLIP)
%endif

%if 0
%if %{sane_backend}
%package -n %{sane_hpaio_libname}-devel
Summary: Headers and links to compile against the "%{sane_hpaio_libname}" ("sane-hpaio") library
Group: Development/C
Requires: %{sane_hpaio_libname} >= %{version}-%{release}
Provides: libsane-hpaio-devel = %{version}-%{release}
%endif

%if %{sane_backend}
%description -n %{sane_hpaio_libname}-devel
This package contains all files which one needs to compile programs using
the "%{sane_hpaio_libname}" library.
%endif
%endif

%package model-data
Summary: Data file listing the HP printer models supported by HPLIP
Group: System/Printing

%description model-data
HPLIP supports most current HP printers and multifunction devices, but
there are some older models not supported. This package contains the
list of supported models. Printerdrake installs it automatically to
determine whether HPLIP has to be installed or not.

%package gui
Summary: HPLIP graphical tools
Group: System/Printing
Requires:python-qt4-gui
Requires: %{name} = %{version}-%{release}
Requires: usermode

%description gui
HPLIP graphical tools.


%package hpijs
Summary: HPs printer driver IJS plug-in for GhostScript
Group: System/Printing
Requires: ghostscript
Provides: hpijs

%description hpijs
HPs printer driver IJS plug-in for GhostScript. This driver gives full
printing support for nearly all non-PostScript inkjet and laser
printers made by HP.

%package hpijs-ppds
Summary: PPD files for the HPIJS printer driver
Group: System/Printing
Requires: foomatic-filters, hplip-hpijs

%description hpijs-ppds
PPD files to use the HPIJS printer driver with foomatic-rip and a
printer spooler like CUPS, LPRng, PDQ, ...

%package doc
Summary:	Documentation for HPLIP
Group:		System/Printing

%description doc
This package contains documentation for the HPLIP driver.

This is the HP driver package to supply Linux support for most
Hewlett-Packard DeskJet, LaserJet, PSC, OfficeJet, and PhotoSmart
printers and all-in-one peripherals (also known as Multi-Function
Peripherals or MFPs), which can print, scan, copy, fax, and/or access
flash memory cards.

%prep
rm -rf $RPM_BUILD_DIR/%{name}-%{version}%{extraversion}
%setup -q -n %{name}-%{version}%{extraversion}

# Fedora patches

# The pstotiff filter is rubbish so replace it (launchpad #528394).
%patch101 -p1 -b .pstotiff-is-rubbish

# Fix compilation.
%patch102 -p1 -b .strstr-const

# Make utils.checkPyQtImport() look for the gui sub-package (RH bug #243273).
%patch103 -p1 -b .ui-optional

# Make sure to avoid handwritten asm.
%patch104 -p1 -b .no-asm

# Corrected several IEEE 1284 Device IDs using foomatic data.
# HP LaserJet P1007 (RH bug #585272).
# HP LaserJet P1505 (RH bug #680951).
# HP Color LaserJet CM1312nfi (RH bug #581005).
# HP Color LaserJet 3800 (RH bug #581935).
# HP Color LaserJet 2840 (RH bug #582215).
# HP Color LaserJet CP1518ni (RH bug #613689).
# HP Color LaserJet 2600n (RH bug #613712).
# HP LaserJet 4050 Series/4100 Series/2100 Series/4350/5100 Series/8000 Series
#             P3005/P3010 Series/P4014/P4515 (RH bug #659039).
# HP Color LaserJet 2500/3700/4550/4600/4650/4700/5550/CP1515n/CP2025n
#                   CP3525/CP4520 Series/CM2320nf (RH bug #659040).
# HP Color LaserJet CP2025dn (RH bug #651509).
# HP Color LaserJet CM4730 MFP (RH bug #658831).
# HP Color LaserJet CM3530 MFP (RH bug #659381).
# HP LaserJet Professional P1606dn (RH bug #708472).
%patch105 -p1 -b .deviceIDs-drv

mv prnt/drv/hpijs.drv.in{,.deviceIDs-drv-hpijs}
python %{SOURCE2} prnt/drv/hpcups.drv.in \
	prnt/drv/hpijs.drv.in.deviceIDs-drv-hpijs \
	> prnt/drv/hpijs.drv.in

# Stopped hpcups pointlessly trying to read spool files
# directly (RH bug #552572).
%patch106 -p1 -b .mucks-with-spooldir

# Retry when connecting to device fails (RH bug #532112).
%patch108 -p1 -b .retry-open

# Mark SNMP quirks in PPD for HP OfficeJet Pro 8500 (RH bug #581825).
%patch109 -p1 -b .snmp-quirks

# Fixed hp-setup traceback when discovery page is skipped (RH bug #523685).
%patch110 -p1 -b .discovery-method

# Fixed bogus low ink warnings from hpijs driver (RH bug #643643).
%patch111 -p1 -b .hpijs-marker-supply

# Clear old printer-state-reasons we used to manage (RH bug #510926).
%patch112 -p1 -b .clear-old-state-reasons

# Avoid busy loop in hpcups when backend has exited (RH bug #525944).
%patch114 -p1 -b .hpcups-sigpipe

# Use correct fax PPD name for Qt3 UI.
%patch115 -p1 -b .fax-ppd

# Fixed Device ID parsing code in hpijs's dj9xxvip.c (RH bug #510926).
%patch116 -p1 -b .bad-low-ink-warning

# Add Device ID for
# HP LaserJet 1200 (RH bug #577308)
# HP LaserJet 1320 series (RH bug #579920)
# HP LaserJet 2300 (RH bug #576928)
# HP LaserJet P2015 Series (RH bug #580231)
# HP LaserJet 4250 (RH bug #585499).
# HP Color LaserJet 2605dn (RH bug #583953).
# HP Color LaserJet 3800 (RH bug #581935).
# HP Color LaserJet 2840 (RH bug #582215).
# HP LaserJet 4050 Series/4100 Series/2100 Series/2420/4200/4300/4350/5100 Series
#            8000 Series/M3027 MFP/M3035 MFP/P3005/P3010 Series (RH bug #659039).
# HP Color LaserJet 2500/2550/2605dn/3700/4550/4600
#                   4650/4700/5550/CP3525 (RH bug #659040).
# HP Color LaserJet CM4730 MFP (RH bug #658831).
# HP Color LaserJet CM3530 MFP (RH bug #659381).
for ppd_file in $(grep '^diff' %{PATCH117} | cut -d " " -f 4);
do
  gunzip ${ppd_file#*/}.gz
done
%patch117 -p1 -b .deviceIDs-ppd
for ppd_file in $(grep '^diff' %{PATCH117} | cut -d " " -f 4);
do
  gzip -n ${ppd_file#*/}
done

# Hpcups (ljcolor) was putting black lines where should be blank lines (RH bug #579461).
%patch118 -p1 -b .skip-blank-lines

# Added missing newline to string argument in dbglog() call (RH bug #585275).
%patch119 -p1 -b .dbglog-newline

# Wait longer to see if a system tray becomes available (RH bug #569969).
%patch120 -p1 -b .no-system-tray

# Fix ImageableArea for Laserjet 8150/9000 (RH bug #596298).
for ppd_file in $(grep '^diff' %{PATCH122} | cut -d " " -f 4);
do
  gunzip ${ppd_file#*/}.gz
done
%patch122 -p1 -b .ImageableArea
for ppd_file in $(grep '^diff' %{PATCH122} | cut -d " " -f 4);
do
  gzip -n ${ppd_file#*/}
done

# Fixed traceback on error condition in device.py (RH bug #628125).
%patch125 -p1 -b .raw_deviceID-traceback

# Avoid UnicodeDecodeError in printsettingstoolbox.py (RH bug #645739).
%patch126 -p1 -b .UnicodeDecodeError

# Don't emit SIGNALs in ui4.setupdialog.SetupDialog the PyQt3 way (RH bug #623834).
%patch127 -p1 -b .emit-SIGNAL

# Prevent hp-fab traceback when run as root.
%patch128 -p1 -b .fab-root-crash

# Call cupsSetUser in cupsext's addPrinter method before connecting so
# that we can get an authentication callback (RH bug #538352).
%patch129 -p1 -b .addprinter

# Catch D-Bus exceptions in fax dialog (RH bug #645316).
%patch130 -p1 -b .dbus-exception

# Prevent hpaio segfaulting on invalid URIs (RH bug #649092).
%patch131 -p1 -b .hpaio-segfault

# Another missing newline in filter output (Ubuntu #418053).
%patch132 -p1 -b .newline

# Enable D-Bus threading (and require pygobject2) (RH bug #600932).
%patch133 -p1 -b .dbus-threads

# Catch GError exception when notification showing failed (RH bug #665577).
%patch134 -p1 -b .notification-exception

# Applied patch to fix CVE-2010-4267, remote stack overflow
# vulnerability (RH bug #670252).
%patch135 -p1 -b .CVE-2010-4267

# Avoid KeyError in ui4/wifisetupdialog.py (RH bug #680939).
%patch136 -p1 -b .wifisetup
%patch137 -p1 -b .CVE-2011-2722

sed -i.duplex-constraints \
    -e 's,\(UIConstraints.* \*Duplex\),//\1,' \
    prnt/drv/hpcups.drv.in

# Debian/Ubuntu patches

# This patch tries to make sure that black is printed with just
# the black pen, if the printer supports it
%patch201 -p1 -b .01_rss

# shebang fixes
%patch202 -p1 -b .10_shebang_fixes

# code cleanup related to char signedness
%patch203 -p1 -b .14_charsign

# compiling ui files to py
%patch204 -p1 -b .85_rebuild_python_ui

# place html documentation under hplip-doc/HTML/
%patch205 -p1 -b .87_move_documentation

# Corrections on the models.dat entry for the HP PhotoSmart Pro B9100,
# especially for the correct color calibration mode.
%patch206 -p1 -b .hplip-photosmart_b9100_support

# Fixes Short-edge duplex printing if duplex is PJL-controlled
# https://bugs.launchpad.net/hplip/+bug/244295
%patch207 -p1 -b .hplip-pjl-duplex-binding

# original patch from debian, path to kdesu added for %%_libdir on x86_64
%patch208 -p1 -b .mga-kde4-kdesudo-support

# https://bugs.launchpad.net/debian/+source/hplip/+bug/530746
%patch209 -p1 -b .hp-check-groups

# Check for hpaio module in /etc/sane.d/dll.d/hplip too
%patch210 -p1 -b .hp-check_debian

%patch211 -p1 -b .hp-setup-prompt-for-custom-PPDs

# Fix use of deprecated udev syntax
# https://bugs.launchpad.net/ubuntu/+source/hplip/+bug/491346
%patch212 -p1 -b .mga-udev-rules-use-attrs-not-sysfs-and-hp-mkuri-call-fix

%patch213 -p1 -b .hp-mkuri-take-into-account-already-installed-plugin-also-for-exit-value

# disable for now, as this changes default hplip behavior
# and change in default scanning application should be decided by a poll first
#%patch215 -p1 -b .simple-scan-as-default

%patch216 -p1 -b .make-commafy-correctly-work-with-python-2

%patch217 -p1 -b .mga-remove-duplicate-entry-for-cp1700-in-drv-files

# dlopen libhpmud.so.0 instad of libhpmud.so, in order not to depend on
# devel package (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=548379)
# obsoletes hplip-3.9.8-dlopen-libhpmud.patch, newer & extended version
%patch219 -p1 -b .try_libhpmud.so.0

%patch220 -p1 -b .add-lidil-two-cartridge-modes

%patch222 -p1 -b .large-sizes-borderless-on-photosmart-pro-b-series

%patch223 -p1 -b .more-user-friendly-choice-names-for-installed-cartridges

# Make all files in the source user-writable
chmod -R u+w .

%build
%serverbuild
#needed by patch205
libtoolize --copy --force
aclocal --force
autoconf -f
#needed by patches 205 and 210
automake -f --foreign

%if !%{sane_backend}
WITHOUT_SANE="--without-sane"
%endif
%configure2_5x $WITHOUT_SANE \
	--disable-foomatic-rip-hplip-install \
	--enable-scan-build \
	--enable-gui-build \
	--enable-fax-build \
	--enable-pp-build \
	--enable-qt4 --disable-qt3 \
	--enable-hpcups-install \
	--enable-cups-drv-install \
	--enable-cups-ppd-install \
	--enable-hpijs-install \
	--enable-udev-acl-rules \
	--enable-policykit \
	--with-mimedir=%{_datadir}/cups/mime

sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool

%make

# convert icons to required sizes
#convert data/images/print.png -resize 16x16 %{name}.mini.png
#convert data/images/print.png -resize 32x32 %{name}.png
#convert data/images/print.png -resize 48x48 %{name}.large.png

%install
rm -rf %{buildroot}
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_includedir}
mkdir -p %{buildroot}%{_initrddir}
mkdir -p %{buildroot}%{_sysconfdir}/hp
mkdir -p %{buildroot}/var/run/hplip

# Do not use the macro here, use the standard DESTDIR method as it works
# with HPLIP, in contrary to the non-standard Mandriva method
#make test-destdir DESTDIR=%{buildroot}
make install DESTDIR=%{buildroot}

# Install files which the "make install" missed to install
install -m 644 ip/hpip.h %{buildroot}%{_includedir}
install -m 644 ip/xform.h %{buildroot}%{_includedir}

# Move doc in sub-package
mv %{buildroot}%{_docdir}/%{name}-%{version}%{extraversion} %{buildroot}%{_docdir}/%{name}-doc-%{version}%{extraversion}

# Remove static libraries of SANE driver
rm -f %{buildroot}%{_libdir}/sane/libsane-hpaio*.so
rm -f %{buildroot}%{_libdir}/sane/libsane-hpaio*.la
rm -f %{buildroot}%{_sysconfdir}/sane.d/dll.conf

# Remove other unneeded files
rm -f %{buildroot}%{py_platsitedir}/*.la

# install menu icons
#mkdir -p %{buildroot}%{_iconsdir}/locolor/16x16/apps/
#install -m 644 %{name}.png -D %{buildroot}%{_iconsdir}/%{name}.png
#install -m 644 %{name}.mini.png -D %{buildroot}%{_miconsdir}/%{name}.png
#install -m 644 %{name}.large.png -D %{buildroot}%{_liconsdir}/%{name}.png

mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications
desktop-file-install --vendor='' \
	--dir=%{buildroot}%{_datadir}/applications \
	--remove-category='Application' \
	--remove-category='Utility' \
	--add-category='System' \
	--add-category='Settings' \
	--add-category='Printing' \
        --add-category='Qt' \
        --add-category='HardwareSettings' \
        --add-category='X-MandrivaLinux-CrossDesktop' \
	--remove-key='Version' \
        %{buildroot}%{_datadir}/applications/hplip.desktop

cat > $RPM_BUILD_ROOT%{_datadir}/applications/%{_real_vendor}-hp-sendfax.desktop << EOF
[Desktop Entry]
Name=HP Sendfax
Comment=Utility for sending faxes with HP's multi-function devices
Exec=%{_bindir}/hp-sendfax
Icon=%{_datadir}/%{name}/data/images/32x32/fax_machine.png
Terminal=false
Type=Application
Categories=TelephonyTools;Qt;Printing;Utility;X-MandrivaLinux-CrossDesktop;
EOF
#' #Fix vim's stupid syntax

# The systray applet doesn't work properly (displays icon as a
# window), so don't ship the launcher yet.
rm -f %{buildroot}%{_sysconfdir}/xdg/autostart/hplip-systray.desktop


# switched to udev, no need for hal information
rm -rf  %{buildroot}%{_datadir}/hal/fdi 

rm -f   %{buildroot}%{_libdir}/*.la \
        %{buildroot}%{python_sitearch}/*.la \
        %{buildroot}%{_libdir}/sane/*.la

# Regenerate hpcups PPDs on upgrade if necessary (bug #579355).
install -p -m755 %{SOURCE1} %{buildroot}%{_bindir}/hpcups-update-ppds

# Fedora pstotiff
rm -f %{buildroot}%{_sysconfdir}/cups/pstotiff.types
rm -f %{buildroot}%{_datadir}/cups/mime/pstotiff.types
rm -f %{buildroot}%{_datadir}/hplip/fax/pstotiff*
rm -f %{buildroot}%{_prefix}/lib/cups/filter/hpcac

# bork?
install -d %{buildroot}%{_sysconfdir}/cups
cp -p %{buildroot}%{_datadir}/cups/mime/pstotiff.convs %{buildroot}%{_sysconfdir}/cups/pstotiff.convs

# set up consolehelper
mkdir -p %{buildroot}%{_sbindir}
mv %{buildroot}%{_bindir}/hp-setup %{buildroot}%{_sbindir}/hp-setup
ln -s consolehelper %{buildroot}%{_bindir}/hp-setup

# Make sure pyc files are generated, otherwise we can get
# difficult to debug problems
pushd %{buildroot}%{_datadir}/%{name}
python -m compileall .
popd

%triggerin -- hplip < 2.7.7
chkconfig --del hplip

# Restart CUPS to make the Fax PPD known to it
if [ -f /etc/init.d/cups ]; then
	/sbin/service cups condrestart || :
fi

%post -n hplip-hpijs-ppds
# Restart CUPS to make the printing PPDs known to it
if [ -f /etc/init.d/cups ]; then
	/sbin/service cups condrestart || :
fi

%post -n hplip-hpijs
%{_bindir}/hpcups-update-ppds &>/dev/null ||:

%post -n hplip-model-data
/sbin/udevadm trigger --subsystem-match=usb --attr-match=idVendor=03f0


%if %{sane_backend}
%post -n %{sane_hpaio_libname}

# Add HPLIP driver to /etc/sane.d/dll.conf
if ! grep ^hpaio /etc/sane.d/dll.conf >/dev/null 2>/dev/null ; then \
	echo hpaio >> /etc/sane.d/dll.conf; \
fi
%endif

%if %{sane_backend}
%preun -n %{sane_hpaio_libname}
# Remove HPLIP driver from /etc/sane.d/dll.conf
if [ "$1" = 0 ]; then \
	if grep ^hpaio /etc/sane.d/dll.conf >/dev/null 2>/dev/null ; then \
		sed '/hpaio/d' /etc/sane.d/dll.conf > /tmp/$$; \
		cp -f /tmp/$$ /etc/sane.d/dll.conf; \
		rm -f /tmp/$$; \
	fi; \
fi
%endif

# Restart CUPS to make the removal of the Fax PPD known to it
if [ -f /etc/init.d/cups ]; then
	/sbin/service cups condrestart || :
fi

%postun -n hplip-hpijs-ppds
# Restart CUPS to make the removal of the printing PPDs known to it
if [ -f /etc/init.d/cups ]; then
	/sbin/service cups condrestart || :
fi



%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root)
#doc COPYING doc/*
%config(noreplace) %{_sysconfdir}/hp
%dir /var/run/hplip/
%{_bindir}/hp-align
%{_bindir}/hp-clean
%{_bindir}/hp-colorcal
%{_bindir}/hp-devicesettings
%{_bindir}/hp-fab
%{_bindir}/hp-faxsetup
%{_bindir}/hp-firmware
%{_bindir}/hp-info
%{_bindir}/hp-levels
%{_bindir}/hp-linefeedcal
%{_bindir}/hp-makecopies
%{_bindir}/hp-makeuri
%{_bindir}/hp-mkuri
%{_bindir}/hp-pkservice
%{_bindir}/hp-plugin
%{_bindir}/hp-pqdiag
%{_bindir}/hp-printsettings
%{_bindir}/hp-probe
%{_bindir}/hp-query
%{_bindir}/hp-scan
%{_bindir}/hp-sendfax
%{_bindir}/hp-setup
%{_sbindir}/hp-setup
%{_bindir}/hp-testpage
%{_bindir}/hp-timedate
%{_bindir}/hp-unload
%{_bindir}/hp-wificonfig

%exclude %{_datadir}/hplip/data/models
# C libraries for Python
%{_libdir}/python*/*/*.so*
# CUPS backends (0755 permissions, so that CUPS 1.2 runs these backends
# as lp user)
# Note: this must be /usr/lib not %{_libdir}, since that's the
# CUPS serverbin directory.
%attr(0755,root,root) %{_prefix}/lib/cups/backend/hp*
%{_prefix}/lib/cups/filter/hplipjs
%{_prefix}/lib/cups/filter/hpcups
%{_prefix}/lib/cups/filter/hpcupsfax
%{_prefix}/lib/cups/filter/hpps
%{_prefix}/lib/cups/filter/pstotiff
%{_datadir}/cups/mime/pstotiff.convs
%config(noreplace) %{_sysconfdir}/cups/pstotiff.convs
%{_datadir}/ppd/HP/HP-Fax*.ppd*
%{_datadir}/cups/drv/hp/hpcups.drv
# Files
%dir %{_datadir}/hplip
%{_datadir}/hplip/align.py*
%{_datadir}/hplip/clean.py*
%{_datadir}/hplip/colorcal.py*
%{_datadir}/hplip/devicesettings.py*
%{_datadir}/hplip/fab.py*
%{_datadir}/hplip/fax
%{_datadir}/hplip/faxsetup.py*
%{_datadir}/hplip/firmware.py*
%{_datadir}/hplip/hpdio.py*
%{_datadir}/hplip/hpssd*
%{_datadir}/hplip/info.py*
%{_datadir}/hplip/__init__.py*
%{_datadir}/hplip/levels.py*
%{_datadir}/hplip/linefeedcal.py*
%{_datadir}/hplip/makecopies.py*
%{_datadir}/hplip/makeuri.py*
%{_datadir}/hplip/pkservice.py*
%{_datadir}/hplip/plugin.py*
%{_datadir}/hplip/pqdiag.py*
%{_datadir}/hplip/printsettings.py*
%{_datadir}/hplip/probe.py*
%{_datadir}/hplip/query.py*
%{_datadir}/hplip/scan.py*
%{_datadir}/hplip/sendfax.py*
%{_datadir}/hplip/setup.py*
%{_datadir}/hplip/testpage.py*
%{_datadir}/hplip/timedate.py*
%{_datadir}/hplip/unload.py*
%{_datadir}/hplip/wificonfig.py*
# Directories
%{_datadir}/hplip/base
%{_datadir}/hplip/copier
%dir %{_datadir}/hplip/data
%{_datadir}/hplip/data/ldl
%{_datadir}/hplip/data/localization
%{_datadir}/hplip/data/models
%{_datadir}/hplip/data/pcl
%{_datadir}/hplip/data/ps
%{_datadir}/hplip/installer
%{_datadir}/hplip/pcard
%{_datadir}/hplip/prnt
%{_datadir}/hplip/scan
%{_datadir}/polkit-1/actions/com.hp.hplip.policy
%{_datadir}/dbus-1/system-services/com.hp.hplip.service
%{_localstatedir}/lib/hp/hplip.state
%config(noreplace) %{_sysconfdir}/dbus-1/system.d/com.hp.hplip.conf

%files doc
%defattr(-,root,root)
%doc %{_docdir}/%{name}-doc-%{version}%{extraversion}

%files -n %{hpip_libname}
%defattr(-,root,root)
%{_libdir}/libhpip*.so.*
%{_libdir}/libhpmud.so.*

%files -n %{hpip_libname}-devel
%defattr(-,root,root)
%{_includedir}/hpip.h
%{_includedir}/xform.h
%{_libdir}/libhpip*.so
%{_libdir}/libhpmud.so

%if %{sane_backend}

%files -n %{sane_hpaio_libname}
%defattr(-,root,root)
%{_libdir}/sane/libsane-hpaio*.so.*

%endif

%files model-data
%defattr(-,root,root)
%{_sysconfdir}/udev/rules.d/*.rules
%{_datadir}/hplip/data/models

%files gui
%{_bindir}/hp-check
%{_bindir}/hp-print
%{_bindir}/hp-systray
%{_bindir}/hp-toolbox
%{_datadir}/applications/*.desktop
# Files
%{_datadir}/hplip/check.py*
%{_datadir}/hplip/print.py*
%{_datadir}/hplip/systray.py*
%{_datadir}/hplip/toolbox.py*
# Directories
%{_datadir}/hplip/data/images
%{_datadir}/hplip/ui4

%files hpijs
%defattr(-,root,root)
%{_bindir}/hpijs
# Needed for both printing and fax PPDs. They all need HPIJS, therefore
# the link is here
%dir %{_datadir}/ppd
%dir %{_datadir}/ppd/HP
%{_bindir}/hpcups-update-ppds

%files hpijs-ppds
%defattr(-,root,root)
%{_datadir}/ppd/HP/apollo*.ppd*
%{_datadir}/ppd/HP/hp-*.ppd*




%changelog

* Mon Sep 12 2011 doktor5000 <doktor5000> 3.11.7-1.1.mga1
+ Revision: 142616
- remove empty %%postun for sane-hpaio subpackage
- disable simple-scan-as-default.patch for now, as it changes default scanning application
- new version 3.11.7
  o fixes upgrade from Mandriva
- fix CVE-2011-2722
- added Requires on wget to avoid misleading errors about network connectivity
- added comments why systray .desktop file needs to be removed
- added Device ID for HP LaserJet Professional P1606dn
- Re-create installed hpcups PPDs unconditionally (RH bug #712241)
- resync with Fedora patches
- resync with Debian/Ubuntu Patches, reordered/renamed patches like debian does
- removed color-value-underflow.patch, already integrated in 3.11.5
- removed hplip-hpinfo-query-without-cups-queue.patch, dropped by debian
- removed hplip-systray-longer-timeout-for-system-tray-start.dpatch, fedora patch does the same
- removed hplip-3.9.8-dlopen-libhpmud.patch, obsoleted by newer try_libhpmud.so.0.dpatch
- removed hplip-udev-rules.patch, patched only one file, replaced by rediffed
  mga-udev-rules-use-attrs-not-sysfs-and-hp-mkuri-call-fix.patch
- removed black-stripes-on-pcl5c-printouts.dpatch, fedora patch does the same
- removed add_missing_newline_for_error_log.dpatch, fedora patch does the same
- removed ubuntu-hp-mkuri-notification-text.dpatch, specific to ubuntu
- rediffed hp-mkuri-take-into-account-already-installed-plugin-also-for-exit-value.dpatch

  + guillomovitch <guillomovitch>
    - rebuild for latest net-snmp

  + cjw <cjw>
    - add provides libsane-hpaio to sane backend (for #792)

  + dmorgan <dmorgan>
    - Do not package .la files

* Sat May 21 2011 cjw <cjw> 3.11.3a-5.mga1
+ Revision: 100081
- release fix for wrong colors on photosmart printers (fixes #1272)

* Sun May 15 2011 cjw <cjw> 3.11.3a-4.mga1
+ Revision: 98895
- patch1: fix color value underflow in hpcups filter (for bug #1272)

* Sat May 07 2011 cjw <cjw> 3.11.3a-3.mga1
+ Revision: 95747
- add provides: sane-backends-hpaio on the sane module package
- make hplip depend on python-imaging and sane-backends-hpaio, so the hp-scan tool actually works (see bug #792)

* Tue Apr 26 2011 wally <wally> 3.11.3a-2.mga1
+ Revision: 91745
- fix desktop file name (mga#954)

* Thu Apr 14 2011 cjw <cjw> 3.11.3a-1.mga1
+ Revision: 85144
- new version 3.11.3a
- remove old conflicts

  + dmorgan <dmorgan>
    - Fix typo

* Thu Feb 10 2011 spuhler <spuhler> 3.11.1-1.mga1
+ Revision: 49623
- removed buildroot definition from .spec
  removed the if mdkversion lines
- imported package hplip