- Finally remove ppdload.

This commit is contained in:
Tim Waugh 2008-09-03 15:45:09 +00:00
parent f71b8fae6b
commit d40cc2dde7
3 changed files with 3 additions and 230 deletions

View File

@ -1,19 +0,0 @@
--- foomatic-db-20031218/db/source/driver/ppd.xml.ppdload-ppd 2003-12-19 16:28:30.329536790 +0000
+++ foomatic-db-20031218/db/source/driver/ppd.xml 2003-12-19 16:19:55.317656589 +0000
@@ -0,0 +1,16 @@
+<driver id="driver/ppd"><!-- experimental ppd driver -->
+ <name>Postscript PPD</name>
+ <url>http://www.adobe.com/products/printerdrivers/winppd.html</url>
+ <execution>
+ <postscript/>
+ <prototype>cat %A%Z</prototype>
+ </execution>
+ <comments>
+ <en>PPD Postscript driver. You can use foomatic-ppdload to add ppd information
+for a particular printer into the foomatic database. Then, when you use that printer
+together with this driver with any Foomatic backend, the options defined in the PPD
+file will be available.</en>
+ </comments>
+ <printers>
+ </printers>
+</driver>

View File

@ -1,205 +0,0 @@
diff -up foomatic-db-engine-3.0-20080710/configure.ac.ppdload foomatic-db-engine-3.0-20080710/configure.ac
--- foomatic-db-engine-3.0-20080710/configure.ac.ppdload 2008-09-02 13:31:19.000000000 +0100
+++ foomatic-db-engine-3.0-20080710/configure.ac 2008-09-02 13:31:19.000000000 +0100
@@ -295,7 +295,7 @@ AC_OUTPUT(Makefile makeDefaults makeMan
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-printermap-to-gutenprint-xml
foomatic-extract-text foomatic-searchprinter
diff -up /dev/null foomatic-db-engine-3.0-20080710/foomatic-ppdload.8.in
--- /dev/null 2008-09-02 08:50:58.290000634 +0100
+++ foomatic-db-engine-3.0-20080710/foomatic-ppdload.8.in 2008-09-02 13:31:19.000000000 +0100
@@ -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.
diff -up /dev/null foomatic-db-engine-3.0-20080710/foomatic-ppdload.in
--- /dev/null 2008-09-02 08:50:58.290000634 +0100
+++ foomatic-db-engine-3.0-20080710/foomatic-ppdload.in 2008-09-02 13:31:19.000000000 +0100
@@ -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);
+}
diff -up foomatic-db-engine-3.0-20080710/Makefile.in.ppdload foomatic-db-engine-3.0-20080710/Makefile.in
--- foomatic-db-engine-3.0-20080710/Makefile.in.ppdload 2008-07-10 08:20:10.000000000 +0100
+++ foomatic-db-engine-3.0-20080710/Makefile.in 2008-09-02 13:31:19.000000000 +0100
@@ -147,6 +147,7 @@ AC_OUTPUT_FILES:=Makefile makeDefaults m
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 foomatic-printermap-to-gutenprint-xml \
foomatic-extract-text foomatic-searchprinter
@@ -158,7 +159,7 @@ BINFILES:=foomatic-printjob foomatic-con
foomatic-ppd-options foomatic-searchprinter
# 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 \

View File

@ -27,10 +27,6 @@ Patch2: foomatic-db-engine-libdir.patch
# Set GS_FONTPATH in gs wrapper (bug #81410).
Patch5: foomatic-2.0.2-fontpath.patch
# Reinstate ppdload long enough for me to work around its disappearance.
Patch6: foomatic-ppdload.patch
Patch7: foomatic-ppdload-ppd.patch
# Fix 3.0.2 build.
Patch10: foomatic-db-engine-xml-cflags.patch
@ -95,7 +91,6 @@ popd
pushd foomatic-db-engine-%{enginever}
chmod a+x mkinstalldirs
%patch2 -p1 -b .libdir
%patch6 -p1 -b .ppdload
%patch14 -p1 -b .ampathxml
%patch10 -p1 -b .xml-cflags
%patch15 -p1
@ -107,7 +102,6 @@ pushd foomatic-db-hpijs-%{hpijsver}
popd
pushd foomatic-db-%{dbver}
%patch7 -p1 -b .ppdload-ppd
%patch19 -p1 -b .459847
%patch21 -p1 -b .hpclj9500mfp
@ -252,6 +246,9 @@ rm -fr %buildroot $RPM_BUILD_DIR/%{name}
%{_var}/cache/foomatic
%changelog
* Wed Sep 3 2008 Tim Waugh <twaugh@redhat.com>
- Finally remove ppdload.
* Tue Sep 2 2008 Tim Waugh <twaugh@redhat.com> 3.0.2-64
- Fixed typo in HP-Color_LaserJet_9500_MFP.xml.