commit 71b1534d9ecfc28b4450cceac3f58f9f1f810a70 Author: Petr Šabata <contyk@xxxxxxxxxx> Date: Thu Jul 26 14:09:04 2012 +0200 Support CUPS 1.6 dest_test.patch | 47 ----------- perl-Net-CUPS-0.61-cups16.patch | 165 +++++++++++++++++++++++++++++++++++++++ perl-Net-CUPS.spec | 34 ++++----- 3 files changed, 180 insertions(+), 66 deletions(-) --- diff --git a/perl-Net-CUPS-0.61-cups16.patch b/perl-Net-CUPS-0.61-cups16.patch new file mode 100644 index 0000000..4c5bf66 --- /dev/null +++ b/perl-Net-CUPS-0.61-cups16.patch @@ -0,0 +1,165 @@ +diff --git a/CUPS.xs b/CUPS.xs +index 2da9558..109f73f 100644 +--- a/CUPS.xs ++++ b/CUPS.xs +@@ -5,9 +5,17 @@ + #include "ppport.h" + + #include <cups/cups.h> ++#if (CUPS_VERSION_MAJOR > 1) || (CUPS_VERSION_MINOR > 5) ++#define HAVE_CUPS_1_6 1 ++#endif ++ + /*#include <cups/backend.h>*/ + #include <cups/http.h> +-#include <cups/image.h> ++#ifdef HAVE_CUPS_1_6 ++ #include <cupsfilters/image.h> ++#else ++ #include <cups/image.h> ++#endif + #include <cups/ipp.h> + #include <cups/ppd.h> + #include <cups/file.h> +@@ -19,6 +27,17 @@ + #include "const-c.inc" + #include "packer.c" + ++#ifndef HAVE_CUPS_1_6 ++#define ippGetGroupTag(attr) attr->group_tag ++#define ippGetName(attr) attr->name ++#define ippGetValueTag(attr) attr->value_tag ++#define ippGetInteger(attr, element) attr->values[element].integer ++#define ippGetString(attr, element, language) attr->values[element].string.text ++#define ippGetStatusCode(ipp) ipp->request.status.status_code ++#define ippFirstAttribute(ipp) ipp->current = ipp->attrs ++#define ippNextAttribute(ipp) ipp->current = ipp->current->next ++#endif ++ + static SV *password_cb = (SV*) NULL; + + const char * +@@ -200,7 +219,7 @@ NETCUPS_getPPDMakes() + if (response != NULL) { + attr = ippFindAttribute(response, "ppd-make", IPP_TAG_TEXT); + rv = sv_newmortal(); +- sv_setpv(rv, attr->values[0].string.text); ++ sv_setpv(rv, ippGetString(attr, 0, NULL)); + XPUSHs(rv); + count++; + +@@ -211,7 +230,7 @@ NETCUPS_getPPDMakes() + } + + rv = sv_newmortal(); +- sv_setpv(rv, attr->values[0].string.text); ++ sv_setpv(rv, ippGetString(attr, 0, NULL)); + XPUSHs(rv); + count++; + } +@@ -252,7 +271,7 @@ NETCUPS_getAllPPDs () + "ppd-make-and-model", + IPP_TAG_TEXT); + rv = sv_newmortal(); +- sv_setpv(rv, attr->values[0].string.text); ++ sv_setpv(rv, ippGetString(attr, 0, NULL)); + XPUSHs(rv); + count++; + while (attr != NULL) { +@@ -263,7 +282,7 @@ NETCUPS_getAllPPDs () + break; + } + rv = sv_newmortal(); +- sv_setpv(rv, attr->values[0].string.text); ++ sv_setpv(rv, ippGetString(attr, 0, NULL)); + XPUSHs(rv); + count++; + } +@@ -356,14 +375,14 @@ NETCUPS_getPPDFileName(ppdfilename); + if (response != NULL) { + attr = ippFindAttribute(response, "ppd-name", IPP_TAG_NAME ); + while ((attr != NULL) && (i < 1)) { +- tmpppd = attr->values[0].string.text; ++ tmpppd = ippGetString(attr, 0, NULL); + attr = ippFindNextAttribute(response, + "ppd-make", + IPP_TAG_TEXT); + attr = ippFindNextAttribute(response, + "ppd-make-and-model", + IPP_TAG_TEXT); +- if (strcmp(attr->values[0].string.text, ppdfilename) == 0 ) { ++ if (strcmp(ippGetString(attr, 0, NULL), ppdfilename) == 0 ) { + /* return tmpppd; */ + strcpy(test, tmpppd); + break; +@@ -410,12 +429,12 @@ NETCUPS_getDeviceAttribute( device, attribute, attribute_type ) + attr = ippFindNextAttribute(response, "printer-name", IPP_TAG_NAME); + + while (attr != NULL) { +- if (strcmp(attr->values[0].string.text, device) == 0) { ++ if (strcmp(ippGetString(attr, 0, NULL), device) == 0) { + attr = ippFindNextAttribute( response, + attribute, + attribute_type); + rv = sv_newmortal(); +- sv_setpv( rv, attr->values[0].string.text); ++ sv_setpv( rv, ippGetString(attr, 0, NULL)); + XPUSHs( rv ); + break; + } +@@ -858,15 +877,15 @@ NETCUPS_getAttributes( ipp ) + SV* rv = NULL; + int count = 0; + ipp_attribute_t* attr = NULL; +- for (attr = ipp->attrs; attr != NULL; attr = attr->next) ++ for (attr = ippFirstAttribute(ipp); attr != NULL; attr = ippNextAttribute(ipp)) + { +- while (attr != NULL && attr->group_tag != IPP_TAG_JOB) +- attr = attr->next; ++ while (attr != NULL && ippGetGroupTag(attr) != IPP_TAG_JOB) ++ attr = ippNextAttribute(ipp); + + if (attr == NULL) + break; + rv = sv_newmortal(); +- sv_setpv( rv, attr->name ); ++ sv_setpv( rv, ippGetName(attr) ); + XPUSHs( rv ); + count++; + } +@@ -880,27 +899,27 @@ NETCUPS_getAttributeValue( ipp, name ) + SV* rv = NULL; + int count = 0; + ipp_attribute_t* attr = NULL; +- for (attr = ipp->attrs; attr != NULL; attr = attr->next) ++ for (attr = ippFirstAttribute(ipp); attr != NULL; attr = ippNextAttribute(ipp)) + { +- while (attr != NULL && attr->group_tag != IPP_TAG_JOB) +- attr = attr->next; ++ while (attr != NULL && ippGetGroupTag(attr) != IPP_TAG_JOB) ++ attr = ippNextAttribute(ipp); + + if (attr == NULL) + break; + +- if( !strcmp( attr->name, name ) ) ++ if( !strcmp( ippGetName(attr), name ) ) + { + rv = sv_newmortal(); +- if( ( attr->value_tag == IPP_TAG_INTEGER ) || +- ( attr->value_tag == IPP_TAG_ENUM ) ) ++ if( ( ippGetValueTag(attr) == IPP_TAG_INTEGER ) || ++ ( ippGetValueTag(attr) == IPP_TAG_ENUM ) ) + { + /* We have a number with any luck ... */ +- sv_setiv( rv, attr->values[0].integer ); ++ sv_setiv( rv, ippGetInteger(attr, 0) ); + } + else + { + /* We have a string ... maybe ... try to set it. */ +- sv_setpv( rv, attr->values[0].string.text ); ++ sv_setpv( rv, ippGetString(attr, 0, NULL) ); + } + + XPUSHs( rv ); diff --git a/perl-Net-CUPS.spec b/perl-Net-CUPS.spec index bb17d17..6e60162 100644 --- a/perl-Net-CUPS.spec +++ b/perl-Net-CUPS.spec @@ -1,18 +1,18 @@ Name: perl-Net-CUPS Version: 0.61 -Release: 11%{?dist} +Release: 12%{?dist} Summary: Perl bindings to the CUPS C API Interface License: GPL+ or Artistic Group: Development/Libraries URL: http://search.cpan.org/dist/Net-CUPS/ Source0: http://search.cpan.org/CPAN/authors/id/D/DH/DHAGEMAN/Net-CUPS-%{version}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) - -# non-perl +Patch0: perl-Net-CUPS-0.61-cups16.patch +Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version)) BuildRequires: cups-devel - -# perl +# Uncomment once cups1.6 lands in rawhide (#832130) +# BuildRequires: cups-filters-devel +BuildRequires: perl(AutoLoader) +BuildRequires: perl(Carp) BuildRequires: perl(ExtUtils::MakeMaker) BuildRequires: perl(Test::More) @@ -24,39 +24,35 @@ an urge to control CUPS servers via Perl, this is a good way to do it :) %prep %setup -q -n Net-CUPS-%{version} - find . -type f -exec chmod -c -x {} + +%patch0 -p1 -b .cups16 %build -%{__perl} Makefile.PL INSTALLDIRS=vendor OPTIMIZE="%{optflags}" +perl Makefile.PL INSTALLDIRS=vendor OPTIMIZE="%{optflags}" make %{?_smp_mflags} %install -rm -rf %{buildroot} - make pure_install PERL_INSTALL_ROOT=%{buildroot} - find %{buildroot} -type f -name .packlist -exec rm -f {} + find %{buildroot} -type f -name '*.bs' -size 0 -exec rm -f {} + find %{buildroot} -depth -type d -exec rmdir {} 2>/dev/null \; - %{_fixperms} %{buildroot}/* %check make test -%clean -rm -rf %{buildroot} - %files -%defattr(-,root,root,-) -# not much in the way of examples, so let's throw in the tests. -%doc Changes README TODO t/ examples/ +%doc Changes README TODO examples/ %{perl_vendorarch}/auto/* %{perl_vendorarch}/Net* %{_mandir}/man3/* %changelog +* Thu Jul 26 2012 Petr Šabata <contyk@xxxxxxxxxx> - 0.61-12 +- Build with CUPS 1.6+, thanks to Jiří Popelka <jpopelka@xxxxxxxxxx>, + rhbz#841925, rt#78583 +- Drop command macros and modernize spec + * Fri Jul 20 2012 Fedora Release Engineering <rel-eng@xxxxxxxxxxxxxxxxxxxxxxx> - 0.61-11 - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild -- Fedora Extras Perl SIG http://www.fedoraproject.org/wiki/Extras/SIGs/Perl perl-devel mailing list perl-devel@xxxxxxxxxxxxxxxxxxxxxxx https://admin.fedoraproject.org/mailman/listinfo/perl-devel