cups-browsed-2.0.0 new package
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env 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 get
|
||||
|
||||
def setup():
|
||||
autotools.configure("--localstatedir=/var \
|
||||
--with-rcdir=no \
|
||||
--enable-auto-setup-driverless-only")
|
||||
|
||||
def build():
|
||||
autotools.make()
|
||||
|
||||
def install():
|
||||
autotools.rawInstall("DESTDIR=%s" % get.installDIR())
|
||||
|
||||
pisitools.insinto("/usr/share/dbus-1/services", "daemon/cups-browsed.service")
|
||||
|
||||
pisitools.dodoc("AUTHORS", "LICENSE", "ChangeLog", "COPYING", "NEWS", "README*")
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
From 57d9351ea45f47b3bd185f263b1e37d276cf17b8 Mon Sep 17 00:00:00 2001
|
||||
From: Till Kamppeter <till.kamppeter@gmail.com>
|
||||
Date: Wed, 6 Dec 2023 01:03:48 +0100
|
||||
Subject: [PATCH] Better handle damage of queues created by cups-browsed
|
||||
|
||||
Fixes #429
|
||||
|
||||
In issue #429 queues created by cups-browsed (with
|
||||
"implicitclass://..." device URI) and left over after cups-browsed
|
||||
shuts down (or crashes or gets killed) lose their cups-browsed flag
|
||||
"cups-browsed=true" for some unknown reason and are not identified as
|
||||
created by cups-browsed any more, making cups-browsed creating a fresh
|
||||
queue with another name while the user continues printing on the old
|
||||
queue which cups-browsed does not take care of any more (assign
|
||||
destination printers for the jobs). So the user gets the message "No
|
||||
destination host name supplied by cups-browsed for printer ..." in
|
||||
the error_log of CUPS.
|
||||
|
||||
Done the following changes:
|
||||
|
||||
- Queues with "implicitclass://..." device URI are always created by
|
||||
cups-browsed, so consider them as such regardless of the
|
||||
"cups-browsed=true" attribute.
|
||||
|
||||
- If a queue gets overwritten and cups-browsed gets note of that by a
|
||||
printer-modified D-Bus notification, we will only drop control from
|
||||
this queue and create a new queue with a new name if the device URI
|
||||
gets replace by something different from "implicitclass://...". If
|
||||
the device URI stays intact and the PPD gets modified, we recover
|
||||
the PPD by regenerating the queue under its current name.
|
||||
|
||||
This especially prevents from queues with "implicitclass://..." device
|
||||
URI not being handled by cups-browsed.
|
||||
---
|
||||
daemon/cups-browsed.c | 27 ++++++++++++++++++++++++---
|
||||
1 file changed, 24 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/daemon/cups-browsed.c b/daemon/cups-browsed.c
|
||||
index c1e64fab..29fd34a1 100644
|
||||
--- a/daemon/cups-browsed.c
|
||||
+++ b/daemon/cups-browsed.c
|
||||
@@ -4090,6 +4090,13 @@ get_local_printers (void)
|
||||
cups_browsed_controlled = val && (!strcasecmp (val, "yes") ||
|
||||
!strcasecmp (val, "on") ||
|
||||
!strcasecmp (val, "true"));
|
||||
+ if (!cups_browsed_controlled &&
|
||||
+ strncmp(device_uri, "implicitclass://", 16) == 0)
|
||||
+ {
|
||||
+ cups_browsed_controlled = 1;
|
||||
+ debug_printf ("Printer %s with URI %s does not have the \"cups-browsed=true\" attribute set, considering cups-browsed-created anyway, due to the implicitclass backend being used.\n",
|
||||
+ dest->name, device_uri);
|
||||
+ }
|
||||
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
|
||||
"localhost", 0, "/printers/%s", dest->name);
|
||||
printer = new_local_printer (device_uri, get_printer_uuid(conn, uri),
|
||||
@@ -7176,7 +7183,11 @@ on_printer_deleted (CupsNotifier *object,
|
||||
}
|
||||
|
||||
|
||||
-static int
|
||||
+static int // 0: Queue OK, keep
|
||||
+ // 1: Device URI overwritten, drop
|
||||
+ // control
|
||||
+ // 2: URI OK, PPD overwritten,
|
||||
+ // recreate queue
|
||||
queue_overwritten (remote_printer_t *p)
|
||||
{
|
||||
http_t *conn = NULL;
|
||||
@@ -7306,7 +7317,7 @@ queue_overwritten (remote_printer_t *p)
|
||||
p->queue_name, (p->nickname ? p->nickname : "(no PPD)"),
|
||||
(makemodel ? makemodel :
|
||||
"(NickName not readable)"));
|
||||
- overwritten = 1;
|
||||
+ overwritten = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7349,7 +7360,7 @@ on_printer_modified (CupsNotifier *object,
|
||||
// avoid an infinite recursion
|
||||
goto end;
|
||||
|
||||
- if (queue_overwritten(p))
|
||||
+ if (queue_overwritten(p) == 1)
|
||||
{
|
||||
// Our generated local queue pointing to a remote printer got
|
||||
// overwritten by an externally created queue with the same
|
||||
@@ -7470,6 +7481,16 @@ on_printer_modified (CupsNotifier *object,
|
||||
if (in_shutdown == 0)
|
||||
recheck_timer();
|
||||
}
|
||||
+ else if (queue_overwritten(p) == 2)
|
||||
+ {
|
||||
+ // Only the PPD got overwritten, the device URI is still
|
||||
+ // "implicitclass://...", so we have a totally broken queue
|
||||
+ // and simply re-create it under its original name
|
||||
+ p->status = STATUS_TO_BE_CREATED;
|
||||
+ p->timeout = time(NULL) + TIMEOUT_IMMEDIATELY;
|
||||
+ debug_printf("CUPS queue %s with URI %s got damaged (PPD overwritten). Re-create it.",
|
||||
+ printer, p->uri);
|
||||
+ }
|
||||
else
|
||||
{
|
||||
if (terminating)
|
||||
@@ -0,0 +1,62 @@
|
||||
<?xml version="1.0" ?>
|
||||
<!DOCTYPE PISI SYSTEM "http://www.pisilinux.org/projeler/pisi/pisi-spec.dtd">
|
||||
<PISI>
|
||||
<Source>
|
||||
<Name>cups-browsed</Name>
|
||||
<Homepage>https://github.com/OpenPrinting/cups-browsed</Homepage>
|
||||
<Packager>
|
||||
<Name>PisiLinux Community</Name>
|
||||
<Email>admins@pisilinux.org</Email>
|
||||
</Packager>
|
||||
<License>Apache</License>
|
||||
<IsA>library</IsA>
|
||||
<Summary>helper daemon to browse for remote CUPS queues and IPP network printers</Summary>
|
||||
<Icon>cups-browsed</Icon>
|
||||
<Description>Uzak CUPS kuyruklarına ve IPP ağ yazıcılarına göz atmak için yardımcı arka plan programı</Description>
|
||||
<Archive sha1sum="240b45a43bcc0a01a373ffb7c9bbff005b1fe3c1" type="tarxz">https://github.com/OpenPrinting/cups-browsed/releases/download/2.0.0/cups-browsed-2.0.0.tar.xz</Archive>
|
||||
<BuildDependencies>
|
||||
<Dependency>cups-devel</Dependency>
|
||||
<Dependency>glib2-devel</Dependency>
|
||||
<Dependency>libppd-devel</Dependency>
|
||||
<Dependency>python3-devel</Dependency>
|
||||
<Dependency>avahi-glib-devel</Dependency>
|
||||
<Dependency>avahi-libs</Dependency>
|
||||
<Dependency>libcupsfilters-devel</Dependency>
|
||||
<Dependency>openldap-client</Dependency>
|
||||
</BuildDependencies>
|
||||
<Patches>
|
||||
<Patch level="1">0001-Better-handle-damage-of-queues-created-by-cups-browsed.patch</Patch>
|
||||
</Patches>
|
||||
</Source>
|
||||
|
||||
<Package>
|
||||
<Name>cups-browsed</Name>
|
||||
<RuntimeDependencies>
|
||||
<Dependency>cups</Dependency>
|
||||
<Dependency>glib2</Dependency>
|
||||
<Dependency>libppd</Dependency>
|
||||
<Dependency>avahi-glib</Dependency>
|
||||
<Dependency>avahi-libs</Dependency>
|
||||
<Dependency>libcupsfilters</Dependency>
|
||||
<Dependency>openldap-client</Dependency>
|
||||
</RuntimeDependencies>
|
||||
<Files>
|
||||
<Path fileType="executable">/usr/sbin</Path>
|
||||
<Path fileType="config">/etc</Path>
|
||||
<Path fileType="library">/usr/lib</Path>
|
||||
<Path fileType="data">/usr/share</Path>
|
||||
<Path fileType="man">/usr/share/man</Path>
|
||||
<Path fileType="doc">/usr/share/doc</Path>
|
||||
</Files>
|
||||
</Package>
|
||||
|
||||
<History>
|
||||
<Update release="1">
|
||||
<Date>2024-05-16</Date>
|
||||
<Version>2.0.0</Version>
|
||||
<Comment>First release</Comment>
|
||||
<Name>PisiLinux Community</Name>
|
||||
<Email>admins@pisilinux.org</Email>
|
||||
</Update>
|
||||
</History>
|
||||
</PISI>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" ?>
|
||||
<PISI>
|
||||
<Source>
|
||||
<Name>cups-browsed</Name>
|
||||
<Summary xml:lang="tr">helper daemon to browse for remote CUPS queues and IPP network printers</Summary>
|
||||
<Description xml:lang="tr">Uzak CUPS kuyruklarına ve IPP ağ yazıcılarına göz atmak için yardımcı arka plan programı</Description>
|
||||
</Source>
|
||||
</PISI>
|
||||
Reference in New Issue
Block a user