diff --git a/hp-plugin.in b/hp-plugin.in new file mode 100644 index 0000000..c3e7bd3 --- /dev/null +++ b/hp-plugin.in @@ -0,0 +1,46 @@ +#!/usr/bin/bash + +# get version from base hplip rpm - it is always in the second column +VER=$(@bindir@/rpm -q hplip | @bindir@/awk -F '-' '{print $2}') + +if test "x$VER" = "x" +then + @bindir@/echo "Version was not acquired - exiting..." + exit 1 +fi + +# link to the plugin +PLUGIN_SOURCE="https://www.openprinting.org/download/printdriver/auxfiles/HP/plugins/hplip-${VER}-plugin.run" + +# plugin name +PLUGIN_FILE="hplip-${VER}-plugin.run" + +# create a hidden hplip dir to store a file indicating the plugin version after successful install +# the directory can be used by other hplip tools, so we don't have to remove it if the failure happens +if [ ! -d ~/.hplip ] +then + @bindir@/mkdir ~/.hplip || @bindir@/echo "Cannot create the ~/.hplip dir, exiting" && exit 1 +fi + +@bindir@/wget -O ~/.hplip/${PLUGIN_FILE} ${PLUGIN_SOURCE} + +if [ ! -f ~/.hplip/${PLUGIN_FILE} ] +then + @bindir@/echo "The downloaded file does not exist - error during downloading, exiting..." + exit 1 +fi + +@bindir@/bash ~/.hplip/${PLUGIN_FILE} + +if [ $? -ne 0 ] +then + @bindir@/echo "Plugin installation failed, exiting..." + @bindir@/rm -f ~/.hplip/${PLUGIN_FILE} &> /dev/null + exit 1 +fi + +@bindir@/rm -f ~/.hplip/${PLUGIN_FILE} &> /dev/null +@bindir@/rm -f ~/.hplip/plugin-installed-* &> /dev/null +@bindir@/touch ~/.hplip/plugin-installed-$VER + +exit 0 diff --git a/hplip-plugin-script.patch b/hplip-plugin-script.patch new file mode 100644 index 0000000..9b3c196 --- /dev/null +++ b/hplip-plugin-script.patch @@ -0,0 +1,28 @@ +diff --git a/Makefile.am b/Makefile.am +index bb4195c..ddac16a 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -680,6 +680,12 @@ if HPLIP_CLASS_DRIVER + filterdir=$(cupsfilterdir) + printpluginsdir=$(cupsfilterdir) + ++# ++# HP Plugin ++# ++ ++pkgplugindir=$(bindir) ++pkgplugin_DATA=hp-plugin + + dist_filter_DATA = hpcups hpps dat2drv + dist_printplugins_DATA = prnt/plugins/hbpl1-arm32.so prnt/plugins/hbpl1-arm64.so prnt/plugins/hbpl1-x86_32.so prnt/plugins/hbpl1-x86_64.so prnt/plugins/lj-arm32.so prnt/plugins/lj-arm64.so prnt/plugins/lj-x86_32.so prnt/plugins/lj-x86_64.so +diff --git a/configure.in b/configure.in +index f8f1a28..7fa5d12 100644 +--- a/configure.in ++++ b/configure.in +@@ -801,5 +801,5 @@ AC_SUBST(udev_sysfs_rules) + AC_SUBST(epm_class_driver) + AC_SUBST(epm_class_install) + +-AC_CONFIG_FILES(Makefile hplip.conf hplip.desktop hp-uiscan.desktop hplip-systray.desktop prnt/drv/hpijs.drv prnt/drv/hpcups.drv hplip.list data/policykit/com.hp.hplip.service) ++AC_CONFIG_FILES(Makefile hplip.conf hplip.desktop hp-uiscan.desktop hplip-systray.desktop prnt/drv/hpijs.drv prnt/drv/hpcups.drv hplip.list data/policykit/com.hp.hplip.service hp-plugin) + AC_OUTPUT diff --git a/hplip.spec b/hplip.spec index 197c315..27279c5 100644 --- a/hplip.spec +++ b/hplip.spec @@ -7,7 +7,7 @@ Summary: HP Linux Imaging and Printing Project Name: hplip Version: 3.22.6 -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv2+ and MIT and BSD and IJG and GPLv2+ with exceptions and ISC Url: https://developers.hp.com/hp-linux-imaging-and-printing @@ -27,6 +27,7 @@ Source3: %{name}.appdata.xml Source4: hp-laserjet_cp_1025nw.ppd.gz Source5: hp-laserjet_professional_p_1102w.ppd.gz Source6: hplip-repack.sh +Source7: hp-plugin.in Patch1: hplip-pstotiff-is-rubbish.patch Patch2: hplip-strstr-const.patch @@ -201,6 +202,7 @@ Patch61: hplip-no-libhpmud-libm-warnings.patch # hplip 3.22.6 doesn't use the correct arguments for snprintf # reported as https://bugs.launchpad.net/hplip/+bug/1982185 Patch62: hplip-snprintf-format.patch +Patch63: hplip-plugin-script.patch %if 0%{?fedora} || 0%{?rhel} <= 8 # mention hplip-gui if you want to have GUI @@ -213,9 +215,12 @@ BuildRequires: autoconf BuildRequires: automake # Make sure we get postscriptdriver tags - need cups and python3-cups. BuildRequires: cups -BuildRequires: python3-cups # uses functions from CUPS in filters, backends and libraries defining them BuildRequires: cups-devel +%if 0%{?rhel} <= 8 || 0%{?fedora} +# needed for desktop file validation in spec file +BuildRequires: desktop-file-utils +%endif # gcc and gcc-c++ are no longer in buildroot by default # gcc is needed for compilation of HPAIO scanning backend, HP implementation of # IPP and MDNS protocols, hpps driver, hp backend, hpip (image processing @@ -238,46 +243,44 @@ BuildRequires: openssl-devel # supports mDNS device discovery via Avahi BuildRequires: pkgconfig(avahi-client) BuildRequires: pkgconfig(avahi-core) +BuildRequires: pkgconfig(dbus-1) +BuildRequires: python3-cups # implements C Python extensions like hpmudext, cupsext, scanext BuildRequires: python3-devel # SANE backend hpaio uses function from SANE API BuildRequires: sane-backends-devel -BuildRequires: pkgconfig(dbus-1) # macros: %%{_tmpfilesdir}, %%{_udevrulesdir} BuildRequires: systemd -%if 0%{?rhel} <= 8 || 0%{?fedora} -# needed for desktop file validation in spec file -BuildRequires: desktop-file-utils -%endif +# uses avahi-browse for discovering IPP-over-USB printers +Recommends: avahi-tools +# 1733449 - Scanner on an HP AIO printer is not detected unless libsane-hpaio is installed +Recommends: libsane-hpaio%{?_isa} = %{version}-%{release} -Requires: %{name}-libs%{?_isa} = %{version}-%{release} -%if 0%{?rhel} <= 8 || 0%{?fedora} -Requires: python3-pillow -%endif Requires: cups -Requires: wget -Requires: python3-dbus +# for bash script acting as hp-plugin (Source7) +Requires: gawk # set require directly to /usr/bin/gpg, because gnupg2 and gnupg ships it, # but gnupg will be deprecated in the future Requires: %{_bindir}/gpg +Requires: %{name}-libs%{?_isa} = %{version}-%{release} +Requires: python3-dbus +%if 0%{?rhel} <= 8 || 0%{?fedora} +Requires: python3-pillow +%endif # /usr/lib/udev/rules.d Requires: systemd # 1788643 - Fedora minimal does not ship tar by default Requires: tar # require usbutils, hp-diagnose_queues needs lsusb Requires: usbutils -# uses avahi-browse for discovering IPP-over-USB printers -Recommends: avahi-tools +Requires: wget # require coreutils, because timeout binary is needed in post scriptlet, # because hpcups-update-ppds script can freeze in certain situation and # stop the update Requires(post): coreutils -# 1733449 - Scanner on an HP AIO printer is not detected unless libsane-hpaio is installed -Recommends: libsane-hpaio%{?_isa} = %{version}-%{release} - %description The Hewlett-Packard Linux Imaging and Printing Project provides drivers for HP printers and multi-function peripherals. @@ -303,14 +306,16 @@ Libraries needed by HPLIP. Summary: HPLIP graphical tools License: BSD BuildRequires: libappstream-glib + # for avahi-browse - looks for devices on local network Recommends: avahi-tools -Requires: python3-qt5 -Requires: python3-reportlab +Recommends: libsane-hpaio%{?_isa} = %{version}-%{release} + +Requires: %{name}%{?_isa} = %{version}-%{release} # hpssd.py Requires: python3-gobject -Requires: %{name}%{?_isa} = %{version}-%{release} -Recommends: libsane-hpaio%{?_isa} = %{version}-%{release} +Requires: python3-reportlab +Requires: python3-qt5 %description gui HPLIP graphical tools. @@ -319,6 +324,7 @@ HPLIP graphical tools. %package -n libsane-hpaio Summary: SANE driver for scanners in HP's multi-function devices License: GPLv2+ + Requires: sane-backends Requires: %{name}-libs%{?_isa} = %{version}-%{release} @@ -519,6 +525,7 @@ done %patch61 -p1 -b .no-libm-libhpmud-warn # hplip 3.22.6 doesn't use proper arguments for snprintf %patch62 -p1 -b .snprintf-format +%patch63 -p1 -b .plugin-patch %if 0%{?fedora} || 0%{?rhel} <= 8 # mention hplip-gui should be installed if you want GUI @@ -540,6 +547,9 @@ rm locatedriver cp -p %{SOURCE4} %{SOURCE5} ppd/hpcups +# 2129849 - move hp-plugin script into srcdir +cp -p %{SOURCE7} . + %build # Work-around Makefile.am imperfections. sed -i 's|^AM_INIT_AUTOMAKE|AM_INIT_AUTOMAKE([foreign])|g' configure.in @@ -612,6 +622,13 @@ rm -f %{buildroot}%{_bindir}/foomatic-rip \ %{buildroot}%{_datadir}/applications/hplip.desktop \ %{buildroot}%{_datadir}/ppd/HP/*.ppd +# 2129849 - remove hp-plugin script, since it depends on plugin.conf being available at +# http://hplip.sourceforge.net/plugin.conf +rm -f %{buildroot}%{_bindir}/hp-plugin \ + %{buildroot}%{_datadir}/hplip/plugin.py* + +install -p -m755 hp-plugin %{buildroot}%{_bindir}/hp-plugin + %if 0%{?rhel} > 8 rm -rf %{buildroot}%{_bindir}/hp-check \ %{buildroot}%{_bindir}/hp-devicesettings \ @@ -782,7 +799,6 @@ rm -f %{buildroot}%{_sysconfdir}/xdg/autostart/hplip-systray.desktop %{_datadir}/hplip/__init__.py* %{_datadir}/hplip/levels.py* %{_datadir}/hplip/makeuri.py* -%{_datadir}/hplip/plugin.py* %{_datadir}/hplip/probe.py* %{_datadir}/hplip/query.py* %if 0%{?rhel} <= 8 || 0%{?fedora} @@ -874,6 +890,9 @@ rm -f %{buildroot}%{_sysconfdir}/xdg/autostart/hplip-systray.desktop %config(noreplace) %{_sysconfdir}/sane.d/dll.d/hpaio %changelog +* Thu Oct 13 2022 Zdenek Dohnal - 3.22.6-3 +- 2129849 - hp-plugin unable to load plugin.conf + * Thu Jul 21 2022 Fedora Release Engineering - 3.22.6-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild