From 7496a3024194289cca0b5c9df9c1c6be86708c02 Mon Sep 17 00:00:00 2001 From: Heinrich Kruger Date: Wed, 20 Oct 2021 09:18:02 +0100 Subject: [PATCH] hplip: Update to 3.21.10 Update hplip to latest upstream version and patch to fix Python 3.10 compatibility. --- ...Processor-functionality-which-is-clo.patch | 113 ------------------ srcpkgs/hplip/patches/gzip_text.patch | 13 ++ srcpkgs/hplip/patches/pysizet_clean.patch | 100 ++++++++++++++++ .../remove-imageprocessing-install.patch | 37 ++++++ srcpkgs/hplip/patches/sane.patch | 31 ----- srcpkgs/hplip/template | 8 +- 6 files changed, 155 insertions(+), 147 deletions(-) delete mode 100644 srcpkgs/hplip/patches/0025-Remove-all-ImageProcessor-functionality-which-is-clo.patch create mode 100644 srcpkgs/hplip/patches/gzip_text.patch create mode 100644 srcpkgs/hplip/patches/pysizet_clean.patch create mode 100644 srcpkgs/hplip/patches/remove-imageprocessing-install.patch delete mode 100644 srcpkgs/hplip/patches/sane.patch diff --git a/srcpkgs/hplip/patches/0025-Remove-all-ImageProcessor-functionality-which-is-clo.patch b/srcpkgs/hplip/patches/0025-Remove-all-ImageProcessor-functionality-which-is-clo.patch deleted file mode 100644 index 8d3b4d7bfda2..000000000000 --- a/srcpkgs/hplip/patches/0025-Remove-all-ImageProcessor-functionality-which-is-clo.patch +++ /dev/null @@ -1,113 +0,0 @@ -From fa9c0cf1a5db9bf8880b4796d5e3e0da46534e3d Mon Sep 17 00:00:00 2001 -From: Didier Raboud -Date: Tue, 21 Aug 2018 18:18:10 +0200 -Subject: Remove all ImageProcessor functionality, which is closed-source - ---- - Makefile.am | 14 ++------------ - prnt/hpcups/HPCupsFilter.cpp | 21 --------------------- - 2 files changed, 2 insertions(+), 33 deletions(-) - -diff --git a/Makefile.am b/Makefile.am -index 1b097c4f9..8d5d78c9f 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -166,7 +166,7 @@ if !HPLIP_CLASS_DRIVER - dist_hplip_SCRIPTS = hpssd.py __init__.py hpdio.py - endif #HPLIP_CLASS_DRIVER - --dist_noinst_DATA += prnt/drv/hpijs.drv.in.template prnt/drv/hpcups.drv.in.template prnt/hpcups/libImageProcessor-x86_64.so prnt/hpcups/libImageProcessor-x86_32.so -+dist_noinst_DATA += prnt/drv/hpijs.drv.in.template prnt/drv/hpcups.drv.in.template - dist_noinst_SCRIPTS += dat2drv.py install.py hplip-install init-suse-firewall init-iptables-firewall class_rpm_build.sh hplipclassdriver.spec createPPD.sh Makefile_dat2drv hpijs-drv - - if !HPLIP_CLASS_DRIVER -@@ -594,7 +594,7 @@ hpcups_SOURCES = prnt/hpcups/HPCupsFilter.cpp prnt/hpcups/HPCupsFilter.h prnt/hp - prnt/hpcups/ImageProcessor.h - - hpcups_CXXFLAGS = $(APDK_ENDIAN_FLAG) $(DBUS_CFLAGS) --hpcups_LDADD = -L./prnt/hpcups/ -ljpeg -ldl -lImageProcessor -lcups -lcupsimage -lz $(DBUS_LIBS) -+hpcups_LDADD = -L./prnt/hpcups/ -ljpeg -ldl -lcups -lcupsimage -lz $(DBUS_LIBS) - #else - #hpcupsdir = $(cupsfilterdir) - #hpcups_PROGRAMS = hpcups -@@ -686,16 +686,6 @@ endif #HPLIP_CLASS_DRIVER - - install-data-hook: - if HPLIP_BUILD -- if [ \( "$(UNAME)" = "x86_64" -a -d "$(libdir)/" \) ]; then \ -- cp prnt/hpcups/libImageProcessor-x86_64.so $(libdir)/ ; \ -- chmod 775 $(libdir)/libImageProcessor-x86_64.so ; \ -- ln -sf $(libdir)/libImageProcessor-x86_64.so $(libdir)/libImageProcessor.so ; \ -- fi; \ -- if [ \( \( "$(UNAME)" = "i686" -o "$(UNAME)" = "i386" \) -a -d "$(libdir)/" \) ]; then \ -- cp prnt/hpcups/libImageProcessor-x86_32.so $(libdir)/ ; \ -- chmod 775 $(libdir)/libImageProcessor-x86_32.so ; \ -- ln -sf $(libdir)/libImageProcessor-x86_32.so $(libdir)/libImageProcessor.so ; \ -- fi - if !HPLIP_CLASS_DRIVER - # If scanner build, add hpaio entry to sane dll.conf. - if [ "$(scan_build)" = "yes" ]; then \ -diff --git a/prnt/hpcups/HPCupsFilter.cpp b/prnt/hpcups/HPCupsFilter.cpp -index 5b282d83f..0bacfafac 100644 ---- a/prnt/hpcups/HPCupsFilter.cpp -+++ b/prnt/hpcups/HPCupsFilter.cpp -@@ -31,7 +31,6 @@ - \*****************************************************************************/ - - #include "HPCupsFilter.h" --#include "ImageProcessor.h" - - #include - #include -@@ -637,16 +636,10 @@ int HPCupsFilter::processRasterData(cups_raster_t *cups_raster) - - - sprintf(hpPreProcessedRasterFile, "%s/hp_%s_cups_SwapedPagesXXXXXX",CUPS_TMP_DIR, m_JA.user_name); -- image_processor_t* imageProcessor = imageProcessorCreate(); - - while (cupsRasterReadHeader2(cups_raster, &cups_header)) - { - -- IMAGE_PROCESSOR_ERROR result = imageProcessorStartPage(imageProcessor, &cups_header); -- if (result != IPE_SUCCESS){ -- dbglog("DEBUG: imageProcessorStartPage failed result = %d\n", result); -- } -- - current_page_number++; - - if (current_page_number == 1) { -@@ -745,12 +738,6 @@ int HPCupsFilter::processRasterData(cups_raster_t *cups_raster) - color_raster = rgbRaster; - black_raster = kRaster; - -- result = imageProcessorProcessLine(imageProcessor, m_pPrinterBuffer, cups_header.cupsBytesPerLine); -- if (result != IPE_SUCCESS){ -- dbglog("DEBUG: imageProcessorProcessLine failed result = %d\n", result); -- } -- -- - if ((y == 0) && !is_ljmono) { - //For ljmono, make sure that first line is not a blankRaster line.Otherwise printer - //may not skip blank lines before actual data -@@ -780,12 +767,6 @@ int HPCupsFilter::processRasterData(cups_raster_t *cups_raster) - } - } // for() loop end - -- result = imageProcessorEndPage(imageProcessor); -- if (result != IPE_SUCCESS){ -- dbglog("DEBUG: imageProcessorEndPage failed result = %d\n", result); -- } -- -- - m_Job.NewPage(); - if (err != NO_ERROR) { - break; -@@ -800,8 +781,6 @@ int HPCupsFilter::processRasterData(cups_raster_t *cups_raster) - rgbRaster = NULL; - } - -- imageProcessorDestroy(imageProcessor); -- - unlink(hpPreProcessedRasterFile); - return ret_status; - } diff --git a/srcpkgs/hplip/patches/gzip_text.patch b/srcpkgs/hplip/patches/gzip_text.patch new file mode 100644 index 000000000000..8309415a2a7a --- /dev/null +++ b/srcpkgs/hplip/patches/gzip_text.patch @@ -0,0 +1,13 @@ +Open gzipped PPD file in text mode, otherwise text regex search fails + +--- a/setup.py 2021-10-18 18:37:49.795887272 +0100 ++++ b/setup.py 2021-10-18 18:37:20.214898473 +0100 +@@ -552,7 +552,7 @@ + if os.path.exists(file_path) and os.path.isfile(file_path): + + if file_path.endswith('.gz'): +- nickname = gzip.GzipFile(file_path, 'r').read(4096) ++ nickname = gzip.open(file_path, 'rt').read(4096) + else: + nickname = open(file_path, 'r').read(4096) + diff --git a/srcpkgs/hplip/patches/pysizet_clean.patch b/srcpkgs/hplip/patches/pysizet_clean.patch new file mode 100644 index 000000000000..38d21f520934 --- /dev/null +++ b/srcpkgs/hplip/patches/pysizet_clean.patch @@ -0,0 +1,100 @@ +Based on patch by Zdenek Dohnal obtained from +https://bugs.launchpad.net/hplip/+bug/1933973 + +diff -pru hplip-3.21.8/io/mudext/hpmudext.c hplip-3.21.8-patched/io/mudext/hpmudext.c +--- hplip-3.21.8/io/mudext/hpmudext.c 2021-09-01 16:10:17.000000000 +0100 ++++ hplip-3.21.8-patched/io/mudext/hpmudext.c 2021-10-22 08:30:38.600922861 +0100 +@@ -24,6 +24,8 @@ Authors: Don Welch, David Suffield, Naga + + \*****************************************************************************/ + ++#define PY_SSIZE_T_CLEAN ++ + #include + #include + #include "hpmud.h" +@@ -187,14 +189,22 @@ static PyObject *write_channel(PyObject + HPMUD_CHANNEL cd; + int timeout = 30; + char * buf; +- int buf_size = 0; ++ Py_ssize_t buf_size = 0; ++ int buf_size_asInt = 0; + int bytes_written = 0; + + if (!PyArg_ParseTuple(args, "iis#|i", &dd, &cd, &buf, &buf_size, &timeout)) + return NULL; + ++ if (buf_size < INT_MIN) ++ buf_size_asInt = INT_MIN; ++ else if (buf_size > INT_MAX) ++ buf_size_asInt = INT_MAX; ++ else ++ buf_size_asInt = (int)buf_size; ++ + Py_BEGIN_ALLOW_THREADS +- result = hpmud_write_channel(dd, cd, buf, buf_size, timeout, &bytes_written); ++ result = hpmud_write_channel(dd, cd, buf, buf_size_asInt, timeout, &bytes_written); + Py_END_ALLOW_THREADS + + return Py_BuildValue("(ii)", result, bytes_written); +@@ -231,14 +241,22 @@ static PyObject *set_pml(PyObject *self, + char * oid; + int type; + char * data; +- int data_size; ++ Py_ssize_t data_size = 0; ++ int data_size_asInt = 0; + int pml_result; + + if (!PyArg_ParseTuple(args, "iisis#", &dd, &cd, &oid, &type, &data, &data_size)) + return NULL; + ++ if (data_size < INT_MIN) ++ data_size_asInt = INT_MIN; ++ else if (data_size > INT_MAX) ++ data_size_asInt = INT_MAX; ++ else ++ data_size_asInt = (int)data_size; ++ + Py_BEGIN_ALLOW_THREADS +- result = hpmud_set_pml(dd, cd, oid, type, (void *)data, data_size, &pml_result); ++ result = hpmud_set_pml(dd, cd, oid, type, (void *)data, data_size_asInt, &pml_result); + Py_END_ALLOW_THREADS + + return Py_BuildValue("(ii)", result, pml_result); +diff -pru hplip-3.21.8/pcard/pcardext/pcardext.c hplip-3.21.8-patched/pcard/pcardext/pcardext.c +--- hplip-3.21.8/pcard/pcardext/pcardext.c 2021-09-01 16:10:17.000000000 +0100 ++++ hplip-3.21.8-patched/pcard/pcardext/pcardext.c 2021-10-22 08:24:11.010798381 +0100 +@@ -24,6 +24,8 @@ Author: Don Welch + + \*****************************************************************************/ + ++#define PY_SSIZE_T_CLEAN ++ + #include + #include + #include "../fat.h" +diff -pru hplip-3.21.8/prnt/cupsext/cupsext.c hplip-3.21.8-patched/prnt/cupsext/cupsext.c +--- hplip-3.21.8/prnt/cupsext/cupsext.c 2021-09-01 16:10:17.000000000 +0100 ++++ hplip-3.21.8-patched/prnt/cupsext/cupsext.c 2021-10-22 08:26:30.975843330 +0100 +@@ -73,6 +73,7 @@ Yashwant Kumar Sahu + Sanjay Kumar + */ + ++#define PY_SSIZE_T_CLEAN + + #include + #include +diff -pru hplip-3.21.8/scan/scanext/scanext.c hplip-3.21.8-patched/scan/scanext/scanext.c +--- hplip-3.21.8/scan/scanext/scanext.c 2021-09-01 16:10:17.000000000 +0100 ++++ hplip-3.21.8-patched/scan/scanext/scanext.c 2021-10-21 21:31:23.074739743 +0100 +@@ -45,6 +45,8 @@ PERFORMANCE OF THIS SOFTWARE. + *******************************************************************/ + + ++#define PY_SSIZE_T_CLEAN ++ + /* _ScanDevice objects */ + + #include "Python.h" diff --git a/srcpkgs/hplip/patches/remove-imageprocessing-install.patch b/srcpkgs/hplip/patches/remove-imageprocessing-install.patch new file mode 100644 index 000000000000..de0efe17fbda --- /dev/null +++ b/srcpkgs/hplip/patches/remove-imageprocessing-install.patch @@ -0,0 +1,37 @@ +--- a/Makefile.am ++++ b/Makefile.am +@@ -167,7 +167,7 @@ + dist_hplip_SCRIPTS = hpssd.py __init__.py hpdio.py + endif #HPLIP_CLASS_DRIVER + +-dist_noinst_DATA += prnt/drv/hpijs.drv.in.template prnt/drv/hpcups.drv.in.template prnt/hpcups/libImageProcessor-x86_64.so prnt/hpcups/libImageProcessor-x86_32.so ++dist_noinst_DATA += prnt/drv/hpijs.drv.in.template prnt/drv/hpcups.drv.in.template + + dist_noinst_DATA += prnt/ipp-usb/HPLIP.conf + dist_noinst_SCRIPTS += dat2drv.py install.py hplip-install init-suse-firewall init-iptables-firewall class_rpm_build.sh hplipclassdriver.spec createPPD.sh Makefile_dat2drv hpijs-drv +@@ -597,7 +597,7 @@ + prnt/hpcups/ImageProcessor.h + + hpcups_CXXFLAGS = $(APDK_ENDIAN_FLAG) $(DBUS_CFLAGS) +-hpcups_LDADD = -L./prnt/hpcups/ -ljpeg -ldl -lImageProcessor -lcups -lcupsimage -lz $(DBUS_LIBS) ++hpcups_LDADD = -L./prnt/hpcups/ -ljpeg -ldl -lcups -lcupsimage -lz $(DBUS_LIBS) + #else + #hpcupsdir = $(cupsfilterdir) + #hpcups_PROGRAMS = hpcups +@@ -687,16 +687,6 @@ + + install-data-hook: + if HPLIP_BUILD +- if [ \( "$(UNAME)" = "x86_64" -a -d "$(libdir)/" \) ]; then \ +- cp prnt/hpcups/libImageProcessor-x86_64.so $(libdir)/ ; \ +- chmod 775 $(libdir)/libImageProcessor-x86_64.so ; \ +- ln -sf $(libdir)/libImageProcessor-x86_64.so $(libdir)/libImageProcessor.so ; \ +- fi; \ +- if [ \( \( "$(UNAME)" = "i686" -o "$(UNAME)" = "i386" \) -a -d "$(libdir)/" \) ]; then \ +- cp prnt/hpcups/libImageProcessor-x86_32.so $(libdir)/ ; \ +- chmod 775 $(libdir)/libImageProcessor-x86_32.so ; \ +- ln -sf $(libdir)/libImageProcessor-x86_32.so $(libdir)/libImageProcessor.so ; \ +- fi + if [ -d "/usr/share/ipp-usb/quirks/" ]; then \ + echo "ipp-usb directory exists"; \ + cp prnt/ipp-usb/HPLIP.conf /usr/share/ipp-usb/quirks/ ; \ diff --git a/srcpkgs/hplip/patches/sane.patch b/srcpkgs/hplip/patches/sane.patch deleted file mode 100644 index d3579638ee97..000000000000 --- a/srcpkgs/hplip/patches/sane.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- a/scan/sane.py 2020-10-13 22:29:59.456276307 -0400 -+++ b/scan/sane.py 2020-10-13 22:32:44.663586789 -0400 -@@ -378,14 +378,14 @@ - - def isScanActive(self): - if self.scan_thread is not None: -- return self.scan_thread.isAlive() and self.scan_thread.scan_active -+ return self.scan_thread.is_alive() and self.scan_thread.scan_active - else: - return False - - - def waitForScanDone(self): - if self.scan_thread is not None and \ -- self.scan_thread.isAlive() and \ -+ self.scan_thread.is_alive() and \ - self.scan_thread.scan_active: - - try: -@@ -398,9 +398,9 @@ - #time.sleep(0.5) - if self.scan_thread is not None: - while True: -- #print self.scan_thread.isAlive() -+ #print self.scan_thread.is_alive() - #print self.scan_thread.scan_active -- if self.scan_thread.isAlive() and \ -+ if self.scan_thread.is_alive() and \ - self.scan_thread.scan_active: - return - diff --git a/srcpkgs/hplip/template b/srcpkgs/hplip/template index c6bc1a9b0df2..339d08b463d8 100644 --- a/srcpkgs/hplip/template +++ b/srcpkgs/hplip/template @@ -1,7 +1,7 @@ # Template file for 'hplip' pkgname=hplip -version=3.20.9 -revision=6 +version=3.21.10 +revision=1 build_style=gnu-configure pycompile_dirs="usr/share/hplip" # configure checks sys.version[:3] for Python versioning, so 3.10 becomes 3.1; @@ -19,6 +19,7 @@ configure_args=" --enable-hpijs-install --enable-foomatic-drv-install --enable-pp-build + --disable-imageProcessor-build --with-mimedir=/usr/share/cups/mime am_cv_python_version=${py3_ver}" conf_files="/etc/hp/hplip.conf" @@ -33,8 +34,9 @@ short_desc="HP Linux Imaging and Printing" maintainer="Orphaned " license="GPL-2.0-only, BSD-3-Clause, MIT" homepage="https://developers.hp.com/hp-linux-imaging-and-printing" +changelog="https://developers.hp.com/hp-linux-imaging-and-printing/release_notes" distfiles="${SOURCEFORGE_SITE}/hplip/hplip/${version}/hplip-${version}.tar.gz" -checksum=36251189aa9cc349f6a3eacbb7ac3c4fd26fc9f087c9f75cee051010c85d2ddf +checksum=de230e1fdd1e718fc718417265612e0c882949e08fe045ee56f9f9882e6b6a60 conflicts="hplip-gui" CFLAGS="-I${XBPS_CROSS_BASE}/usr/include/libusb-1.0 -I${XBPS_CROSS_BASE}/${py3_inc}"