This commit is contained in:
Tim Waugh 2013-08-13 15:20:40 +01:00
parent c61f61ece3
commit 5edcd874f9
7 changed files with 12 additions and 3860 deletions

1
.gitignore vendored
View File

@ -11,3 +11,4 @@
/cups-filters-1.0.33.tar.xz
/cups-filters-1.0.34.tar.xz
/cups-filters-1.0.35.tar.xz
/cups-filters-1.0.36.tar.xz

File diff suppressed because it is too large Load Diff

View File

@ -1,27 +0,0 @@
diff -up cups-filters-1.0.34/utils/cups-browsed.c.lookup cups-filters-1.0.34/utils/cups-browsed.c
--- cups-filters-1.0.34/utils/cups-browsed.c.lookup 2013-06-26 16:23:38.000000000 +0200
+++ cups-filters-1.0.34/utils/cups-browsed.c 2013-06-26 16:24:28.491804795 +0200
@@ -990,23 +990,6 @@ found_cups_printer (const char *remote_h
debug_printf("cups-browsed: browsed queue name is %s\n",
local_resource + 9);
- /* Does the host need resolving? */
- if (host[strspn (host, "0123456789.")] == '\0') {
- /* Yes. Resolve it. */
- struct addrinfo hints, *addr;
- memset(&hints, 0, sizeof(struct addrinfo));
- hints.ai_family = AF_UNSPEC;
- hints.ai_socktype = SOCK_DGRAM;
- hints.ai_flags = 0;
- hints.ai_protocol = 0;
- if (!getaddrinfo (host, NULL, &hints, &addr)) {
- getnameinfo (addr->ai_addr, addr->ai_addrlen,
- host, sizeof(host),
- NULL, 0, 0);
- freeaddrinfo (addr);
- }
- }
-
generate_local_queue(host, port, local_resource, info ? info : "", "", "");
}

View File

@ -1,179 +0,0 @@
diff -up cups-filters-1.0.35/Makefile.am.man cups-filters-1.0.35/Makefile.am
--- cups-filters-1.0.35/Makefile.am.man 2013-05-15 20:46:22.000000000 +0200
+++ cups-filters-1.0.35/Makefile.am 2013-07-01 14:03:58.395572035 +0200
@@ -618,7 +618,6 @@ EXTRA_DIST += \
# UTILS
# =====
-EXTRA_DIST += utils/cups-browsed.in
sbin_PROGRAMS = \
cups-browsed
cups_browsed_SOURCES = \
@@ -636,6 +635,11 @@ cups_browsed_LDADD = \
$(GLIB_LIBS)
initrcdir = $(INITDDIR)
initrc_SCRIPTS = utils/cups-browsed
+man_MANS = \
+ utils/cups-browsed.8 \
+ utils/cups-browsed.conf.5
+EXTRA_DIST += utils/cups-browsed.in \
+ $(man_MANS)
# ===
# PPD
diff -up cups-filters-1.0.35/utils/cups-browsed.8.man cups-filters-1.0.35/utils/cups-browsed.8
--- cups-filters-1.0.35/utils/cups-browsed.8.man 2013-07-01 14:03:58.404571910 +0200
+++ cups-filters-1.0.35/utils/cups-browsed.8 2013-07-01 14:03:58.404571910 +0200
@@ -0,0 +1,56 @@
+.\"Text automatically generated by txt2man
+.TH cups-browsed 8 "29 June 2013" "" ""
+.SH NAME
+\fBcups-browsed \fP- A daemon for browsing the Bonjour broadcasts of shared, remote CUPS printers
+\fB
+.SH SYNOPSIS
+.nf
+.fam C
+\fBcups-browsed\fP [\fB-v\fP | \fB-d\fP | \fB--debug\fP]
+
+.fam T
+.fi
+.fam T
+.fi
+.SH DESCRIPTION
+\fBcups-browsed\fP has three independently switchable functions:
+.IP 1. 4
+Browse Bonjour broadcasts of remote printers and create/remove local
+raw queues pointing to these printers.
+.IP 2. 4
+Browse CUPS broadcasts of remote printers and create/remove local raw
+queues pointing to these printers.
+.IP 3. 4
+Broadcast local queues with the CUPS protocol.
+.SH OPTIONS
+.TP
+.B
+\fB-v\fP, \fB-d\fP, \fB--debug\fP
+Debug mode
+.SH FILES
+/etc/cups/cups-browsed.conf
+.SH NOTES
+Please take references to cups 1.6.x to include newer versions.
+Similarily, cups 1.5.x is intended to encompass older versions too.
+.PP
+In environments with only cups 1.6.x servers and clients (plus
+\fBcups-browsed\fP on either server or client or both) the function described in 1.
+enables the automatic discovery of remote queues and their display in
+printing dialogues of applications and with command line tools.
+.PP
+The facility provided by 3. means that servers running cups 1.6.x plus
+\fBcups-browsed\fP can broadcast their local queues so that clients with cups
+1.5.x get these queues automatically available. The outcome of 2. is
+that clients running cups 1.6.x plus \fBcups-browsed\fP can use the CUPS
+broadcasts from servers with cups 1.5.x. As with browsing of Bonjour
+broadcasts, the created local raw queues are available to applications
+and command line tools.
+.SH SEE ALSO
+
+\fBcups-browsed.conf\fP(5)
+.PP
+/usr/share/doc/\fBcups-filters\fP/README
+.SH AUTHOR
+The authors of \fBcups-browsed\fP are listed in /usr/share/doc/\fBcups-filters\fP/AUTHORS.
+.PP
+This manual page was written for the Debian Project, but it may be used by others.
diff -up cups-filters-1.0.35/utils/cups-browsed.conf.5.man cups-filters-1.0.35/utils/cups-browsed.conf.5
--- cups-filters-1.0.35/utils/cups-browsed.conf.5.man 2013-07-01 14:03:58.404571910 +0200
+++ cups-filters-1.0.35/utils/cups-browsed.conf.5 2013-07-01 14:03:58.404571910 +0200
@@ -0,0 +1,92 @@
+.\"Text automatically generated by txt2man
+.TH cups-browsed.conf 5 "29 June 2013" "" ""
+.SH NAME
+\fBcups-browsed.conf \fP- server configuration file for cups-browsed
+\fB
+.SH DESCRIPTION
+The cups-browsed.conf file configures the cups-browsed daemon. It is normally
+located in the /etc/cups directory. Each line in the file can be a
+configuration directive, a blank line, or a comment. Comment lines start
+with the # character.
+.SH DIRECTIVES
+
+The BrowseAllow directive specifies a system or network to accept
+CUPS browse packets from. The default is to accept browse packets from
+all hosts when BrowseRemoteProtocols uses the CUPS protocol.
+.PP
+.nf
+.fam C
+ BrowseAllow 192.168.7.20
+ BrowseAllow 192.168.7.0/24
+ BrowseAllow 192.168.7.0/255.255.255.0
+
+
+.fam T
+.fi
+The BrowsePoll directive polls a server for available printers once
+every 60 seconds. Multiple BrowsePoll directives can be specified
+to poll multiple servers. The default port to connect to is 631.
+BrowsePoll works independently of whether CUPS browsing is activated
+in BrowseRemoteProtocols.
+.PP
+.nf
+.fam C
+ BrowsePoll 192.168.7.20
+ BrowsePoll 192.168.7.65:631
+ BrowsePoll host.example.com:631
+
+
+.fam T
+.fi
+The BrowseLocalProtocols directive specifies the protocols to use
+when advertising local shared printers on the network. The default
+is "none". Control of advertising of local shared printers using
+dnssd is done in /etc/cups/cupsd.conf.
+.PP
+.nf
+.fam C
+ BrowseLocalProtocols none
+ BrowseLocalProtocols CUPS
+
+
+.fam T
+.fi
+The BrowseRemoteProtocols directive specifies the protocols to use
+when finding remote shared printers on the network. Multiple
+protocols can be specified by separating them with spaces.
+The default is "dnssd cups".
+.PP
+.nf
+.fam C
+ BrowseRemoteProtocols none
+ BrowseRemoteProtocols CUPS dnssd
+ BrowseRemoteProtocols CUPS
+ BrowseRemoteProtocols dnssd
+
+.fam T
+.fi
+The BrowseProtocols directive specifies the protocols to use when
+finding remote shared printers on the network and advertising local
+shared printers. "dnssd" is ignored for BrowseLocalProtocols. Multiple
+protocols can be specified by separating them with spaces. The
+default is "none" for BrowseLocalProtocols and "dnssd cups" for
+BrowseRemoteProtocols.
+.PP
+.nf
+.fam C
+ BrowseProtocols none
+ BrowseProtocols CUPS dnssd
+ BrowseProtocols CUPS
+ BrowseProtocols dnssd
+
+.fam T
+.fi
+.SH SEE ALSO
+
+\fBcups-browsed\fP(8)
+.PP
+/usr/share/doc/cups-filters/README
+.SH AUTHOR
+The authors of cups-browsed are listed in /usr/share/doc/cups-filters/AUTHORS.
+.PP
+This manual page was written for the Debian Project, but it may be used by others.

View File

@ -1,229 +0,0 @@
diff -up cups-filters-1.0.35/filter/pdftopdf/pdftopdf.cc.page-label cups-filters-1.0.35/filter/pdftopdf/pdftopdf.cc
--- cups-filters-1.0.35/filter/pdftopdf/pdftopdf.cc.page-label 2013-04-09 19:14:42.000000000 +0100
+++ cups-filters-1.0.35/filter/pdftopdf/pdftopdf.cc 2013-07-24 08:49:23.919081384 +0100
@@ -9,6 +9,8 @@
#include <assert.h>
#include <cups/cups.h>
#include <cups/ppd.h>
+#include <iomanip>
+#include <sstream>
#include <memory>
#include "pdftopdf_processor.h"
@@ -402,8 +404,27 @@ void getParameters(ppd_file_t *ppd,int n
param.reverse=ppdDefaultOrder(ppd);
}
- // TODO: pageLabel (not used)
- // param.pageLabel=cupsGetOption("page-label",num_options,options); // strdup?
+ std::string rawlabel;
+ char *classification = getenv("CLASSIFICATION");
+ if (classification)
+ rawlabel.append (classification);
+
+ if ( (val=cupsGetOption("page-label", num_options, options)) != NULL) {
+ if (!rawlabel.empty())
+ rawlabel.append (" - ");
+ rawlabel.append(cupsGetOption("page-label",num_options,options));
+ }
+
+ std::ostringstream cookedlabel;
+ for (std::string::iterator it = rawlabel.begin();
+ it != rawlabel.end ();
+ ++it) {
+ if (*it < 32 || *it > 126)
+ cookedlabel << "\\" << std::oct << std::setfill('0') << std::setw(3) << (unsigned int) *it;
+ else
+ cookedlabel.put (*it);
+ }
+ param.pageLabel = cookedlabel.str ();
if ( (val=cupsGetOption("page-set",num_options,options)) != NULL) {
if (strcasecmp(val,"even")==0) {
diff -up cups-filters-1.0.35/filter/pdftopdf/pdftopdf_processor.cc.page-label cups-filters-1.0.35/filter/pdftopdf/pdftopdf_processor.cc
--- cups-filters-1.0.35/filter/pdftopdf/pdftopdf_processor.cc.page-label 2013-02-15 17:37:59.000000000 +0000
+++ cups-filters-1.0.35/filter/pdftopdf/pdftopdf_processor.cc 2013-07-24 09:50:04.437720618 +0100
@@ -80,12 +80,8 @@ void ProcessingParameters::dump() const
fprintf(stderr,"evenDuplex: %s\n",
(evenDuplex)?"true":"false");
-/*
- // std::string pageLabel; // or NULL? must stay/dup!
- ...
- ...
-
-*/
+ fprintf(stderr,"pageLabel: %s\n",
+ pageLabel.empty () ? "(none)" : pageLabel.c_str());
fprintf(stderr,"bookletMode: ");
BookletMode_dump(booklet);
@@ -206,6 +202,10 @@ bool processPDFTOPDF(PDFTOPDF_Processor
page->mirror();
}
+ if (!param.pageLabel.empty()) {
+ page->add_label(param.page, param.pageLabel);
+ }
+
// place border
if ( (param.border!=BorderType::NONE)&&(iA<numOrigPages) ) {
#if 0 // would be nice, but is not possible
@@ -310,6 +310,10 @@ const bool origls=param.nup.landscape;
page->add_border_rect(rect,param.border,1.0/pgedit.scale);
}
+ if (!param.pageLabel.empty()) {
+ page->add_label(param.page, param.pageLabel);
+ }
+
if (!param.fitplot) {
curpage->add_subpage(page,pgedit.xpos+xpos,pgedit.ypos+ypos,pgedit.scale,&rect);
} else {
diff -up cups-filters-1.0.35/filter/pdftopdf/pdftopdf_processor.h.page-label cups-filters-1.0.35/filter/pdftopdf/pdftopdf_processor.h
--- cups-filters-1.0.35/filter/pdftopdf/pdftopdf_processor.h.page-label 2012-11-15 15:58:39.000000000 +0000
+++ cups-filters-1.0.35/filter/pdftopdf/pdftopdf_processor.h 2013-07-24 08:49:23.920081389 +0100
@@ -20,7 +20,7 @@ struct ProcessingParameters {
border(NONE),
reverse(false),
-// pageLabel(NULL),
+ pageLabel(),
evenPages(true),oddPages(true),
mirror(false),
@@ -60,7 +60,7 @@ struct ProcessingParameters {
NupParameters nup;
bool reverse;
- // std::string pageLabel; // or NULL? must stay/dup!
+ std::string pageLabel;
bool evenPages,oddPages;
IntervalSet pageRange;
@@ -105,6 +105,7 @@ public:
virtual void add_subpage(const std::shared_ptr<PDFTOPDF_PageHandle> &sub,float xpos,float ypos,float scale,const PageRect *crop=NULL) =0;
virtual void mirror() =0;
virtual void rotate(Rotation rot) =0;
+ virtual void add_label(const PageRect &rect, const std::string label) =0;
};
// TODO: ... error output?
diff -up cups-filters-1.0.35/filter/pdftopdf/qpdf_pdftopdf_processor.cc.page-label cups-filters-1.0.35/filter/pdftopdf/qpdf_pdftopdf_processor.cc
--- cups-filters-1.0.35/filter/pdftopdf/qpdf_pdftopdf_processor.cc.page-label 2013-03-14 20:32:42.000000000 +0000
+++ cups-filters-1.0.35/filter/pdftopdf/qpdf_pdftopdf_processor.cc 2013-07-24 08:49:23.920081389 +0100
@@ -257,6 +257,94 @@ void QPDF_PDFTOPDF_PageHandle::rotate(Ro
}
// }}}
+void QPDF_PDFTOPDF_PageHandle::add_label(const PageRect &_rect, const std::string label) // {{{
+{
+ assert(isExisting());
+
+ PageRect rect = ungetRect (_rect, *this, rotation, page);
+
+ assert (rect.left <= rect.right);
+ assert (rect.bottom <= rect.top);
+
+ // TODO: Only add in the font once, not once per page.
+ QPDFObjectHandle font = page.getOwningQPDF()->makeIndirectObject (
+ QPDFObjectHandle::parse(
+ "<<"
+ " /Type /Font"
+ " /Subtype /Type1"
+ " /Name /pagelabel-font"
+ " /BaseFont /Helvetica" // TODO: support UTF-8 labels?
+ ">>"));
+ QPDFObjectHandle resources = page.getKey ("/Resources");
+ QPDFObjectHandle rfont = resources.getKey ("/Font");
+ rfont.replaceKey ("/pagelabel-font", font);
+
+ double margin = 2.25;
+ double height = 12;
+
+ std::string boxcmd = "q\n";
+
+ // White filled rectangle (top)
+ boxcmd += " 1 1 1 rg\n";
+ boxcmd += " " + QUtil::double_to_string(rect.left + margin) + " " +
+ QUtil::double_to_string(rect.top - height - 2 * margin) + " " +
+ QUtil::double_to_string(rect.right - rect.left - 2 * margin) + " " +
+ QUtil::double_to_string(height + 2 * margin) + " re f\n";
+
+ // White filled rectangle (bottom)
+ boxcmd += " " + QUtil::double_to_string(rect.left + margin) + " " +
+ QUtil::double_to_string(rect.bottom + height + margin) + " " +
+ QUtil::double_to_string(rect.right - rect.left - 2 * margin) + " " +
+ QUtil::double_to_string(height + 2 * margin) + " re f\n";
+
+ // Black outline (top)
+ boxcmd += " 0 0 0 RG\n";
+ boxcmd += " " + QUtil::double_to_string(rect.left + margin) + " " +
+ QUtil::double_to_string(rect.top - height - 2 * margin) + " " +
+ QUtil::double_to_string(rect.right - rect.left - 2 * margin) + " " +
+ QUtil::double_to_string(height + 2 * margin) + " re S\n";
+
+ // Black outline (bottom)
+ boxcmd += " " + QUtil::double_to_string(rect.left + margin) + " " +
+ QUtil::double_to_string(rect.bottom + height + margin) + " " +
+ QUtil::double_to_string(rect.right - rect.left - 2 * margin) + " " +
+ QUtil::double_to_string(height + 2 * margin) + " re S\n";
+
+ // Black text (top)
+ boxcmd += " 0 0 0 rg\n";
+ boxcmd += " BT\n";
+ boxcmd += " /pagelabel-font 12 Tf\n";
+ boxcmd += " " + QUtil::double_to_string(rect.left + 2 * margin) + " " +
+ QUtil::double_to_string(rect.top - height - margin) + " Td\n";
+ boxcmd += " (" + label + ") Tj\n";
+ boxcmd += " ET\n";
+
+ // Black text (bottom)
+ boxcmd += " BT\n";
+ boxcmd += " /pagelabel-font 12 Tf\n";
+ boxcmd += " " + QUtil::double_to_string(rect.left + 2 * margin) + " " +
+ QUtil::double_to_string(rect.bottom + height + 2 * margin) + " Td\n";
+ boxcmd += " (" + label + ") Tj\n";
+ boxcmd += " ET\n";
+
+ boxcmd += "Q\n";
+
+ assert(page.getOwningQPDF()); // existing pages are always indirect
+ static const char *pre="%pdftopdf q\n"
+ "q\n",
+ *post="%pdftopdf Q\n"
+ "Q\n";
+
+ QPDFObjectHandle stm1=QPDFObjectHandle::newStream(page.getOwningQPDF(),
+ pre),
+ stm2=QPDFObjectHandle::newStream(page.getOwningQPDF(),
+ std::string(post) + boxcmd);
+
+ page.addPageContents(stm1,true); // before
+ page.addPageContents(stm2,false); // after
+}
+// }}}
+
void QPDF_PDFTOPDF_PageHandle::debug(const PageRect &rect,float xpos,float ypos) // {{{
{
assert(!isExisting());
@@ -264,7 +352,7 @@ void QPDF_PDFTOPDF_PageHandle::debug(con
}
// }}}
-
+// }}}
void QPDF_PDFTOPDF_Processor::closeFile() // {{{
{
pdf.reset();
diff -up cups-filters-1.0.35/filter/pdftopdf/qpdf_pdftopdf_processor.h.page-label cups-filters-1.0.35/filter/pdftopdf/qpdf_pdftopdf_processor.h
--- cups-filters-1.0.35/filter/pdftopdf/qpdf_pdftopdf_processor.h.page-label 2012-11-15 15:58:39.000000000 +0000
+++ cups-filters-1.0.35/filter/pdftopdf/qpdf_pdftopdf_processor.h 2013-07-24 08:49:23.920081389 +0100
@@ -11,6 +11,7 @@ public:
virtual void add_subpage(const std::shared_ptr<PDFTOPDF_PageHandle> &sub,float xpos,float ypos,float scale,const PageRect *crop=NULL);
virtual void mirror();
virtual void rotate(Rotation rot);
+ virtual void add_label(const PageRect &rect, const std::string label);
void debug(const PageRect &rect,float xpos,float ypos);
private:

View File

@ -3,8 +3,8 @@
Summary: OpenPrinting CUPS filters and backends
Name: cups-filters
Version: 1.0.35
Release: 7%{?dist}
Version: 1.0.36
Release: 1%{?dist}
# For a breakdown of the licensing, see COPYING file
# GPLv2: filters: commandto*, imagetoraster, pdftops, rasterto*,
@ -22,11 +22,7 @@ Url: http://www.linuxfoundation.org/collaborate/workgroups/openprinting/cups
Source0: http://www.openprinting.org/download/cups-filters/cups-filters-%{version}.tar.xz
Source1: cups-browsed.service
Patch1: cups-filters-man.patch
Patch2: cups-filters-lookup.patch
Patch3: cups-filters-page-label.patch
Patch4: cups-filters-textfilters.patch
Patch5: cups-filters-gs-filters.patch
Patch1: cups-filters-textfilters.patch
Requires: cups-filters-libs%{?_isa} = %{version}-%{release}
@ -105,17 +101,9 @@ This is the development package for OpenPrinting CUPS filters and backends.
%prep
%setup -q
%patch1 -p1 -b .man
%patch2 -p1 -b .lookup
# Added support for page-label (bug #987515).
%patch3 -p1 -b .page-label
# Set cost for text filters to 200 (bug #988909).
%patch4 -p1 -b .textfilters
# Upstream patch to move in filters from ghostscript.
%patch5 -p1 -b .gs-filters
%patch1 -p1 -b .textfilters
%build
# work-around Rpath
@ -212,18 +200,22 @@ fi
%files libs
%doc __doc/COPYING fontembed/README
%attr(0755,root,root) %{_libdir}/libcupsfilters.so.*
%attr(0755,root,root) %{_libdir}/libfontembed.so.*
%{_libdir}/libcupsfilters.so.*
%{_libdir}/libfontembed.so.*
%files devel
%{_includedir}/cupsfilters
%{_includedir}/fontembed
%{_datadir}/cups/ppdc/escp.h
%{_libdir}/pkgconfig/libcupsfilters.pc
%{_libdir}/pkgconfig/libfontembed.pc
%{_libdir}/libcupsfilters.so
%{_libdir}/libfontembed.so
%changelog
* Tue Aug 13 2013 Tim Waugh <twaugh@redhat.com> - 1.0.36-1
- 1.0.36.
* Tue Aug 13 2013 Tim Waugh <twaugh@redhat.com> - 1.0.35-7
- Upstream patch to move in filters from ghostscript.

View File

@ -1 +1 @@
f722074dfa8efd3fcb8502cede13a608 cups-filters-1.0.35.tar.xz
595c41a7e16136fc8c0fed1d35f583f6 cups-filters-1.0.36.tar.xz