From 8067374d02616d5d14bb7f1b0a97852eb1cf3b76 Mon Sep 17 00:00:00 2001 From: David P Date: Fri, 27 Dec 2019 16:44:44 -0300 Subject: updpkg: libre/hplip 1:3.19.12-1.par1 Signed-off-by: David P --- libre/hplip/PKGBUILD | 34 ++++++----- libre/hplip/python3.diff | 147 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 167 insertions(+), 14 deletions(-) create mode 100644 libre/hplip/python3.diff diff --git a/libre/hplip/PKGBUILD b/libre/hplip/PKGBUILD index e3f222464..256b8cca4 100644 --- a/libre/hplip/PKGBUILD +++ b/libre/hplip/PKGBUILD @@ -8,7 +8,7 @@ # Maintainer: Omar Vega Ramos pkgname=hplip -pkgver=3.19.6 +pkgver=3.19.12 pkgrel=1 pkgrel+=.par1 epoch=1 @@ -18,7 +18,7 @@ arch=('x86_64') arch+=('i686' 'armv7h') url="https://hplipopensource.com" license=('GPL' 'custom') -depends=('python-dbus' 'ghostscript' 'net-snmp' 'foomatic-db-engine' 'python-gobject') +depends=('python-dbus' 'python-distro' 'ghostscript' 'net-snmp' 'foomatic-db-engine' 'python-gobject') makedepends=('python-pyqt5' 'sane' 'rpcbind' 'cups' 'libusb') optdepends=('cups: for printing support' 'sane: for scanner support' @@ -36,17 +36,19 @@ source=(https://downloads.sourceforge.net/${pkgname}/$pkgname-$pkgver.tar.gz{,.a disable_upgrade.patch 0022-Add-include-cups-ppd.h-in-various-places-as-CUPS-2.2.patch 0023-Fix-handling-of-unicode-filenames-in-sixext.py.patch - 0025-Remove-all-ImageProcessor-functionality-which-is-clo.patch) -sha512sums=('c99448ad0cef9fc626a0a03147a0d582513cb838ecfbfe29f07c65bbf701dee5c7d02222469b118ccc4e8c230c7a4b4685a72a1e67595ee01150b0472692d654' + 0025-Remove-all-ImageProcessor-functionality-which-is-clo.patch + python3.diff) +sha512sums=('5552cd717ae082ee55cdb77d79e8d035d8ecb7cf23c79d659fda43468d8ed414a33c4d869eab4ab83dee836f0d1cceb74c3c4a249e26f904a5ab2350e08a5677' 'SKIP' 'f0cf2774e53070406e89614b748e3c45079be889b83d5854340b92093643f6f8b332d6b6e617884d2bdcbef667a84ee5741b07c5fb080bb04925bb454af448d1' '22aeb5b851f78bc6bc62e0bc3da99fecaf42d7604af41e2f3343f8d3666541f7b06b7d1a7d0ddf24f1731ac7b12dfe582375a98e3b94dfa323d6ce954549ca67' '763949a0bc460dcc9faefc86f2a91cf342781bfce696ed0c3826758572dd03ac266bbeb7b6a4f9376ac298d7d3c9c4def42d94921a8e1d1695e39396e36d95ff' - '8710e039626878270b8b7bc1569566274d935c84652d758e25ce8fe01c0f44d911148620bb494489e1238201c01f3ba255c19f7dc5c2ff0d45a5f2a79190286b') + '8710e039626878270b8b7bc1569566274d935c84652d758e25ce8fe01c0f44d911148620bb494489e1238201c01f3ba255c19f7dc5c2ff0d45a5f2a79190286b' + '5885b223f96706bc09a147b5c141d620846c9058563e986983ca2ab90922cabe891a651d90d5004d45549b3874c40f8a1570a8a79e067d66f1826681111c7e82') validpgpkeys=('4ABA2F66DBD5A95894910E0673D770CDA59047B9') # HPLIP prepare() { - cd $pkgname-$pkgver + cd "$pkgname"-$pkgver echo "Removing printers not supported with free drivers from the database" @@ -74,21 +76,25 @@ prepare() { echo "Preparing source" # disable insecure update - https://bugs.archlinux.org/task/38083 - patch -Np0 -i ${srcdir}/disable_upgrade.patch + patch -Np0 -i "${srcdir}"/disable_upgrade.patch # add missing 'include ' at various places - patch -Np1 -i ${srcdir}/0022-Add-include-cups-ppd.h-in-various-places-as-CUPS-2.2.patch + patch -Np1 -i "${srcdir}"/0022-Add-include-cups-ppd.h-in-various-places-as-CUPS-2.2.patch # fix some handling unicode file names FS#58412 - patch -Np1 -i ${srcdir}/0023-Fix-handling-of-unicode-filenames-in-sixext.py.patch + patch -Np1 -i "${srcdir}"/0023-Fix-handling-of-unicode-filenames-in-sixext.py.patch # remove binary blob libImageProcessor and all linking - FS#59681 - patch -Np1 -i ${srcdir}/0025-Remove-all-ImageProcessor-functionality-which-is-clo.patch + patch -Np1 -i "${srcdir}"/0025-Remove-all-ImageProcessor-functionality-which-is-clo.patch + # Workaround patch for missing Python3 transition of the old + # (pre-USB-storage) photo memory card support (pcardext) - Debian patch + patch -Np1 -i "${srcdir}"/python3.diff export AUTOMAKE='automake --foreign' autoreconf --force --install } build() { - cd $pkgname-$pkgver + cd "$pkgname"-$pkgver + export CFLAGS+=" $(python3-config --includes)" # Fix build with python 3.8 ./configure --prefix=/usr \ --enable-qt5 \ --disable-qt4 \ @@ -99,13 +105,13 @@ build() { } package() { - cd $pkgname-$pkgver + cd "$pkgname"-$pkgver make -j1 rulesdir=/usr/lib/udev/rules.d DESTDIR="$pkgdir/" install # remove config provided by sane and autostart of hp-daemon rm -rf "$pkgdir"/etc/{sane.d,xdg} - install -dm755 ${pkgdir}/etc/sane.d/dll.d - echo hpaio > ${pkgdir}/etc/sane.d/dll.d/hpaio + install -dm755 "${pkgdir}"/etc/sane.d/dll.d + echo hpaio > "${pkgdir}"/etc/sane.d/dll.d/hpaio # remove HAL .fdi file because HAL is no longer used rm -vrf "$pkgdir"/usr/share/hal diff --git a/libre/hplip/python3.diff b/libre/hplip/python3.diff new file mode 100644 index 000000000..b79f0c017 --- /dev/null +++ b/libre/hplip/python3.diff @@ -0,0 +1,147 @@ +From: Till Kamppeter +Date: Fri, 22 Jul 2016 09:33:04 +0200 +Subject: Workaround patch for missing Python3 transition of the old + (pre-USB-storage) photo memory card support (pcardext) as this part builds + in Python3 environments but with pointer-related warnings which are fatal + errors for Ubuntu's build servers. The patch silences the warnings but the + memory card support is dropped in Python3 environments. This patch is + supplied by the HPLIP upstream developers and will be replaced by a more + proper solution in the next upstream release of HPLIP (see LP: #1275353) + +--- + pcard/pcardext/pcardext.c | 59 +++++++++++++++++++++++++++++++++++++---------- + pcard/photocard.py | 2 +- + unload.py | 5 ++++ + 3 files changed, 53 insertions(+), 13 deletions(-) + +diff --git a/pcard/pcardext/pcardext.c b/pcard/pcardext/pcardext.c +index c1a8273..37d979b 100644 +--- a/pcard/pcardext/pcardext.c ++++ b/pcard/pcardext/pcardext.c +@@ -20,7 +20,7 @@ pcardext - Python extension for HP photocard services + Requires: + Python 2.2+ + +-Author: Don Welch ++Author: Don Welch + + \*****************************************************************************/ + +@@ -38,9 +38,37 @@ typedef int Py_ssize_t; + + int verbose=0; + ++#if PY_MAJOR_VERSION >= 3 ++ #define MOD_ERROR_VAL NULL ++ #define MOD_SUCCESS_VAL(val) val ++ #define MOD_INIT(name) PyMODINIT_FUNC PyInit_##name(void) ++ #define PyInt_AS_LONG PyLong_AS_LONG ++ #define MOD_DEF(ob, name, doc, methods) \ ++ static struct PyModuleDef moduledef = { \ ++ PyModuleDef_HEAD_INIT, name, doc, -1, methods, }; \ ++ ob = PyModule_Create(&moduledef); ++ ++ ++ #define PY_String_Bytes PyBytes_FromStringAndSize ++ #define PY_AsString_Bytes PyBytes_AsStringAndSize ++ ++#else ++ #define MOD_ERROR_VAL ++ #define MOD_SUCCESS_VAL(val) ++ #define MOD_INIT(name) void init##name(void) ++ #define MOD_DEF(ob, name, doc, methods) \ ++ ob = Py_InitModule3(name, methods, doc); ++ ++ #define PY_String_Bytes PyString_FromStringAndSize ++ #define PY_AsString_Bytes PyString_AsStringAndSize ++ ++#endif ++ + PyObject * readsectorFunc = NULL; + PyObject * writesectorFunc = NULL; + ++ ++ + int ReadSector(int sector, int nsector, void *buf, int size) + { + PyObject * result; +@@ -56,9 +84,13 @@ int ReadSector(int sector, int nsector, void *buf, int size) + if( result ) + { + Py_ssize_t len = 0; +- PyString_AsStringAndSize( result, &result_str, &len ); ++ ++ //PyString_AsStringAndSize( result, &result_str, &len ); ++ //PyBytes_AsStringAndSize( result, &result_str, &len ); ++ PY_AsString_Bytes( result, &result_str, &len ); + +- if( len < nsector*FAT_HARDSECT ) ++ ++ if( len < nsector*FAT_HARDSECT ) + { + goto abort; + } +@@ -205,7 +237,9 @@ PyObject * pcardext_read( PyObject * self, PyObject * args ) + + if( FatReadFileExt( name, offset, len, buffer ) == len ) + { +- return PyString_FromStringAndSize( (char *)buffer, len ); ++ // return PyString_FromStringAndSize( (char *)buffer, len ); ++ return PY_String_Bytes( (char *)buffer, len ); ++ // return PyBytes_FromStringAndSize( (char *)buffer, len ); + } + else + { +@@ -233,14 +267,15 @@ static PyMethodDef pcardext_methods[] = + + static char pcardext_documentation[] = "Python extension for HP photocard services"; + +-void initpcardext( void ) +-{ +- PyObject * mod = Py_InitModule4( "pcardext", pcardext_methods, +- pcardext_documentation, (PyObject*)NULL, +- PYTHON_API_VERSION ); +- +- if (mod == NULL) +- return; ++MOD_INIT(pcardext) { ++ ++ PyObject* mod ; ++ MOD_DEF(mod, "pcardext", pcardext_documentation, pcardext_methods); ++ if (mod == NULL) ++ return MOD_ERROR_VAL; ++ ++ return MOD_SUCCESS_VAL(mod); ++ + } + + +diff --git a/pcard/photocard.py b/pcard/photocard.py +index 913dc4e..2c73158 100644 +--- a/pcard/photocard.py ++++ b/pcard/photocard.py +@@ -30,7 +30,7 @@ from base.codes import * + from base import device, utils, exif + + try: +- from . import pcardext ++ import pcardext + except ImportError: + if not os.getenv("HPLIP_BUILD"): + log.error("PCARDEXT could not be loaded. Please check HPLIP installation.") +diff --git a/unload.py b/unload.py +index 3fdd5a3..ce8b069 100755 +--- a/unload.py ++++ b/unload.py +@@ -44,6 +44,11 @@ except ImportError: + + # Local + from base.g import * ++from base.sixext import PY3 ++if PY3: ++ log.error("This functionality is not spported in python3 environment.") ++ sys.exit(1) ++ + from base import device, utils, tui, module + from prnt import cups + -- cgit v1.2.3