Merge branch 'f15'

This commit is contained in:
Jiri Popelka 2011-07-25 13:44:19 +02:00
commit 892a6e2919
10 changed files with 12 additions and 984 deletions

2
.gitignore vendored
View File

@ -4,3 +4,5 @@
/foomatic-filters-4.0.6.tar.gz
/foomatic-db-engine-4.0.7.tar.gz
/foomatic-filters-4.0.7.tar.gz
/foomatic-db-engine-4.0.8.tar.gz
/foomatic-filters-4.0.8.tar.gz

View File

@ -1,24 +0,0 @@
--- foomatic-db-engine-3.0.2/lib/Foomatic/PPD.pm.bad-utf8 2002-10-11 02:16:34.000000000 +0100
+++ foomatic-db-engine-3.0.2/lib/Foomatic/PPD.pm 2004-11-23 19:32:26.000000000 +0000
@@ -300,11 +300,17 @@
sub xml_esc {
my ($in) = (@_);
- $in =~ s!&!&!g;
- $in =~ s!<!&lt;!g;
- $in =~ s!>!&gt;!g;
+ @chars = split(//,$in);
+ $ascii = "";
+ foreach (@chars) {
+ if (ord ($_) > 127) { $_="?"; }
+ $ascii .= $_;
+ }
+ $ascii =~ s!&!&amp;!g;
+ $ascii =~ s!<!&lt;!g;
+ $ascii =~ s!>!&gt;!g;
- return $in;
+ return $ascii;
}
sub pdq_filter {

View File

@ -1,616 +0,0 @@
diff --git a/Makefile.am b/Makefile.am
index 03e437e..1f12fbb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -53,6 +53,15 @@ foomatic_rip_SOURCES = \
fileconverter.c \
fileconverter.h
+if BUILD_DBUS
+foomatic_rip_SOURCES += \
+ colord.c \
+ colord.h
+
+foomatic_rip_CFLAGS = $(DBUS_CFLAGS) -DHAVE_DBUS
+foomatic_rip_LDADD = $(DBUS_LIBS)
+endif
+
AM_CPPFLAGS = -DCONFIG_PATH='"$(sysconfdir)/foomatic"'
# Masks for trash files which have to be removed before packaging Foomatic
diff --git a/colord.c b/colord.c
new file mode 100644
index 0000000..260b8c7
--- /dev/null
+++ b/colord.c
@@ -0,0 +1,263 @@
+/* colord.c
+ *
+ * Copyright (C) 2011 Richard Hughes <richard@hughsie.com>
+ *
+ * This file is part of foomatic-rip.
+ *
+ * Foomatic-rip is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Foomatic-rip is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/* Common routines for accessing the colord CMS framework */
+
+#include <dbus/dbus.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+
+#include "colord.h"
+
+#define QUAL_COLORSPACE 0
+#define QUAL_MEDIA 1
+#define QUAL_RESOLUTION 2
+#define QUAL_SIZE 3
+
+static char *
+get_filename_for_profile_path (DBusConnection *con,
+ const char *object_path)
+{
+ char *filename = NULL;
+ const char *interface = "org.freedesktop.ColorManager.Profile";
+ const char *property = "Filename";
+ const char *tmp;
+ DBusError error;
+ DBusMessageIter args;
+ DBusMessage *message = NULL;
+ DBusMessage *reply = NULL;
+ DBusMessageIter sub;
+
+ message = dbus_message_new_method_call("org.freedesktop.ColorManager",
+ object_path,
+ "org.freedesktop.DBus.Properties",
+ "Get");
+
+ dbus_message_iter_init_append(message, &args);
+ dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &interface);
+ dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &property);
+
+ /* send syncronous */
+ dbus_error_init(&error);
+ fprintf(stderr, "DEBUG: Calling %s.Get(%s)\n", interface, property);
+ reply = dbus_connection_send_with_reply_and_block(con,
+ message,
+ -1,
+ &error);
+ if (reply == NULL) {
+ fprintf(stderr, "DEBUG: Failed to send: %s:%s\n",
+ error.name, error.message);
+ dbus_error_free(&error);
+ goto out;
+ }
+
+ /* get reply data */
+ dbus_message_iter_init(reply, &args);
+ if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_VARIANT) {
+ fprintf(stderr, "DEBUG: Incorrect reply type\n");
+ goto out;
+ }
+
+ dbus_message_iter_recurse(&args, &sub);
+ dbus_message_iter_get_basic(&sub, &tmp);
+ filename = strdup(tmp);
+out:
+ if (message != NULL)
+ dbus_message_unref(message);
+ if (reply != NULL)
+ dbus_message_unref(reply);
+ return filename;
+}
+
+static char *
+get_profile_for_device_path (DBusConnection *con,
+ const char *object_path,
+ const char **split)
+{
+ char **key = NULL;
+ char *profile = NULL;
+ char str[256];
+ const char *tmp;
+ DBusError error;
+ DBusMessageIter args;
+ DBusMessageIter entry;
+ DBusMessage *message = NULL;
+ DBusMessage *reply = NULL;
+ int i = 0;
+ const int max_keys = 7;
+
+ message = dbus_message_new_method_call("org.freedesktop.ColorManager",
+ object_path,
+ "org.freedesktop.ColorManager.Device",
+ "GetProfileForQualifiers");
+ dbus_message_iter_init_append(message, &args);
+
+ /* create the fallbacks */
+ key = calloc(max_keys + 1, sizeof(char*));
+
+ /* exact match */
+ i = 0;
+ snprintf(str, sizeof(str), "%s.%s.%s",
+ split[QUAL_COLORSPACE],
+ split[QUAL_MEDIA],
+ split[QUAL_RESOLUTION]);
+ key[i++] = strdup(str);
+ snprintf(str, sizeof(str), "%s.%s.*",
+ split[QUAL_COLORSPACE],
+ split[QUAL_MEDIA]);
+ key[i++] = strdup(str);
+ snprintf(str, sizeof(str), "%s.*.%s",
+ split[QUAL_COLORSPACE],
+ split[QUAL_RESOLUTION]);
+ key[i++] = strdup(str);
+ snprintf(str, sizeof(str), "%s.*.*",
+ split[QUAL_COLORSPACE]);
+ key[i++] = strdup(str);
+ key[i++] = strdup("*");
+ dbus_message_iter_open_container(&args,
+ DBUS_TYPE_ARRAY,
+ "s",
+ &entry);
+ for (i=0; key[i] != NULL; i++) {
+ dbus_message_iter_append_basic(&entry,
+ DBUS_TYPE_STRING,
+ &key[i]);
+ }
+ dbus_message_iter_close_container(&args, &entry);
+
+ /* send syncronous */
+ dbus_error_init(&error);
+ fprintf(stderr, "DEBUG: Calling GetProfileForQualifiers(%s...)\n", key[0]);
+ reply = dbus_connection_send_with_reply_and_block(con,
+ message,
+ -1,
+ &error);
+ if (reply == NULL) {
+ fprintf(stderr, "DEBUG: Failed to send: %s:%s\n",
+ error.name, error.message);
+ dbus_error_free(&error);
+ goto out;
+ }
+
+ /* get reply data */
+ dbus_message_iter_init(reply, &args);
+ if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_OBJECT_PATH) {
+ fprintf(stderr, "DEBUG: Incorrect reply type\n");
+ goto out;
+ }
+ dbus_message_iter_get_basic(&args, &tmp);
+ fprintf(stderr, "DEBUG: Found profile %s\n", tmp);
+
+ /* get filename */
+ profile = get_filename_for_profile_path(con, tmp);
+
+out:
+ if (message != NULL)
+ dbus_message_unref(message);
+ if (reply != NULL)
+ dbus_message_unref(reply);
+ if (key != NULL) {
+ for (i=0; i < max_keys; i++)
+ free(key[i]);
+ free(key);
+ }
+ return profile;
+}
+
+static char *
+get_profile_for_device_id (DBusConnection *con,
+ const char *device_id,
+ const char **qualifier_tuple)
+{
+ char *profile = NULL;
+ const char *device_path_tmp;
+ DBusError error;
+ DBusMessageIter args;
+ DBusMessage *message = NULL;
+ DBusMessage *reply = NULL;
+
+ message = dbus_message_new_method_call("org.freedesktop.ColorManager",
+ "/org/freedesktop/ColorManager",
+ "org.freedesktop.ColorManager",
+ "FindDeviceById");
+ dbus_message_iter_init_append(message, &args);
+ dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &device_id);
+
+ /* send syncronous */
+ dbus_error_init(&error);
+ fprintf(stderr, "DEBUG: Calling FindDeviceById(%s)\n", device_id);
+ reply = dbus_connection_send_with_reply_and_block(con,
+ message,
+ -1,
+ &error);
+ if (reply == NULL) {
+ fprintf(stderr, "DEBUG: Failed to send: %s:%s\n",
+ error.name, error.message);
+ dbus_error_free(&error);
+ goto out;
+ }
+
+ /* get reply data */
+ dbus_message_iter_init(reply, &args);
+ if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_OBJECT_PATH) {
+ fprintf(stderr, "DEBUG: Incorrect reply type\n");
+ goto out;
+ }
+ dbus_message_iter_get_basic(&args, &device_path_tmp);
+ fprintf(stderr, "DEBUG: Found device %s\n", device_path_tmp);
+ profile = get_profile_for_device_path(con, device_path_tmp, qualifier_tuple);
+out:
+ if (message != NULL)
+ dbus_message_unref(message);
+ if (reply != NULL)
+ dbus_message_unref(reply);
+ return profile;
+}
+
+char *
+colord_get_profile_for_device_id (const char *device_id,
+ const char **qualifier_tuple)
+{
+ DBusConnection *con;
+ char *filename = NULL;
+
+ /* connect to system bus */
+ con = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
+ if (con == NULL) {
+ fprintf(stderr, "ERROR: Failed to connect to system bus\n");
+ goto out;
+ }
+
+ /* get the best profile for the device */
+ filename = get_profile_for_device_id (con, device_id, qualifier_tuple);
+ if (filename == NULL) {
+ fprintf(stderr, "DEBUG: Failed to get profile filename!\n");
+ goto out;
+ }
+ fprintf(stderr, "DEBUG: Use profile filename: '%s'\n", filename);
+out:
+ if (con != NULL)
+ dbus_connection_unref(con);
+ return filename;
+}
diff --git a/colord.h b/colord.h
new file mode 100644
index 0000000..2ea98bc
--- /dev/null
+++ b/colord.h
@@ -0,0 +1,24 @@
+/* colord.h
+ *
+ * Copyright (C) 2011 Richard Hughes <richard@hughsie.com>
+ *
+ * This file is part of foomatic-rip.
+ *
+ * Foomatic-rip is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Foomatic-rip is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+char *colord_get_profile_for_device_id (const char *device_id,
+ const char **qualifier_tuple);
diff --git a/configure.ac b/configure.ac
index 96a9e21..d33726d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -16,6 +16,9 @@ AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
+# Allows per-target compilation flags
+AM_PROG_CC_C_O
+
# Checks for libraries.
AC_CHECK_LIB(m, roundf)
@@ -119,6 +122,14 @@ AC_ARG_WITH(file-converter,[ --with-file-converter=[a2ps|enscript|mpage]
AC_MSG_RESULT([file-converter: $FILECONVERTER])
AC_SUBST(FILECONVERTER)
+# Use DBUS
+AC_ARG_ENABLE(dbus, AS_HELP_STRING([--enable-dbus],[enable DBus CMS code]),
+ enable_dbus=$enableval,enable_dbus=yes)
+AM_CONDITIONAL(BUILD_DBUS, test x$enable_dbus = xyes)
+if test x$enable_dbus = xyes; then
+ PKG_CHECK_MODULES(DBUS, dbus-1)
+fi
+
if test "${NOCONVERTERCHECK}" = "" -a "${A2PS}" = "" -a "${ENSCRIPT}" = "" -a "${MPAGE}" = "" -a "${TEXTTOPS}" = "" ; then
AC_MSG_ERROR([cannot find a2ps, enscript, mpage, or CUPS' texttops. You need to have at least one installed]);
fi
diff --git a/foomaticrip.c b/foomaticrip.c
index 41a7577..6065768 100644
--- a/foomaticrip.c
+++ b/foomaticrip.c
@@ -45,6 +45,9 @@
#include <signal.h>
#include <pwd.h>
+#ifdef HAVE_DBUS
+ #include "colord.h"
+#endif
/* Logging */
FILE* logh = NULL;
@@ -1477,13 +1480,45 @@ int main(int argc, char** argv)
strlcat(pstoraster, " 0 '' '' 0 '%X'", 256);
break;
}
+ /* gstoraster is the new name for pstoraster */
+ strlcat(tmp, "/gstoraster", 1024);
+ if (access(tmp, X_OK) == 0) {
+ havepstoraster = 1;
+ strlcpy(pstoraster, tmp, 256);
+ strlcat(pstoraster, " 0 '' '' 0 '%X'", 256);
+ break;
+ }
}
if (!havepstoraster) {
- strcpy(pstoraster, "gs -dQUIET -dDEBUG -dPARANOIDSAFER -dNOPAUSE -dBATCH -dNOMEDIAATTRS -sDEVICE=cups -sOutputFile=-%W -");
+ const char **qualifier = NULL;
+ const char *icc_profile = NULL;
+
+ qualifier = get_ppd_qualifier();
+ _log("INFO: Using qualifer: '%s.%s.%s'\n",
+ qualifier[0], qualifier[1], qualifier[2]);
+
+ /* ask colord for the profile */
+ icc_profile = colord_get_profile_for_device_id ((const char *) getenv("PRINTER"),
+ qualifier);
+
+ /* fall back to PPD */
+ if (icc_profile == NULL) {
+ _log("INFO: need to look in PPD for matching qualifer\n");
+ icc_profile = get_icc_profile_for_qualifier(qualifier);
+ }
+
+ if (icc_profile != NULL)
+ snprintf(cmd, sizeof(cmd),
+ "-sOutputICCProfile='%s'", icc_profile);
+ else
+ cmd[0] = '\0';
+
+ snprintf(pstoraster, sizeof(pstoraster), "gs -dQUIET -dDEBUG -dPARANOIDSAFER -dNOPAUSE -dBATCH -dNOMEDIAATTRS -sDEVICE=cups %s -sOutputFile=-%W -", cmd);
}
/* build Ghostscript/CUPS driver command line */
snprintf(cmd, 1024, "%s | %s", pstoraster, cupsfilter);
+ _log("INFO: Using command line: %s\n", cmd);
/* Set environment variables */
setenv("PPD", job->ppdfile, 1);
diff --git a/options.c b/options.c
index 9a4b116..662cedd 100644
--- a/options.c
+++ b/options.c
@@ -31,6 +31,11 @@
#include <string.h>
#include <math.h>
+/* qualifier -> filename mapping entry */
+typedef struct icc_mapping_entry_s {
+ char *qualifier;
+ char *filename;
+} icc_mapping_entry_t;
/* Values from foomatic keywords in the ppd file */
char printer_model [256];
@@ -70,6 +75,8 @@ dstr_t *setupprepend;
dstr_t *pagesetupprepend;
+list_t *qualifier_data = NULL;
+char **qualifier = NULL;
option_t *optionlist = NULL;
option_t *optionlist_sorted_by_order = NULL;
@@ -78,7 +85,42 @@ int optionset_alloc, optionset_count;
char **optionsets;
+const char * get_icc_profile_for_qualifier(const char **qualifier)
+{
+ char tmp[1024];
+ char *profile = NULL;
+ listitem_t *i;
+ icc_mapping_entry_t *entry;
+
+ /* no data */
+ if (qualifier_data == NULL)
+ goto out;
+
+ /* search list for qualifier */
+ snprintf(tmp, sizeof(tmp), "%s.%s.%s",
+ qualifier[0], qualifier[1], qualifier[2]);
+ for (i = qualifier_data->first; i != NULL; i = i->next) {
+ entry = (icc_mapping_entry_t *) i->data;
+ if (strcmp(entry->qualifier, tmp) == 0) {
+ profile = entry->filename;
+ break;
+ }
+ }
+out:
+ return profile;
+}
+/* a selector is a general tri-dotted specification.
+ * The 2nd and 3rd elements of the qualifier are optionally modified by
+ * cupsICCQualifier2 and cupsICCQualifier3:
+ *
+ * [Colorspace].[{cupsICCQualifier2}].[{cupsICCQualifier3}]
+ */
+const char **
+get_ppd_qualifier ()
+{
+ return (const char**) qualifier;
+}
const char * type_name(int type)
{
@@ -239,6 +281,8 @@ void options_free()
{
option_t *opt;
int i;
+ listitem_t *item;
+ icc_mapping_entry_t *entry;
for (i = 0; i < optionset_count; i++)
free(optionsets[i]);
@@ -247,6 +291,20 @@ void options_free()
optionset_alloc = 0;
optionset_count = 0;
+ if (qualifier_data) {
+ for (item = qualifier_data->first; item != NULL; item = item->next) {
+ entry = (icc_mapping_entry_t *) item->data;
+ free(entry->qualifier);
+ free(entry->filename);
+ free(entry);
+ }
+ list_free(qualifier_data);
+ }
+
+ for (i=0; i<3; i++)
+ free(qualifier[i]);
+ free(qualifier);
+
while (optionlist) {
opt = optionlist;
optionlist = optionlist->next;
@@ -1493,6 +1551,9 @@ int optionset_equal(int optset1, int optset2, int exceptPS)
void read_ppd_file(const char *filename)
{
FILE *fh;
+ const char *tmp;
+ char *icc_qual2 = NULL;
+ char *icc_qual3 = NULL;
char line [256]; /* PPD line length is max 255 (excl. \0) */
char *p;
char key[128], name[64], text[64];
@@ -1501,6 +1562,7 @@ void read_ppd_file(const char *filename)
value_t *val;
option_t *opt, *current_opt = NULL;
param_t *param;
+ icc_mapping_entry_t *entry;
fh = fopen(filename, "r");
if (!fh) {
@@ -1511,6 +1573,7 @@ void read_ppd_file(const char *filename)
dstrassure(value, 256);
+ qualifier_data = list_create();
while (!feof(fh)) {
fgets(line, 256, fh);
@@ -1691,10 +1754,6 @@ void read_ppd_file(const char *filename)
else if (!prefixcmp(key, "Default")) {
/* Default<option>: <value> */
- /* TODO *DefaultColorSpace is a keyword and doesn't need to be extraced, does it? */
- if (!strcmp(key, "DefaultColorSpace"))
- continue;
-
opt = assure_option(&key[7]);
val = option_assure_value(opt, optionset("default"));
free(val->value);
@@ -1768,6 +1827,21 @@ void read_ppd_file(const char *filename)
/* "*FoomaticRIPOptionsEntityMaxLength: <length>" */
sscanf(value->data, "%d", &optionsentitymaxlen);
}
+ else if (!strcmp(key, "cupsICCProfile")) {
+ /* "*cupsICCProfile: <qualifier/Title> <filename>" */
+ entry = calloc(1, sizeof(icc_mapping_entry_t));
+ entry->qualifier = strdup(name);
+ entry->filename = strdup(value->data);
+ list_append (qualifier_data, entry);
+ }
+ else if (!strcmp(key, "cupsICCQualifier2")) {
+ /* "*cupsICCQualifier2: <value>" */
+ icc_qual2 = strdup(value->data);
+ }
+ else if (!strcmp(key, "cupsICCQualifier3")) {
+ /* "*cupsICCQualifier3: <value>" */
+ icc_qual3 = strdup(value->data);
+ }
}
fclose(fh);
@@ -1786,6 +1860,36 @@ void read_ppd_file(const char *filename)
defined in the PPD file */
option_set_value(opt, optionset("default"), opt->choicelist->value);
}
+
+ /* create qualifier for this PPD */
+ qualifier = calloc(4, sizeof(char*));
+
+ /* get colorspace */
+ tmp = option_get_value(find_option("ColorSpace"), optionset("default"));
+ if (tmp == NULL)
+ tmp = option_get_value(find_option("ColorModel"), optionset("default"));
+ if (tmp == NULL)
+ tmp = "";
+ qualifier[0] = strdup(tmp);
+
+ /* get selector2 */
+ if (icc_qual2 == NULL)
+ icc_qual2 = strdup("MediaType");
+ tmp = option_get_value(find_option(icc_qual2), optionset("default"));
+ if (tmp == NULL)
+ tmp = "";
+ qualifier[1] = strdup(tmp);
+
+ /* get selectors */
+ if (icc_qual3 == NULL)
+ icc_qual3 = strdup("Resolution");
+ tmp = option_get_value(find_option(icc_qual3), optionset("default"));
+ if (tmp == NULL)
+ tmp = "";
+ qualifier[2] = strdup(tmp);
+
+ free (icc_qual2);
+ free (icc_qual3);
}
int ppd_supports_pdf()
diff --git a/options.h b/options.h
index db7c3e9..242e8f2 100644
--- a/options.h
+++ b/options.h
@@ -177,6 +177,8 @@ void append_page_setup_section(dstr_t *str, int optset, int comments);
int build_commandline(int optset, dstr_t *cmdline, int pdfcmdline);
void set_options_for_page(int optset, int page);
+const char *get_icc_profile_for_qualifier(const char **qualifier);
+const char **get_ppd_qualifier(void);
#endif

View File

@ -1,33 +0,0 @@
diff -up foomatic-db-engine-4.0.7/configure.ac.libdir foomatic-db-engine-4.0.7/configure.ac
--- foomatic-db-engine-4.0.7/configure.ac.libdir 2011-02-18 13:30:22.000000000 +0100
+++ foomatic-db-engine-4.0.7/configure.ac 2011-02-21 12:43:24.000000000 +0100
@@ -69,8 +69,8 @@ LOGSEARCHPATH=/var/log:/usr/log:/usr/loc
SYSCONFSEARCHPATH=/etc:/usr/etc:/usr/local/etc:/var/etc
SBINSEARCHPATH=/usr/sbin:/sbin:/usr/local/sbin:/etc/sbin
BINSEARCHPATH=/usr/bin:/bin:/usr/local/bin
-DATASEARCHPATH=/usr/share:/usr/local/share:/usr/lib:/usr/local/lib:/opt
-LIBSEARCHPATH=/usr/lib:/lib:/usr/local/lib:/usr/local/libexec:/opt
+DATASEARCHPATH=/usr/share:/usr/local/share:$libdir:/usr/local/lib:/opt
+LIBSEARCHPATH=$libdir:/lib:/usr/local/lib:/usr/local/libexec:/opt
PTALPIPESSEARCHPATH=/var/run:/var:/var/ptal:/usr/var/run:/usr/var:/usr/var/ptal:/usr/local/var/run:/usr/local/var:/usr/local/var/ptal:/dev:/dev/ptal
MTINKPIPESSEARCHPATH=/var:/var/run:/usr/var/:/usr/var/run:/usr/local/var:/usr/local/var/run:/dev
@@ -257,15 +257,15 @@ AC_PATH_PROGS(CUPS_LPOPTIONS,lpoptions,/
AC_PATH_PROGS(CUPS_LPINFO,lpinfo,/usr/sbin/lpinfo,$SBINSEARCHPATH)
# Paths for PDQ
-FM_PATH_DIRS(PDQ_CONF,pdq,/usr/lib/pdq,$SYS_LIB_PATH)
+FM_PATH_DIRS(PDQ_CONF,pdq,$libdir/pdq,$SYS_LIB_PATH)
AC_PATH_PROGS(PDQ_PRINTRC,pdq/printrc,$PDQ_CONF/printrc,$SYS_LIB_PATH)
dnl PDQ_FOOMATIC=$PDQ_CONF/drivers/foomatic
AC_PATH_PROGS(PDQ_PRINT,pdq lpr-pdq,/usr/bin/pdq,$BINSEARCHPATH)
dnl PDQ_JOBDIR=~/.printjobs
# Paths for PPR
-AC_PATH_PROGS(PPR_PPRD,ppr/bin/pprd,/usr/lib/ppr/bin/pprd,$LIBSEARCHPATH)
-FM_PATH_DIRS(PPR_INTERFACES,ppr/interfaces,/usr/lib/ppr/interfaces,$LIBSEARCHPATH)
+AC_PATH_PROGS(PPR_PPRD,ppr/bin/pprd,$libdir/ppr/bin/pprd,$LIBSEARCHPATH)
+FM_PATH_DIRS(PPR_INTERFACES,ppr/interfaces,$libdir/ppr/interfaces,$LIBSEARCHPATH)
FM_PATH_DIRS(PPR_PPDFILES,ppr/PPDFiles,/usr/share/ppr/PPDFiles,$DATASEARCHPATH)
FM_PATH_DIRS(PPR_ETC,ppr,/etc/ppr,$SYSCONFSEARCHPATH)
AC_PATH_PROGS(PPR_PPR,ppr lpr-ppr,/usr/bin/ppr,$BINSEARCHPATH)

View File

@ -1,39 +0,0 @@
diff -up foomatic-db-engine-4.0.3/configure.ac.perl foomatic-db-engine-4.0.3/configure.ac
--- foomatic-db-engine-4.0.3/configure.ac.perl 2009-12-04 09:26:14.236782616 +0000
+++ foomatic-db-engine-4.0.3/configure.ac 2009-12-04 09:29:08.819781206 +0000
@@ -184,13 +184,13 @@ else
PREFIX=$prefix
fi
echo -n Checking whether Perl will find libraries installed under $PREFIX...
-if ( $PERL -V | egrep "^ *$PREFIX/lib(/perl[[0-9]]?|)(/site_perl|)/[[0-9]]" > /dev/null); then
+if ( $PERL -V | egrep "^ *$PREFIX/lib(/perl[[0-9]]?|)(/site_perl|)" > /dev/null); then
PERLPREFIX=$PREFIX
echo " yes"
else
echo " no"
echo -n Checking whether Perl will find libraries installed under /usr/local...
- if ( $PERL -V | egrep "^ */usr/local/lib(/perl[[0-9]]?|)(/site_perl|)/[[0-9]]" > /dev/null); then
+ if ( $PERL -V | egrep "^ */usr/local/lib(/perl[[0-9]]?|)(/site_perl|)" > /dev/null); then
PERLPREFIX=/usr/local
echo " yes"
echo Installing the Perl libraries with prefix /usr/local.
diff -up foomatic-db-engine-4.0.3/configure.perl foomatic-db-engine-4.0.3/configure
--- foomatic-db-engine-4.0.3/configure.perl 2009-12-04 09:29:12.117906609 +0000
+++ foomatic-db-engine-4.0.3/configure 2009-12-04 09:29:34.709782105 +0000
@@ -4519,13 +4519,13 @@ else
PREFIX=$prefix
fi
echo -n Checking whether Perl will find libraries installed under $PREFIX...
-if ( $PERL -V | egrep "^ *$PREFIX/lib(/perl[0-9]?|)(/site_perl|)/[0-9]" > /dev/null); then
+if ( $PERL -V | egrep "^ *$PREFIX/lib(/perl[0-9]?|)(/site_perl|)" > /dev/null); then
PERLPREFIX=$PREFIX
echo " yes"
else
echo " no"
echo -n Checking whether Perl will find libraries installed under /usr/local...
- if ( $PERL -V | egrep "^ */usr/local/lib(/perl[0-9]?|)(/site_perl|)/[0-9]" > /dev/null); then
+ if ( $PERL -V | egrep "^ */usr/local/lib(/perl[0-9]?|)(/site_perl|)" > /dev/null); then
PERLPREFIX=/usr/local
echo " yes"
echo Installing the Perl libraries with prefix /usr/local.
diff -up foomatic-db-engine-4.0.3/Makefile.in.perl foomatic-db-engine-4.0.3/Makefile.in

View File

@ -1,209 +0,0 @@
diff -up foomatic-filters-4.0.7/foomaticrip.c.CVE-2011-2697 foomatic-filters-4.0.7/foomaticrip.c
--- foomatic-filters-4.0.7/foomaticrip.c.CVE-2011-2697 2011-07-20 10:41:15.825401233 +0100
+++ foomatic-filters-4.0.7/foomaticrip.c 2011-07-20 10:42:22.784101806 +0100
@@ -1239,8 +1239,11 @@ int main(int argc, char** argv)
}
/* Check for LPRng first so we do not pick up bogus ppd files by the -ppd option */
- if (arglist_remove_flag(arglist, "--lprng"))
- spooler = SPOOLER_LPRNG;
+ if (spooler != SPOOLER_CUPS && spooler != SPOOLER_PPR &&
+ spooler != SPOOLER_PPR_INT) {
+ if (arglist_remove_flag(arglist, "--lprng"))
+ spooler = SPOOLER_LPRNG;
+ }
/* 'PRINTCAP_ENTRY' environment variable is : LPRng
the :ppd=/path/to/ppdfile printcap entry should be used */
@@ -1262,96 +1265,104 @@ int main(int argc, char** argv)
}
}
- /* PPD file name given via the command line
- allow duplicates, and use the last specified one */
- if (spooler != SPOOLER_LPRNG) {
- while ((str = arglist_get_value(arglist, "-p"))) {
- strncpy(job->ppdfile, str, 256);
- arglist_remove(arglist, "-p");
- }
- }
- while ((str = arglist_get_value(arglist, "--ppd"))) {
- strncpy(job->ppdfile, str, 256);
- arglist_remove(arglist, "--ppd");
- }
-
- /* Check for LPD/GNUlpr by typical options which the spooler puts onto
- the filter's command line (options "-w": text width, "-l": text
- length, "-i": indent, "-x", "-y": graphics size, "-c": raw printing,
- "-n": user name, "-h": host name) */
- if ((str = arglist_get_value(arglist, "-h"))) {
- if (spooler != SPOOLER_GNULPR && spooler != SPOOLER_LPRNG)
- spooler = SPOOLER_LPD;
- strncpy(job->host, str, 127);
- job->host[127] = '\0';
- arglist_remove(arglist, "-h");
- }
- if ((str = arglist_get_value(arglist, "-n"))) {
- if (spooler != SPOOLER_GNULPR && spooler != SPOOLER_LPRNG)
- spooler = SPOOLER_LPD;
-
- strncpy(job->user, str, 127);
- job->user[127] = '\0';
- arglist_remove(arglist, "-n");
- }
- if (arglist_remove(arglist, "-w") ||
- arglist_remove(arglist, "-l") ||
- arglist_remove(arglist, "-x") ||
- arglist_remove(arglist, "-y") ||
- arglist_remove(arglist, "-i") ||
- arglist_remove_flag(arglist, "-c")) {
+ /* CUPS calls foomatic-rip only with 5 or 6 positional parameters,
+ not with named options, like for example "-p <string>". Also PPR
+ does not used named options. */
+ if (spooler != SPOOLER_CUPS && spooler != SPOOLER_PPR &&
+ spooler != SPOOLER_PPR_INT) {
+ /* Check for LPD/GNUlpr by typical options which the spooler puts onto
+ the filter's command line (options "-w": text width, "-l": text
+ length, "-i": indent, "-x", "-y": graphics size, "-c": raw printing,
+ "-n": user name, "-h": host name) */
+ if ((str = arglist_get_value(arglist, "-h"))) {
+ if (spooler != SPOOLER_GNULPR && spooler != SPOOLER_LPRNG)
+ spooler = SPOOLER_LPD;
+ strncpy(job->host, str, 127);
+ job->host[127] = '\0';
+ arglist_remove(arglist, "-h");
+ }
+ if ((str = arglist_get_value(arglist, "-n"))) {
if (spooler != SPOOLER_GNULPR && spooler != SPOOLER_LPRNG)
spooler = SPOOLER_LPD;
- }
- /* LPRng delivers the option settings via the "-Z" argument */
- if ((str = arglist_get_value(arglist, "-Z"))) {
- spooler = SPOOLER_LPRNG;
- dstrcatf(job->optstr, "%s ", str);
- arglist_remove(arglist, "-Z");
- }
- /* Job title and options for stock LPD */
- if ((str = arglist_get_value(arglist, "-j")) || (str = arglist_get_value(arglist, "-J"))) {
- strncpy_omit(job->title, str, 128, omit_shellescapes);
- if (spooler == SPOOLER_LPD)
- dstrcatf(job->optstr, "%s ", job->title);
- if (!arglist_remove(arglist, "-j"))
- arglist_remove(arglist, "-J");
- }
- /* Check for CPS */
- if (arglist_remove_flag(arglist, "--cps") > 0)
- spooler = SPOOLER_CPS;
-
- /* Options for spooler-less printing, CPS, or PDQ */
- while ((str = arglist_get_value(arglist, "-o"))) {
- strncpy_omit(tmp, str, 1024, omit_shellescapes);
- dstrcatf(job->optstr, "%s ", tmp);
- arglist_remove(arglist, "-o");
- /* If we don't print as PPR RIP or as CPS filter, we print
- without spooler (we check for PDQ later) */
- if (spooler != SPOOLER_PPR && spooler != SPOOLER_CPS)
- spooler = SPOOLER_DIRECT;
- }
-
- /* Printer for spooler-less printing or PDQ */
- if ((str = arglist_get_value(arglist, "-d"))) {
- strncpy_omit(job->printer, str, 256, omit_shellescapes);
- arglist_remove(arglist, "-d");
- }
-
- /* Printer for spooler-less printing, PDQ, or LPRng */
- if ((str = arglist_get_value(arglist, "-P"))) {
- strncpy_omit(job->printer, str, 256, omit_shellescapes);
- arglist_remove(arglist, "-P");
- }
-
- /* Were we called from a PDQ wrapper? */
- if (arglist_remove_flag(arglist, "--pdq"))
- spooler = SPOOLER_PDQ;
- /* Were we called to build the PDQ driver declaration file? */
- genpdqfile = check_pdq_file(arglist);
- if (genpdqfile)
- spooler = SPOOLER_PDQ;
+ strncpy(job->user, str, 127);
+ job->user[127] = '\0';
+ arglist_remove(arglist, "-n");
+ }
+ if (arglist_remove(arglist, "-w") ||
+ arglist_remove(arglist, "-l") ||
+ arglist_remove(arglist, "-x") ||
+ arglist_remove(arglist, "-y") ||
+ arglist_remove(arglist, "-i") ||
+ arglist_remove_flag(arglist, "-c")) {
+ if (spooler != SPOOLER_GNULPR && spooler != SPOOLER_LPRNG)
+ spooler = SPOOLER_LPD;
+ }
+ /* LPRng delivers the option settings via the "-Z" argument */
+ if ((str = arglist_get_value(arglist, "-Z"))) {
+ spooler = SPOOLER_LPRNG;
+ dstrcatf(job->optstr, "%s ", str);
+ arglist_remove(arglist, "-Z");
+ }
+ /* Job title and options for stock LPD */
+ if ((str = arglist_get_value(arglist, "-j")) || (str = arglist_get_value(arglist, "-J"))) {
+ strncpy_omit(job->title, str, 128, omit_shellescapes);
+ if (spooler == SPOOLER_LPD)
+ dstrcatf(job->optstr, "%s ", job->title);
+ if (!arglist_remove(arglist, "-j"))
+ arglist_remove(arglist, "-J");
+ }
+
+ /* Check for CPS */
+ if (arglist_remove_flag(arglist, "--cps") > 0)
+ spooler = SPOOLER_CPS;
+
+ /* PPD file name given via the command line
+ allow duplicates, and use the last specified one */
+ if (spooler != SPOOLER_GNULPR && spooler != SPOOLER_LPRNG &&
+ spooler != SPOOLER_LPD) {
+ while ((str = arglist_get_value(arglist, "-p"))) {
+ strncpy(job->ppdfile, str, 256);
+ arglist_remove(arglist, "-p");
+ }
+ while ((str = arglist_get_value(arglist, "--ppd"))) {
+ strncpy(job->ppdfile, str, 256);
+ arglist_remove(arglist, "--ppd");
+ }
+ }
+
+ /* Options for spooler-less printing, CPS, or PDQ */
+ while ((str = arglist_get_value(arglist, "-o"))) {
+ strncpy_omit(tmp, str, 1024, omit_shellescapes);
+ dstrcatf(job->optstr, "%s ", tmp);
+ arglist_remove(arglist, "-o");
+ /* If we don't print as PPR RIP or as CPS filter, we print
+ without spooler (we check for PDQ later) */
+ if (spooler != SPOOLER_PPR && spooler != SPOOLER_CPS)
+ spooler = SPOOLER_DIRECT;
+ }
+
+ /* Printer for spooler-less printing or PDQ */
+ if ((str = arglist_get_value(arglist, "-d"))) {
+ strncpy_omit(job->printer, str, 256, omit_shellescapes);
+ arglist_remove(arglist, "-d");
+ }
+
+ /* Printer for spooler-less printing, PDQ, or LPRng */
+ if ((str = arglist_get_value(arglist, "-P"))) {
+ strncpy_omit(job->printer, str, 256, omit_shellescapes);
+ arglist_remove(arglist, "-P");
+ }
+
+ /* Were we called from a PDQ wrapper? */
+ if (arglist_remove_flag(arglist, "--pdq"))
+ spooler = SPOOLER_PDQ;
+
+ /* Were we called to build the PDQ driver declaration file? */
+ genpdqfile = check_pdq_file(arglist);
+ if (genpdqfile)
+ spooler = SPOOLER_PDQ;
+ }
/* spooler specific initialization */
switch (spooler) {

View File

@ -1,12 +0,0 @@
diff -up foomatic-filters-4.0.0/configure.ac.libdir foomatic-filters-4.0.0/configure.ac
--- foomatic-filters-4.0.0/configure.ac.libdir 2009-01-14 19:23:15.000000000 +0000
+++ foomatic-filters-4.0.0/configure.ac 2009-01-15 10:57:55.000000000 +0000
@@ -43,7 +43,7 @@ AC_CHECK_FUNCS([dup2 getcwd gethostname
ETCSEARCHPATH=${prefix}/etc:/usr/etc:/usr/local/etc
-LIBSEARCHPATH=${prefix}/lib:${prefix}/lib64:/usr/lib:/usr/lib64:/usr/local/lib:${prefix}/libexec:/usr/libexec:/usr/local/libexec
+LIBSEARCHPATH=${libdir}:/usr/lib:/usr/lib64:/usr/local/lib:${prefix}/libexec:/usr/libexec:/usr/local/libexec
uname=`uname`
uversion=`uname -r | sed -e '1,$s/[[^0-9]]//g'`

View File

@ -1,20 +0,0 @@
diff -up foomatic-filters-4.0.5/pdf.c.mkstemp foomatic-filters-4.0.5/pdf.c
--- foomatic-filters-4.0.5/pdf.c.mkstemp 2010-08-10 12:08:04.000000000 +0200
+++ foomatic-filters-4.0.5/pdf.c 2010-08-18 12:34:11.000000000 +0200
@@ -110,13 +110,14 @@ static int pdf_extract_pages(char filena
{
char gscommand[4095];
char filename_arg[PATH_MAX], first_arg[50], last_arg[50];
+ int fd;
_log("Extracting pages %d through %d\n", first, last);
snprintf(filename, PATH_MAX, "%s/foomatic-XXXXXX", temp_dir());
- mktemp(filename);
- if (!filename[0])
+ if ((fd = mkstemp(filename)) == -1)
rip_die(EXIT_STARVED, "Unable to create temporary file!\n");
+ close (fd);
snprintf(filename_arg, PATH_MAX, "-sOutputFile=%s", filename);
snprintf(first_arg, 50, "-dFirstPage=%d", first);

View File

@ -1,10 +1,10 @@
%define enginever 4.0.7
%define filtersver 4.0.7
%define enginever 4.0.8
%define filtersver 4.0.8
Summary: Tools for using the foomatic database of printers and printer drivers
Name: foomatic
Version: %{enginever}
Release: 6%{?dist}
Release: 1%{?dist}
License: GPLv2+
Group: System Environment/Libraries
@ -16,27 +16,8 @@ Source1: http://www.openprinting.org/download/foomatic/foomatic-filters-%{filter
## PATCHES FOR FOOMATIC-FILTERS (PATCHES 1 TO 100)
# Use libdir.
Patch1: foomatic-filters-libdir.patch
# Use mkstemp, not mktemp.
Patch2: foomatic-mkstemp.patch
# Use colord
Patch3: foomatic-colord.patch
# Fix improper sanitization of command line options (bug #721001,
# CVE-2011-2697).
Patch4: foomatic-filters-CVE-2011-2697.patch
## PATCHES FOR FOOMATIC-DB-ENGINE (PATCHES 101 TO 200)
# Use libdir.
Patch101: foomatic-db-engine-libdir.patch
# Handle non-UTF-8 encodings in imported PPD files.
Patch102: foomatic-bad-utf8.patch
## PATCHES FOR FOOMATIC-DB-HPIJS (PATCHES 201 TO 300)
Url: http://www.linuxprinting.org
@ -46,7 +27,8 @@ BuildRequires: libxml2-devel
BuildRequires: autoconf, automake
BuildRequires: cups
BuildRequires: dbus-devel
Requires: %{name}-filters = %{version}-%{release}
Requires: dbus
Requires: %{name}-filters = %{version}-%{release}
Requires: perl >= 3:5.8.1
Requires: %(eval `perl -V:version`; echo "perl(:MODULE_COMPAT_$version)")
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -92,10 +74,6 @@ CUPS print filters for the foomatic package.
%setup -q -c -a 1
pushd foomatic-filters-%{filtersver}
%patch1 -p1 -b .libdir
%patch2 -p1 -b .mkstemp
%patch3 -p1 -b .colord
%patch4 -p1 -b .CVE-2011-2697
aclocal
automake --add-missing
autoconf
@ -103,8 +81,6 @@ popd
pushd foomatic-db-engine-%{enginever}
chmod a+x mkinstalldirs
%patch101 -p1 -b .libdir
%patch102 -p1
aclocal
autoconf
popd
@ -204,6 +180,9 @@ rm -fr %buildroot $RPM_BUILD_DIR/%{name}
%{_mandir}/man1/foomatic-rip.1*
%changelog
* Mon Jul 25 2011 Jiri Popelka <jpopelka@redhat.com> - 4.0.8-1
- 4.0.8 (all patches merged upstream)
* Thu Jul 21 2011 Petr Sabata <contyk@redhat.com> - 4.0.7-6
- Perl mass rebuild

View File

@ -1,2 +1,2 @@
fcfa8eb9ce5494b81b58ae983fc2aeb5 foomatic-db-engine-4.0.7.tar.gz
20abd25c1c98b2dae68709062a132a7d foomatic-filters-4.0.7.tar.gz
5283cd5125a96dc0b35d896326512b1a foomatic-db-engine-4.0.8.tar.gz
752324ef037fbb0de18190aa26ceab7d foomatic-filters-4.0.8.tar.gz