code:
diff -up cups-2.2.5/scheduler/avahi.c.avahi-no-threaded cups-2.2.5/scheduler/avahi.c
--- cups-2.2.5/scheduler/avahi.c.avahi-no-threaded	2017-10-17 19:03:00.760881016 +0200
+++ cups-2.2.5/scheduler/avahi.c	2017-10-17 19:03:00.760881016 +0200
@@ -0,0 +1,441 @@
+/*
+ * "$Id$"
+ *
+ *   Avahi poll implementation for the CUPS scheduler.
+ *
+ *   Copyright (C) 2010, 2011 Red Hat, Inc.
+ *   Authors:
+ *    Tim Waugh <twaugh@redhat.com>
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *   Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ *   Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ *   FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ *   COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ *   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ *   (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ *   SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ *   STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ *   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ *   OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Contents:
+ *
+ *   watch_read_cb         - Read callback for file descriptor
+ *   watch_write_cb        - Write callback for file descriptor
+ *   watched_fd_add_select() - Call cupsdAddSelect() as needed
+ *   watch_new()           - Create a new file descriptor watch
+ *   watch_free()          - Free a file descriptor watch
+ *   watch_update()        - Update watched events for a file descriptor
+ *   watch_get_events()    - Get events that happened for a file descriptor
+ *   timeout_cb()          - Run a timed Avahi callback
+ *   timeout_new()         - Set a wakeup time
+ *   timeout_update()      - Update the expiration time for a timeout
+ *   timeout_free()        - Free a timeout
+ *   compare_watched_fds() - Compare watched file descriptors for array sorting
+ *   avahi_cups_poll_new() - Create a new Avahi main loop object for CUPS
+ *   avahi_cups_poll_free() - Free an Avahi main loop object for CUPS
+ *   avahi_cups_poll_get() - Get the abstract poll API structure
+ */
+
+#include <config.h>
+
+#ifdef HAVE_AVAHI /* Applies to entire file... */
+
+/*
+ * Include necessary headers...
+ */
+
+#include "cupsd.h"
+
+#if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO)
+#  include <malloc.h>
+#endif /* HAVE_MALLOC_H && HAVE_MALLINFO */
+
+#ifdef HAVE_AVAHI
+#  include <avahi-common/timeval.h>
+#endif /* HAVE_AVAHI */
+
+
+typedef struct
+{
+  AvahiCupsPoll *cups_poll;
+
+  int fd;
+  AvahiWatchEvent occurred;
+  cups_array_t *watches;
+} cupsd_watched_fd_t;
+
+struct AvahiWatch
+{
+  cupsd_watched_fd_t *watched_fd;
+
+  AvahiWatchEvent events;
+  AvahiWatchCallback callback;
+  void *userdata;
+};
+
+struct AvahiTimeout
+{
+  AvahiCupsPoll *cups_poll;
+  AvahiTimeoutCallback callback;
+  void *userdata;
+  cupsd_timeout_t *cupsd_timeout;
+};
+
+/*
+ * Local functions...
+ */
+
+static AvahiWatch *	watch_new(const AvahiPoll *api,
+				  int fd,
+				  AvahiWatchEvent events,
+				  AvahiWatchCallback callback,
+				  void *userdata);
+static void		watch_free(AvahiWatch *watch);
+static void		watch_update(AvahiWatch *watch,
+				     AvahiWatchEvent events);
+static AvahiWatchEvent	watch_get_events(AvahiWatch *watch);
+
+
+/*
+ * 'watch_read_cb' - Read callback for file descriptor
+ */
+
+static void
+watch_read_cb (void *userdata)
+{
+  AvahiWatch *watch;
+  cupsd_watched_fd_t *watched_fd = userdata;
+  watched_fd->occurred |= AVAHI_WATCH_IN;
+  for (watch = (AvahiWatch *)cupsArrayFirst(watched_fd->watches);
+       watch;
+       watch = (AvahiWatch *)cupsArrayNext(watched_fd->watches))
+  {
+    if (watch->events & watched_fd->occurred)
+    {
+      (watch->callback) (watch, watched_fd->fd,
+			 AVAHI_WATCH_IN, watch->userdata);
+      watched_fd->occurred &= ~AVAHI_WATCH_IN;
+      break;
+    }
+  }
+}
+
+
+/*
+ * 'watch_write_cb' - Write callback for file descriptor
+ */
+
+static void
+watch_write_cb (void *userdata)
+{
+  AvahiWatch *watch;
+  cupsd_watched_fd_t *watched_fd = userdata;
+  watched_fd->occurred |= AVAHI_WATCH_OUT;
+  for (watch = (AvahiWatch *)cupsArrayFirst(watched_fd->watches);
+       watch;
+       watch = (AvahiWatch *)cupsArrayNext(watched_fd->watches))
+  {
+    if (watch->events & watched_fd->occurred)
+    {
+      (watch->callback) (watch, watched_fd->fd,
+			 AVAHI_WATCH_OUT, watch->userdata);
+      watched_fd->occurred &= ~AVAHI_WATCH_OUT;
+      break;
+    }
+  }
+}
+
+
+/*
+ * 'watched_fd_add_select' - Call cupsdAddSelect() as needed
+ */
+
+static int						/* O - Watches? */
+watched_fd_add_select (cupsd_watched_fd_t *watched_fd)
+{
+  AvahiWatch *watch;
+  cupsd_selfunc_t read_cb = NULL, write_cb = NULL;
+  int any_watches = 0;
+
+  for (watch = (AvahiWatch *)cupsArrayFirst(watched_fd->watches);
+       watch;
+       watch = (AvahiWatch *)cupsArrayNext(watched_fd->watches))
+  {
+    any_watches = 1;
+    if (watch->events & (AVAHI_WATCH_IN |
+			     AVAHI_WATCH_ERR |
+			     AVAHI_WATCH_HUP))
+    {
+      read_cb = (cupsd_selfunc_t)watch_read_cb;
+      if (write_cb != NULL)
+	break;
+    }
+
+    if (watch->events & AVAHI_WATCH_OUT)
+    {
+      write_cb = (cupsd_selfunc_t)watch_write_cb;
+      if (read_cb != NULL)
+	break;
+    }
+  }
+
+  if (read_cb || write_cb)
+    cupsdAddSelect (watched_fd->fd, read_cb, write_cb, watched_fd);
+  else
+    cupsdRemoveSelect (watched_fd->fd);
+
+  return (any_watches);
+}
+
+/*
+ * 'watch_new' - Create a new file descriptor watch
+ */
+
+static AvahiWatch *
+watch_new (const AvahiPoll *api,
+	   int fd,
+	   AvahiWatchEvent events,
+	   AvahiWatchCallback callback,
+	   void *userdata)
+{
+  cupsd_watched_fd_t key, *watched_fd;
+  AvahiCupsPoll *cups_poll = api->userdata;
+  AvahiWatch *watch = malloc(sizeof(AvahiWatch));
+  if (watch == NULL)
+    return (NULL);
+
+  watch->events = events;
+  watch->callback = callback;
+  watch->userdata = userdata;
+
+  key.fd = fd;
+  watched_fd = cupsArrayFind (cups_poll->watched_fds, &key);
+  if (watched_fd == NULL)
+  {
+    watched_fd = malloc(sizeof(cupsd_watched_fd_t));
+    if (watched_fd == NULL)
+    {
+      free (watch);
+      return (NULL);
+    }
+
+    watched_fd->fd = fd;
+    watched_fd->occurred = 0;
+    watched_fd->cups_poll = cups_poll;
+    watched_fd->watches = cupsArrayNew (NULL, NULL);
+    cupsArrayAdd (cups_poll->watched_fds, watched_fd);
+  }
+
+  watch->watched_fd = watched_fd;
+  cupsArrayAdd(watched_fd->watches, watch);
+  watched_fd_add_select (watched_fd);
+  return (watch);
+}
+
+
+/*
+ * 'watch_free' - Free a file descriptor watch
+ */
+
+static void
+watch_free (AvahiWatch *watch)
+{
+  cupsd_watched_fd_t *watched_fd = watch->watched_fd;
+  AvahiCupsPoll *cups_poll = watched_fd->cups_poll;
+
+  cupsArrayRemove (watched_fd->watches, watch);
+  free (watch);
+
+  if (!watched_fd_add_select (watched_fd))
+  {
+    /* No more watches */
+    cupsArrayRemove (cups_poll->watched_fds, watched_fd);
+    free (watched_fd);
+  }
+}
+
+
+/*
+ * 'watch_update' - Update watched events for a file descriptor
+ */
+
+static void
+watch_update (AvahiWatch *watch,
+	      AvahiWatchEvent events)
+{
+  watch->events = events;
+  watched_fd_add_select (watch->watched_fd);
+}
+
+
+/*
+ * 'watch_get_events' - Get events that happened for a file descriptor
+ */
+
+static AvahiWatchEvent
+watch_get_events (AvahiWatch *watch)
+{
+  return (watch->watched_fd->occurred);
+}
+
+
+/*
+ * 'timeout_cb()' - Run a timed Avahi callback
+ */
+
+static void
+timeout_cb (cupsd_timeout_t *cupsd_timeout, void *userdata)
+{
+  AvahiTimeout *timeout = userdata;
+  (timeout->callback) (timeout, timeout->userdata);
+}
+
+
+/*
+ * 'timeout_new' - Set a wakeup time
+ */
+
+static AvahiTimeout *
+timeout_new (const AvahiPoll *api,
+	     const struct timeval *tv,
+	     AvahiTimeoutCallback callback,
+	     void *userdata)
+{
+  AvahiTimeout *timeout;
+  AvahiCupsPoll *cups_poll = api->userdata;
+
+  timeout = malloc(sizeof(AvahiTimeout));
+  if (timeout == NULL)
+    return (NULL);
+
+  timeout->cups_poll = cups_poll;
+  timeout->callback = callback;
+  timeout->userdata = userdata;
+  timeout->cupsd_timeout = cupsdAddTimeout (tv,
+					    (cupsd_timeoutfunc_t)timeout_cb,
+					    timeout);
+  cupsArrayAdd (cups_poll->timeouts, timeout);
+  return (timeout);
+}
+
+
+/*
+ * 'timeout_update' - Update the expiration time for a timeout
+ */
+
+static void
+timeout_update (AvahiTimeout *timeout,
+		const struct timeval *tv)
+{
+  cupsdUpdateTimeout (timeout->cupsd_timeout, tv);
+}
+
+
+/*
+ * ' timeout_free' - Free a timeout
+ */
+
+static void
+timeout_free (AvahiTimeout *timeout)
+{
+  cupsArrayRemove (timeout->cups_poll->timeouts, timeout);
+  cupsdRemoveTimeout (timeout->cupsd_timeout);
+  free (timeout);
+}
+
+
+/*
+ * 'compare_watched_fds' - Compare watched file descriptors for array sorting
+ */
+static int
+compare_watched_fds(cupsd_watched_fd_t *p0,
+		    cupsd_watched_fd_t *p1)
+{
+  /*
+   * Compare by fd (no two elements have the same fd)
+   */
+
+  if (p0->fd == p1->fd)
+    return 0;
+
+  return (p0->fd < p1->fd ? -1 : 1);
+}
+
+
+/*
+ * 'avahi_cups_poll_new' - Create a new Avahi main loop object for CUPS
+ */
+
+AvahiCupsPoll *
+avahi_cups_poll_new (void)
+{
+  AvahiCupsPoll *cups_poll = malloc(sizeof(AvahiCupsPoll));
+  if (cups_poll == NULL)
+    return (NULL);
+
+  cups_poll->watched_fds = cupsArrayNew ((cups_array_func_t)compare_watched_fds,
+					 NULL);
+  cups_poll->timeouts = cupsArrayNew (NULL, NULL);
+
+  cups_poll->api.userdata = cups_poll;
+  cups_poll->api.watch_new = watch_new;
+  cups_poll->api.watch_free = watch_free;
+  cups_poll->api.watch_update = watch_update;
+  cups_poll->api.watch_get_events = watch_get_events;
+
+  cups_poll->api.timeout_new = timeout_new;
+  cups_poll->api.timeout_update = timeout_update;
+  cups_poll->api.timeout_free = timeout_free;
+
+  return (cups_poll);
+}
+
+
+/*
+ * 'avahi_cups_poll_free' - Free an Avahi main loop object for CUPS
+ */
+void
+avahi_cups_poll_free (AvahiCupsPoll *cups_poll)
+{
+  cupsd_watched_fd_t *watched_fd;
+
+  for (watched_fd = (cupsd_watched_fd_t*)cupsArrayFirst(cups_poll->watched_fds);
+       watched_fd;
+       watched_fd = (cupsd_watched_fd_t*)cupsArrayNext(cups_poll->watched_fds))
+    cupsArrayClear (watched_fd->watches);
+
+  cupsArrayClear (cups_poll->watched_fds);
+  cupsArrayClear (cups_poll->timeouts);
+}
+
+
+/*
+ * 'avahi_cups_poll_get' - Get the abstract poll API structure
+ */
+
+const AvahiPoll *
+avahi_cups_poll_get (AvahiCupsPoll *cups_poll)
+{
+  return (&cups_poll->api);
+}
+
+
+#endif /* HAVE_AVAHI ... from top of file */
+
+/*
+ * End of "$Id$".
+ */
diff -up cups-2.2.5/scheduler/avahi.h.avahi-no-threaded cups-2.2.5/scheduler/avahi.h
--- cups-2.2.5/scheduler/avahi.h.avahi-no-threaded	2017-10-17 19:03:00.760881016 +0200
+++ cups-2.2.5/scheduler/avahi.h	2017-10-17 19:03:00.760881016 +0200
@@ -0,0 +1,69 @@
+/*
+ * "$Id$"
+ *
+ *   Avahi poll implementation for the CUPS scheduler.
+ *
+ *   Copyright (C) 2010, 2011 Red Hat, Inc.
+ *   Authors:
+ *    Tim Waugh <twaugh@redhat.com>
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *   Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ *   Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ *   FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ *   COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ *   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ *   (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ *   SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ *   STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ *   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ *   OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <config.h>
+
+#ifdef HAVE_AVAHI
+#  include <avahi-client/client.h>
+#  include <avahi-client/publish.h>
+#endif /* HAVE_AVAHI */
+
+#ifdef HAVE_AUTHORIZATION_H
+#  include <Security/Authorization.h>
+#endif /* HAVE_AUTHORIZATION_H */
+
+
+#ifdef HAVE_AVAHI
+typedef struct
+{
+    AvahiPoll api;
+    cups_array_t *watched_fds;
+    cups_array_t *timeouts;
+} AvahiCupsPoll;
+#endif /* HAVE_AVAHI */
+
+/*
+ * Prototypes...
+ */
+
+#ifdef HAVE_AVAHI
+extern AvahiCupsPoll *	avahi_cups_poll_new(void);
+extern void		avahi_cups_poll_free(AvahiCupsPoll *cups_poll);
+extern const AvahiPoll *avahi_cups_poll_get(AvahiCupsPoll *cups_poll);
+#endif /* HAVE_AVAHI */
+
+
+/*
+ * End of "$Id$".
+ */
diff -up cups-2.2.5/scheduler/cupsd.h.avahi-no-threaded cups-2.2.5/scheduler/cupsd.h
--- cups-2.2.5/scheduler/cupsd.h.avahi-no-threaded	2017-10-13 20:22:26.000000000 +0200
+++ cups-2.2.5/scheduler/cupsd.h	2017-10-17 19:03:00.760881016 +0200
@@ -118,6 +118,7 @@ extern const char *cups_hstrerror(int);
 #include "colorman.h"
 #include "conf.h"
 #include "banners.h"
+#include "avahi.h"
 #include "dirsvc.h"
 #include "network.h"
 #include "subscriptions.h"
@@ -138,6 +139,15 @@ extern const char *cups_hstrerror(int);

 typedef void (*cupsd_selfunc_t)(void *data);

+#ifdef HAVE_AVAHI
+/*
+ * Timeout callback function type...
+ */
+
+typedef struct _cupsd_timeout_s cupsd_timeout_t;
+typedef void (*cupsd_timeoutfunc_t)(cupsd_timeout_t *timeout, void *data);
+#endif /* HAVE_AVAHI */
+

 /*
  * Globals...
@@ -162,6 +172,9 @@ VAR int			OnDemand	VALUE(0);
 					/* Launched on demand */
 #endif /* HAVE_ONDEMAND */

+#ifdef HAVE_AVAHI
+VAR cups_array_t *Timeouts;		/* Timed callbacks for main loop */
+#endif /* HAVE_AVAHI */

 /*
  * Prototypes...
@@ -224,3 +237,15 @@ extern void		cupsdStopSelect(void);
 /* server.c */
 extern void		cupsdStartServer(void);
 extern void		cupsdStopServer(void);
+
+#ifdef HAVE_AVAHI
+extern void     cupsdInitTimeouts(void);
+extern cupsd_timeout_t *cupsdAddTimeout (const struct timeval *tv,
+					 cupsd_timeoutfunc_t cb,
+					 void *data);
+extern cupsd_timeout_t *cupsdNextTimeout (long *delay);
+extern void     cupsdRunTimeout (cupsd_timeout_t *timeout);
+extern void     cupsdUpdateTimeout (cupsd_timeout_t *timeout,
+				    const struct timeval *tv);
+extern void     cupsdRemoveTimeout (cupsd_timeout_t *timeout);
+#endif /* HAVE_AVAHI */
\ No newline at end of file
diff -up cups-2.2.5/scheduler/dirsvc.c.avahi-no-threaded cups-2.2.5/scheduler/dirsvc.c
--- cups-2.2.5/scheduler/dirsvc.c.avahi-no-threaded	2017-10-13 20:22:26.000000000 +0200
+++ cups-2.2.5/scheduler/dirsvc.c	2017-10-17 19:05:35.938592292 +0200
@@ -193,7 +193,7 @@ cupsdStartBrowsing(void)
     cupsdUpdateDNSSDName();

 #  else /* HAVE_AVAHI */
-    if ((DNSSDMaster = avahi_threaded_poll_new()) == NULL)
+    if ((DNSSDMaster = avahi_cups_poll_new()) == NULL)
     {
       cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to create DNS-SD thread.");

@@ -204,7 +204,7 @@ cupsdStartBrowsing(void)
     {
       int error;			/* Error code, if any */

-      DNSSDClient = avahi_client_new(avahi_threaded_poll_get(DNSSDMaster), AVAHI_CLIENT_NO_FAIL, dnssdClientCallback, NULL, &error);
+      DNSSDClient = avahi_client_new(avahi_cups_poll_get(DNSSDMaster), AVAHI_CLIENT_NO_FAIL, dnssdClientCallback, NULL, &error);

       if (DNSSDClient == NULL)
       {
@@ -215,11 +215,9 @@ cupsdStartBrowsing(void)
         if (FatalErrors & CUPSD_FATAL_BROWSE)
 	  cupsdEndProcess(getpid(), 0);

-        avahi_threaded_poll_free(DNSSDMaster);
+        avahi_cups_poll_free(DNSSDMaster);
         DNSSDMaster = NULL;
       }
-      else
-	avahi_threaded_poll_start(DNSSDMaster);
     }
 #  endif /* HAVE_DNSSD */
   }
@@ -635,7 +633,7 @@ dnssdClientCallback(
 	  * Renew Avahi client...
 	  */

-	  DNSSDClient = avahi_client_new(avahi_threaded_poll_get(DNSSDMaster), AVAHI_CLIENT_NO_FAIL, dnssdClientCallback, NULL, &error);
+	  DNSSDClient = avahi_client_new(avahi_cups_poll_get(DNSSDMaster), AVAHI_CLIENT_NO_FAIL, dnssdClientCallback, NULL, &error);

 	  if (!DNSSDClient)
 	  {
@@ -701,13 +699,7 @@ dnssdDeregisterInstance(
 #  else /* HAVE_AVAHI */
   if (*srv)
   {
-    if (!from_callback)
-      avahi_threaded_poll_lock(DNSSDMaster);
-
     avahi_entry_group_free(*srv);
-
-    if (!from_callback)
-      avahi_threaded_poll_unlock(DNSSDMaster);
   }
 #  endif /* HAVE_DNSSD */

@@ -1029,16 +1021,10 @@ dnssdRegisterInstance(
   (void)commit;

 #  else /* HAVE_AVAHI */
-  if (!from_callback)
-    avahi_threaded_poll_lock(DNSSDMaster);
-
   if (!*srv)
     *srv = avahi_entry_group_new(DNSSDClient, dnssdRegisterCallback, NULL);
   if (!*srv)
   {
-    if (!from_callback)
-      avahi_threaded_poll_unlock(DNSSDMaster);
-
     cupsdLogMessage(CUPSD_LOG_WARN, "DNS-SD registration of \"%s\" failed: %s",
                     name, dnssdErrorString(avahi_client_errno(DNSSDClient)));
     return (0);
@@ -1153,9 +1139,6 @@ dnssdRegisterInstance(
       cupsdLogMessage(CUPSD_LOG_DEBUG, "DNS-SD commit of \"%s\" failed.",
                       name);
   }
-
-  if (!from_callback)
-    avahi_threaded_poll_unlock(DNSSDMaster);
 #  endif /* HAVE_DNSSD */

   if (error)
@@ -1326,9 +1309,6 @@ dnssdStop(void)
   DNSSDMaster = NULL;

 #  else /* HAVE_AVAHI */
-  if (DNSSDMaster)
-    avahi_threaded_poll_stop(DNSSDMaster);
-
   if (DNSSDClient)
   {
     avahi_client_free(DNSSDClient);
@@ -1337,7 +1317,7 @@ dnssdStop(void)

   if (DNSSDMaster)
   {
-    avahi_threaded_poll_free(DNSSDMaster);
+    avahi_cups_poll_free(DNSSDMaster);
     DNSSDMaster = NULL;
   }
 #  endif /* HAVE_DNSSD */
diff -up cups-2.2.5/scheduler/dirsvc.h.avahi-no-threaded cups-2.2.5/scheduler/dirsvc.h
--- cups-2.2.5/scheduler/dirsvc.h.avahi-no-threaded	2017-10-13 20:22:26.000000000 +0200
+++ cups-2.2.5/scheduler/dirsvc.h	2017-10-17 19:03:00.761881007 +0200
@@ -49,7 +49,7 @@ VAR cups_array_t	*DNSSDPrinters	VALUE(NU
 VAR DNSServiceRef	DNSSDMaster	VALUE(NULL);
 					/* Master DNS-SD service reference */
 #  else /* HAVE_AVAHI */
-VAR AvahiThreadedPoll	*DNSSDMaster	VALUE(NULL);
+VAR AvahiCupsPoll	*DNSSDMaster	VALUE(NULL);
 					/* Master polling interface for Avahi */
 VAR AvahiClient		*DNSSDClient	VALUE(NULL);
 					/* Client information */
diff -up cups-2.2.5/scheduler/main.c.avahi-no-threaded cups-2.2.5/scheduler/main.c
--- cups-2.2.5/scheduler/main.c.avahi-no-threaded	2017-10-17 19:03:00.753881074 +0200
+++ cups-2.2.5/scheduler/main.c	2017-10-17 19:03:00.761881007 +0200
@@ -131,7 +131,10 @@ main(int  argc,				/* I - Number of comm
   int			service_idle_exit;
 					/* Idle exit on select timeout? */
 #endif /* HAVE_ONDEMAND */
-
+#ifdef HAVE_AVAHI
+  cupsd_timeout_t	*tmo;		/* Next scheduled timed callback */
+  long			tmo_delay;	/* Time before it must be called */
+#endif /* HAVE_AVAHI */

 #ifdef HAVE_GETEUID
  /*
@@ -610,6 +613,14 @@ main(int  argc,				/* I - Number of comm

   httpInitialize();

+#ifdef HAVE_AVAHI
+ /*
+  * Initialize timed callback structures.
+  */
+
+  cupsdInitTimeouts();
+#endif /* HAVE_AVAHI */
+
   cupsdStartServer();

  /*
@@ -928,6 +939,16 @@ main(int  argc,				/* I - Number of comm
     }
 #endif /* __APPLE__ */

+#ifdef HAVE_AVAHI
+   /*
+    * If a timed callback is due, run it.
+    */
+
+    tmo = cupsdNextTimeout (&tmo_delay);
+    if (tmo && tmo_delay == 0)
+      cupsdRunTimeout (tmo);
+#endif /* HAVE_AVAHI */
+
 #ifndef __APPLE__
    /*
     * Update the network interfaces once a minute...
@@ -1632,6 +1653,10 @@ select_timeout(int fds)			/* I - Number
   cupsd_job_t		*job;		/* Job information */
   cupsd_printer_t       *printer;       /* Printer information */
   const char		*why;		/* Debugging aid */
+#ifdef HAVE_AVAHI
+  cupsd_timeout_t	*tmo;		/* Timed callback */
+  long			tmo_delay;	/* Seconds before calling it */
+#endif /* HAVE_AVAHI */

   cupsdLogMessage(CUPSD_LOG_DEBUG2, "select_timeout: JobHistoryUpdate=%ld",
@@ -1677,6 +1702,19 @@ select_timeout(int fds)			/* I - Number
   }
 #endif /* __APPLE__ */

+#ifdef HAVE_AVAHI
+ /*
+  * See if there are any scheduled timed callbacks to run.
+  */
+
+  if ((tmo = cupsdNextTimeout(&tmo_delay)) != NULL &&
+      (now + tmo_delay) < timeout)
+  {
+    timeout = tmo_delay;
+    why = "run a timed callback";
+  }
+#endif /* HAVE_AVAHI */
+
  /*
   * Check whether we are accepting new connections...
   */
diff -up cups-2.2.5/scheduler/Makefile.avahi-no-threaded cups-2.2.5/scheduler/Makefile
--- cups-2.2.5/scheduler/Makefile.avahi-no-threaded	2017-10-13 20:22:26.000000000 +0200
+++ cups-2.2.5/scheduler/Makefile	2017-10-17 19:03:00.762880999 +0200
@@ -15,6 +15,7 @@ include ../Makedefs

 CUPSDOBJS =	\
 		auth.o \
+		avahi.o \
 		banners.o \
 		cert.o \
 		classes.o \
@@ -38,7 +39,8 @@ CUPSDOBJS =	\
 		server.o \
 		statbuf.o \
 		subscriptions.o \
-		sysman.o
+		sysman.o \
+		timeout.o
 LIBOBJS =	\
 		filter.o \
 		mime.o \
diff -up cups-2.2.5/scheduler/timeout.c.avahi-no-threaded cups-2.2.5/scheduler/timeout.c
--- cups-2.2.5/scheduler/timeout.c.avahi-no-threaded	2017-10-17 19:03:00.762880999 +0200
+++ cups-2.2.5/scheduler/timeout.c	2017-10-17 19:03:00.762880999 +0200
@@ -0,0 +1,235 @@
+/*
+ * "$Id$"
+ *
+ *   Timeout functions for the Common UNIX Printing System (CUPS).
+ *
+ *   Copyright (C) 2010, 2011 Red Hat, Inc.
+ *   Authors:
+ *     Tim Waugh <twaugh@redhat.com>
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *   Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ *   Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ *   FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ *   COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ *   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ *   (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ *   SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ *   STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ *   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ *   OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Contents:
+ *
+ *   cupsdInitTimeouts()  - Initialise timeout structure.
+ *   cupsdAddTimeout()    - Add a timed callback.
+ *   cupsdNextTimeout()   - Find the next enabled timed callback.
+ *   cupsdUpdateTimeout() - Adjust the time of a timed callback or disable it.
+ *   cupsdRemoveTimeout() - Discard a timed callback.
+ *   compare_timeouts()   - Compare timed callbacks for array sorting.
+ */
+
+#include <config.h>
+
+#ifdef HAVE_AVAHI /* Applies to entire file... */
+
+/*
+ * Include necessary headers...
+ */
+
+#include "cupsd.h"
+
+#if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO)
+#  include <malloc.h>
+#endif /* HAVE_MALLOC_H && HAVE_MALLINFO */
+
+#ifdef HAVE_AVAHI
+#  include <avahi-common/timeval.h>
+#endif /* HAVE_AVAHI */
+
+
+struct _cupsd_timeout_s
+{
+  struct timeval when;
+  int enabled;
+  cupsd_timeoutfunc_t callback;
+  void *data;
+};
+
+/*
+ * Local functions...
+ */
+
+/*
+ * 'compare_timeouts()' - Compare timed callbacks for array sorting.
+ */
+
+static int
+compare_addrs (void *p0, void *p1)
+{
+  if (p0 == p1)
+    return (0);
+  if (p0 < p1)
+    return (-1);
+  return (1);
+}
+
+static int
+compare_timeouts (cupsd_timeout_t *p0, cupsd_timeout_t *p1)
+{
+  int addrsdiff = compare_addrs (p0, p1);
+  int tvdiff;
+
+  if (addrsdiff == 0)
+    return (0);
+
+  if (!p0->enabled || !p1->enabled)
+  {
+    if (!p0->enabled && !p1->enabled)
+      return (addrsdiff);
+
+    return (p0->enabled ? -1 : 1);
+  }
+
+  tvdiff = avahi_timeval_compare (&p0->when, &p1->when);
+  if (tvdiff != 0)
+    return (tvdiff);
+
+  return (addrsdiff);
+}
+
+
+/*
+ * 'cupsdInitTimeouts()' - Initialise timeout structures.
+ */
+
+void
+cupsdInitTimeouts(void)
+{
+  Timeouts = cupsArrayNew ((cups_array_func_t)compare_timeouts, NULL);
+}
+
+
+/*
+ * 'cupsdAddTimeout()' - Add a timed callback.
+ */
+
+cupsd_timeout_t *				/* O - Timeout handle */
+cupsdAddTimeout(const struct timeval *tv,	/* I - Absolute time */
+		cupsd_timeoutfunc_t cb,		/* I - Callback function */
+		void *data)			/* I - User data */
+{
+  cupsd_timeout_t *timeout;
+
+  timeout = malloc (sizeof(cupsd_timeout_t));
+  if (timeout != NULL)
+  {
+    timeout->enabled = (tv != NULL);
+    if (tv)
+    {
+      timeout->when.tv_sec = tv->tv_sec;
+      timeout->when.tv_usec = tv->tv_usec;
+    }
+
+    timeout->callback = cb;
+    timeout->data = data;
+    cupsArrayAdd (Timeouts, timeout);
+  }
+
+  return timeout;
+}
+
+
+/*
+ * 'cupsdNextTimeout()' - Find the next enabled timed callback.
+ */
+
+cupsd_timeout_t *		/* O - Next enabled timeout or NULL */
+cupsdNextTimeout(long *delay)	/* O - Seconds before scheduled */
+{
+  cupsd_timeout_t *first = cupsArrayFirst (Timeouts);
+  struct timeval curtime;
+
+  if (first && !first->enabled)
+    first = NULL;
+
+  if (first && delay)
+  {
+    gettimeofday (&curtime, NULL);
+    if (avahi_timeval_compare (&curtime, &first->when) > 0)
+    {
+      *delay = 0;
+    } else {
+      *delay = 1 + first->when.tv_sec - curtime.tv_sec;
+      if (first->when.tv_usec < curtime.tv_usec)
+	(*delay)--;
+    }
+  }
+
+  return (first);
+}
+
+
+/*
+ * 'cupsdRunTimeout()' - Run a timed callback.
+ */
+
+void
+cupsdRunTimeout(cupsd_timeout_t *timeout)	/* I - Timeout */
+{
+  if (!timeout)
+    return;
+  timeout->enabled = 0;
+  if (!timeout->callback)
+    return;
+  timeout->callback (timeout, timeout->data);
+}
+
+/*
+ * 'cupsdUpdateTimeout()' - Adjust the time of a timed callback or disable it.
+ */
+
+void
+cupsdUpdateTimeout(cupsd_timeout_t *timeout,	/* I - Timeout */
+		   const struct timeval *tv)	/* I - Absolute time or NULL */
+{
+  cupsArrayRemove (Timeouts, timeout);
+  timeout->enabled = (tv != NULL);
+  if (tv)
+  {
+    timeout->when.tv_sec = tv->tv_sec;
+    timeout->when.tv_usec = tv->tv_usec;
+  }
+  cupsArrayAdd (Timeouts, timeout);
+}
+
+
+/*
+ * 'cupsdRemoveTimeout()' - Discard a timed callback.
+ */
+
+void
+cupsdRemoveTimeout(cupsd_timeout_t *timeout)	/* I - Timeout */
+{
+  cupsArrayRemove (Timeouts, timeout);
+  free (timeout);
+}
+
+
+#endif /* HAVE_AVAHI ... from top of file */
+
+/*
+ * End of "$Id$".
+ */


code:
diff -up cups-1.6.4/scheduler/job.c.final-content-type cups-1.6.4/scheduler/job.c
--- cups-1.6.4/scheduler/job.c.final-content-type	2013-09-27 16:58:13.934775402 +0100
+++ cups-1.6.4/scheduler/job.c	2013-09-27 17:00:57.716549576 +0100
@@ -692,12 +692,7 @@ cupsdContinueJob(cupsd_job_t *job)	/* I

     if (!job->printer->remote)
     {
-      for (filter = (mime_filter_t *)cupsArrayLast(filters);
-           filter && filter->dst;
-           filter = (mime_filter_t *)cupsArrayPrev(filters))
-        if (strcmp(filter->dst->super, "printer") ||
-            strcmp(filter->dst->type, job->printer->name))
-          break;
+      filter = (mime_filter_t *)cupsArrayLast(filters);

       if (filter && filter->dst)
       {

repo_name: ayhanyalcinsoy/main


code:
diff -up cups-1.5b1/backend/snmp.c.hp-deviceid-oid cups-1.5b1/backend/snmp.c
--- cups-1.5b1/backend/snmp.c.hp-deviceid-oid	2011-05-20 05:49:49.000000000 +0200
+++ cups-1.5b1/backend/snmp.c	2011-05-24 17:24:48.000000000 +0200
@@ -187,6 +187,7 @@ static const int	UriOID[] = { CUPS_OID_p
 static const int	LexmarkProductOID[] = { 1,3,6,1,4,1,641,2,1,2,1,2,1,-1 };
 static const int	LexmarkProductOID2[] = { 1,3,6,1,4,1,674,10898,100,2,1,2,1,2,1,-1 };
 static const int	LexmarkDeviceIdOID[] = { 1,3,6,1,4,1,641,2,1,2,1,3,1,-1 };
+static const int	HPDeviceIdOID[] = { 1,3,6,1,4,1,11,2,3,9,1,1,7,0,-1 };
 static const int	XeroxProductOID[] = { 1,3,6,1,4,1,128,2,1,3,1,2,0,-1 };
 static cups_array_t	*DeviceURIs = NULL;
 static int		HostNameLookups = 0;
@@ -1006,6 +1007,9 @@ read_snmp_response(int fd)		/* I - SNMP
 	_cupsSNMPWrite(fd, &(packet.address), CUPS_SNMP_VERSION_1,
 	               packet.community, CUPS_ASN1_GET_REQUEST,
 		       DEVICE_PRODUCT, XeroxProductOID);
+	_cupsSNMPWrite(fd, &(packet.address), CUPS_SNMP_VERSION_1,
+		       packet.community, CUPS_ASN1_GET_REQUEST,
+		       DEVICE_ID, HPDeviceIdOID);
         break;

     case DEVICE_DESCRIPTION :


code:
diff -up cups-2.1b1/scheduler/log.c.logrotate cups-2.1b1/scheduler/log.c
--- cups-2.1b1/scheduler/log.c.logrotate	2015-06-04 20:00:31.000000000 +0200
+++ cups-2.1b1/scheduler/log.c	2015-06-29 13:25:09.623350218 +0200
@@ -26,6 +26,9 @@
 #  include <systemd/sd-journal.h>
 #endif /* HAVE_ASL_H */
 #include <syslog.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>

 /*
@@ -135,12 +138,10 @@ cupsdCheckLogFile(cups_file_t **lf,	/* I
   }

  /*
-  * Format the filename as needed...
+  * Format the filename...
   */

-  if (!*lf ||
-      (strncmp(logname, "/dev/", 5) && cupsFileTell(*lf) > MaxLogSize &&
-       MaxLogSize > 0))
+  if (strncmp(logname, "/dev/", 5))
   {
    /*
     * Handle format strings...
@@ -254,6 +255,34 @@ cupsdCheckLogFile(cups_file_t **lf,	/* I
      /*
       * Change ownership and permissions of non-device logs...
       */
+
+      fchown(cupsFileNumber(*lf), RunUser, Group);
+      fchmod(cupsFileNumber(*lf), LogFilePerm);
+    }
+  }
+
+ /*
+  * Has someone else (i.e. logrotate) already rotated the log for us?
+  */
+  else if (strncmp(filename, "/dev/", 5))
+  {
+    struct stat st;
+    if (stat(filename, &st) || st.st_size == 0)
+    {
+      /* File is either missing or has zero size. */
+
+      cupsFileClose(*lf);
+      if ((*lf = cupsFileOpen(filename, "a")) == NULL)
+      {
+	syslog(LOG_ERR, "Unable to open log file \"%s\" - %s", filename,
+             strerror(errno));
+
+	return (0);
+      }
+
+     /*
+      * Change ownership and permissions of non-device logs...
+      */

       fchown(cupsFileNumber(*lf), RunUser, Group);
       fchmod(cupsFileNumber(*lf), LogFilePerm);


code:
diff -up cups-1.7b1/cups/http-addr.c.res_init cups-1.7b1/cups/http-addr.c
--- cups-1.7b1/cups/http-addr.c.res_init	2013-03-20 19:14:10.000000000 +0100
+++ cups-1.7b1/cups/http-addr.c	2013-04-19 12:01:36.927512159 +0200
@@ -319,7 +319,8 @@ httpAddrLookup(

     if (error)
     {
-      if (error == EAI_FAIL)
+      if (error == EAI_FAIL || error == EAI_AGAIN || error == EAI_NODATA ||
+          error == EAI_NONAME)
         cg->need_res_init = 1;

       return (httpAddrString(addr, name, namelen));
diff -up cups-1.7b1/cups/http-addrlist.c.res_init cups-1.7b1/cups/http-addrlist.c
--- cups-1.7b1/cups/http-addrlist.c.res_init	2013-04-19 12:01:36.930512119 +0200
+++ cups-1.7b1/cups/http-addrlist.c	2013-04-19 12:03:13.769229554 +0200
@@ -581,7 +581,8 @@ httpAddrGetList(const char *hostname,	/*
     }
     else
     {
-      if (error == EAI_FAIL)
+      if (error == EAI_FAIL || error == EAI_AGAIN || error == EAI_NODATA ||
+          error == EAI_NONAME)
         cg->need_res_init = 1;

       _cupsSetError(IPP_STATUS_ERROR_INTERNAL, gai_strerror(error), 0);


code:
*PPD-Adobe: "4.3"
*%
*% Text-only printer definition
*%
*FormatVersion:	"4.3"
*FileVersion:	"1.1"
*LanguageVersion: English
*LanguageEncoding: ISOLatin1
*PCFileName:	"TEXTONLY.PPD"
*Manufacturer:	"Generic"
*Product:	"(Generic)"
*cupsVersion:   1.0
*cupsManualCopies: True
*cupsModelNumber:  2
*cupsFilter:    "text/plain 0 textonly"
*ModelName:     "Generic text-only printer"
*ShortNickName: "Generic text-only printer"
*NickName:      "Generic text-only printer"
*PSVersion:	"(2017.000) 0"
*LanguageLevel:	"2"
*ColorDevice:	False
*DefaultColorSpace: Gray
*FileSystem:	False
*Throughput:	"8"
*LandscapeOrientation: Plus90
*VariablePaperSize: False
*TTRasterizer:	Type42
*DefaultImageableArea: Letter
*ImageableArea Letter/US Letter:	"18 36 594 756"
*DefaultPaperDimension: Letter
*PaperDimension Letter/Letter:		"612 792"
*OpenUI *PageSize/Media Size: PickOne
*OrderDependency: 10 AnySetup *PageSize
*DefaultPageSize: Letter
*PageSize Letter/Letter:	"<</PageSize[612 792]/ImagingBBox null>>setpagedevice"
*CloseUI: *PageSize
*OpenUI *PageRegion: PickOne
*OrderDependency: 10 AnySetup *PageRegion
*DefaultPageRegion: Letter
*PageRegion Letter/Letter:	"<</PageSize[612 792]/ImagingBBox null>>setpagedevice"
*CloseUI: *PageRegion

*OpenUI *SendFF: Boolean
*DefaultSendFF: False
*SendFF True/True:        ""
*SendFF False/False:   ""
*CloseUI: *SendFF


code:
From 33e0d4c8e450fe69b195422c0880aaa96ca9478d Mon Sep 17 00:00:00 2001
From: Matthias Maier <tamiko@kyomu.43-1.org>
Date: Wed, 19 Nov 2014 18:00:06 +0100
Subject: [PATCH] change systemd service files to gentoo naming scheme

---
 scheduler/Makefile                  | 10 +++++-----
 scheduler/org.cups.cupsd.path.in    |  2 +-
 scheduler/org.cups.cupsd.service.in |  2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/scheduler/Makefile b/scheduler/Makefile
index 3e0884a..b354420 100644
--- a/scheduler/Makefile
+++ b/scheduler/Makefile
@@ -203,11 +203,11 @@ install-data:
 	if test "x$(SYSTEMD_DIR)" != x; then \
 		echo Installing systemd configuration files...; \
 		$(INSTALL_DIR) $(BUILDROOT)$(SYSTEMD_DIR); \
-		$(INSTALL_DATA) org.cups.cupsd.path $(BUILDROOT)$(SYSTEMD_DIR); \
-		$(INSTALL_DATA) org.cups.cupsd.service $(BUILDROOT)$(SYSTEMD_DIR); \
-		$(INSTALL_DATA) org.cups.cupsd.socket $(BUILDROOT)$(SYSTEMD_DIR); \
-		$(INSTALL_DATA) org.cups.cups-lpdAT.service $(BUILDROOT)$(SYSTEMD_DIR)/org.cups.cups-lpd@.service; \
-		$(INSTALL_DATA) org.cups.cups-lpd.socket $(BUILDROOT)$(SYSTEMD_DIR); \
+		$(INSTALL_DATA) org.cups.cupsd.path $(BUILDROOT)$(SYSTEMD_DIR)/cups.path; \
+		$(INSTALL_DATA) org.cups.cupsd.service $(BUILDROOT)$(SYSTEMD_DIR)/cups.service; \
+		$(INSTALL_DATA) org.cups.cupsd.socket $(BUILDROOT)$(SYSTEMD_DIR)/cups.socket; \
+		$(INSTALL_DATA) org.cups.cups-lpdAT.service $(BUILDROOT)$(SYSTEMD_DIR)/cups-lpd@.service; \
+		$(INSTALL_DATA) org.cups.cups-lpd.socket $(BUILDROOT)$(SYSTEMD_DIR)/cups-lpd.socket; \
 	elif test "x$(XINETD)" != x; then \
 		echo Installing xinetd configuration file for cups-lpd...; \
 		$(INSTALL_DIR) -m 755 $(BUILDROOT)$(XINETD); \
diff --git a/scheduler/org.cups.cupsd.service.in b/scheduler/org.cups.cupsd.service.in
index 0a27c76..7a04248 100644
--- a/scheduler/org.cups.cupsd.service.in
+++ b/scheduler/org.cups.cupsd.service.in
@@ -7,5 +7,5 @@ ExecStart=@sbindir@/cupsd -l
 Type=simple

 [Install]
-Also=org.cups.cupsd.socket org.cups.cupsd.path
+Also=cups.socket cups.path
 WantedBy=printer.target
--
2.0.4


code:
--- cups-2.2.6/Makedefs.in
+++ cups-2.2.6/Makedefs.in
@@ -49,12 +49,12 @@
 #

 INSTALL_BIN	=	@LIBTOOL_INSTALL@ $(INSTALL) -c -m @CUPS_EXE_FILE_PERM@ @INSTALL_STRIP@
-INSTALL_COMPDATA =	$(INSTALL) -c -m 444 @INSTALL_GZIP@
+INSTALL_COMPDATA =	$(INSTALL) -c -m 644 @INSTALL_GZIP@
 INSTALL_CONFIG	=	$(INSTALL) -c -m @CUPS_CONFIG_FILE_PERM@
-INSTALL_DATA	=	$(INSTALL) -c -m 444
+INSTALL_DATA	=	$(INSTALL) -c -m 644
 INSTALL_DIR	=	$(INSTALL) -d
 INSTALL_LIB	=	@LIBTOOL_INSTALL@ $(INSTALL) -c -m @CUPS_EXE_FILE_PERM@ @INSTALL_STRIP@
-INSTALL_MAN	=	$(INSTALL) -c -m 444
+INSTALL_MAN	=	$(INSTALL) -c -m 644
 INSTALL_SCRIPT	=	$(INSTALL) -c -m @CUPS_EXE_FILE_PERM@

 #


code:
diff -Nuar cups-1.6.1.orig/config.h.in cups-1.6.1/config.h.in
--- cups-1.6.1.orig/config.h.in	2012-07-16 21:21:43.000000000 +0300
+++ cups-1.6.1/config.h.in	2013-03-13 18:46:13.805434622 +0200
@@ -127,7 +127,7 @@
 #define CUPS_SBINDIR	"/usr/sbin"
 #define CUPS_SERVERBIN	"/usr/lib/cups"
 #define CUPS_SERVERROOT	"/etc/cups"
-#define CUPS_STATEDIR	"/var/run/cups"
+#define CUPS_STATEDIR	"/run/cups"

 /*
diff -Nuar cups-1.6.1.orig/doc/help/security.html cups-1.6.1/doc/help/security.html
--- cups-1.6.1.orig/doc/help/security.html	2011-04-29 00:20:12.000000000 +0300
+++ cups-1.6.1/doc/help/security.html	2013-03-13 18:45:47.222433880 +0200
@@ -53,7 +53,7 @@
 	<LI>Local certificate authentication passes 128-bit
 	"certificates" that identify an authenticated user.
 	Certificates are created on-the-fly from random data and
-	stored in files under <VAR>/var/run/cups/certs</VAR>.
+	stored in files under <VAR>/run/cups/certs</VAR>.
 	They have restricted read permissions: root +
 	system-group(s) for the root certificate, and lp + lp
 	for CGI certificates.
diff -Nuar cups-1.6.1.orig/scheduler/org.cups.cupsd.plist cups-1.6.1/scheduler/org.cups.cupsd.plist
--- cups-1.6.1.orig/scheduler/org.cups.cupsd.plist	2011-04-20 21:15:44.000000000 +0300
+++ cups-1.6.1/scheduler/org.cups.cupsd.plist	2013-03-13 18:44:26.286431623 +0200
@@ -54,7 +54,7 @@
 				<key>SockPathMode</key>
 				<integer>49663</integer>
 				<key>SockPathName</key>
-				<string>/private/var/run/cupsd</string>
+				<string>/run/cupsd</string>
 			</dict>
 		</array>
 	</dict>
diff -Nuar cups-1.6.1.orig/xcode/config.h cups-1.6.1/xcode/config.h
--- cups-1.6.1.orig/xcode/config.h	2012-07-16 21:21:43.000000000 +0300
+++ cups-1.6.1/xcode/config.h	2013-03-13 18:43:13.618429596 +0200
@@ -100,7 +100,7 @@
  * Do we have domain socket support, and if so what is the default one?
  */

-#define CUPS_DEFAULT_DOMAINSOCKET "/private/var/run/cupsd"
+#define CUPS_DEFAULT_DOMAINSOCKET "/run/cupsd"

 /*


code:
diff -Nuar cups_old-2.2.6/desktop/cups.desktop.in cups-2.2.6/desktop/cups.desktop.in
--- cups_old-2.2.6/desktop/cups.desktop.in	2017-11-01 17:57:53.000000000 +0300
+++ cups-2.2.6/desktop/cups.desktop.in	2011-02-24 14:03:21.000000000 +0200
@@ -7,18 +7,6 @@
 Type=Application
 Name=Manage Printing
 Comment=CUPS Web Interface
-Name[af]=bestuur Printing
-Comment[af]=CUPS Web Interface
-Name[ar]=إدارة الطباعة
-Comment[ar]=الكؤوس واجهة الويب
-Name[az]=Çap idarə
-Comment[az]=CUPS Web Interface
-Name[bn-IN]=মুদ্রণ পরিচালনা
-Comment[bn-IN]=CUPS ওয়েব ইন্টারফেস
-Name[ca]=Gestor d'impressió
-Comment[ca]=Interfície web de CUPS
-Name[cs]=Správa tisku CUPS
-Comment[cs]=Webové rozhraní CUPS
 Name[de]=Druckerverwaltung
 Comment[de]=CUPS Webinterface
 Name[en_US]=Manage Printing
@@ -39,24 +27,14 @@
 Comment[it]=Interfaccia web di CUPS
 Name[ja]=印刷の管理
 Comment[ja]=CUPS Web インタフェース
-Name[ko]=인쇄 관리
-Comment[ko]=CUPS 웹 인터페이스
 Name[pl]=Zarządzanie drukowaniem
 Comment[pl]=Interfejs WWW CUPS
-Name[pt_BR]=Gerenciador de impressão
-Comment[pt_BR]=Interface web do CUPS
-Name[pt-PT]=Gerenciador de impressão
-Comment[pt-PT]=Interface sítio do CUPS
 Name[ru]=Настройка печати
 Comment[ru]=Настройка CUPS
 Name[sv]=Hantera skrivare
 Comment[sv]=CUPS webb-gränssnitt
-Name[sq]=Menaxho Printime
-Comment[sq]=CUPS Web Interface
-Name[th]=จัดการการพิมพ์
-Comment[th]=CUPS เว็บอินเตอร์เฟส
-Name[uz]=chop boshqarish
-Comment[uz]=CUPS veb interfeysi
+Name[tr]=Yazıcıları Yönet
+Comment[tr]=CUPS Web Arayüzü
 Name[zh]=打印机管理
 Comment[zh]=CUPS网页界面
 Name[zh_TW]=印表管理


code:
diff -Nuar cups_old-2.2.6/config-scripts/cups-directories.m4 cups-2.2.6/config-scripts/cups-directories.m4
--- cups_old-2.2.6/config-scripts/cups-directories.m4	2017-12-14 06:56:50.708946000 +0300
+++ cups-2.2.6/config-scripts/cups-directories.m4	2017-12-14 09:23:45.490213940 +0300
@@ -101,8 +101,8 @@
 if test "$libdir" = "\${exec_prefix}/lib"; then
 	case "$host_os_name" in
 		linux*)
-			if test -d /usr/lib64 -a ! -d /usr/lib64/fakeroot; then
-				libdir="$exec_prefix/lib64"
+			if test -d /usr/lib -a ! -d /usr/lib/fakeroot; then
+				libdir="$exec_prefix/lib"
 			fi
 			;;
 	esac
diff -Nuar cups_old-2.2.6/configure cups-2.2.6/configure
--- cups_old-2.2.6/configure	2017-12-14 06:56:51.766946000 +0300
+++ cups-2.2.6/configure	2017-12-14 09:26:43.667224765 +0300
@@ -6187,8 +6187,8 @@
 if test "$libdir" = "\${exec_prefix}/lib"; then
 	case "$host_os_name" in
 		linux*)
-			if test -d /usr/lib64 -a ! -d /usr/lib64/fakeroot; then
-				libdir="$exec_prefix/lib64"
+			if test -d /usr/lib -a ! -d /usr/lib/fakeroot; then
+				libdir="$exec_prefix/lib"
 			fi
 			;;
 	esac
diff -Nuar cups_old-2.2.6/cups-config.in cups-2.2.6/cups-config.in
--- cups_old-2.2.6/cups-config.in	2017-11-01 17:57:53.000000000 +0300
+++ cups-2.2.6/cups-config.in	2017-12-14 09:22:37.641209818 +0300
@@ -48,7 +48,7 @@
 	CFLAGS="$CFLAGS -I$includedir"
     fi

-    if test $libdir != /usr/lib -a $libdir != /usr/lib32 -a $libdir != /usr/lib64; then
+    if test $libdir != /usr/lib -a $libdir != /usr/lib32 -a $libdir != /usr/lib; then
 	LDFLAGS="$LDFLAGS -L$libdir"
     fi
 fi


code:
Index: cups-1.4.4/config-scripts/cups-compiler.m4
===================================================================
--- cups-1.4.4.orig/config-scripts/cups-compiler.m4
+++ cups-1.4.4/config-scripts/cups-compiler.m4
@@ -30,7 +30,7 @@ dnl For debugging, keep symbols, otherwi
 if test x$enable_debug = xyes; then
 	OPTIM="-g"
 else
-	INSTALL_STRIP="-s"
+	INSTALL_STRIP=""
 fi

 dnl Debug printfs can slow things down, so provide a separate option for that
Index: cups-1.4.4/configure
===================================================================
--- cups-1.4.4.orig/configure
+++ cups-1.4.4/configure
@@ -10978,7 +10978,7 @@ fi
 if test x$enable_debug = xyes; then
 	OPTIM="-g"
 else
-	INSTALL_STRIP="-s"
+	INSTALL_STRIP=""
 fi

 if test x$enable_debug_printfs = xyes; then


code:
diff -Nuar cups_old-2.2.6/config-scripts/cups-network.m4 cups-2.2.6/config-scripts/cups-network.m4
--- cups_old-2.2.6/config-scripts/cups-network.m4	2017-11-01 17:57:53.000000000 +0300
+++ cups-2.2.6/config-scripts/cups-network.m4	2017-12-14 09:40:48.442276087 +0300
@@ -48,7 +48,7 @@
 		case "$host_os_name" in
 			darwin*)
 				# Darwin and macOS do their own thing...
-				CUPS_DEFAULT_DOMAINSOCKET="$localstatedir/run/cupsd"
+				CUPS_DEFAULT_DOMAINSOCKET="/run/cupsd"
 				;;
 			*)
 				# All others use FHS standard...


code:
diff -up cups-2.2b2/cups/http-support.c.avahi-address cups-2.2b2/cups/http-support.c
--- cups-2.2b2/cups/http-support.c.avahi-address	2016-06-24 17:43:35.000000000 +0200
+++ cups-2.2b2/cups/http-support.c	2016-06-27 15:31:34.201361844 +0200
@@ -2340,7 +2340,7 @@ http_resolve_cb(
     const char             *type,	/* I - Registration type */
     const char             *domain,	/* I - Domain (unused) */
     const char             *hostTarget,	/* I - Hostname */
-    const AvahiAddress     *address,	/* I - Address (unused) */
+    const AvahiAddress     *address,	/* I - Address */
     uint16_t               port,	/* I - Port number */
     AvahiStringList        *txt,	/* I - TXT record */
     AvahiLookupResultFlags flags,	/* I - Lookup flags (unused) */
@@ -2493,39 +2493,62 @@ http_resolve_cb(
     * getting the IP address of the .local name and then do reverse-lookups...
     */

-    http_addrlist_t	*addrlist,	/* List of addresses */
-			*addr;		/* Current address */
+    http_addr_t addr;
+    size_t addrlen;
+    int error;

     DEBUG_printf(("5http_resolve_cb: Looking up \"%s\".", hostTarget));

-    snprintf(fqdn, sizeof(fqdn), "%d", ntohs(port));
-    if ((addrlist = httpAddrGetList(hostTarget, AF_UNSPEC, fqdn)) != NULL)
+    switch (address->proto)
     {
-      for (addr = addrlist; addr; addr = addr->next)
+    case AVAHI_PROTO_INET:
+      addr.ipv4.sin_family = AF_INET;
+      addrlen = sizeof (addr.ipv4.sin_addr);
+      memcpy (&addr.ipv4.sin_addr, &address->data, addrlen);
+      break;
+    case AVAHI_PROTO_INET6:
+      addr.ipv6.sin6_family = AF_INET6;
+      addrlen = sizeof (addr.ipv6.sin6_addr);
+      memcpy (&addr.ipv6.sin6_addr, &address->data, addrlen);
+      break;
+    default:
+      DEBUG_printf(("8http_resolve_cb: unknown address family %d",
+		    address->proto));
+      addrlen = 0;
+    }
+
+    if (addrlen > 0) {
+      error = getnameinfo(&addr.addr, httpAddrLength (&addr),
+			  fqdn, sizeof(fqdn), NULL, 0, NI_NAMEREQD);
+
+      if (!error)
       {
-        int error = getnameinfo(&(addr->addr.addr), (socklen_t)httpAddrLength(&(addr->addr)), fqdn, sizeof(fqdn), NULL, 0, NI_NAMEREQD);
+	DEBUG_printf(("8http_resolve_cb: Found \"%s\".", fqdn));

-        if (!error)
-	{
-	  DEBUG_printf(("5http_resolve_cb: Found \"%s\".", fqdn));
+	if ((hostptr = fqdn + strlen(fqdn) - 6) <= fqdn ||
+	    _cups_strcasecmp(hostptr, ".local"))

-	  if ((hostptr = fqdn + strlen(fqdn) - 6) <= fqdn ||
-	      _cups_strcasecmp(hostptr, ".local"))
-	  {
-	    hostTarget = fqdn;
-	    break;
-	  }
+	{
+	  hostTarget = fqdn;
 	}
+      } else {
+	avahi_address_snprint (fqdn, sizeof (fqdn), address);
+	hostTarget = fqdn;
+
 #ifdef DEBUG
-	else
-	  DEBUG_printf(("5http_resolve_cb: \"%s\" did not resolve: %d",
-	                httpAddrString(&(addr->addr), fqdn, sizeof(fqdn)),
-			error));
+	DEBUG_printf(("8http_resolve_cb: \"%s\" did not resolve: %d",
+		      fqdn, error));
 #endif /* DEBUG */
       }

-      httpAddrFreeList(addrlist);
     }
+  } else {
+   /*
+    * Use the IP address that responded...
+    */
+
+   avahi_address_snprint (fqdn, sizeof (fqdn), address);
+   hostTarget = fqdn;
   }

  /*


code:
d /run/cups 0755 root lp
d /run/cups/certs 0755 lp lpadmin


code:
<?xml version="1.0" ?>
<!DOCTYPE PISI SYSTEM "http://www.pisilinux.org/projeler/pisi/pisi-spec.dtd">
<PISI>
    <Source>
        <Name>cups</Name>
        <Homepage>http://www.cups.org/</Homepage>
        <Packager>
            <Name>Pisi Linux Admins</Name>
            <Email>admins@pisilinux.org</Email>
        </Packager>
        <License>GPLv2</License>
        <IsA>service</IsA>
        Common Unix Printing System
        <Description>cups provides a portable printing layer for *nix-based operating systems.</Description>
        <Archive sha1sum="b5e3389fb9450bfed377c95c0230c029c053acc4" type="targz">https://github.com/apple/cups/releases/download/v2.2.6/cups-2.2.6-source.tar.gz</Archive>
 -->
        <BuildDependencies>
            <Dependency>acl-devel</Dependency>
            <Dependency>pam-devel</Dependency>
            <Dependency>dbus-devel</Dependency>
            <Dependency>libpcre-devel</Dependency>
            <Dependency>zlib-devel</Dependency>
            <Dependency>python-devel</Dependency>
            <Dependency>libusb-devel</Dependency>
            <Dependency>libgcc</Dependency>
            <Dependency>avahi-libs</Dependency>
            <Dependency>avahi-devel</Dependency>

            <Dependency>mit-kerberos</Dependency>
            <Dependency>libpaper-devel</Dependency>
            <Dependency>xdg-utils</Dependency>
            <Dependency>colord-devel</Dependency>
        </BuildDependencies>
        <Patches>

            <Patch level="1">archlinux/cups-no-export-ssllibs.patch</Patch>
            <Patch level="1">archlinux/cups-no-gzip-man.patch</Patch>

            <Patch level="1">fedora/cups-final-content-type.patch</Patch>
            <Patch level="1">fedora/cups-res_init.patch</Patch>
            <Patch level="1">fedora/cups-hp-deviceid-oid.patch</Patch>
            <Patch level="1">fedora/cups-logrotate.patch</Patch>
            <Patch level="1">fedora/cups-avahi-no-threaded.patch</Patch>

            <Patch>gentoo/cups-2.2.6-fix-install-perms.patch</Patch>
            <Patch >gentoo/cups-2.0.2-rename-systemd-service-files.patch</Patch>

            <Patch level="1">pisilinux/nostrip.patch</Patch>
            <Patch level="1">pisilinux/cups-run.patch</Patch>
            <Patch level="1">pisilinux/lib64.patch</Patch>
            <Patch level="1">pisilinux/statedir.patch</Patch>
            <Patch level="1">pisilinux/desktop.patch</Patch>

            <Patch>pld-linux/cups-avahi-address.patch</Patch>
        </Patches>
    </Source>

    <Package>
        <Name>cups</Name>
        <RuntimeDependencies>
            <Dependency>acl</Dependency>
            <Dependency>pam</Dependency>
            <Dependency>dbus</Dependency>
            <Dependency>zlib</Dependency>
            <Dependency>libusb</Dependency>
            <Dependency>libgcc</Dependency>
            <Dependency>libpaper</Dependency>
            <Dependency>avahi</Dependency>
            <Dependency>avahi-libs</Dependency>
            <Dependency>mit-kerberos</Dependency>
        </RuntimeDependencies>
        <Files>
            <Path fileType="config">/etc/cups/*conf</Path>
            <Path fileType="config">/usr/lib/tmpfiles.d/cups.conf</Path>
            <Path fileType="library">/usr/lib</Path>
            <Path fileType="executable">/usr/sbin</Path>
            <Path fileType="executable">/usr/bin</Path>
            <Path fileType="data">/var/cache/cups/rss</Path>
            <Path fileType="data">/var/spool/cups/tmp</Path>
            <Path fileType="data">/run/cups/certs</Path>
            <Path fileType="data">/var/log/cups</Path>
            <Path fileType="data">/etc</Path>
            <Path fileType="data">/lib/udev/rules.d</Path>
            <Path fileType="data">/lib/systemd/system</Path>
            <Path fileType="data">/usr/share/cups</Path>
            <Path fileType="data">/usr/share/icons</Path>
            <Path fileType="data">/usr/share/applications</Path>
            <Path fileType="doc">/usr/share/doc</Path>
            <Path fileType="man">/usr/share/man</Path>
            <Path fileType="localedata">/usr/share/locale</Path>
        </Files>
        <AdditionalFiles>
            <AdditionalFile owner="root" permission="0644" target="/usr/lib/tmpfiles.d/cups.conf">tmpfiles.conf</AdditionalFile>

            <AdditionalFile owner="root" permission="0644" target="/etc/logrotate.d/cups">cups.logrotate</AdditionalFile>

            <AdditionalFile owner="root" permission="0644" target="/usr/share/cups/model/textonly.ppd">fedora/textonly.ppd</AdditionalFile>
        </AdditionalFiles>
        <Provides>
            <COMAR script="service.py">System.Service</COMAR>
            <COMAR script="package.py">System.Package</COMAR>
        </Provides>
    </Package>

    <Package>
        <Name>cups-devel</Name>
        Development files for cups
        <RuntimeDependencies>
            <Dependency release="current">cups</Dependency>
        </RuntimeDependencies>
        <Files>
            <Path fileType="header">/usr/include</Path>
            <Path fileType="executable">/usr/bin/cups-config</Path>
        </Files>
    </Package>

    <Package>
        <Name>cups-32bit</Name>
        <PartOf>emul32</PartOf>
        32-bit shared libraries for cups
        <BuildType>emul32</BuildType>
        <BuildDependencies>
            <Dependency>zlib-32bit</Dependency>
            <Dependency>openssl-32bit</Dependency>
        </BuildDependencies>
        <RuntimeDependencies>
            <Dependency>zlib-32bit</Dependency>
            <Dependency>openssl-32bit</Dependency>
            <Dependency>libgcc</Dependency>
            <Dependency release="current">cups</Dependency>
        </RuntimeDependencies>
        <Files>
            <Path fileType="executable">/usr/bin/cups-config-32bit</Path>
            <Path fileType="library">/usr/lib32</Path>
        </Files>
    </Package>

    <History>
        <Update release="6">
            <Date>2017-12-13</Date>
            <Version>2.2.6</Version>
            <Comment>Version bump</Comment>
            <Name>Ayhan Yalçınsoy</Name>
            <Email>ayhanyacinsoy@pisilinux.org</Email>
        </Update>
        <Update release="5">
            <Date>2017-07-16</Date>
            <Version>2.2.3</Version>
            <Comment>Rebuild</Comment>
            <Name>Pisi Linux Community</Name>
            <Email>admin@pisilinux.org</Email>
        </Update>
        <Update release="4">
            <Date>2017-02-17</Date>
            <Version>2.2.2</Version>
            <Comment>Version Bump.</Comment>
            <Name>Pisi Linux Community</Name>
            <Email>admin@pisilinux.org</Email>
        </Update>
        <Update release="3">
            <Date>2016-06-09</Date>
            <Version>2.1.3</Version>
            <Comment>Release Bump</Comment>
            <Name>Pisi Linux Community</Name>
            <Email>admin@pisilinux.org</Email>
        </Update>
        <Update release="2">
            <Date>2016-05-25</Date>
            <Version>2.1.3</Version>
            <Comment>Rebuild</Comment>
            <Name>Alihan Öztürk</Name>
            <Email>alihan@pisilinux.org</Email>
        </Update>
        <Update release="1">
            <Date>2016-03-23</Date>
            <Version>2.1.3</Version>
            <Comment>First release</Comment>
            <Name>Alihan Öztürk</Name>
            <Email>alihan@pisilinux.org</Email>
        </Update>
    </History>
</PISI>


code:
<?xml version="1.0" ?>
<PISI>
    <Source>
        <Name>cups</Name>
        Unix Ortak Yazdırma Sistemi
    </Source>

    <Package>
        <Name>cups-php</Name>
        PHP için CUPS programlama kitaplığı
    </Package>

    <Package>
        <Name>cups-devel</Name>
        cups için geliştirme dosyaları
    </Package>

    <Package>
        <Name>cups-32bit</Name>
        cups için 32-bit paylaşımlı kitaplıklar
    </Package>
</PISI>


code:
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Licensed under the GNU General Public License, version 3.
# See the file http://www.gnu.org/licenses/gpl.txt

from pisi.actionsapi import autotools
from pisi.actionsapi import pisitools
from pisi.actionsapi import shelltools
from pisi.actionsapi import get

def setup():
    shelltools.export("CC", "")
    autotools.configure("--enable-nls")

def build():
    autotools.make()

def install():
    autotools.rawInstall('DESTDIR="%s"' % get.installDIR())

    pisitools.dodoc("AUTHORS", "ChangeLog", "docs/FAQ.html", "NEWS", "README*", "THANKS", "TODO")


code:
diff -u -p -Nr --exclude CVS orig/enscript-1.6.3/src/gsint.h enscript-1.6.3.CAN-2004-1184/src/gsint.h
--- orig/enscript-1.6.3/src/gsint.h	2000-07-11 17:28:06.000000000 +0200
+++ enscript-1.6.3.CAN-2004-1184/src/gsint.h	2005-01-04 20:45:24.000000000 +0100
@@ -701,4 +701,9 @@ FILE *printer_open ___P ((char *cmd, cha
  */
 void printer_close ___P ((void *context));

+/*
+ * Escape filenames for shell usage
+ */
+char *shell_escape ___P ((const char *fn));
+
 #endif /* not GSINT_H */
diff -u -p -Nr --exclude CVS orig/enscript-1.6.3/src/main.c enscript-1.6.3.CAN-2004-1184/src/main.c
--- orig/enscript-1.6.3/src/main.c	2005-01-04 20:52:31.000000000 +0100
+++ enscript-1.6.3.CAN-2004-1184/src/main.c	2005-01-05 10:57:44.000000000 +0100
@@ -1555,9 +1555,13 @@ name             width\theight\tllx\tlly
       buffer_append (&cmd, intbuf);
       buffer_append (&cmd, " ");

-      buffer_append (&cmd, "-Ddocument_title=\"");
-      buffer_append (&cmd, title);
-      buffer_append (&cmd, "\" ");
+      buffer_append (&cmd, "-Ddocument_title=\'");
+      if ((cp = shell_escape (title)) != NULL)
+	{
+	  buffer_append (&cmd, cp);
+	  free (cp);
+	}
+      buffer_append (&cmd, "\' ");

       buffer_append (&cmd, "-Dtoc=");
       buffer_append (&cmd, toc ? "1" : "0");
@@ -1574,8 +1578,14 @@ name             width\theight\tllx\tlly
       /* Append input files. */
       for (i = optind; i < argc; i++)
 	{
-	  buffer_append (&cmd, " ");
-	  buffer_append (&cmd, argv[i]);
+	  char *cp;
+	  if ((cp = shell_escape (argv[i])) != NULL)
+	    {
+	      buffer_append (&cmd, " \'");
+	      buffer_append (&cmd, cp);
+	      buffer_append (&cmd, "\'");
+	      free (cp);
+	    }
 	}

       /* And do the job. */
@@ -1636,7 +1645,7 @@ name             width\theight\tllx\tlly
 				 buffer_ptr (opts), buffer_len (opts));
 	    }

-	  buffer_append (&buffer, " \"%s\"");
+	  buffer_append (&buffer, " \'%s\'");

 	  input_filter = buffer_copy (&buffer);
 	  input_filter_stdin = "-";
diff -u -p -Nr --exclude CVS orig/enscript-1.6.3/src/util.c enscript-1.6.3.CAN-2004-1184/src/util.c
--- orig/enscript-1.6.3/src/util.c	1999-09-17 17:26:51.000000000 +0200
+++ enscript-1.6.3.CAN-2004-1184/src/util.c	2005-01-05 10:43:23.000000000 +0100
@@ -1239,6 +1239,8 @@ escape_string (char *string)

   /* Create result. */
   cp = xmalloc (len + 1);
+  if (cp == NULL)
+      return NULL;
   for (i = 0, j = 0; string[i]; i++)
     switch (string[i])
       {
@@ -1879,6 +1881,7 @@ is_open (InputStream *is, FILE *fp, char
       char *cmd = NULL;
       int cmdlen;
       int i, pos;
+      char *cp;

       is->is_pipe = 1;

@@ -1902,12 +1905,16 @@ is_open (InputStream *is, FILE *fp, char
 		{
 		case 's':
 		  /* Expand cmd-buffer. */
-		  cmdlen += strlen (fname);
-		  cmd = xrealloc (cmd, cmdlen);
+		  if ((cp = shell_escape (fname)) != NULL)
+		    {
+		      cmdlen += strlen (cp);
+		      cmd = xrealloc (cmd, cmdlen);

-		  /* Paste filename. */
-		  strcpy (cmd + pos, fname);
-		  pos += strlen (fname);
+		      /* Paste filename. */
+		      strcpy (cmd + pos, cp);
+		      pos += strlen (cp);
+		      free (cp);
+		    }

 		  i++;
 		  break;
@@ -2116,3 +2123,36 @@ buffer_len (Buffer *buffer)
 {
   return buffer->len;
 }
+
+/*
+ * Escapes the name of a file so that the shell groks it in 'single'
+ * quotation marks.  The resulting pointer has to be free()ed when not
+ * longer used.
+*/
+char *
+shell_escape(const char *fn)
+{
+  size_t len = 0;
+  const char *inp;
+  char *retval, *outp;
+
+  for(inp = fn; *inp; ++inp)
+    switch(*inp)
+    {
+      case '\'': len += 4; break;
+      default:   len += 1; break;
+    }
+
+  outp = retval = malloc(len + 1);
+  if(!outp)
+    return NULL; /* perhaps one should do better error handling here */
+  for(inp = fn; *inp; ++inp)
+    switch(*inp)
+    {
+      case '\'': *outp++ = '\''; *outp++ = '\\'; *outp++ = '\'', *outp++ = '\''; break;
+      default:   *outp++ = *inp; break;
+    }
+  *outp = 0;
+
+  return retval;
+}
diff -u -p -Nr --exclude CVS enscript-1.6.3.CAN-2004-1184/src/psgen.c enscript-1.6.3.CAN-2004-1185/src/psgen.c
--- enscript-1.6.3.CAN-2004-1184/src/psgen.c	2005-01-04 20:59:56.000000000 +0100
+++ enscript-1.6.3.CAN-2004-1185/src/psgen.c	2005-01-05 15:22:40.000000000 +0100
@@ -2385,9 +2385,10 @@ recognize_eps_file (Token *token)
   MESSAGE (2, (stderr, "^@epsf=\"%s\"\n", token->u.epsf.filename));

   i = strlen (token->u.epsf.filename);
+  /*
   if (i > 0 && token->u.epsf.filename[i - 1] == '|')
     {
-      /* Read EPS data from pipe. */
+      / * Read EPS data from pipe. * /
       token->u.epsf.pipe = 1;
       token->u.epsf.filename[i - 1] = '\0';
       token->u.epsf.fp = popen (token->u.epsf.filename, "r");
@@ -2400,6 +2401,7 @@ recognize_eps_file (Token *token)
 	}
     }
   else
+  */
     {
       char *filename;

diff -u -p -Nr --exclude CVS enscript-1.6.3.CAN-2004-1185/src/psgen.c enscript-1.6.3.CAN-2004-1186/src/psgen.c
--- enscript-1.6.3.CAN-2004-1185/src/psgen.c	2005-01-05 15:22:40.000000000 +0100
+++ enscript-1.6.3.CAN-2004-1186/src/psgen.c	2005-01-05 15:22:44.000000000 +0100
@@ -2034,8 +2034,9 @@ dump_ps_page_header (char *fname, int em
   else
     {
       ftail++;
-      strncpy (buf, fname, ftail - fname);
-      buf[ftail - fname] = '\0';
+      i = ftail - fname >= sizeof (buf)-1 ? sizeof (buf)-1 : ftail - fname;
+      strncpy (buf, fname, i);
+      buf[i] = '\0';
     }

   if (nup > 1)


code:
--- src/psgen.c
+++ src/psgen.c	2008-10-29 10:43:08.512598143 +0100
@@ -24,6 +24,7 @@
  * Boston, MA 02111-1307, USA.
  */

+#include <limits.h>
 #include "gsint.h"

 /*
@@ -124,7 +125,7 @@ struct gs_token_st
 	  double xscale;
 	  double yscale;
 	  int llx, lly, urx, ury; /* Bounding box. */
-	  char filename[512];
+	  char filename[PATH_MAX];
 	  char *skipbuf;
 	  unsigned int skipbuf_len;
 	  unsigned int skipbuf_pos;
@@ -135,11 +136,11 @@ struct gs_token_st
       Color bgcolor;
       struct
 	{
-	  char name[512];
+	  char name[PATH_MAX];
 	  FontPoint size;
 	  InputEncoding encoding;
 	} font;
-      char filename[512];
+      char filename[PATH_MAX];
     } u;
 };

@@ -248,7 +249,7 @@ static int do_print = 1;
 static int user_fontp = 0;

 /* The user ^@font{}-defined font. */
-static char user_font_name[256];
+static char user_font_name[PATH_MAX];
 static FontPoint user_font_pt;
 static InputEncoding user_font_encoding;

@@ -978,7 +979,8 @@ large for page\n"),
 			FATAL ((stderr,
 				_("user font encoding can be only the system's default or `ps'")));

-		      strcpy (user_font_name, token.u.font.name);
+		      memset  (user_font_name, 0, sizeof(user_font_name));
+		      strncpy (user_font_name, token.u.font.name, sizeof(user_font_name) - 1);
 		      user_font_pt.w = token.u.font.size.w;
 		      user_font_pt.h = token.u.font.size.h;
 		      user_font_encoding = token.u.font.encoding;
@@ -1444,7 +1446,7 @@ read_special_escape (InputStream *is, To
 	  buf[i] = ch;
 	  if (i + 1 >= sizeof (buf))
 	    FATAL ((stderr, _("too long argument for %s escape:\n%.*s"),
-		    escapes[i].name, i, buf));
+		    escapes[e].name, i, buf));
 	}
       buf[i] = '\0';

@@ -1452,7 +1454,8 @@ read_special_escape (InputStream *is, To
       switch (escapes[e].escape)
 	{
 	case ESC_FONT:
-	  strcpy (token->u.font.name, buf);
+	  memset  (token->u.font.name, 0, sizeof(token->u.font.name));
+	  strncpy (token->u.font.name, buf, sizeof(token->u.font.name) - 1);

 	  /* Check for the default font. */
 	  if (strcmp (token->u.font.name, "default") == 0)
@@ -1465,7 +1468,8 @@ read_special_escape (InputStream *is, To
 		FATAL ((stderr, _("malformed font spec for ^@font escape: %s"),
 			token->u.font.name));

-	      strcpy (token->u.font.name, cp);
+	      memset  (token->u.font.name, 0, sizeof(token->u.font.name));
+	      strncpy (token->u.font.name, cp, sizeof(token->u.font.name) - 1);
 	      xfree (cp);
 	    }
 	  token->type = tFONT;
@@ -1544,7 +1548,8 @@ read_special_escape (InputStream *is, To
 	  break;

 	case ESC_SETFILENAME:
-	  strcpy (token->u.filename, buf);
+	  memset  (token->u.filename, 0, sizeof(token->u.font.name));
+	  strncpy (token->u.filename, buf, sizeof(token->u.filename) - 1);
 	  token->type = tSETFILENAME;
 	  break;


code:
--- enscript-1.6.4/afm/Makefile.am.config	2003-03-05 07:26:16.000000000 +0000
+++ enscript-1.6.4/afm/Makefile.am	2005-12-23 09:56:52.000000000 +0000
@@ -36,11 +36,11 @@
 EXTRA_DIST = font.map $(default_afm) $(public_fonts)

 install-data-local:
-	$(top_srcdir)/mkinstalldirs $(datadir)/enscript
-	$(top_srcdir)/mkinstalldirs $(datadir)/enscript/afm
+	$(top_srcdir)/mkinstalldirs $(DESTDIR)/$(datadir)/enscript
+	$(top_srcdir)/mkinstalldirs $(DESTDIR)/$(datadir)/enscript/afm
 	for f in $(EXTRA_DIST); do \
-	  $(INSTALL_DATA) $(srcdir)/$$f $(datadir)/enscript/afm/$$f; \
+	  $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)/$(datadir)/enscript/afm/$$f; \
 	done

 uninstall-local:
-	rm -rf $(datadir)/enscript/afm
+	rm -rf $(DESTDIR)/$(datadir)/enscript/afm
--- enscript-1.6.4/afm/Makefile.in.config	2003-03-05 07:40:06.000000000 +0000
+++ enscript-1.6.4/afm/Makefile.in	2005-12-23 09:56:52.000000000 +0000
@@ -319,14 +319,14 @@

 install-data-local:
-	$(top_srcdir)/mkinstalldirs $(datadir)/enscript
-	$(top_srcdir)/mkinstalldirs $(datadir)/enscript/afm
+	$(top_srcdir)/mkinstalldirs $(DESTDIR)/$(datadir)/enscript
+	$(top_srcdir)/mkinstalldirs $(DESTDIR)/$(datadir)/enscript/afm
 	for f in $(EXTRA_DIST); do \
-	  $(INSTALL_DATA) $(srcdir)/$$f $(datadir)/enscript/afm/$$f; \
+	  $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)/$(datadir)/enscript/afm/$$f; \
 	done

 uninstall-local:
-	rm -rf $(datadir)/enscript/afm
+	rm -rf $(DESTDIR)/$(datadir)/enscript/afm
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
--- enscript-1.6.4/lib/Makefile.in.config	2003-03-05 07:40:07.000000000 +0000
+++ enscript-1.6.4/lib/Makefile.in	2005-12-23 09:56:52.000000000 +0000
@@ -345,15 +345,16 @@
 all-local: enscript.cfg

 install-data-local: enscript.cfg
-	$(top_srcdir)/mkinstalldirs $(sysconfdir)
-	if test -r $(sysconfdir)/enscript.cfg; then \
-	  cp $(sysconfdir)/enscript.cfg $(sysconfdir)/enscript.cfg.old; \
+	$(top_srcdir)/mkinstalldirs $(DESTDIR)$(sysconfdir)
+	if test -r $(DESTDIR)$(sysconfdir)/enscript.cfg; then \
+	  cp $(DESTDIR)$(sysconfdir)/enscript.cfg \
+		$(DESTDIR)$(sysconfdir)/enscript.cfg.old; \
 	else :; \
 	fi
-	$(INSTALL_DATA) enscript.cfg $(sysconfdir)/enscript.cfg
+	$(INSTALL_DATA) enscript.cfg $(DESTDIR)$(sysconfdir)/enscript.cfg

 uninstall-local:
-	rm -f $(sysconfdir)/enscript.cfg
+	rm -f $(DESTDIR)$(sysconfdir)/enscript.cfg

 enscript.cfg: $(srcdir)/enscript.cfg.in Makefile
 	sed 's%@DATADIR@%$(datadir)%g; s%@media@%@MEDIA@%g; s%@BINDIR@%$(bindir)%g; s%@spooler@%@SPOOLER@%g; s%@pslevel@%@PSLEVEL@%g' \
--- enscript-1.6.4/states/hl/Makefile.am.config	2005-12-23 09:59:55.000000000 +0000
+++ enscript-1.6.4/states/hl/Makefile.am	2005-12-23 10:00:09.000000000 +0000
@@ -45,10 +45,10 @@
 EXTRA_DIST = $(states)

 install-data-local:
-	$(top_srcdir)/mkinstalldirs $(datadir)/enscript
-	$(top_srcdir)/mkinstalldirs $(datadir)/enscript/hl
+	$(top_srcdir)/mkinstalldirs $(DESTDIR)/$(datadir)/enscript
+	$(top_srcdir)/mkinstalldirs $(DESTDIR)/$(datadir)/enscript/hl
 	for f in $(states); do \
-	  $(INSTALL_DATA) $(srcdir)/$$f $(datadir)/enscript/hl/$$f; \
+	  $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)/$(datadir)/enscript/hl/$$f; \
 	done

 uninstall-local:
--- enscript-1.6.4/states/hl/Makefile.in.config	2005-12-23 10:00:13.000000000 +0000
+++ enscript-1.6.4/states/hl/Makefile.in	2005-12-23 10:00:34.000000000 +0000
@@ -330,10 +330,10 @@

 install-data-local:
-	$(top_srcdir)/mkinstalldirs $(datadir)/enscript
-	$(top_srcdir)/mkinstalldirs $(datadir)/enscript/hl
+	$(top_srcdir)/mkinstalldirs $(DESTDIR)/$(datadir)/enscript
+	$(top_srcdir)/mkinstalldirs $(DESTDIR)/$(datadir)/enscript/hl
 	for f in $(states); do \
-	  $(INSTALL_DATA) $(srcdir)/$$f $(datadir)/enscript/hl/$$f; \
+	  $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)/$(datadir)/enscript/hl/$$f; \
 	done

 uninstall-local:


code:
--- src/main.c	2005/11/04 11:02:27	1.1
+++ src/main.c	2005/11/04 11:16:28
@@ -1695,7 +1695,7 @@ name             width\theight\tllx\tlly
 	}

       /* Table of Contents. */
-      if (toc)
+      if (ofp != NULL && toc)
 	{
 	  /* This is really cool... */

@@ -1714,9 +1714,11 @@ name             width\theight\tllx\tlly
 	      process_file (_("Table of Contents"), &is, 1);
 	      is_close (&is);
 	    }
-
-	  /* Clean up toc file. */
-	  fclose (toc_fp);
+	  else
+	    {
+	      /* Clean up toc file. */
+	      fclose (toc_fp);
+	    }
 	}

       /* Give trailer a chance to dump itself. */


code:
/**
 * Name: ruby
 * Description: Ruby programming language.
 * Author: Mike Wilson <m.v.wilson@home.com>
 */

state ruby_comment
{
  /\*\\\// {
    language_print ($0);
    return;
  }
  LANGUAGE_SPECIALS {
   language_print ($0);
  }
}

state ruby_dquot_string
{
  /\\\\./ {
    language_print ($0);
  }
  /\"/ {
    language_print ($0);
    return;
  }
  LANGUAGE_SPECIALS {
    language_print ($0);
  }
}

state ruby_quot_string
{
  /\\\\./ {
    language_print ($0);
  }
  /[\']/ {
    language_print ($0);
    return;
  }
  LANGUAGE_SPECIALS {
    language_print ($0);
  }
}

state ruby_bquot_string
{
  /\\\\./ {
    language_print ($0);
  }
  /`/ {
    language_print ($0);
    return;
  }
  LANGUAGE_SPECIALS {
    language_print ($0);
  }
}

state ruby
{
  BEGIN {
    header ();
  }
  END {
    trailer ();
  }

  /* Comments. */
  /#[^{].*$/ {
    comment_face (true);
    language_print ($0);
    comment_face (false);
  }

  /* Ignore escaped quote marks */
  /\\\"/ {
    language_print ($0);
  }
  /\\\'/ {
    language_print ($0);
  }
  /\\\`/ {
    language_print ($0);
  }

  /* In cgi files, JavaScript might be imbedded, so we need to look out
   * for the JavaScript comments, because they might contain something
   * we don't like, like a contraction (don't, won't, etc.)
   * We won't put them in comment face, because they are not ruby
   * comments.
   */
  /\/\// {
    language_print ($0);
    call (eat_one_line);
  }

  /* String constants. */
  /\"/ {
    string_face (true);
    language_print ($0);
    call (ruby_dquot_string);
    string_face (false);
  }
  /[\']/ {
    string_face (true);
    language_print ($0);
    call (ruby_quot_string);
    string_face (false);
  }

  /* Backquoted command string */
  /`/ {
    string_face (true);
    language_print ($0);
    call (ruby_bquot_string);
    string_face (false);
  }

  /* Variables globals and instance */
  /[$@]\w+/ {
    variable_name_face (true);
    language_print ($0);
    variable_name_face (false);
  }

  /* Variables class variable */
  /@@\w+/ {
    variable_name_face (true);
    language_print ($0);
    variable_name_face (false);
  }

   /([ \t]*)(def)([ \t]+)([^(]*)/ {
    /* indentation */
    language_print ($1);

    /* def */
    keyword_face (true);
    language_print ($2);
    keyword_face (false);

    /* middle */
    language_print ($3);

    /* Function name. */
    function_name_face (true);
    language_print ($4);
    function_name_face (false);
  }

  /\$[!@&`'+~=\/\\,;.<>_*$?:"]/ {
    variable_name_face (true);
    language_print ($0);
    variable_name_face (false);
  }

  /* Highlighting
	--Type face
 	private protected public

	--Builtin face (I consider these to be somewhat special)
	alias alias_method attr attr_accessor attr_reader attr_writer
	module_alias module_function self super

	--Reference face
	require include

	--Keyword face
	and begin break case class def defined? do else elsif end
	ensure eval extend false for if in method module next nil not
	or redo rescue retry return then true undef unless until when
	while yield
   */
/\\b(private|protected|public)\\b/ {
    type_face (true);
    language_print ($0);
    type_face (false);
  }

/\\b(alias|alias_method|attr|attr_accessor|attr_reader|attr_writer\\
|module_alias|module_function|self|super)\\b/ {
    builtin_face (true);
    language_print ($0);
    builtin_face (false);
  }

/\\b(include|require)\\b/ {
    reference_face (true);
    language_print ($0);
    reference_face (false);
  }

/\\b(and|begin|break|case|class|def|defined?|do|else|elsif|end|ensure|eval\\
|extend|false|for|if|in|method|module|next|nil|not|or|raise|redo|rescue|retry\\
|return|then|true|undef|unless|until|when|while|yield)\\b/ {
    keyword_face (true);
    language_print ($0);
    keyword_face (false);
  }

  LANGUAGE_SPECIALS {
    language_print ($0);
  }
}

/*
Local variables:
mode: c
End:
*/


code:
<?xml version="1.0" ?>
<!DOCTYPE PISI SYSTEM "http://www.pisilinux.org/projeler/pisi/pisi-spec.dtd">
<PISI>
    <Source>
        <Name>enscript</Name>
        <Homepage>http://www.gnu.org/software/enscript/enscript.html</Homepage>
        <Packager>
            <Name>PisiLinux Community</Name>
            <Email>admins@pisilinux.org</Email>
        </Packager>
        <License>GPLv2</License>
        <IsA>app:console</IsA>
        <Summary>Powerful text-to-postscript converter</Summary>
        <Description>enscript is an application that you can use to convert your text files to postscript files with enhanced formatting capabilities like colorizing, page layout management etc.</Description>
        <Archive type="targz" sha1sum="9dd7128a508d4c9671659b9520028d12add50cfa">http://www.iki.fi/mtr/genscript/enscript-1.6.4.tar.gz</Archive>
        <Patches>
            <Patch level="1">enscript-1.6.3-security.patch</Patch>
            <Patch>enscript-1.6.3-language.patch</Patch>
            <Patch>enscript-catmur.patch</Patch>
            <Patch>ruby.patch</Patch>
            <Patch>enscript-1.6.4-CVE-2008-3863-CVE-2008-4306.patch</Patch>
            <Patch level="1">enscript-1.6.4-config.patch</Patch>
        </Patches>
    </Source>

    <Package>
        <Name>enscript</Name>
        <Files>
            <Path fileType="config">/etc</Path>
            <Path fileType="executable">/usr/bin</Path>
            <Path fileType="doc">/usr/share/doc</Path>
            <Path fileType="data">/usr/share/enscript</Path>
            <Path fileType="info">/usr/share/info</Path>
            <Path fileType="localedata">/usr/share/locale</Path>
            <Path fileType="man">/usr/share/man</Path>
        </Files>
        <AdditionalFiles>
            <AdditionalFile owner="root" permission="0644" target="/usr/share/enscript/hl/ruby.st">ruby.st</AdditionalFile>
        </AdditionalFiles>
    </Package>

    <History>
        <Update release="3">
            <Date>2017-02-28</Date>
            <Version>1.6.4</Version>
            <Comment>Rebuild for new Toolchain.</Comment>
            <Name>Stefan Gronewold(groni)</Name>
            <Email>groni@pisilinux.org</Email>
        </Update>
        <Update release="2">
            <Date>2016-06-09</Date>
            <Version>1.6.4</Version>
            <Comment>Release Bump</Comment>
            <Name>Pisi Linux Community</Name>
            <Email>admin@pisilinux.org</Email>
        </Update>
        <Update release="1">
            <Date>2014-01-23</Date>
            <Version>1.6.4</Version>
            <Comment>First release</Comment>
            <Name>Stefan Gronewold(groni)</Name>
            <Email>groni@pisilinux.org</Email>
        </Update>
    </History>
</PISI>


code:
<?xml version="1.0" ?>
<PISI>
    <Source>
        <Name>enscript</Name>
        <Summary xml:lang="tr">Metin dosyalarından postscript belge oluşturma aracı</Summary>
        <Description xml:lang="tr">Metin dosyalarını postscript belgelere dönüştüren, dönüşüm sırasında renklendirme, sayfa düzeni ve boyut değiştirme gibi biçimlendirmeler yapabilen bir araç</Description>
    </Source>
</PISI>


code:
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Licensed under the GNU General Public License, version 3.
# See the file http://www.gnu.org/licenses/gpl.txt

from pisi.actionsapi import get
from pisi.actionsapi import autotools
from pisi.actionsapi import pisitools
from pisi.actionsapi import shelltools
from pisi.actionsapi import perlmodules

def setup():
    # The LANG vars aren't reset early enough so when sed tries to use [a-zA-Z], it borks
    shelltools.export("LC_ALL", "C")
    shelltools.export("LANG", "C")

    autotools.autoconf()
    autotools.configure()

def build():
    autotools.make()

def install():
    autotools.rawInstall("DESTDIR=%s" % get.installDIR())

    shelltools.cd("lib")
    perlmodules.configure()
    perlmodules.make()
    perlmodules.install()
    shelltools.cd("..")

    pisitools.dodoc("ChangeLog", "COPYING", "README", "TODO", "USAGE")


code:
case "$1" in
    configure)
        # Do the following only if CUPS is running and the needed CUPS tools
        # are available
	if which lpstat > /dev/null 2>&1 && \
	    which lpinfo > /dev/null 2>&1 && \
	    which lpadmin > /dev/null 2>&1 && \
	    lpstat -r > /dev/null 2>&1; then
 	    # Update the PPD files of all already installed print queues
	    driverregexp='^foomatic:'
	    gennicknameregexp=''
	    [ ! -z "$gennicknameregexp" ] && \
		gennicknameregexp="; $gennicknameregexp"
	    gennicknameregexp='s/\s*\(recommended\)//'"$gennicknameregexp"
	    tempfiles=
	    trap 'rm -f $tempfiles; exit 0' 0 1 2 13 15
	    tmpfile1=`mktemp -t updateppds.XXXXXX`
	    tempfiles="$tempfiles $tmpfile1"
	    lpinfo -m | grep -E $driverregexp > $tmpfile1
	    cd /etc/cups/ppd
	    for ppd in `ls -1 *.ppd 2>/dev/null`; do
		queue=${ppd%.ppd}
		nickname=`grep '\*NickName:' $ppd | cut -d '"' -f 2 | perl -p -e 's/\n$//' | perl -p -e "$gennicknameregexp" | perl -p -e 's/(\W)/\\\\$1/g'`
		lang=`grep '\*LanguageVersion:' $ppd | cut -d ' ' -f 2 | perl -e 'print lc(<>)' | perl -p -e 's/[\r\n]//gs'`
		ppdfound="0"
		englishppduri=""
		tmpfile2=`mktemp -t updateppds.XXXXXX`
		tempfiles="$tempfiles $tmpfile2"
		cat $tmpfile1 | perl -p -e "$gennicknameregexp" | grep -E '^\S+\s+.*'"$nickname"'$' | cut -d ' ' -f 1 > $tmpfile2
		while read newppduri; do
		    [ "$ppdfound" = "0" ] && lpadmin -p $queue -m $newppduri
		    newlang=`grep '\*LanguageVersion:' $ppd | cut -d ' ' -f 2 | perl -e 'print lc(<>)' | perl -p -e 's/[\r\n]//gs'`
		    [ "$newlang" = "$lang" ] && ppdfound="1"
		    [ "$newlang" = "english" ] && englishppduri="$newppduri"
		done < $tmpfile2
		[ "$ppdfound" = "0" ] && [ ! -z "$englishppduri" ] && lpadmin -p $queue -m $englishppduri && ppdfound="1"
		[ "$ppdfound" = "1" ] && echo PPD for printer $queue updated >&2
	    done
	fi
    ;;

    abort-upgrade|abort-remove|abort-deconfigure)
    ;;

    *)
        echo "postinst called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0


code:
diff --git a/Makefile.in b/Makefile.in
index 3014185..81e090d 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -42,7 +42,7 @@ LOCAL_LIBDIR=@LOCAL_LIBDIR@
 FOOMATIC_RIP=@FOOMATIC_RIP@

 # foomatic-rip path for a "make inplace" installation
-LOCAL_FOOMATIC_RIP=@LOCAL_FOOMATIC_RIP@
+LOCAL_FOOMATIC_RIP=@FOOMATIC_RIP@

 # Locations for installing the components of this package
 BINDIR=$(bindir)


code:
--- foomatic-db-engine-4.0.2/Makefile.in.orig	2009-07-23 11:45:28.487999828 +0200
+++ foomatic-db-engine-4.0.2/Makefile.in	2009-07-23 11:45:53.939525006 +0200
@@ -231,10 +231,10 @@
 	( cd lib && $(PERL) Makefile.PL verbose INSTALLDIRS=$(PERL_INSTALLDIRS) )

 foomatic-combo-xml: foomatic-combo-xml.c
-	$(CC) $(CFLAGS) -o foomatic-combo-xml foomatic-combo-xml.c
+	$(CC) $(CFLAGS) $(LDFLAGS) -o foomatic-combo-xml foomatic-combo-xml.c

 foomatic-perl-data: foomatic-perl-data.c
-	$(CC) $(CFLAGS) $(XML_CFLAGS) -o foomatic-perl-data foomatic-perl-data.c $(XML_LIBS)
+	$(CC) $(CFLAGS) $(LDFLAGS) -o foomatic-perl-data foomatic-perl-data.c $(XML_CFLAGS) $(XML_LIBS)

 man: lib/Foomatic/Defaults.pm
 	chmod a+rx ./makeMan


code:
--- configure.ac.OSmanOS	2011-07-25 12:51:20.000000000 +0300
+++ configure.ac	2012-11-20 13:21:36.921307899 +0200
@@ -163,27 +163,6 @@
 fi

-AC_MSG_CHECKING(how to redirect Ghostscript output to fd 3)
-if test "$DEVFD3" = "" ; then
-	v=`( if test -d /dev/fd ; then echo 3 >/dev/fd/3; fi) 3>&1 1>&2`
-	if test "$v" != "" ; then
-		DEVFD3=/dev/fd/3
-		DEVFD0=/dev/fd/0
-	else
-		DEVFD3="|$CAT >&3"
-		DEVFD0=-
-	fi
-	if test "$GS" != "GHOSTSCRIPT_NOT_FOUND" -a "$GSCHECK" != "no" ; then
-	   rm -f gs_out
-	   gs -q -dBATCH -dNOPAUSE -dSAFER -dPARANOIDSAFER -sDEVICE=laserjet "-sOutputFile=$DEVFD3" ${srcdir}/gsPrint 3>gs_out
-	   if test "!" -s gs_out ; then
-		AC_MSG_ERROR("ERROR - gs cannot handle -sOutputFile=$OUT" )
-	   fi
-	fi
-fi
-AC_MSG_RESULT(using $DEVFD3)
-AC_SUBST(DEVFD3)
-AC_SUBST(DEVFD0)

 # Check for Perl
 AC_PATH_PROGS(PERL,perl,/usr/bin/perl,$BINSEARCHPATH)


code:
diff -Nur foomatic-db-engine-3.0-20061031-old/Makefile.in foomatic-db-engine-3.0-20061031/Makefile.in
--- foomatic-db-engine-3.0-20061031-old/Makefile.in	2006-11-08 10:33:59.000000000 +0200
+++ foomatic-db-engine-3.0-20061031/Makefile.in	2006-11-08 10:38:44.000000000 +0200
@@ -42,7 +42,7 @@
 FOOMATIC_RIP=@FOOMATIC_RIP@

 # foomatic-rip path for a "make inplace" installation
-LOCAL_FOOMATIC_RIP=@LOCAL_FOOMATIC_RIP@
+LOCAL_FOOMATIC_RIP=@FOOMATIC_RIP@

 # Locations for installing the components of this package
 BINDIR=$(bindir)
@@ -186,10 +186,10 @@
 install-bin: check-config lib/Makefile
 #	This is the only way to get the Perl-generated Makefile using
 #	$(DESTDIR) properly
-	( cd lib && \
-	  $(MAKE) PREFIX=$(PERLPREFIX) && \
-	  $(MAKE) PREFIX=$(DESTDIR)$(PERLPREFIX) pure_install \
-	)
+#	( cd lib && \
+#	  $(MAKE) PREFIX=$(PERLPREFIX) && \
+#	  $(MAKE) PREFIX=$(DESTDIR)$(PERLPREFIX) pure_install \
+#	)
 	${SRC}/mkinstalldirs $(DESTDIR)$(BINDIR)
 	${SRC}/mkinstalldirs $(DESTDIR)$(SBINDIR)
 	${SRC}/mkinstalldirs $(DESTDIR)$(ETCDIR)


code:
<?xml version="1.0" ?>
<!DOCTYPE PISI SYSTEM "http://www.pisilinux.org/projeler/pisi/pisi-spec.dtd">
<PISI>
    <Source>
        <Name>foomatic-db-engine</Name>
        <Homepage>http://www.linuxprinting.org/</Homepage>
        <Packager>
            <Name>PisiLinux Community</Name>
            <Email>admins@pisilinux.org</Email>
        </Packager>
        <License>GPLv2</License>
        <IsA>app:console</IsA>
        <Summary>Foomatic printer database engine</Summary>
        <Description>foomatic-db-engine is the layer that provides the database engine to Foomatic.</Description>
        <Archive sha1sum="c3b747113b6a64b998000774e7c2d03ce48654c1" type="targz">http://www.openprinting.org/download/foomatic/foomatic-db-engine-4.0.12.tar.gz</Archive>
        <BuildDependencies>
            <Dependency>libxml2-devel</Dependency>
            <Dependency>cups-devel</Dependency>
        </BuildDependencies>
        <Patches>
            <Patch level="0">foomatic-db-engine-4.0.8-fix-sandbox.patch</Patch>
            <Patch level="1">4.0.7-perl-module.patch</Patch>
            <Patch level="1">4.0.7-respect-ldflag.patch</Patch>
        </Patches>
    </Source>

    <Package>
        <Name>foomatic-db-engine</Name>
        <RuntimeDependencies>
            <Dependency>libxml2</Dependency>
        </RuntimeDependencies>
        <Files>
            <Path fileType="executable">/usr/bin</Path>
            <Path fileType="executable">/usr/sbin</Path>
            <Path fileType="library">/usr/lib</Path>
            <Path fileType="config">/etc/foomatic</Path>
            <Path fileType="data">/usr/share/foomatic/templates</Path>
            <Path fileType="man">/usr/share/man</Path>
            <Path fileType="doc">/usr/share/doc</Path>
        </Files>
    </Package>

    <History>
        <Update release="3">
            <Date>2017-02-28</Date>
            <Version>4.0.12</Version>
            <Comment>Rebuild for new Toolchain.</Comment>
            <Name>Stefan Gronewold(groni)</Name>
            <Email>groni@pisilinux.org</Email>
        </Update>
        <Update release="2">
            <Date>2016-06-09</Date>
            <Version>4.0.12</Version>
            <Comment>Release Bump</Comment>
            <Name>Pisi Linux Community</Name>
            <Email>admin@pisilinux.org</Email>
        </Update>
        <Update release="1">
            <Date>2016-03-24</Date>
            <Version>4.0.12</Version>
            <Comment>First release</Comment>
            <Name>Ayhan Yalçınsoy</Name>
            <Email>ayhanyalcinsoy@pisilinux.org</Email>
        </Update>
    </History>
</PISI>


code:
<?xml version="1.0" ?>
<PISI>
    <Source>
        <Name>foomatic-db-engine</Name>
        <Summary xml:lang="tr">Foomatic yazıcı veritabanı motoru</Summary>
        <Description xml:lang="tr">foomatic-db-engine, Foomatic veritabanı motorunu oluşturan katmandır.</Description>
    </Source>
</PISI>


code:
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Licensed under the GNU General Public License, version 3.
# See the file http://www.gnu.org/licenses/gpl.txt

from pisi.actionsapi import get
from pisi.actionsapi import autotools
from pisi.actionsapi import pisitools
from pisi.actionsapi import shelltools
from pisi.actionsapi import perlmodules

def setup():
    # The LANG vars aren't reset early enough so when sed tries to use [a-zA-Z], it borks
    shelltools.export("LC_ALL", "C")
    shelltools.export("LANG", "C")

    autotools.autoconf()
    autotools.configure()

def build():
    autotools.make()

def install():
    autotools.rawInstall("DESTDIR=%s" % get.installDIR())

    pisitools.dodoc("ChangeLog", "COPYING", "README", "USAGE")


code:
<?xml version="1.0" ?>
<!DOCTYPE PISI SYSTEM "http://www.pisilinux.org/projeler/pisi/pisi-spec.dtd">
<PISI>
    <Source>
        <Name>foomatic-db-nonfree</Name>
        <Homepage>http://www.linuxprinting.org/</Homepage>
        <Packager>
            <Name>Osman Erkan</Name>
            <Email>osman.erkan@pisilinux.org</Email>
        </Packager>
        <License>Custom</License>
        <IsA>app:console</IsA>
        <Summary>Foomatic printer database nonfree</Summary>
        <Description>Foomatic - database extension consisting of manufacturer-supplied PPD files released under non-free licenses.</Description>
         <Archive sha1sum="dc60930a405d000ec034c21d9c0e6d31d8ec4b56" type="targz">http://www.openprinting.org/download/foomatic/foomatic-db-nonfree-20171214.tar.gz</Archive>
        <BuildDependencies>
            <Dependency>cups-devel</Dependency>
            <Dependency>foomatic-db</Dependency>
        </BuildDependencies>
    </Source>

    <Package>
        <Name>foomatic-db-nonfree</Name>
        <RuntimeDependencies>
            <Dependency>foomatic-db</Dependency>
        </RuntimeDependencies>
        <Files>
            <Path fileType="data">/usr/share/foomatic/db/</Path>
            <Path fileType="doc">/usr/share/doc/foomatic-db-nonfree</Path>
        </Files>
    </Package>

    <History>
        <Update release="4">
            <Date>2017-12-14</Date>
            <Version>20171214</Version>
            <Comment>Version Bump.</Comment>
            <Name>Ayhan Yalçınsoy</Name>
            <Email>ayhanyalcinsoy@pisilinux.org</Email>
        </Update>
        <Update release="3">
            <Date>2017-04-09</Date>
            <Version>20170409</Version>
            <Comment>Version Bump</Comment>
            <Name>Kamil Atlı</Name>
            <Email>suvari@pisilinux.org</Email>
        </Update>
        <Update release="2">
            <Date>2016-06-09</Date>
            <Version>20160609</Version>
            <Comment>Release Bump</Comment>
            <Name>Pisi Linux Community</Name>
            <Email>admin@pisilinux.org</Email>
        </Update>
        <Update release="1">
            <Date>2016-03-26</Date>
            <Version>20160326</Version>
            <Comment>First release</Comment>
            <Name>Alihan Öztürk</Name>
            <Email>alihan@pisilinux.org</Email>
        </Update>
    </History>
</PISI>


code:
<?xml version="1.0" ?>
<PISI>
    <Source>
        <Name>foomatic-db-nonfree</Name>
        <Summary xml:lang="en">Foomatic printer database nonfree</Summary>
        <Description xml:lang="en">Foomatic - database extension consisting of manufacturer-supplied PPD files released under non-free licenses.</Description>
    </Source>
</PISI>


code:
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Licensed under the GNU General Public License, version 3.
# See the file http://www.gnu.org/licenses/gpl.txt

from pisi.actionsapi import get
from pisi.actionsapi import autotools

NoStrip = "/"

def setup():
    # For gutenprint printers, use gutenprint-ijs-simplified.5.2
    #pisitools.dosed("db/source/printer/*.xml", ">gutenprint<", ">gutenprint-ijs-simplified.5.2<")

    autotools.configure()

    # Cleanup conflicts
    #shelltools.cd("db/source")
    #shelltools.system("../../cleanup-conflicts")

def install():
    autotools.rawInstall("DESTDIR=%s" % get.installDIR())

    # Fix permissions
    #for root, dirs, files in os.walk("%s/usr/share/foomatic/db" % get.installDIR()):
    #    for name in dirs:
    #        shelltools.chmod(os.path.join(root, name), 0755)
    #    for name in files:
    #        shelltools.chmod(os.path.join(root, name), 0644)


code:
#!/bin/bash

# Running this script cleanups XML's which conflicts with other
# packages like foo2zjs, lexmark X125, etc.

# Remove references to foo2zjs, foo2oak, foo2hp and foo2qpdl (bug #208851).
# Also foo2lava, foo2kyo, foo2xqx (bug #438319).

# Remove Samsung-CLP-300, Samsung-CLP-315 (bug #625505)
find printer -name '*.xml' |grep -E 'Samsung-CLP-300|Samsung-CLP-315'|xargs rm -vf

for x in zjs oak oak-z1 hp qpdl lava kyo xqx hiperc slx
do
    find printer -name '*.xml' | xargs grep -l "<driver>foo2${x}"| xargs rm -vf
    rm -f driver/foo2${x}.xml opt/foo2${x}-*
done

# Same for m2300w/m2400w
find printer -name '*.xml' |xargs grep -l '<driver>m2[34]00w<'|xargs rm -vf
rm -f driver/m2300w.xml driver/m2400w.xml opt/m2300w-*

# Same for all these.
for x in drv_x125 ml85p pbm2lwxl pbmtozjs bjc800j
do
    find printer -name '*.xml' |xargs grep -l "<driver>${x}</driver>"|xargs rm -vf
    rm -vf driver/${x}.xml opt/${x}-*
done

# We also have those one in foo2zjs
#source/driver/foo2oak-z1.xml
#source/driver/foo2slx.xml


code:
diff -up foomatic-db-20120103/db/source/PPD/Brother/BR8840_2_GPL.ppd.device-ids-20120103 foomatic-db-20120103/db/source/PPD/Brother/BR8840_2_GPL.ppd
--- foomatic-db-20120103/db/source/PPD/Brother/BR8840_2_GPL.ppd.device-ids-20120103	2012-01-03 00:40:44.000000000 +0000
+++ foomatic-db-20120103/db/source/PPD/Brother/BR8840_2_GPL.ppd	2012-02-24 09:33:37.047452635 +0000
@@ -32,6 +32,7 @@
 *ShortNickName: "Brother MFC-8840D BR-Script3"
 *ModelName: "Brother MFC-8840D BR-Script3"
 *NickName: "Brother MFC-8840D BR-Script3"
+*1284DeviceID: "MFG:Brother;MDL:MFC-8840D;CMD:HBP,PJL,PCL,PCLXL;"

 *%==== Basic Device Capabilities =============
 *LanguageLevel: "3"
diff -up foomatic-db-20120103/db/source/PPD/Lexmark/Lexmark_C543.ppd.device-ids-20120103 foomatic-db-20120103/db/source/PPD/Lexmark/Lexmark_C543.ppd
--- foomatic-db-20120103/db/source/PPD/Lexmark/Lexmark_C543.ppd.device-ids-20120103	2012-01-03 00:40:44.000000000 +0000
+++ foomatic-db-20120103/db/source/PPD/Lexmark/Lexmark_C543.ppd	2012-02-24 09:33:37.049452637 +0000
@@ -62,7 +62,7 @@
 *LXCountPIN: "4"
 *LXlowPINchar: "0"
 *LXhiPINchar: "9"
-*1284DeviceID: "MFG: Lexmark;MDL: Lexmark C543"
+*1284DeviceID: "MFG:Lexmark International;MDL:Lexmark C543;"
 *FreeVM: "252000000"
 *VMOption 256Meg: "252000000"
 *VMOption 320Meg: "312000000"
diff -up foomatic-db-20120103/db/source/printer/Brother-MFC-8840D.xml.device-ids-20120103 foomatic-db-20120103/db/source/printer/Brother-MFC-8840D.xml
--- foomatic-db-20120103/db/source/printer/Brother-MFC-8840D.xml.device-ids-20120103	2012-02-24 09:33:36.314452298 +0000
+++ foomatic-db-20120103/db/source/printer/Brother-MFC-8840D.xml	2012-02-24 09:33:37.051452638 +0000
@@ -15,7 +15,7 @@
   </lang>
   <autodetect>
     <general>
-      <ieee1284>MFG:Brother;MDL:Brother MFC-8840D;</ieee1284>
+      <ieee1284>MFG:Brother;MDL:MFC-8840D;CMD:HBP,PJL,PCL,PCLXL;</ieee1284>
       <manufacturer>Brother</manufacturer>
       <model>Brother MFC-8840D</model>
     </general>
diff -up foomatic-db-20120103/db/source/printer/HP-DeskJet_720C.xml.device-ids-20120103 foomatic-db-20120103/db/source/printer/HP-DeskJet_720C.xml
--- foomatic-db-20120103/db/source/printer/HP-DeskJet_720C.xml.device-ids-20120103	2012-02-24 09:33:36.401452339 +0000
+++ foomatic-db-20120103/db/source/printer/HP-DeskJet_720C.xml	2012-02-24 09:33:37.087452655 +0000
@@ -20,7 +20,7 @@
       <commandset>SCP,VLINK</commandset>
       <description>Hewlett-Packard DeskJet 720 Series</description>
       <manufacturer>HEWLETT-PACKARD</manufacturer>
-      <model>DESKJET 720</model>
+      <model>DESKJET 720C</model>
     </parallel>
   </autodetect>
   <functionality>A</functionality>
diff -up foomatic-db-20120103/db/source/printer/HP-LaserJet_M1522nf_MFP.xml.device-ids-20120103 foomatic-db-20120103/db/source/printer/HP-LaserJet_M1522nf_MFP.xml
--- foomatic-db-20120103/db/source/printer/HP-LaserJet_M1522nf_MFP.xml.device-ids-20120103	2012-02-24 09:33:36.411452343 +0000
+++ foomatic-db-20120103/db/source/printer/HP-LaserJet_M1522nf_MFP.xml	2012-02-24 09:33:37.089452655 +0000
@@ -13,6 +13,13 @@
     <postscript level="3" />
     <pcl level="6" />
   </lang>
+  <autodetect>
+    <usb>
+      <commandset>PJL,PML,PCLXL,POSTSCRIPT,PCL</commandset>
+      <manufacturer>Hewlett-Packard</manufacturer>
+      <model>HP LaserJet MFP M1522nf MFP</model>
+    </usb>
+  </autodetect>
   <functionality>D</functionality>
   <driver>pxlmono</driver>
   <drivers>
diff -up foomatic-db-20120103/db/source/printer/Kyocera-FS-1118MFP.xml.device-ids-20120103 foomatic-db-20120103/db/source/printer/Kyocera-FS-1118MFP.xml
--- foomatic-db-20120103/db/source/printer/Kyocera-FS-1118MFP.xml.device-ids-20120103	2012-02-24 09:34:34.375478948 +0000
+++ foomatic-db-20120103/db/source/printer/Kyocera-FS-1118MFP.xml	2012-02-24 09:41:52.635757050 +0000
@@ -19,10 +19,10 @@
   </lang>
   <autodetect>
     <general>
-      <ieee1284>MFG:Kyocera;MODEL:Kyocera FS-1118MFP;COMMAND SET: POSTSCRIPT,PJL,PCL</ieee1284>
-      <commandset>POSTSCRIPT,PJL,PCL</commandset>
+      <ieee1284>MFG:Kyocera;MODEL:FS-1118MFP;CMD:PCLXL,PostScript Emulation,PCL5E,PJL;</ieee1284>
+      <commandset>CMD:PCLXL,PostScript Emulation,PCL5E,PJL</commandset>
       <manufacturer>Kyocera</manufacturer>
-      <model>Kyocera FS-1118MFP</model>
+      <model>FS-1118MFP</model>
     </general>
   </autodetect>
   <functionality>A</functionality>
diff -up foomatic-db-20120103/db/source/printer/Lexmark-C543.xml.device-ids-20120103 foomatic-db-20120103/db/source/printer/Lexmark-C543.xml
--- foomatic-db-20120103/db/source/printer/Lexmark-C543.xml.device-ids-20120103	2012-02-24 09:33:36.463452367 +0000
+++ foomatic-db-20120103/db/source/printer/Lexmark-C543.xml	2012-02-24 09:33:37.090452655 +0000
@@ -15,7 +15,7 @@
   </lang>
   <autodetect>
     <general>
-      <ieee1284>MFG: Lexmark;MDL: Lexmark C543</ieee1284>
+      <ieee1284>MFG:Lexmark International;MDL:Lexmark C543;</ieee1284>
       <manufacturer>Lexmark</manufacturer>
       <model>Lexmark C543</model>
     </general>
diff -up foomatic-db-20130911/db/source/printer/Brother-HL-2040.xml.device-ids foomatic-db-20130911/db/source/printer/Brother-HL-2040.xml
--- foomatic-db-20130911/db/source/printer/Brother-HL-2040.xml.device-ids	2013-09-11 15:55:21.853642637 +0200
+++ foomatic-db-20130911/db/source/printer/Brother-HL-2040.xml	2013-09-11 15:53:30.775176972 +0200
@@ -15,6 +15,13 @@
     <pcl level="5e" />
     <pjl />
   </lang>
+  <autodetect>
+    <general>
+      <ieee1284>MFG:Brother;MDL:HL-2040 series;CMD:PJL,HBP;</ieee1284>
+      <manufacturer>Brother</manufacturer>
+      <model>Brother HL-2040 series</model>
+    </general>
+  </autodetect>
   <functionality>B</functionality>
   <driver>hl1250</driver>
   <drivers>


code:
diff -up foomatic-db-20131218/db/source/driver/Postscript.xml.orig foomatic-db-20131218/db/source/driver/Postscript.xml
--- foomatic-db-20131218/db/source/driver/Postscript.xml.orig	2013-12-18 01:41:18.000000000 +0100
+++ foomatic-db-20131218/db/source/driver/Postscript.xml	2013-12-18 15:09:08.471674405 +0100
@@ -358,9 +358,6 @@
       <id>printer/HP-Business_Inkjet_3000</id>
     </printer>
     <printer>
-      <id>printer/HP-Business_Inkjet_9100</id>
-    </printer>
-    <printer>
       <id>printer/HP-Color_LaserJet_2500</id>
     </printer>
     <printer>
@@ -1066,9 +1063,6 @@
       <id>printer/Oce-3155PS</id>
     </printer>
     <printer>
-      <id>printer/Oce-3165</id>
-    </printer>
-    <printer>
       <id>printer/Oce-3165PS</id>
     </printer>
     <printer>


code:
<?xml version="1.0" ?>
<!DOCTYPE PISI SYSTEM "http://www.pisilinux.org/projeler/pisi/pisi-spec.dtd">
<PISI>
    <Source>
        <Name>foomatic-db</Name>
        <Homepage>http://www.linuxprinting.org/foomatic.html</Homepage>
        <Packager>
            <Name>PisiLinux Community</Name>
            <Email>admins@pisilinux.org</Email>
        </Packager>
        <License>GPLv2+</License>
        <IsA>data</IsA>
        <Summary>Database of printers and printer drivers</Summary>
        <Description>foomatic-db contains the knowledge database for printers which are used by foomatic-db-engine to generate PPD files.</Description>
        <Archive sha1sum="a006a9d75cf0bfdf3f802dc711f26b16bd19c46d" type="tarxz">http://www.openprinting.org/download/foomatic/foomatic-db-4.0-20171214.tar.xz</Archive>
        <AdditionalFiles>
            <AdditionalFile permission="0755" target="cleanup-conflicts">cleanup-script</AdditionalFile>
        </AdditionalFiles>
        <BuildDependencies>
            <!--<Dependency>cups-filters</Dependency>-->
        </BuildDependencies>
    </Source>

    <Package>
        <Name>foomatic-db</Name>
        <RuntimeDependencies>
            <Dependency>pnm2ppa</Dependency>
        </RuntimeDependencies>
        <Files>
            <Path fileType="data">/usr/share</Path>
        </Files>
    </Package>

    <History>
        <Update release="4">
            <Date>2017-12-14</Date>
            <Version>4.0.20171214</Version>
            <Comment>version bump.</Comment>
            <Name>Ayhan Yalçınsoy</Name>
            <Email>ayhanyalcinsoy@pisilinux.org</Email>
        </Update>
        <Update release="3">
            <Date>2017-02-28</Date>
            <Version>4.0.20170228</Version>
            <Comment>Release bump.</Comment>
            <Name>Stefan Gronewold(groni)</Name>
            <Email>groni@pisilinux.org</Email>
        </Update>
        <Update release="2">
            <Date>2016-06-09</Date>
            <Version>4.0.20160609</Version>
            <Comment>Release Bump</Comment>
            <Name>Pisi Linux Community</Name>
            <Email>admin@pisilinux.org</Email>
        </Update>
        <Update release="1">
            <Date>2016-03-26</Date>
            <Version>4.0.20160326</Version>
            <Comment>First release</Comment>
            <Name>Marcin Bojara</Name>
            <Email>marcin@pisilinux.org</Email>
        </Update>
    </History>
</PISI>


code:
<?xml version="1.0" ?>
<PISI>
    <Source>
        <Name>foomatic-db</Name>
        <Summary xml:lang="tr">Yazıcı sürücüleri</Summary>
        <Description xml:lang="tr">Foomatic yazıcı veritabanı ve sürücüleri</Description>
    </Source>
</PISI>


code:
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Licensed under the GNU General Public License, version 3.
# See the file http://www.gnu.org/licenses/gpl.txt

from pisi.actionsapi import shelltools
from pisi.actionsapi import autotools
from pisi.actionsapi import pisitools
from pisi.actionsapi import get

def setup():
    shelltools.system("sed -i 's:cups_sbindir=\"\/usr\/sbin\":cups_sbindir=\"\/usr\/bin\":g' m4/stp_cups.m4")
    shelltools.system("sed -i  's:cups_sbindir=\"\${cups_prefix}\/sbin\":cups_sbindir=\"\${cups_prefix}\/bin\":' m4/stp_cups.m4")
    shelltools.system("sed -i 's:m4local:m4extra:' Makefile.am")

    autotools.autoreconf("-fi")

    autotools.configure("--prefix=/usr \
                         --sbindir=/usr/bin \
                         --enable-samples \
                         --enable-cups-ppds \
                         --enable-cups-ppds-at-top-level \
                         --disable-translated-cups-ppds \
                         --disable-globalized-cups-ppds \
                         --disable-static \
                         --disable-static-genppd")

    pisitools.dosed("libtool", " -shared ", " -Wl,-O1,--as-needed -shared ")

def build():
    autotools.make()

def install():
    autotools.rawInstall("DESTDIR=%s install" % get.installDIR())


code:
#!/usr/bin/python
# -*- coding: utf-8 -*-

import os

def postInstall(fromVersion, fromRelease, toVersion, toRelease):
    os.system("/usr/sbin/cups-genppdupdate")