diff options
author | 2012-08-07 09:10:52 +0000 | |
---|---|---|
committer | 2012-08-07 09:10:52 +0000 | |
commit | e3901939f680b0d9a50323c3b6221985ab2d0ce1 (patch) | |
tree | a2f12ecdc91be15617eb74179f49ade74f1218d6 /net-print | |
parent | Restricting py-2.5 and jython (diff) | |
download | gentoo-2-e3901939f680b0d9a50323c3b6221985ab2d0ce1.tar.gz gentoo-2-e3901939f680b0d9a50323c3b6221985ab2d0ce1.tar.bz2 gentoo-2-e3901939f680b0d9a50323c3b6221985ab2d0ce1.zip |
Fix build failure with cups-1.6.x (bug #428544, thanks to Diego Elio Pettenò and Andreas K. Hüttel).
(Portage version: 2.2.0_alpha120/cvs/Linux x86_64)
Diffstat (limited to 'net-print')
-rw-r--r-- | net-print/cups-pk-helper/ChangeLog | 7 | ||||
-rw-r--r-- | net-print/cups-pk-helper/cups-pk-helper-0.2.2.ebuild | 7 | ||||
-rw-r--r-- | net-print/cups-pk-helper/files/cups-pk-helper-0.2.2-cups-1.6.patch | 340 |
3 files changed, 352 insertions, 2 deletions
diff --git a/net-print/cups-pk-helper/ChangeLog b/net-print/cups-pk-helper/ChangeLog index f28fb3b1fa16..f6fc5fefcd9c 100644 --- a/net-print/cups-pk-helper/ChangeLog +++ b/net-print/cups-pk-helper/ChangeLog @@ -1,6 +1,11 @@ # ChangeLog for net-print/cups-pk-helper # Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/net-print/cups-pk-helper/ChangeLog,v 1.7 2012/05/27 23:12:09 mattst88 Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-print/cups-pk-helper/ChangeLog,v 1.8 2012/08/07 09:10:52 tetromino Exp $ + + 07 Aug 2012; Alexandre Rostovtsev <tetromino@gentoo.org> + cups-pk-helper-0.2.2.ebuild, +files/cups-pk-helper-0.2.2-cups-1.6.patch: + Fix build failure with cups-1.6.x (bug #428544, thanks to Diego Elio Pettenò + and Andreas K. Hüttel). 27 May 2012; Matt Turner <mattst88@gentoo.org> cups-pk-helper-0.2.2.ebuild: Added ~alpha, bug 379651. diff --git a/net-print/cups-pk-helper/cups-pk-helper-0.2.2.ebuild b/net-print/cups-pk-helper/cups-pk-helper-0.2.2.ebuild index f13f228eec05..7df52dc9494d 100644 --- a/net-print/cups-pk-helper/cups-pk-helper-0.2.2.ebuild +++ b/net-print/cups-pk-helper/cups-pk-helper-0.2.2.ebuild @@ -1,9 +1,11 @@ # Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-print/cups-pk-helper/cups-pk-helper-0.2.2.ebuild,v 1.4 2012/05/27 23:12:09 mattst88 Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-print/cups-pk-helper/cups-pk-helper-0.2.2.ebuild,v 1.5 2012/08/07 09:10:52 tetromino Exp $ EAPI="4" +inherit eutils + DESCRIPTION="PolicyKit helper to configure cups with fine-grained privileges" HOMEPAGE="http://www.freedesktop.org/wiki/Software/cups-pk-helper" SRC_URI="http://www.freedesktop.org/software/${PN}/releases/${P}.tar.xz" @@ -30,6 +32,9 @@ DEPEND="${COMMON_DEPEND} src_prepare() { DOCS="AUTHORS HACKING NEWS README" + # bug #428544, https://bugs.freedesktop.org/show_bug.cgi?id=52265 + epatch "${FILESDIR}/${PN}-0.2.2-cups-1.6.patch" + # Regenerate dbus-codegen files to fix build with glib-2.30.x; bug #410773 rm -v src/cph-iface-mechanism.{c,h} || die } diff --git a/net-print/cups-pk-helper/files/cups-pk-helper-0.2.2-cups-1.6.patch b/net-print/cups-pk-helper/files/cups-pk-helper-0.2.2-cups-1.6.patch new file mode 100644 index 000000000000..c9950b1861b8 --- /dev/null +++ b/net-print/cups-pk-helper/files/cups-pk-helper-0.2.2-cups-1.6.patch @@ -0,0 +1,340 @@ +From b72bdab92d4fd89529f76a1188d5961e592f001a Mon Sep 17 00:00:00 2001 +From: Jiri Popelka <jpopelka@redhat.com> +Date: Thu, 19 Jul 2012 15:07:18 +0200 +Subject: [PATCH] Use ippGet/ippSet (accessors) for IPP API. + +CUPS 1.6 makes various structures private and +introduces these ippGet and ippSet functions +for all of the fields in these structures. +http://www.cups.org/str.php?L3928 + +We define our own accessors when CUPS < 1.6. +--- + src/cups.c | 153 ++++++++++++++++++++++++++++++++++++++---------------------- + 1 file changed, 96 insertions(+), 57 deletions(-) + +diff --git a/src/cups.c b/src/cups.c +index 1b2562b..2529f9a 100644 +--- a/src/cups.c ++++ b/src/cups.c +@@ -47,6 +47,45 @@ + + #include "cups.h" + ++#if (CUPS_VERSION_MAJOR > 1) || (CUPS_VERSION_MINOR > 5) ++#define HAVE_CUPS_1_6 1 ++#endif ++ ++#ifndef HAVE_CUPS_1_6 ++#define ippGetCount(attr) attr->num_values ++#define ippGetGroupTag(attr) attr->group_tag ++#define ippGetValueTag(attr) attr->value_tag ++#define ippGetName(attr) attr->name ++#define ippGetStatusCode(ipp) ipp->request.status.status_code ++#define ippGetString(attr, element, language) attr->values[element].string.text ++ ++static ipp_attribute_t * ++ippFirstAttribute(ipp_t *ipp) ++{ ++ if (!ipp) ++ return (NULL); ++ return (ipp->current = ipp->attrs); ++} ++ ++static ipp_attribute_t * ++ippNextAttribute(ipp_t *ipp) ++{ ++ if (!ipp || !ipp->current) ++ return (NULL); ++ return (ipp->current = ipp->current->next); ++} ++ ++static int ++ippSetString(ipp_t *ipp, ++ ipp_attribute_t **attr, ++ int element, ++ const char *strvalue) ++{ ++ (*attr)->values[element].string.text = (char *) strvalue; ++ return (1); ++} ++#endif ++ + /* This is 0.1 second */ + #define RECONNECT_DELAY 100000 + /* We try to reconnect during 3 seconds. It's still a fairly long time even for +@@ -560,7 +599,7 @@ _cph_cups_set_error_from_reply (CphCups *cups, + ipp_t *reply) + { + if (reply) +- cups->priv->last_status = reply->request.status.status_code; ++ cups->priv->last_status = ippGetStatusCode (reply); + else + cups->priv->last_status = cupsLastError (); + } +@@ -573,7 +612,7 @@ _cph_cups_is_reply_ok (CphCups *cups, + /* reset the internal status: we'll use the cups status */ + _cph_cups_set_internal_status (cups, NULL); + +- if (reply && reply->request.status.status_code <= IPP_OK_CONFLICT) { ++ if (reply && ippGetStatusCode (reply) <= IPP_OK_CONFLICT) { + cups->priv->last_status = IPP_OK; + return TRUE; + } else { +@@ -767,28 +806,28 @@ _cph_cups_send_new_job_attributes_request (CphCups *cups, + } + + static const char * +-_cph_cups_get_attribute_string (ipp_attribute_t *attrs, ++_cph_cups_get_attribute_string (ipp_t *reply, + ipp_tag_t group, + const char *name, + ipp_tag_t type) + { + ipp_attribute_t *attr; + +- for (attr = attrs; attr; attr = attr->next) { +- while (attr && attr->group_tag != group) +- attr = attr->next; ++ for (attr = ippFirstAttribute (reply); attr; attr = ippNextAttribute (reply)) { ++ while (attr && ippGetGroupTag (attr) != group) ++ attr = ippNextAttribute (reply); + + if (attr == NULL) + break; + +- while (attr && attr->group_tag == group) { +- if (attr->name && +- strcmp (attr->name, name) == 0 && +- attr->value_tag == type) { +- return attr->values[0].string.text; ++ while (attr && ippGetGroupTag (attr) == group) { ++ if (ippGetName (attr) && ++ strcmp (ippGetName (attr), name) == 0 && ++ ippGetValueTag (attr) == type) { ++ return ippGetString (attr, 0, NULL); + } + +- attr = attr->next; ++ attr = ippNextAttribute (reply); + } + + if (attr == NULL) +@@ -832,8 +871,8 @@ _cph_cups_class_has_printer (CphCups *cups, + if (!printer_names) + goto out; + +- for (i = 0; i < printer_names->num_values; i++) { +- if (!g_ascii_strcasecmp (printer_names->values[i].string.text, ++ for (i = 0; i < ippGetCount (printer_names); i++) { ++ if (!g_ascii_strcasecmp (ippGetString (printer_names, i, NULL), + printer_name)) { + retval = i; + break; +@@ -877,7 +916,7 @@ _cph_cups_printer_class_set_users (CphCups *cups, + attr = ippAddStrings (request, IPP_TAG_PRINTER, IPP_TAG_NAME, + request_name, len ? len : 1, NULL, NULL); + if (len == 0) +- attr->values[0].string.text = g_strdup (default_value); ++ ippSetString (request, &attr, 0, g_strdup (default_value)); + else { + int i, j; + for (i = 0, j = 0; i < real_len && j < len; i++) { +@@ -885,7 +924,7 @@ _cph_cups_printer_class_set_users (CphCups *cups, + if (users[i][0] == '\0') + continue; + +- attr->values[j].string.text = g_strdup (users[i]); ++ ippSetString (request, &attr, j, g_strdup (users[i])); + j++; + } + } +@@ -903,7 +942,7 @@ _cph_cups_printer_class_set_users (CphCups *cups, + attr = ippAddStrings (request, IPP_TAG_PRINTER, IPP_TAG_NAME, + request_name, len ? len : 1, NULL, NULL); + if (len == 0) +- attr->values[0].string.text = g_strdup (default_value); ++ ippSetString (request, &attr, 0, g_strdup (default_value)); + else { + int i, j; + for (i = 0, j = 0; i < real_len && j < len; i++) { +@@ -911,7 +950,7 @@ _cph_cups_printer_class_set_users (CphCups *cups, + if (users[i][0] == '\0') + continue; + +- attr->values[j].string.text = g_strdup (users[i]); ++ ippSetString (request, &attr, j, g_strdup (users[i])); + j++; + } + } +@@ -1002,7 +1041,7 @@ cph_cups_printer_get_uri (CphCups *cups, + if (!_cph_cups_is_reply_ok (cups, reply, TRUE)) + return NULL; + +- const_uri = _cph_cups_get_attribute_string (reply->attrs, IPP_TAG_PRINTER, ++ const_uri = _cph_cups_get_attribute_string (reply, IPP_TAG_PRINTER, + attrs[0], IPP_TAG_URI); + + uri = NULL; +@@ -1361,7 +1400,7 @@ _cph_cups_devices_get_old (CphCups *cups, + attr = ippAddStrings (request, IPP_TAG_OPERATION, IPP_TAG_NAME, + "include-schemes", len_include, NULL, NULL); + for (i = 0; i < len_include; i++) +- attr->values[i].string.text = g_strdup (include_schemes[i]); ++ ippSetString (request, &attr, i, g_strdup (include_schemes[i])); + } + + if (exclude_schemes && len_exclude > 0) { +@@ -1370,7 +1409,7 @@ _cph_cups_devices_get_old (CphCups *cups, + attr = ippAddStrings (request, IPP_TAG_OPERATION, IPP_TAG_NAME, + "exclude-schemes", len_exclude, NULL, NULL); + for (i = 0; i < len_exclude; i++) +- attr->values[i].string.text = g_strdup (exclude_schemes[i]); ++ ippSetString (request, &attr, i, g_strdup (exclude_schemes[i])); + } + + resource_char = _cph_cups_get_resource (CPH_RESOURCE_ROOT); +@@ -1380,9 +1419,9 @@ _cph_cups_devices_get_old (CphCups *cups, + if (!_cph_cups_is_reply_ok (cups, reply, TRUE)) + return FALSE; + +- for (attr = reply->attrs; attr; attr = attr->next) { +- while (attr && attr->group_tag != IPP_TAG_PRINTER) +- attr = attr->next; ++ for (attr = ippFirstAttribute (reply); attr; attr = ippNextAttribute (reply)) { ++ while (attr && ippGetGroupTag (attr) != IPP_TAG_PRINTER) ++ attr = ippNextAttribute (reply); + + if (attr == NULL) + break; +@@ -1394,29 +1433,29 @@ _cph_cups_devices_get_old (CphCups *cups, + device_make_and_model = NULL; + device_uri = NULL; + +- while (attr && attr->group_tag == IPP_TAG_PRINTER) { +- if (attr->name == NULL) ++ while (attr && ippGetGroupTag (attr) == IPP_TAG_PRINTER) { ++ if (ippGetName (attr) == NULL) + /* nothing, just skip */; +- else if (strcmp (attr->name, "device-class") == 0 && +- attr->value_tag == IPP_TAG_KEYWORD) +- device_class = g_strdup (attr->values[0].string.text); +- else if (strcmp (attr->name, "device-id") == 0 && +- attr->value_tag == IPP_TAG_TEXT) +- device_id = g_strdup (attr->values[0].string.text); +- else if (strcmp (attr->name, "device-info") == 0 && +- attr->value_tag == IPP_TAG_TEXT) +- device_info = g_strdup (attr->values[0].string.text); +- else if (strcmp (attr->name, "device-location") == 0 && +- attr->value_tag == IPP_TAG_TEXT) +- device_location = g_strdup (attr->values[0].string.text); +- else if (strcmp (attr->name, "device-make-and-model") == 0 && +- attr->value_tag == IPP_TAG_TEXT) +- device_make_and_model = g_strdup (attr->values[0].string.text); +- else if (strcmp (attr->name, "device-uri") == 0 && +- attr->value_tag == IPP_TAG_URI) +- device_uri = g_strdup (attr->values[0].string.text); +- +- attr = attr->next; ++ else if (strcmp (ippGetName (attr), "device-class") == 0 && ++ ippGetValueTag (attr) == IPP_TAG_KEYWORD) ++ device_class = g_strdup (ippGetString (attr, 0, NULL)); ++ else if (strcmp (ippGetName (attr), "device-id") == 0 && ++ ippGetValueTag (attr) == IPP_TAG_TEXT) ++ device_id = g_strdup (ippGetString (attr, 0, NULL)); ++ else if (strcmp (ippGetName (attr), "device-info") == 0 && ++ ippGetValueTag (attr) == IPP_TAG_TEXT) ++ device_info = g_strdup (ippGetString (attr, 0, NULL)); ++ else if (strcmp (ippGetName (attr), "device-location") == 0 && ++ ippGetValueTag (attr) == IPP_TAG_TEXT) ++ device_location = g_strdup (ippGetString (attr, 0, NULL)); ++ else if (strcmp (ippGetName (attr), "device-make-and-model") == 0 && ++ ippGetValueTag (attr) == IPP_TAG_TEXT) ++ device_make_and_model = g_strdup (ippGetString (attr, 0, NULL)); ++ else if (strcmp (ippGetName (attr), "device-uri") == 0 && ++ ippGetValueTag (attr) == IPP_TAG_URI) ++ device_uri = g_strdup (ippGetString (attr, 0, NULL)); ++ ++ attr = ippNextAttribute (reply); + } + + if (device_uri) +@@ -1758,7 +1797,7 @@ cph_cups_class_add_printer (CphCups *cups, + printer_uris = ippFindAttribute (reply, + "member-uris", IPP_TAG_URI); + if (printer_uris) +- new_len += printer_uris->num_values; ++ new_len += ippGetCount (printer_uris); + } else + printer_uris = NULL; + +@@ -1768,14 +1807,14 @@ cph_cups_class_add_printer (CphCups *cups, + if (printer_uris) { + int i; + +- for (i = 0; i < printer_uris->num_values; i++) +- attr->values[i].string.text = g_strdup (printer_uris->values[i].string.text); ++ for (i = 0; i < ippGetCount (printer_uris); i++) ++ ippSetString (request, &attr, i, g_strdup (ippGetString (printer_uris, i, NULL))); + } + + if (reply) + ippDelete (reply); + +- attr->values[new_len - 1].string.text = g_strdup (printer_uri); ++ ippSetString (request, &attr, new_len - 1, g_strdup (printer_uri)); + + return _cph_cups_send_request (cups, request, CPH_RESOURCE_ADMIN); + } +@@ -1827,7 +1866,7 @@ cph_cups_class_delete_printer (CphCups *cups, + printer_uris = ippFindAttribute (reply, + "member-uris", IPP_TAG_URI); + if (printer_uris) +- new_len += printer_uris->num_values; ++ new_len += ippGetCount (printer_uris); + + /* empty class: we delete it */ + if (new_len <= 0) { +@@ -1847,9 +1886,9 @@ cph_cups_class_delete_printer (CphCups *cups, + + /* copy all printers from the class, except the one we remove */ + for (i = 0; i < printer_index; i++) +- attr->values[i].string.text = g_strdup (printer_uris->values[i].string.text); +- for (i = printer_index + 1; i < printer_uris->num_values; i++) +- attr->values[i].string.text = g_strdup (printer_uris->values[i].string.text); ++ ippSetString (request, &attr, i, g_strdup (ippGetString (printer_uris, i, NULL))); ++ for (i = printer_index + 1; i < ippGetCount (printer_uris); i++) ++ ippSetString (request, &attr, i, g_strdup (ippGetString (printer_uris, i, NULL))); + + ippDelete (reply); + +@@ -2146,7 +2185,7 @@ cph_cups_printer_class_set_option_default (CphCups *cups, + option_name, len, NULL, NULL); + + for (i = 0; i < len; i++) +- attr->values[i].string.text = g_strdup (values[i]); ++ ippSetString (request, &attr, i, g_strdup (values[i])); + } + + retval = _cph_cups_send_request (cups, request, CPH_RESOURCE_ADMIN); +@@ -2371,7 +2410,7 @@ cph_cups_printer_class_set_option (CphCups *cups, + option, len, NULL, NULL); + + for (i = 0; i < len; i++) +- attr->values[i].string.text = g_strdup (values[i]); ++ ippSetString (request, &attr, i, g_strdup (values[i])); + } + + if (newppdfile) { +@@ -2490,7 +2529,7 @@ cph_cups_job_get_status (CphCups *cups, + if (!_cph_cups_is_reply_ok (cups, reply, TRUE)) + return CPH_JOB_STATUS_INVALID; + +- orig_user = _cph_cups_get_attribute_string (reply->attrs, IPP_TAG_JOB, ++ orig_user = _cph_cups_get_attribute_string (reply, IPP_TAG_JOB, + attrs[0], IPP_TAG_NAME); + + status = CPH_JOB_STATUS_INVALID; +-- +1.7.10.4 + |