diff --git a/pycups-git.patch b/pycups-git.patch new file mode 100644 index 0000000..5322891 --- /dev/null +++ b/pycups-git.patch @@ -0,0 +1,113 @@ +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 ++ ++ * 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 ++ ++ * cupsconnection.c (Connection_printTestPage): Only set a ++ document-format attribute if one is specified. ++ ++2008-12-17 Tim Waugh ++ ++ * 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); diff --git a/system-config-printer.spec b/system-config-printer.spec index a9b315b..cc1058d 100644 --- a/system-config-printer.spec +++ b/system-config-printer.spec @@ -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 @@ Source1: http://cyberelk.net/tim/data/pycups/pycups-%{pycups_version}.tar.bz2 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 @@ the configuration tool. %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 @@ rm -rf %buildroot exit 0 %changelog +* Wed Dec 17 2008 Tim Waugh 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 1.0.12-4 - Updated patch for 1.0.x changes: - Fix for advanced server settings dialog.