[kdelibs3] fix FTBFS with CUPS 2.0 due to bad CUPS_VERSION_MAJOR checks

Kevin Kofler kkofler at fedoraproject.org
Tue Nov 25 20:44:20 UTC 2014


commit 41b88741c0686146be73b295b5ff110d979ad23e
Author: Kevin Kofler <Kevin at tigcc.ticalc.org>
Date:   Tue Nov 25 21:36:45 2014 +0100

    fix FTBFS with CUPS 2.0 due to bad CUPS_VERSION_MAJOR checks
    
    * Tue Nov 25 2014 Kevin Kofler <Kevin at tigcc.ticalc.org> 3.5.10-65
    - fix FTBFS with CUPS 2.0 due to bad CUPS_VERSION_MAJOR checks

 kdelibs-3.5.10-cups20.patch |  159 +++++++++++++++++++++++++++++++++++++++++++
 kdelibs3.spec               |    8 ++-
 2 files changed, 166 insertions(+), 1 deletions(-)
---
diff --git a/kdelibs-3.5.10-cups20.patch b/kdelibs-3.5.10-cups20.patch
new file mode 100644
index 0000000..10e30f5
--- /dev/null
+++ b/kdelibs-3.5.10-cups20.patch
@@ -0,0 +1,159 @@
+diff -ur kdelibs-3.5.10/kdeprint/cups/cupsdconf2/cups-util.c kdelibs-3.5.10-cups20/kdeprint/cups/cupsdconf2/cups-util.c
+--- kdelibs-3.5.10/kdeprint/cups/cupsdconf2/cups-util.c	2007-10-08 11:52:10.000000000 +0200
++++ kdelibs-3.5.10-cups20/kdeprint/cups/cupsdconf2/cups-util.c	2014-11-25 21:41:51.000000000 +0100
+@@ -32,7 +32,7 @@
+   char		prompt[1024];		/* Prompt string */
+   int		digest_tries;		/* Number of tries with Digest */
+   static char	filename[HTTP_MAX_URI];	/* Local filename */
+-#if CUPS_VERSION_MAJOR - 0 <= 1 && CUPS_VERSION_MINOR - 0 < 2
++#if CUPS_VERSION_MAJOR < 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 2)
+   const char    *fqdn = 0;
+ #else
+   char          fqdn[ HTTP_MAX_URI ];   /* Server name buffer */
+@@ -118,7 +118,7 @@
+       * See if we should retry the current digest password...
+       */
+ 
+-#if CUPS_VERSION_MAJOR - 0 <= 1 && CUPS_VERSION_MINOR - 0 < 2
++#if CUPS_VERSION_MAJOR < 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 2)
+       www_authenticate = cups_server->fields[HTTP_FIELD_WWW_AUTHENTICATE];
+ #else
+       www_authenticate = httpGetField( cups_server, HTTP_FIELD_WWW_AUTHENTICATE );
+@@ -129,7 +129,7 @@
+        /*
+ 	* Nope - get a password from the user...
+ 	*/
+-#if CUPS_VERSION_MAJOR - 0 <= 1 && CUPS_VERSION_MINOR - 0 < 2
++#if CUPS_VERSION_MAJOR < 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 2)
+         fqdn = cups_server->hostname;
+ #else
+         httpGetHostname( cups_server, fqdn, sizeof( fqdn ) );
+@@ -154,7 +154,7 @@
+       * Got a password; encode it for the server...
+       */
+ 
+-#if CUPS_VERSION_MAJOR - 0 <= 1 && CUPS_VERSION_MINOR - 0 < 2
++#if CUPS_VERSION_MAJOR < 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 2)
+       www_authenticate = cups_server->fields[HTTP_FIELD_WWW_AUTHENTICATE];
+ #else
+       www_authenticate = httpGetField( cups_server, HTTP_FIELD_WWW_AUTHENTICATE );
+@@ -166,7 +166,7 @@
+ 	*/
+ 
+ 	snprintf(plain, sizeof(plain), "%s:%s", cupsUser(), pwdstring);
+-#if CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR >= 2
++#if CUPS_VERSION_MAJOR > 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR >= 2)
+        httpEncode64_2(encode, sizeof(encode), plain, sizeof(plain));
+ #else
+        httpEncode64(encode, plain);
+@@ -235,7 +235,7 @@
+   */
+ 
+   while ((bytes =
+-#if CUPS_VERSION_MAJOR - 0 <= 1 && CUPS_VERSION_MINOR - 0 < 2
++#if CUPS_VERSION_MAJOR < 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 2)
+           httpRead
+ #else
+           httpRead2
+@@ -265,7 +265,7 @@
+   http_status_t	status;			/* HTTP status from server */
+   char		prompt[1024];		/* Prompt string */
+   int		digest_tries;		/* Number of tries with Digest */
+-#if CUPS_VERSION_MAJOR - 0 <= 1 && CUPS_VERSION_MINOR - 0 < 2
++#if CUPS_VERSION_MAJOR < 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 2)
+   const char    *fqdn = 0;
+ #else
+   char          fqdn[ HTTP_MAX_URI ];   /* Server name buffer */
+@@ -340,7 +340,7 @@
+ 	        break;
+ 	}
+ 	else
+-#if CUPS_VERSION_MAJOR - 0 <= 1 && CUPS_VERSION_MINOR - 0 < 2
++#if CUPS_VERSION_MAJOR < 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 2)
+           httpWrite
+ #else
+           httpWrite2
+@@ -349,7 +349,7 @@
+ 
+     if (status == HTTP_CONTINUE)
+     {
+-#if CUPS_VERSION_MAJOR - 0 <= 1 && CUPS_VERSION_MINOR - 0 < 2
++#if CUPS_VERSION_MAJOR < 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 2)
+         httpWrite
+ #else
+         httpWrite2
+@@ -380,7 +380,7 @@
+       * See if we should retry the current digest password...
+       */
+ 
+-#if CUPS_VERSION_MAJOR - 0 <= 1 && CUPS_VERSION_MINOR - 0 < 2
++#if CUPS_VERSION_MAJOR < 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 2)
+       www_authenticate = cups_server->fields[HTTP_FIELD_WWW_AUTHENTICATE];
+ #else
+       www_authenticate = httpGetField( cups_server, HTTP_FIELD_WWW_AUTHENTICATE );
+@@ -393,7 +393,7 @@
+ 	*/
+ 
+ 
+-#if CUPS_VERSION_MAJOR - 0 <= 1 && CUPS_VERSION_MINOR - 0 < 2
++#if CUPS_VERSION_MAJOR < 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 2)
+         fqdn = cups_server->hostname;
+ #else
+         httpGetHostname( cups_server, fqdn, sizeof( fqdn ) );
+@@ -417,7 +417,7 @@
+       * Got a password; encode it for the server...
+       */
+ 
+-#if CUPS_VERSION_MAJOR - 0 <= 1 && CUPS_VERSION_MINOR - 0 < 2
++#if CUPS_VERSION_MAJOR < 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 2)
+       www_authenticate = cups_server->fields[HTTP_FIELD_WWW_AUTHENTICATE];
+ #else
+       www_authenticate = httpGetField( cups_server, HTTP_FIELD_WWW_AUTHENTICATE );
+@@ -429,7 +429,7 @@
+ 	*/
+ 
+ 	snprintf(plain, sizeof(plain), "%s:%s", cupsUser(), pwdstring);
+-#if CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR >= 2
++#if CUPS_VERSION_MAJOR > 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR >= 2)
+        httpEncode64_2(encode, sizeof(encode), plain, sizeof(plain));
+ #else
+        httpEncode64(encode, plain);
+@@ -511,7 +511,7 @@
+   * See if we are accessing localhost...
+ 	the struct has changed in newer versions - PiggZ (adam at piggz.co.uk)
+   */
+-#if CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR >= 2
++#if CUPS_VERSION_MAJOR > 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR >= 2)
+         if (!httpAddrLocalhost(http))
+ #else
+ 	if (ntohl(*(int*)&http->hostaddr.sin_addr) != 0x7f000001 &&
+diff -ur kdelibs-3.5.10/kdeprint/cups/ipprequest.cpp kdelibs-3.5.10-cups20/kdeprint/cups/ipprequest.cpp
+--- kdelibs-3.5.10/kdeprint/cups/ipprequest.cpp	2007-10-08 11:52:10.000000000 +0200
++++ kdelibs-3.5.10-cups20/kdeprint/cups/ipprequest.cpp	2014-11-25 21:41:51.000000000 +0100
+@@ -310,7 +310,7 @@
+ 	}
+ 
+ #ifdef HAVE_CUPS_NO_PWD_CACHE
+-#if CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR <= 2
++#if CUPS_VERSION_MAJOR < 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR <= 2)
+    strncpy(  HTTP->authstring, cups_authstring.data(), HTTP_MAX_VALUE );
+ #else
+    httpSetAuthString( HTTP, NULL, cups_authstring.data() );
+@@ -324,7 +324,7 @@
+ 
+ 	request_ = cupsDoFileRequest(HTTP, request_, (res.isEmpty() ? "/" : res.latin1()), (filename.isEmpty() ? NULL : filename.latin1()));
+ #ifdef HAVE_CUPS_NO_PWD_CACHE
+-#if CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR <= 2
++#if CUPS_VERSION_MAJOR < 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR <= 2)
+    cups_authstring = HTTP->authstring;
+ #else
+ 	cups_authstring = httpGetAuthString( HTTP );
+@@ -523,7 +523,7 @@
+ 	cupsFreeOptions(n, options);
+ 
+ 	// find an remove that annoying "document-format" attribute
+-#if CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR >= 2
++#if CUPS_VERSION_MAJOR > 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR >= 2)
+     ipp_attribute_t *attr = ippFindAttribute(request_, "document-format", IPP_TAG_NAME);
+     ippDeleteAttribute(request_, attr);
+ #else
diff --git a/kdelibs3.spec b/kdelibs3.spec
index 40c4a6b..1e814fe 100644
--- a/kdelibs3.spec
+++ b/kdelibs3.spec
@@ -18,7 +18,7 @@
 Summary: KDE 3 Libraries
 Name:    kdelibs3
 Version: 3.5.10
-Release: 64%{?dist}
+Release: 65%{?dist}
 
 License: LGPLv2
 Url: http://www.kde.org/
@@ -63,6 +63,8 @@ Patch55: kdelibs-3.5.10-latex-syntax-kile-2.0.3.patch
 Patch56: kdelibs-3.5.10-qcolor_gcc_ftbfs.patch
 # fix FTBFS (cups-util.c must include stdio.h, #714133)
 Patch57: kdelibs-3.5.10-cups-util-missing-header.patch
+# fix FTBFS with CUPS 2.0 due to bad CUPS_VERSION_MAJOR checks
+Patch58: kdelibs-3.5.10-cups20.patch
 
 # use /etc/kde in addition to /usr/share/config, borrowed from debian
 Patch100: kdelibs-3.5.5-kstandarddirs.patch
@@ -244,6 +246,7 @@ format for easy browsing
 %patch55 -p1 -b .latex-syntax
 %patch56 -p1 -b .qcolor_gcc_ftbfs
 %patch57 -p1 -b .cups-util
+%patch58 -p1 -b .cups20
 
 %patch100 -p1 -b .kstandarddirs
 %patch101 -p1 -b .libtool-shlibext
@@ -589,6 +592,9 @@ touch --no-create %{_datadir}/icons/crystalsvg 2> /dev/null || :
 
 
 %changelog
+* Tue Nov 25 2014 Kevin Kofler <Kevin at tigcc.ticalc.org> 3.5.10-65
+- fix FTBFS with CUPS 2.0 due to bad CUPS_VERSION_MAJOR checks
+
 * Tue Nov 25 2014 Rex Dieter <rdieter at fedoraproject.org> 3.5.10-64
 - rebuild (openexr)
 


More information about the scm-commits mailing list