rpms/system-config-printer/devel pycups-git.patch, NONE, 1.1 system-config-printer.spec, 1.233, 1.234

Tim Waugh twaugh at fedoraproject.org
Wed Dec 17 16:40:44 UTC 2008


Author: twaugh

Update of /cvs/pkgs/rpms/system-config-printer/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv6575

Modified Files:
	system-config-printer.spec 
Added Files:
	pycups-git.patch 
Log Message:
* Wed Dec 17 2008 Tim Waugh <twaugh at redhat.com> 1.0.12-5
- Added patch for pycups git changes since 1.9.44:
  - Look for test page file in new location for CUPS 1.4 (bug
    #476612).


pycups-git.patch:

--- NEW FILE pycups-git.patch ---
diff -U0 pycups-1.9.44/ChangeLog.pycups-git pycups-1.9.44/ChangeLog
--- pycups-1.9.44/ChangeLog.pycups-git	2008-11-28 12:27:15.000000000 +0000
+++ pycups-1.9.44/ChangeLog	2008-12-17 16:36:03.000000000 +0000
@@ -0,0 +1,16 @@
+2008-12-17  Tim Waugh  <twaugh at redhat.com>
+
+	* cupsconnection.c (Connection_printTestPage): Look for
+	"testprint" as well as "testprint.ps", as that is the name of the
+	test page file in CUPS 1.4 (bug #476612).
+
+2008-12-17  Tim Waugh  <twaugh at redhat.com>
+
+	* cupsconnection.c (Connection_printTestPage): Only set a
+	document-format attribute if one is specified.
+
+2008-12-17  Tim Waugh  <twaugh at redhat.com>
+
+	* cupsconnection.c (Connection_printTestPage): Avoid crash when
+	given bad parameters.
+
diff -up pycups-1.9.44/cupsconnection.c.pycups-git pycups-1.9.44/cupsconnection.c
--- pycups-1.9.44/cupsconnection.c.pycups-git	2008-11-25 12:12:38.000000000 +0000
+++ pycups-1.9.44/cupsconnection.c	2008-12-17 16:36:03.000000000 +0000
@@ -2908,13 +2908,13 @@ Connection_printTestPage (Connection *se
   PyObject *printerobj;
   char *printer;
   PyObject *fileobj = NULL;
-  char *file;
+  char *file = NULL;
   PyObject *titleobj = NULL;
-  char *title;
+  char *title = NULL;
   PyObject *formatobj = NULL;
-  char *format;
+  char *format = NULL;
   PyObject *userobj = NULL;
-  char *user;
+  char *user = NULL;
   const char *datadir;
   char filename[PATH_MAX];
   char uri[HTTP_MAX_URI];
@@ -2946,17 +2946,33 @@ Connection_printTestPage (Connection *se
   }
     
   if (!fileobj) {
-    const char *testprint = "%s/data/testprint.ps";
-    if ((datadir = getenv ("CUPS_DATADIR")) != NULL)
-      snprintf (filename, sizeof (filename), testprint, datadir);
-    else {
+    const char *testprint[] = { "%s/data/testprint",
+				"%s/data/testprint.ps",
+				NULL };
+    if ((datadir = getenv ("CUPS_DATADIR")) != NULL) {
+      const char **pattern;
+      for (pattern = testprint; *pattern != NULL; pattern++) {
+	snprintf (filename, sizeof (filename), *pattern, datadir);
+	if (access (filename, R_OK) == 0)
+	  break;
+      }
+    } else {
       const char *const dirs[] = { "/usr/share/cups",
 				   "/usr/local/share/cups",
 				   NULL };
+      int found = 0;
       int i;
       for (i = 0; (datadir = dirs[i]) != NULL; i++) {
-	snprintf (filename, sizeof (filename), testprint, datadir);
-	if (access (filename, R_OK) == 0)
+	const char **pattern;
+	for (pattern = testprint; *pattern != NULL; pattern++) {
+	  snprintf (filename, sizeof (filename), *pattern, datadir);
+	  if (access (filename, R_OK) == 0) {
+	    found = 1;
+	    break;
+	  }
+	}
+
+	if (found)
 	  break;
       }
 
@@ -2966,7 +2982,7 @@ Connection_printTestPage (Connection *se
 	 * client-error-not-found, but we'll let that happen rather
 	 * than raising an exception so as to be consistent with the
 	 * case where CUPS_DATADIR is set and we trust it. */
-	snprintf (filename, sizeof (filename), testprint, dirs[0]);
+	snprintf (filename, sizeof (filename), testprint[0], dirs[0]);
     }
 
     file = filename;
@@ -2975,9 +2991,6 @@ Connection_printTestPage (Connection *se
   if (!titleobj)
     title = "Test Page";
 
-  if (!formatobj)
-    format = "application/postscript";
-
   if (!userobj)
 	  user = (char *) cupsUser();
 
@@ -2991,8 +3004,10 @@ Connection_printTestPage (Connection *se
 		  "requesting-user-name", NULL, user);
     ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_NAME, "job-name",
 		  NULL, title);
-    ippAddString (request, IPP_TAG_JOB, IPP_TAG_MIMETYPE, "document-format",
-		  NULL, format);
+    if (format)
+      ippAddString (request, IPP_TAG_JOB, IPP_TAG_MIMETYPE, "document-format",
+		    NULL, format);
+
     Connection_begin_allow_threads (self);
     answer = cupsDoFileRequest (self->http, request, resource, file);
     Connection_end_allow_threads (self);


Index: system-config-printer.spec
===================================================================
RCS file: /cvs/pkgs/rpms/system-config-printer/devel/system-config-printer.spec,v
retrieving revision 1.233
retrieving revision 1.234
diff -u -r1.233 -r1.234
--- system-config-printer.spec	12 Dec 2008 10:04:55 -0000	1.233
+++ system-config-printer.spec	17 Dec 2008 16:40:14 -0000	1.234
@@ -7,7 +7,7 @@
 Summary: A printer administration tool
 Name: system-config-printer
 Version: 1.0.12
-Release: 4%{?dist}
+Release: 5%{?dist}
 License: GPLv2+
 URL: http://cyberelk.net/tim/software/system-config-printer/
 Group: System Environment/Base
@@ -16,6 +16,7 @@
 Source2: http://cyberelk.net/tim/data/pysmbc/pysmbc-%{pysmbc_version}.tar.bz2
 
 Patch0: system-config-printer-1.0.x.patch
+Patch10: pycups-git.patch
 
 BuildRequires: cups-devel >= 1.2
 BuildRequires: python-devel >= 2.4
@@ -63,6 +64,9 @@
 %prep
 %setup -q -a 1 -a 2
 %patch0 -p1 -b .1.0.x
+pushd pycups-%{pycups_version}
+%patch10 -p1 -b .pycups-git
+popd
 
 %build
 %configure
@@ -152,6 +156,11 @@
 exit 0
 
 %changelog
+* Wed Dec 17 2008 Tim Waugh <twaugh at redhat.com> 1.0.12-5
+- Added patch for pycups git changes since 1.9.44:
+  - Look for test page file in new location for CUPS 1.4 (bug
+    #476612).
+
 * Fri Dec 12 2008 Tim Waugh <twaugh at redhat.com> 1.0.12-4
 - Updated patch for 1.0.x changes:
   - Fix for advanced server settings dialog.




More information about the fedora-extras-commits mailing list