From 0ba36903ee2586138d660c1de4a88883fd74bbf1 Mon Sep 17 00:00:00 2001 From: hauke Date: Sat, 23 Nov 2019 17:55:01 +0000 Subject: Newer cups versions are actively deprecating APIs, and access to struct fields is now exclusively through accessor functions. Deal with both issues. --- net/netatalk22/Makefile | 6 +- net/netatalk22/distinfo | 3 +- net/netatalk22/patches/patch-etc_papd_print_cups.c | 124 +++++++++++++++++++++ 3 files changed, 129 insertions(+), 4 deletions(-) create mode 100644 net/netatalk22/patches/patch-etc_papd_print_cups.c (limited to 'net/netatalk22') diff --git a/net/netatalk22/Makefile b/net/netatalk22/Makefile index 08dccf803b5..f867a40ace7 100644 --- a/net/netatalk22/Makefile +++ b/net/netatalk22/Makefile @@ -1,8 +1,8 @@ -# $NetBSD: Makefile,v 1.24 2019/11/03 11:45:44 rillig Exp $ +# $NetBSD: Makefile,v 1.25 2019/11/23 17:55:01 hauke Exp $ DISTNAME= netatalk-2.2.6 PKGNAME= ${DISTNAME:C/-/22-/} -PKGREVISION= 13 +PKGREVISION= 14 CATEGORIES= net print MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=netatalk/} EXTRACT_SUFX= .tar.bz2 @@ -69,7 +69,7 @@ PLIST.rcd= yes PLIST_VARS+= ea .if ${OPSYS} == "SunOS" || ${OPSYS} == "DragonFly" || ${OPSYS} == "Linux" || \ - (${OPSYS} == "NetBSD" && empty(OS_VERSION:M[0-6].[0-8]*)) || \ + (${OPSYS} == "NetBSD" && empty(OS_VERSION:M[0-6].[0-8].*)) || \ ${OPSYS} == "FreeBSD" PLIST.ea= yes .endif diff --git a/net/netatalk22/distinfo b/net/netatalk22/distinfo index 5a704546d3b..be65fa16cf2 100644 --- a/net/netatalk22/distinfo +++ b/net/netatalk22/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.7 2019/06/02 20:03:32 rjs Exp $ +$NetBSD: distinfo,v 1.8 2019/11/23 17:55:01 hauke Exp $ SHA1 (netatalk-2.2.6.tar.bz2) = 98a2d33f2e240e49caec32b83bca579723ce87f7 RMD160 (netatalk-2.2.6.tar.bz2) = c7b051cf89d30c9bf1d491d9e04ceee2f39b897d @@ -7,6 +7,7 @@ Size (netatalk-2.2.6.tar.bz2) = 1301887 bytes SHA1 (patch-config_Makefile.in) = 6b9f545e5ddb178e9a310cec4de300c02557e685 SHA1 (patch-configure) = 9919625c3cd54e34ab45c6606094e12215630d33 SHA1 (patch-distrib_initscripts_Makefile.in) = 706890f9e0aacab4d523cc1900048b7fab96f5d4 +SHA1 (patch-etc_papd_print_cups.c) = 8dada275f9525b9229a85492050de982b1e54295 SHA1 (patch-etc_uams_uams__dhx__pam.c) = 9c75c8562271204c6be974af189e48a9a1b35e11 SHA1 (patch-etc_uams_uams__dhx__passwd.c) = eb950f16b8d9c00ff45e40769f01850138e76176 SHA1 (patch-etc_uams_uams__randnum.c) = ff9f698156e0954000e95ac0fbd9b9604d15b8d1 diff --git a/net/netatalk22/patches/patch-etc_papd_print_cups.c b/net/netatalk22/patches/patch-etc_papd_print_cups.c new file mode 100644 index 00000000000..e9413e0fe95 --- /dev/null +++ b/net/netatalk22/patches/patch-etc_papd_print_cups.c @@ -0,0 +1,124 @@ +$NetBSD: patch-etc_papd_print_cups.c,v 1.3 2019/11/23 17:55:02 hauke Exp $ + +Deprecated functions: Remove obsolete define, and disable compiler +errors for deprecation warnings, as seen in the darktable print code. + +Accessors: Cups has abstracted away access to ipp_t fields, use +accessor functions. + +--- etc/papd/print_cups.c.orig 2017-07-09 11:03:31.000000000 +0000 ++++ etc/papd/print_cups.c +@@ -39,11 +39,11 @@ + + #ifdef HAVE_CUPS + +-/* enable pre-1.6 CUPS API for now */ +-#define _PPD_DEPRECATED +- +-/* expose structs that are private post-1.5 CUPS */ +-#define _IPP_PRIVATE_STRUCTURES 1 ++/* ++ * Do not error out on deprecation messages ++ * -- darktable does this in their "src/common/cups_print.c" ++ */ ++#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + + #include + #include +@@ -61,6 +61,11 @@ + #define MAXCHOOSERLEN 31 + #define HTTP_MAX_URI 1024 + ++/* Deal with post-1.7 deprecated httpConnect() */ ++#define httpConnect(host, port) httpConnect2(host, port, NULL, AF_UNSPEC, HTTP_ENCRYPTION_IF_REQUESTED, 1, 1000, NULL) ++ ++/* XXX Also: cupsGetPPD() */ ++ + static const char* cups_status_msg[] = { + "status: busy; info: \"%s\" is rejecting jobs; ", + "status: idle; info: \"%s\" is stopped, accepting jobs ;", +@@ -136,12 +141,8 @@ cups_printername_ok(char *name) + * requested-attributes + * printer-uri + */ +- +- request = ippNew(); +- +- request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES; +- request->request.op.request_id = 1; +- ++ request = ippNewRequest(IPP_OP_GET_PRINTER_ATTRIBUTES); ++ + language = cupsLangDefault(); + + ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, +@@ -172,10 +173,11 @@ cups_printername_ok(char *name) + + httpClose(http); + +- if (response->request.status.status_code >= IPP_OK_CONFLICT) ++ if ( cupsLastError() >= IPP_OK_CONFLICT) + { + LOG(log_error, logtype_papd, "Unable to get printer status for %s - %s", name, +- ippErrorString(response->request.status.status_code)); ++ ippErrorString(cupsLastError())); ++ + ippDelete(response); + return (0); + } +@@ -249,10 +251,7 @@ cups_get_printer_status (struct printer + * printer-uri + */ + +- request = ippNew(); +- +- request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES; +- request->request.op.request_id = 1; ++ request = ippNewRequest(IPP_OP_GET_PRINTER_ATTRIBUTES); + + language = cupsLangDefault(); + +@@ -282,10 +281,11 @@ cups_get_printer_status (struct printer + return (0); + } + +- if (response->request.status.status_code >= IPP_OK_CONFLICT) ++ if (cupsLastError() >= IPP_OK_CONFLICT) + { +- LOG(log_error, logtype_papd, "Unable to get printer status for %s - %s", pr->p_printer, +- ippErrorString(response->request.status.status_code)); ++ LOG(log_error, logtype_papd, "Unable to get printer status for %s - %s", pr->p_printer, ++ ippErrorString(cupsLastError())); ++ + ippDelete(response); + httpClose(http); + return (0); +@@ -299,9 +299,9 @@ cups_get_printer_status (struct printer + + if ((attr = ippFindAttribute(response, "printer-state", IPP_TAG_ENUM)) != NULL) + { +- if (attr->values[0].integer == IPP_PRINTER_STOPPED) ++ if (ippGetInteger(attr, 0) == IPP_PRINTER_STOPPED) + status = 1; +- else if (attr->values[0].integer == IPP_NOT_ACCEPTING) ++ else if (ippGetInteger(attr,0) == IPP_NOT_ACCEPTING) + status = 0; + else + status = 2; +@@ -309,14 +309,14 @@ cups_get_printer_status (struct printer + + if ((attr = ippFindAttribute(response, "printer-is-accepting-jobs", IPP_TAG_BOOLEAN)) != NULL) + { +- if ( attr->values[0].integer == 0 ) ++ if ( ippGetInteger(attr, 0) == 0 ) + status = 0; + } + + snprintf ( pr->p_status, 255, cups_status_msg[status], pr->p_printer ); + + if ((attr = ippFindAttribute(response, "printer-state-message", IPP_TAG_TEXT)) != NULL) +- strncat ( pr->p_status, attr->values[0].string.text, 255-strlen(pr->p_status)); ++ strncat ( pr->p_status, ippGetString(attr, 0, NULL), 255-strlen(pr->p_status)); + + ippDelete(response); + -- cgit v1.2.3