foomatic/foomatic-ppdload.patch

202 lines
6.7 KiB
Diff
Raw Normal View History

auto-import changelog data from foomatic-3.0.0-21.3.src.rpm Mon Feb 09 2004 Tim Waugh <twaugh@redhat.com> 3.0.0-21.3 - Fix up HP Color Inkjet CP1700 support. Mon Jan 26 2004 Tim Waugh <twaugh@redhat.com> 3.0.0-21.2 - Remove PrintoutMode option from gimp-print driver to avoid breaking it. - Upgrade filters to 3.0.1rc3. - Upgrade engine to 3.0.1rc2. - No longer need symlink patch. Mon Jan 19 2004 Tim Waugh <twaugh@redhat.com> 3.0.0-21.1 - Build for Fedora Core 1 printer drivers update. - Downgrade filters back down to 3.0.0. Mon Jan 12 2004 Tim Waugh <twaugh@redhat.com> 3.0.0-21 - Build for Fedora Core 1 printer drivers update. - Revert Omni update temporarily. - Downgrade engine to 20031217 to stick to the stable branch. Mon Jan 12 2004 Tim Waugh <twaugh@redhat.com> 3.0.0-20 - Updated Omni printers to 0.9.1. Mon Jan 12 2004 Tim Waugh <twaugh@redhat.com> 3.0.0-19 - Build for Fedora Core 1 printer drivers update. - No longer need symlink patch. - Updated fontpath patch. - Updated engine to 20040112. - Updated db to 20040112. - Updated gimp-print data to 4.2.6. Tue Jan 06 2004 Tim Waugh <twaugh@redhat.com> 3.0.0-18 - Build for Fedora Core 1 printer drivers update. - Explicitly state conflict with hpijs < 1.5. - Make foomatic-ppdfile accept '-t type' like foomatic-datafile used to. Tue Dec 23 2003 Tim Waugh <twaugh@redhat.com> 3.0.0-17 - Fix up gimp-print XML (bug #112574). Fri Dec 19 2003 Tim Waugh <twaugh@redhat.com> 3.0.0-16 - Need the ppd driver too. Fri Dec 19 2003 Tim Waugh <twaugh@redhat.com> 3.0.0-15 - Reinstate ppdload long enough for me to work around its disappearance. Thu Dec 18 2003 Tim Waugh <twaugh@redhat.com> - Updated db to 20031218. - No longer need hpdj656, dell, mc3100 patches. Wed Dec 17 2003 Tim Waugh <twaugh@redhat.com> 3.0.0-14 - Updated db to 20031217. - Updated engine to 20031217. - Updated hpijs to 1.5-20031217. - Use relative symlinks. Fri Dec 12 2003 Tim Waugh <twaugh@redhat.com> 3.0.0-13 - Add Minolta magicolor 3100. Tue Dec 02 2003 Tim Waugh <twaugh@redhat.com> - Don't ship backup files. Sat Nov 29 2003 Tim Waugh <twaugh@redhat.com> 3.0.0-12 - Undo over-zealous percent escaping in PostScript.xml - Build requires libxml2-devel (bug #110589). - Use relative, not absolute, symlink for CUPS filter. Fri Nov 07 2003 Tim Waugh <twaugh@redhat.com> 3.0.0-11 - Add pxlmono driver for HP LaserJet 5 (bug #109378). Wed Nov 05 2003 Tim Waugh <twaugh@redhat.com> 3.0.0-10 - Updated db to 20031105. - Drop filters path patch. - Updated fontpath patch, both libdir patches. - Updated engine and filters to 3.0-20031105. - Updated hpijs db to 1.4-1.
2004-09-09 04:53:21 +00:00
--- foomatic-db-engine-3.0-20031217/foomatic-ppdload.in.ppdload 2003-12-19 15:26:40.360620848 +0000
+++ foomatic-db-engine-3.0-20031217/foomatic-ppdload.in 2003-12-19 15:26:56.289725866 +0000
@@ -0,0 +1,118 @@
+#!@PERL@
+
+use Getopt::Std;
+getopts("hdR:");
+help() if $opt_h;
+
+use Foomatic::PPD;
+use Foomatic::Defaults;
+
+my $file;
+my $printer;
+
+if ($opt_R) { # Remove entry
+ $printer = $opt_R;
+} else { # Add entry
+ $file = $ARGV[0];
+ $printer = $ARGV[1];
+}
+
+if (!$opt_R) { # Add entry
+
+ if (! -f "$libdir/db/source/printer/$printer.xml") {
+ die "Printer $printer does not seem to exist in the database!\n";
+ }
+
+ if (! -f $file) {
+ die "The PPD file you specified, $file, does not seem to exist!\n";
+ }
+
+ # Load the PPD
+ my $p = new Foomatic::PPD $file, $printer;
+
+ if ($opt_d) {
+ # Parser PPD structure dump
+ use Data::Dumper;
+ local $Data::Dumper::Purity=1;
+ local $Data::Dumper::Indent=1;
+ print Dumper($p);
+ } else {
+ # Normal behavior, save as various option files by ID
+ my @opts = $p->foo_options();
+ for (@opts) {
+ my ($id, $xml) = ($_->{'id'}, $_->{'xml'});
+
+ my $ofile = "$libdir/db/source/opt/$id.xml";
+ open TMP, ">$ofile" or die "Cannot write $ofile!\n";
+ print STDERR "Writing $ofile\n";
+ print TMP join('',@{$xml});
+ close TMP;
+ }
+
+ # Add this printer to the ppd driver
+
+ # Read the driver entry file
+ open PPDENTRY, "< $libdir/db/source/driver/ppd.xml" or
+ die "Cannot read $libdir/db/source/driver/ppd.xml!\n";
+ print STDERR "Reading $libdir/db/source/driver/ppd.xml\n";
+ $ppdentry = join('', <PPDENTRY>);
+ close PPDENTRY;
+
+ # Either we've got it already
+ my $found =
+ ($ppdentry =~ m!<id>[\s\n]*printer/$printer[\s\n]*</id>!s);
+
+ # Or we need to append a new item and write the file
+ if (! $found) {
+ $ppdentry =~ s!^(\s*)</printers>!$1 <printer>\n$1 <id>printer/$printer</id>\n$1 </printer>\n$1</printers>!m;
+ open PPDENTRY, "> $libdir/db/source/driver/ppd.xml" or
+ die "Cannot write $libdir/db/source/driver/ppd.xml!\n";
+ print STDERR "Writing $libdir/db/source/driver/ppd.xml\n";
+ print PPDENTRY $ppdentry;
+ close PPDENTRY;
+ } else {
+ print STDERR "Printer $printer already registered as supported by the \"ppd\" driver!\n";
+ }
+ }
+} else { # Remove entry
+ # Read the driver entry file
+ open PPDENTRY, "< $libdir/db/source/driver/ppd.xml" or
+ die "Cannot read $libdir/db/source/driver/ppd.xml!\n";
+ print STDERR "Reading $libdir/db/source/driver/ppd.xml\n";
+ $ppdentry = join('', <PPDENTRY>);
+ close PPDENTRY;
+
+ # Do we have the requested entry?
+ my $found =
+ ($ppdentry =~ m!<id>[\s\n]*printer/$printer[\s\n]*</id>!s);
+
+ # Then we have to remove it and to write the file
+ if ($found) {
+ $ppdentry =~ s!\n+\s*<printer>[\s\n]*<id>printer/$printer</id>[\s\n]*</printer>\s*\n+!\n!sg;
+ open PPDENTRY, "> $libdir/db/source/driver/ppd.xml" or
+ die "Cannot write $libdir/db/source/driver/ppd.xml!\n";
+ print STDERR "Writing $libdir/db/source/driver/ppd.xml\n";
+ print PPDENTRY $ppdentry;
+ close PPDENTRY;
+ } else {
+ print STDERR "Printer $printer not registered as supported by the \"ppd\" driver!\n";
+ }
+ # Remove the option entries
+ system("rm -f $libdir/db/source/opt/ppd-${printer}-*.xml");
+}
+
+exit(0);
+
+sub help {
+ select STDERR;
+ print "\n";
+ print "Usage: foomatic-ppdload filename.ppd printer-id\n";
+ print " foomatic-ppdload -R printer-id\n";
+ print "\n";
+ print " The first form adds the printer with the ID printer-id\n";
+ print " and the PPD file filename.ppd to the \"ppd\" driver,\n";
+ print " the second form removes the printer with the ID\n";
+ print " printer-id from the \"ppd\" driver.\n";
+ print "\n";
+ exit(1);
+}
--- foomatic-db-engine-3.0-20031217/foomatic-ppdload.8.in.ppdload 2003-12-19 15:26:45.290034426 +0000
+++ foomatic-db-engine-3.0-20031217/foomatic-ppdload.8.in 2003-12-19 15:26:56.034756198 +0000
@@ -0,0 +1,47 @@
+.\" This -*- nroff -*- source file is part of foomatic.
+.\"
+.TH FOOMATIC-PPDLOAD 8 "2001-05-07" "Foomatic Project"
+.SH NAME
+foomatic-ppdload \- <put a short description here>
+.SH SYNOPSIS
+.B foomatic-ppdload \-h
+
+.B foomatic-ppdload
+\fIfilename.ppd printer-id\fR
+
+.B foomatic-ppdload \-R
+\fIprinter-id\fR
+
+.SH DESCRIPTION
+.B foomatic-ppdload
+takes a ppd filename and a printer ID as arguments. It
+parses a PPD file and writes option data into the foomatic database
+for use with the foomatic "ppd" driver and that printer.
+
+With the \fB-R\fR option you can remove a printer from the "ppd"
+driver, and with \fB-h\fR a short help text is shown.
+
+Right now, it will handle Boolean and PickOne options that go in the
+Prolog, DocumentSetup, or PageSetup spots. Also, PPD interoption
+constraints (not to be confused with foomatic option to printer and
+driver mapping constraints) are not supported by foomatic. And of
+course, the interesting color and font information from the PPD has
+no place in the current foomatic schema. All this will change over
+time.
+
+
+.\".SH SEE ALSO
+.\".IR foomatic-XXX (1),
+
+.SH EXIT STATUS
+.B foomatic-ppdload
+returns ...
+
+.SH AUTHOR
+Manfred Wassmann <\fImanolo@NCC-1701.B.Shuttle.de\fR> for the foomatic
+project using output from the associated binary.
+
+.SH BUGS
+There are several limitations, but it's an interesting experiment.
+
+Please send bug reports to foomatic-devel@linuxprinting.org.
--- foomatic-db-engine-3.0-20031217/configure.in.ppdload 2003-12-19 15:27:03.188905120 +0000
+++ foomatic-db-engine-3.0-20031217/configure.in 2003-12-19 15:27:21.165766554 +0000
@@ -280,7 +280,7 @@
foomatic-configure foomatic-printjob foomatic-kitload
foomatic-ppdfile foomatic-preferred-driver foomatic-cleanupdrivers
foomatic-getpjloptions foomatic-addpjloptions
-foomatic-compiledb foomatic-fix-xml
+foomatic-compiledb foomatic-fix-xml foomatic-ppdload
foomatic-nonumericalids foomatic-replaceoldprinterids
foomatic-ppd-options
)
--- foomatic-db-engine-3.0-20031217/Makefile.in.ppdload 2003-12-19 15:27:25.217284580 +0000
+++ foomatic-db-engine-3.0-20031217/Makefile.in 2003-12-19 15:28:09.349034667 +0000
@@ -145,6 +145,7 @@
foomatic-kitload foomatic-ppdfile foomatic-preferred-driver \
foomatic-cleanupdrivers foomatic-getpjloptions \
foomatic-addpjloptions foomatic-compiledb foomatic-fix-xml \
+ foomatic-ppdload \
foomatic-nonumericalids foomatic-replaceoldprinterids \
foomatic-ppd-options
@@ -155,7 +156,7 @@
foomatic-ppd-options
# Administrative commands, only useful for admins
-SBINFILES:=foomatic-kitload \
+SBINFILES:=foomatic-kitload foomatic-ppdload \
foomatic-getpjloptions foomatic-addpjloptions \
foomatic-preferred-driver foomatic-fix-xml \
foomatic-nonumericalids foomatic-replaceoldprinterids