From 5cbe7aab1e49318dc4c561eee1e387653304409e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Thu, 24 Feb 2022 09:43:51 +0100 Subject: New d/p/0115-Fix_text_filter.patch --- debian/changelog | 7 +++++++ debian/patches/0115-Fix_text_filter.patch | 16 ++++++++++++++++ debian/patches/series | 1 + 3 files changed, 24 insertions(+) create mode 100644 debian/patches/0115-Fix_text_filter.patch diff --git a/debian/changelog b/debian/changelog index 98a28a4..1b4ea46 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +foomatic-filters (4.0.17-14) UNRELEASED; urgency=medium + + * New debian/patches/0115-Fix_text_filter.patch (Closes: #776315): + - Fix error on handling text filter. + + -- Jörg Frings-Fürst Thu, 24 Feb 2022 08:07:44 +0100 + foomatic-filters (4.0.17-13) unstable; urgency=medium * Fix error processing package (Closes: #997318): diff --git a/debian/patches/0115-Fix_text_filter.patch b/debian/patches/0115-Fix_text_filter.patch new file mode 100644 index 0000000..652aa1b --- /dev/null +++ b/debian/patches/0115-Fix_text_filter.patch @@ -0,0 +1,16 @@ +Index: trunk/fileconverter.c +=================================================================== +--- trunk.orig/fileconverter.c ++++ trunk/fileconverter.c +@@ -37,9 +37,9 @@ + * is not set. (Except if the spooler is CUPS, then 'texttops' is used + */ + const char *fileconverters[][2] = { +- { "a2ps", "a2ps -1 @@--medium=@@PAGESIZE@@ @@--center-title=@@JOBTITLE@@ -o -" }, ++ { "a2ps", "a2ps -1 @@--medium=@@PAGESIZE@@ @@--center-title=\"@@JOBTITLE@@ -o -" }, + { "enscript", "enscript -G @@-M @@PAGESIZE@@ @@-b \"Page $%|@@JOBTITLE@@ --margins=36:36:36:36 --mark-wrapped-lines=arrow --word-wrap -p-" }, +- { "mpage", "mpage -o -1 @@-b @@PAGESIZE@@ @@-H -h @@JOBTITLE@@ -m36l36b36t36r -f -P- -" }, ++ { "mpage", "mpage -o -1 @@-b @@PAGESIZE@@ @@-H -h \"@@JOBTITLE@@ -m36l36b36t36r -f -P- -" }, + { "paps", "paps @@--paper @@PAGESIZE@@ --header --font=11.5" }, + { NULL, NULL } + }; diff --git a/debian/patches/series b/debian/patches/series index e6a186b..abbd0fe 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -4,3 +4,4 @@ 0110-fixed-segfault-when-creating-logfile.patch 0001-paps.patch 0500-r7406_also_consider_the_back_tick_as_an_illegal_shell_escape_character.patch +0115-Fix_text_filter.patch -- cgit v1.2.3 From bf03eee236924f68b1ff16a1a31e04f82e247ee7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Thu, 24 Feb 2022 12:46:16 +0100 Subject: New d/p/0120-Disable_option_docs.patch --- debian/changelog | 3 +++ debian/patches/0120-Disable_option_docs.patch | 28 +++++++++++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 32 insertions(+) create mode 100644 debian/patches/0120-Disable_option_docs.patch diff --git a/debian/changelog b/debian/changelog index 1b4ea46..fdf56d3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,9 @@ foomatic-filters (4.0.17-14) UNRELEASED; urgency=medium * New debian/patches/0115-Fix_text_filter.patch (Closes: #776315): - Fix error on handling text filter. + * New debian/patches/0120-Disable_option_docs.patch (Closes: #1004417) + - Disable not availaqble option docs. + -- Jörg Frings-Fürst Thu, 24 Feb 2022 08:07:44 +0100 diff --git a/debian/patches/0120-Disable_option_docs.patch b/debian/patches/0120-Disable_option_docs.patch new file mode 100644 index 0000000..6fc85a7 --- /dev/null +++ b/debian/patches/0120-Disable_option_docs.patch @@ -0,0 +1,28 @@ +Index: trunk/foomaticrip.c +=================================================================== +--- trunk.orig/foomaticrip.c ++++ trunk/foomaticrip.c +@@ -330,8 +330,9 @@ void process_cmdline_options() + + /* "docs" option to print help page */ + if (!strcasecmp(key, "docs")) { +- do_docs = 1; +- continue; ++ do_docs = 0; ++ rip_die(EXIT_OPTION_NOT_AVAILABLE, "Option \"docs\" isn't available now.\n"); ++/* continue; */ + } + /* "profile" option to supply a color correction profile to a CUPS raster driver */ + if (!strcmp(key, "profile")) { +Index: trunk/foomaticrip.h +=================================================================== +--- trunk.orig/foomaticrip.h ++++ trunk/foomaticrip.h +@@ -62,6 +62,7 @@ + #define EXIT_PRNERR_NORETRY_BAD_SETTINGS 9 /* interface settings are invalid */ + #define EXIT_PRNERR_NO_SUCH_ADDRESS 10 /* address lookup failed, may be transient */ + #define EXIT_PRNERR_NORETRY_NO_SUCH_ADDRESS 11 /* address lookup failed, not transient */ ++#define EXIT_OPTION_NOT_AVAILABLE 20 /* Otion isn't avalable now */ + #define EXIT_INCAPABLE 50 /* printer wants (lacks) features or resources */ + + diff --git a/debian/patches/series b/debian/patches/series index abbd0fe..7ede85b 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -5,3 +5,4 @@ 0001-paps.patch 0500-r7406_also_consider_the_back_tick_as_an_illegal_shell_escape_character.patch 0115-Fix_text_filter.patch +0120-Disable_option_docs.patch -- cgit v1.2.3 From 19edb7f8abe844f9eb1bcac31f15f0f27e65c25c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Thu, 24 Feb 2022 13:17:33 +0100 Subject: Add DEP-3 headers --- debian/changelog | 3 +-- debian/patches/0115-Fix_text_filter.patch | 9 +++++++++ debian/patches/0120-Disable_option_docs.patch | 7 +++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index fdf56d3..1a6c793 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,8 +3,7 @@ foomatic-filters (4.0.17-14) UNRELEASED; urgency=medium * New debian/patches/0115-Fix_text_filter.patch (Closes: #776315): - Fix error on handling text filter. * New debian/patches/0120-Disable_option_docs.patch (Closes: #1004417) - - Disable not availaqble option docs. - + - Disable not available option docs. -- Jörg Frings-Fürst Thu, 24 Feb 2022 08:07:44 +0100 diff --git a/debian/patches/0115-Fix_text_filter.patch b/debian/patches/0115-Fix_text_filter.patch index 652aa1b..b9727fc 100644 --- a/debian/patches/0115-Fix_text_filter.patch +++ b/debian/patches/0115-Fix_text_filter.patch @@ -1,3 +1,12 @@ +Description: Fix error on handling text filter +Author: Alexander Zangerl +Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=776315 +Bug: https://bugs.linuxfoundation.org/show_bug.cgi?id=1283 +Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=776315 +Forwarded: no +Last-Update: 2022-02-24 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ Index: trunk/fileconverter.c =================================================================== --- trunk.orig/fileconverter.c diff --git a/debian/patches/0120-Disable_option_docs.patch b/debian/patches/0120-Disable_option_docs.patch index 6fc85a7..8471aff 100644 --- a/debian/patches/0120-Disable_option_docs.patch +++ b/debian/patches/0120-Disable_option_docs.patch @@ -1,3 +1,10 @@ +Description: Disable not available option docs +Author: Jörg Frings-Fürst +Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1004417 +Forwarded: no +Last-Update: 2022-02-24 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ Index: trunk/foomaticrip.c =================================================================== --- trunk.orig/foomaticrip.c -- cgit v1.2.3 From fb1799c6d1cec4c80ba4fbb7abf2af3404cc75c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Thu, 24 Feb 2022 14:01:33 +0100 Subject: New d/ppd-doc-extractor; refresh d/copyright --- debian/README.Debian | 5 + debian/changelog | 6 + debian/copyright | 6 +- debian/foomatic-filters.examples | 1 + debian/patches/0120-Disable_option_docs.patch | 2 +- debian/ppd-doc-extractor | 184 ++++++++++++++++++++++++++ 6 files changed, 202 insertions(+), 2 deletions(-) create mode 100644 debian/ppd-doc-extractor diff --git a/debian/README.Debian b/debian/README.Debian index e10326e..ec3de19 100644 --- a/debian/README.Debian +++ b/debian/README.Debian @@ -1,6 +1,11 @@ foomatic-filters for Debian --------------------------- +At /usr/share/doc/foomatic-filters/examples you can found a new +ppd-doc-extractor. Thanks to Alexander Zangerl . + + -- Jörg Frings-Fürst Thu, 24 Feb 2022 08:07:44 +0100 + Note that the structure of the OpenPrinting (foomatic) printer configuration system in Debian (and upstream) has changed from the 2.0 series. There are now 3 core packages: diff --git a/debian/changelog b/debian/changelog index 1a6c793..79535cc 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,12 @@ foomatic-filters (4.0.17-14) UNRELEASED; urgency=medium - Fix error on handling text filter. * New debian/patches/0120-Disable_option_docs.patch (Closes: #1004417) - Disable not available option docs. + * New debian/ppd-doc-extractor installed at + /usr/share/doc/foomatic-filters/examples. + Thanks to Alexander Zangerl + * debian/copyright: + - Add year 2022 to myself. + - New paragraph for debian/ppd-doc-extractor. -- Jörg Frings-Fürst Thu, 24 Feb 2022 08:07:44 +0100 diff --git a/debian/copyright b/debian/copyright index e9e74a0..7425f33 100644 --- a/debian/copyright +++ b/debian/copyright @@ -23,9 +23,13 @@ License: GPL-2.0+ Files: debian/* Copyright: 2003 Chris Lawrence - 2014-2021 Jörg Frings-Fürst + 2014-2022 Jörg Frings-Fürst License: GPL-2.0+ +Files: debian/ppd-doc-extractor +Copyright: 2022 Alexander Zangerl +License: GPL-2.0 + License: GPL-2.0+ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public diff --git a/debian/foomatic-filters.examples b/debian/foomatic-filters.examples index 930b11e..8727d19 100644 --- a/debian/foomatic-filters.examples +++ b/debian/foomatic-filters.examples @@ -1 +1,2 @@ filter.conf +debian/ppd-doc-extractor diff --git a/debian/patches/0120-Disable_option_docs.patch b/debian/patches/0120-Disable_option_docs.patch index 8471aff..62060f9 100644 --- a/debian/patches/0120-Disable_option_docs.patch +++ b/debian/patches/0120-Disable_option_docs.patch @@ -1,7 +1,7 @@ Description: Disable not available option docs Author: Jörg Frings-Fürst Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1004417 -Forwarded: no +Forwarded: not-needed Last-Update: 2022-02-24 --- This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ diff --git a/debian/ppd-doc-extractor b/debian/ppd-doc-extractor new file mode 100644 index 0000000..2d29543 --- /dev/null +++ b/debian/ppd-doc-extractor @@ -0,0 +1,184 @@ +#!/usr/bin/perl +# $Id$ +# +# File: ppd-doc-extractor +# Date: 27 Jan 2022 16:28:17 +# Author: Alexander Zangerl +# +# Abstract: +# very minimal recreation of the PPD documentation extractor +# of foomatic-rip 3.x (which you got with foomatic-rip -o docs), which +# is not part of the rewritten 4.x versions despite the documentation's +# claims and the broken option code that doesn't reject what it cannot +# handle. +# +# copyright (c) 2022 Alexander Zangerl +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 +# as published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +use strict; +use File::Slurp; +use Data::Dumper; + +my ($ppdfile,@a2ps) = @ARGV; +die "usage: $0 [a2ps args]\n +no a2ps args: print to stdout +automatically added: --center-title, --footer\n\n" if (!-f $ppdfile); + +my @stuff = read_file($ppdfile); + +# parse everything but massage and handle just the relevant parts +my (%x, $curopengroup); +for (my $i = 0; $i <= $#stuff; ++$i) +{ + my $line = $stuff[$i]; + $line =~ s/\r\n$//; # de-dos + chomp $line; + + my ($key, $value, $option, $xlatoption); + + next if ($line =~ /^(\*%.*)?$/ or $line eq "*End"); + if ($line =~ /^\*([^:]+):\s*(.+)\s*$/) + { + ($key, $value) = ($1,$2); + if ($key =~ /^(\S+)\s+(.+)$/) + { + $key = $1; + $option = $2; + + if ($option =~ m!^([^/]+)/(.+)$!) + { + ($option,$xlatoption) = ($1,$2); + undef $xlatoption if ($xlatoption eq $option); # unnecessary ones + } + } + # invocationvalue and quotedvalue allow continuation + if ($value =~ /^"([^"]+)"\s*$/) + { + $value = $1; + } + elsif ($value =~ /^"([^"]*)*$/) + { + $value = $1; + while ((my $nextline = $stuff[++$i]) !~ /"/) + { + $value .= $nextline; + } + if ($stuff[$i] =~ /^([^"]+)"\s*$/) + { + $value .= $1; + } + } + + # orderdependency is laid out extraspecially stupidly + if ($key =~ /^(NonUI)?OrderDependency$/) + { + $key = "OrderDependency"; # we lump these together + my ($num,$dontcare,$appliesto) = split(/\s+/,$value); + ($option = $appliesto) =~ s/^\*//; + $value = $num; + } + # want the options under openui w/o fluff + elsif ($key eq "OpenUI") + { + $option =~ s/^\*//; + } + # another instance of shitty structural layout + elsif ($key eq "OpenGroup") + { + if ($value =~ m!^\s*(\S+)/(.+)$!) + { + ($option,$xlatoption) = ($1,$2); + } + else + { + $xlatoption = $option = $value; + } + $curopengroup = $value = $option; + } + elsif ($key eq "CloseGroup") + { + undef $curopengroup; + } + + if (defined $option) + { + # for option entries add a sequence number for sorting - simply use the line number + $x{$key}->{$option} = { xlat => $xlatoption, + value => $value, + sequence => $i, + ingroup => $curopengroup, }; + + } + else + { + $x{$key} = $value; + } + } + else + { + die "unrecognized line nr. $i\n"; + } +} + +# print Dumper(\%x); + +if (@a2ps) +{ + push @a2ps, ("--center-title=Documentation for $x{ModelName}","--footer="); + + # lazy me: just duping the pipe fd... + open(P, "|-", "a2ps", @a2ps) or die "cannot pipe to a2ps: $!\n"; + open(STDOUT, ">&", \*P) or die "cannot dup: $!\n"; +} + +print qq| +Invocation summary for $x{ModelName}: +Command line: lpr [-Z opt=value, opt=value...] [lpr options] + +List of available options:\n\n|; + +# meh...orderdependency is not in all ppds or all sections :-( +my $odep = $x{OrderDependency}; +my @onames = sort { $odep->{$a}->{ingroup} cmp $odep->{$a}->{ingroup} + || $odep->{$a}->{sequence} <=> $odep->{$b}->{sequence} + || $odep->{$a}->{value} <=> $odep->{$b}->{value} + || $x{OpenUI}->{$a}->{sequence} <=> $x{OpenUI}->{$b}->{sequence} } keys %{$x{OpenUI}}; + +for my $oname (@onames) +{ + my $label = $x{OpenUI}->{$oname}->{xlat} // $oname; + my $type = $x{OpenUI}->{$oname}->{value} // "Unknown"; + + # one choice is no choice + next if ($type eq "PickOne" && keys %{$x{$oname}} == 1); + + my $this = $x{$oname}; + my $example = (keys %$this)[0]; + my $sectionname = $x{OpenGroup}->{$this->{$example}->{ingroup}}->{xlat}; + my $sectionlabel = $sectionname ? " Section: $sectionname\n":""; + + print "Option '$oname': $label\n$sectionlabel Type: $type\n Choices:\n"; + for my $choice (sort { $this->{$a}->{sequence} <=> $this->{$b}->{sequence} } keys %$this) + { + my $choicelabel = $x{$oname}->{$choice}->{xlat}; + print " o '$choice'".($choicelabel? ": $choicelabel":"")."\n"; + } + print " Default: ".$x{"Default$oname"}."\n Example: -Z $oname=$example\n\n"; +} + +if (@a2ps) +{ + close(STDOUT); + close(P); +} -- cgit v1.2.3 From a5fda82a2dfb9ce7887564ca5f63e13c776a14f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Thu, 24 Feb 2022 14:08:55 +0100 Subject: add debian/files to .gitignore --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 527834c..4fec8f6 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ build/* Makefile .valencia .pc -.bzr \ No newline at end of file +.bzr +debian/files -- cgit v1.2.3 From 835d97e276c937f2078a205137a97f0a752ea4dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Thu, 24 Feb 2022 14:12:01 +0100 Subject: d/changelog: Change distribution to unstable, Change date and time --- debian/README.Debian | 3 ++- debian/changelog | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/debian/README.Debian b/debian/README.Debian index ec3de19..cb2fcc9 100644 --- a/debian/README.Debian +++ b/debian/README.Debian @@ -4,7 +4,8 @@ foomatic-filters for Debian At /usr/share/doc/foomatic-filters/examples you can found a new ppd-doc-extractor. Thanks to Alexander Zangerl . - -- Jörg Frings-Fürst Thu, 24 Feb 2022 08:07:44 +0100 + -- Jörg Frings-Fürst Thu, 24 Feb 2022 14:09:09 +0100 + Note that the structure of the OpenPrinting (foomatic) printer configuration system in Debian (and upstream) has changed from the 2.0 diff --git a/debian/changelog b/debian/changelog index 79535cc..73bb182 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -foomatic-filters (4.0.17-14) UNRELEASED; urgency=medium +foomatic-filters (4.0.17-14) unstable; urgency=medium * New debian/patches/0115-Fix_text_filter.patch (Closes: #776315): - Fix error on handling text filter. @@ -11,7 +11,7 @@ foomatic-filters (4.0.17-14) UNRELEASED; urgency=medium - Add year 2022 to myself. - New paragraph for debian/ppd-doc-extractor. - -- Jörg Frings-Fürst Thu, 24 Feb 2022 08:07:44 +0100 + -- Jörg Frings-Fürst Thu, 24 Feb 2022 14:09:09 +0100 foomatic-filters (4.0.17-13) unstable; urgency=medium -- cgit v1.2.3 From bf97cbc41a39cd3b8bb0a3357683ef84e6b16c6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Thu, 24 Feb 2022 15:10:28 +0100 Subject: Add License GPL-2 to d/copyright --- debian/copyright | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/debian/copyright b/debian/copyright index 7425f33..740f451 100644 --- a/debian/copyright +++ b/debian/copyright @@ -30,6 +30,27 @@ Files: debian/ppd-doc-extractor Copyright: 2022 Alexander Zangerl License: GPL-2.0 +License: GPL-2.0 + This program is free software; you can redistribute it + and/or modify it under the terms of the GNU General Public + License as published by the Free Software Foundation version + 2 of the License. + . + This program is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied + warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the GNU General Public License for more + details. + . + You should have received a copy of the GNU General Public + License along with this package; if not, write to the Free + Software Foundation, Inc., 51 Franklin St, Fifth Floor, + Boston, MA 02110-1301 USA + . + On Debian systems, the full text of the GNU General Public + License version 2 can be found in the file + `/usr/share/common-licenses/GPL-2'. + License: GPL-2.0+ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public -- cgit v1.2.3