[Pkg-cups-devel] r522 - in cupsys/branches/cups-1.2-ubuntu/debian: . local patches

Martin Pitt mpitt at alioth.debian.org
Mon Aug 6 14:29:24 UTC 2007


Author: mpitt
Date: Mon Aug  6 14:29:24 2007
New Revision: 522

Log:
merge with Debian

Added:
   cupsys/branches/cups-1.2-ubuntu/debian/local/oopstops.convs
   cupsys/branches/cups-1.2-ubuntu/debian/local/oopstops.pl
   cupsys/branches/cups-1.2-ubuntu/debian/local/oopstops.types
      - copied unchanged from r520, /cupsys/branches/cups-1.2-ubuntu/debian/oopstops.types
   cupsys/branches/cups-1.2-ubuntu/debian/local/textonly.filter
   cupsys/branches/cups-1.2-ubuntu/debian/local/textonly.ppd
Removed:
   cupsys/branches/cups-1.2-ubuntu/debian/oopstops.convs
   cupsys/branches/cups-1.2-ubuntu/debian/oopstops.pl
   cupsys/branches/cups-1.2-ubuntu/debian/oopstops.types
   cupsys/branches/cups-1.2-ubuntu/debian/patches/05_avoidunknowngroup.dpatch
   cupsys/branches/cups-1.2-ubuntu/debian/textonly.filter
   cupsys/branches/cups-1.2-ubuntu/debian/textonly.ppd
Modified:
   cupsys/branches/cups-1.2-ubuntu/debian/changelog
   cupsys/branches/cups-1.2-ubuntu/debian/control
   cupsys/branches/cups-1.2-ubuntu/debian/cupsys.config
   cupsys/branches/cups-1.2-ubuntu/debian/cupsys.postinst
   cupsys/branches/cups-1.2-ubuntu/debian/cupsys.preinst
   cupsys/branches/cups-1.2-ubuntu/debian/patches/00list
   cupsys/branches/cups-1.2-ubuntu/debian/patches/47_pid.dpatch
   cupsys/branches/cups-1.2-ubuntu/debian/rules

Modified: cupsys/branches/cups-1.2-ubuntu/debian/changelog
==============================================================================
--- cupsys/branches/cups-1.2-ubuntu/debian/changelog	(original)
+++ cupsys/branches/cups-1.2-ubuntu/debian/changelog	Mon Aug  6 14:29:24 2007
@@ -1,3 +1,88 @@
+cupsys (1.2.12-2ubuntu1) UNRELEASED; urgency=low
+
+  * Merge from debian unstable, remaining changes:
+    - TearDown (fast shutdown):
+      + debian/control: Add sysv-rc (>= 2.86.ds1-14.1ubuntu2) dependency.
+      + debian/rules: Use 'multiuser' update-rc.d mode.
+    - debian/control, debian/rules: Drop cupsys-dbg package.
+    - debian/cupsys.postinst: Various transitions that need to be kept until
+      the next LTS:
+      + Auto-enable snmp, scsi, and serial backends on upgrade.
+      + Revert to single cupsd.conf file.
+      + Remove obsolete rc.d links.
+    - debian/patches/ubuntu-default-error-policy-retry-job.dpatch: Retry a
+      failed job instead of stopping the print queue.
+    - debian/patches/ubuntu-disable-browsing.dpatch: Disable browsing by
+      default.
+    - Add AppArmor profile:
+      + debian/local/apparmor-profile
+      + debian/cupsys.postinst: Reload AA profile on configuration.
+
+ -- Martin Pitt <martin.pitt at ubuntu.com>  Mon, 06 Aug 2007 16:24:49 +0200
+
+cupsys (1.2.12-2) unstable; urgency=low
+
+  [ Kenshi Muto ]
+  * Added scripting directory to /usr/share/doc/cupsys/examples.
+    This directory contains the binding code from Java, Perl, and PHP
+    to CUPS. (closes: #193076)
+    Although we Debian CUPS team cannot afford to maintain them,
+    some of you may want them.
+  * Added 'Recommends: cupsys' to cupsys-bsd. (closes: #426521)
+  * Changed cupsys-client from 'Recommends: cupsys-bsd' to 'Suggests:
+    cupsys-bsd.' because cupsys-bsd isn't so necessary for cupsys-client.
+  * Fixed to use 'cupsys' instead of 'cups' for PAM on cups-check-pam-auth.
+    (though Debian CUPS doesn't use this daemon) (closes: #425701)
+  * Added debconf-2.0 to the dependency of cupsys-bsd. (closes: #415684)
+
+  [ Martin Pitt ]
+  * Drop the derooting changes. It still has some regressions, and with
+    upstream not even acknowledging the need for improving cupsys' security we
+    will sit on this forever. This will be replaced by an AppArmor/SELinux
+    profiles in the future.
+    - Drop derooting related patches:
+      06_disable_backend_setuid.dpatch
+      10_external_pam_helper.dpatch
+      09_runasuser.dpatch
+      09_runasuser_autoconf.dpatch
+    - debian/cupsys{,-client}.postinst: Drop the 'cupsys' user setup and file
+      permission juggling.
+    - debian/rules:
+      + Drop --with-cups-user configure option.
+      + Do not modify the upstream default backend permissions.
+    - debian/cupsys.init.d: Do not touch log file permissions any more.
+    - debian/cupsys.files: Drop cups-check-pam-auth.
+    - debian/NEWS: Drop description of derooting changes.
+    - debian/control: Drop adduser dependency.
+   * debian/patches/44_fixconfdirperms.dpatch: Do not create
+     /var/run/cups/certs as lp:lpadmin, but as root:lpadmin, so that cupsd
+     does not need CAP_DAC_OVERRIDE. This will make it possible to create a
+     sensible AppArmor/SELinux profile.
+   * debian/cupsys.preinst: Fix file permissions on upgrades (owner cupsys ->
+     root).
+   * debian/control, debian/rules: Remove references to libcupsys2-gnutls10,
+     since it's a transitional package in Etch and not relevant any more in
+     Lenny.
+  * debian/cupsys.{pre,post}inst: Remove obsolete transition bits.
+  * Remove obsolete debian/patches/05_avoidunknowngroup.dpatch.
+  * Use ssl-cert's "snakeoil" SSL certificate by default: (Closes: #402370)
+    - debian/control: Add ssl-cert dependency.
+    - debian/cupsys.postinst: Symlink snakeoil SSL certificate if present, and
+      there is none present yet.
+  * debian/control: Replace obsolete ${Source-Version} with ${binary:Version}.
+
+  [ Till Kamppeter ]
+  * Add debian/local/textonly.{ppd,filter}: Text-only printer driver from Red
+    Hat. Install it in debian/rules.
+  * debian/rules: Install the D-Bus config file so that CUPS reports
+    job progress to dbus clients (like sytem-config-printer).
+  * Add debian/local/oopstops.{.pl,types,convs}: Helge Bliscke's oopstops
+    filter to work around the bugs in the PostScript output of OpenOffice.org
+    (from http://www.srz.de/Members/bla/cups/filter/oopstops). Install them in
+    debian/rules.
+
+ -- Martin Pitt <mpitt at debian.org>  Mon, 06 Aug 2007 15:47:33 +0200
+
 cupsys (1.2.12-1ubuntu3) gutsy; urgency=low
 
   * debian/rules: Install the D-Bus config file so that CUPS reports
@@ -49,22 +134,6 @@
 
  -- Martin Pitt <martin.pitt at ubuntu.com>  Mon, 16 Jul 2007 15:58:08 +0200
 
-cupsys (1.2.12-2) UNRELEASED; urgency=low
-
-  [ Kenshi Muto ]
-  * Added scripting directory to /usr/share/doc/cupsys/examples.
-    This directory contains the binding code from Java, Perl, and PHP
-    to CUPS.
-    Although we Debian CUPS team cannot afford to maintain them,
-    some of you may want them.
-  * Added 'Recommends: cupsys' to cupsys-bsd. (closes: #426521)
-  * Changed cupsys-client from 'Recommends: cupsys-bsd' to 'Suggests:
-    cupsys-bsd.' because cupsys-bsd isn't so necessary for cupsys-client.
-
-  ** Well, is it time to separate cupsys and cupsys-bin? (#233339) **
-
- -- Kenshi Muto <kmuto at debian.org>  Sun, 15 Jul 2007 23:39:33 +0900
-
 cupsys (1.2.12-1) unstable; urgency=low
 
   * New upstream release
@@ -287,7 +356,7 @@
        broken (upstream STR #2278).
      o The LPD mini-daemon did not handle the document-format
        option correctly (upstream STR #2266).
-	
+
  -- Till Kamppeter <till.kamppeter at gmail.com>  Mon, 12 Mar 2007 15:22:06 +0000
 
 cupsys (1.2.8-0ubuntu4) feisty; urgency=low

Modified: cupsys/branches/cups-1.2-ubuntu/debian/control
==============================================================================
--- cupsys/branches/cups-1.2-ubuntu/debian/control	(original)
+++ cupsys/branches/cups-1.2-ubuntu/debian/control	Mon Aug  6 14:29:24 2007
@@ -13,9 +13,8 @@
 Architecture: any
 Depends: ${shlibs:Depends}
 Suggests: cupsys-common
-Provides: libcupsys2-gnutls10
-Replaces: cupsys-client (<= 1.1.10-2), libcupsys2-gnutls10 (<= 1.1.23-11)
-Conflicts: gs-esp (<< 7.05.6-2), cupsys-driver-gimpprint (<< 4.2.5-3), libcupsys2-gnutls10 (<= 1.1.23-11), cupsys (<< 1.2.1)
+Replaces: cupsys-client (<= 1.1.10-2)
+Conflicts: gs-esp (<< 7.05.6-2), cupsys-driver-gimpprint (<< 4.2.5-3), cupsys (<< 1.2.1)
 Description: Common UNIX Printing System(tm) - libs
  The Common UNIX Printing System (or CUPS(tm)) is a printing system and 
  general replacement for lpd and the like.  It supports the Internet 
@@ -93,7 +92,7 @@
 Priority: optional
 Section: libdevel
 Architecture: any
-Depends: libcupsys2 (= ${Source-Version}), libgnutls-dev
+Depends: libcupsys2 (= ${binary:Version}), libgnutls-dev
 Provides: libcupsys-dev
 Conflicts: libcupsys1-dev, libcupsys-dev, cupsys (<< 1.1.22-3)
 Replaces: libcupsys1-dev, libcupsys-dev, cupsys (<< 1.1.22-3)
@@ -114,7 +113,7 @@
 Priority: optional
 Section: libdevel
 Architecture: any
-Depends: libcupsimage2 (= ${Source-Version}), libcupsys2-dev (= ${Source-Version}), libpng-dev, libtiff4-dev, libjpeg62-dev, zlib1g-dev
+Depends: libcupsimage2 (= ${binary:Version}), libcupsys2-dev (= ${binary:Version}), libpng-dev, libtiff4-dev, libjpeg62-dev, zlib1g-dev
 Provides: libcupsimage-dev
 Conflicts: libcupsimage-dev
 Replaces: libcupsys1-dev, libcupsimage-dev, libcupsys2-dev (<= 1.1.18-2)
@@ -135,7 +134,7 @@
 Priority: extra
 Section: net
 Architecture: any
-Depends: ${shlibs:Depends}, cupsys-client (= ${Source-Version}), debconf, update-inetd, cupsys-common
+Depends: ${shlibs:Depends}, cupsys-client (= ${binary:Version}), debconf | debconf-2.0, update-inetd, cupsys-common
 Recommends: cupsys
 Conflicts: lpr, lprng, manpages-fr (<< 0.9.5-1)
 Provides: lpr

Modified: cupsys/branches/cups-1.2-ubuntu/debian/cupsys.config
==============================================================================
--- cupsys/branches/cups-1.2-ubuntu/debian/cupsys.config	(original)
+++ cupsys/branches/cups-1.2-ubuntu/debian/cupsys.config	Mon Aug  6 14:29:24 2007
@@ -70,17 +70,9 @@
   fi
 fi
 
-db_get cupsys/backend
-OLD_RET=$RET
-
 db_input low cupsys/backend || true
 db_go
 
-db_get cupsys/backend
-if [ "$OLD_RET" != "$RET" ]; then
-    db_fset cupsys/backend changed true
-fi
-
 #RET=
 #if [ -f "$CONF" ]; then
 #  if [ "$(grep -h "Include[[:space:]]\+$PORTS" $CONF)" -a -f "$PORTS" ]; then

Modified: cupsys/branches/cups-1.2-ubuntu/debian/cupsys.postinst
==============================================================================
--- cupsys/branches/cups-1.2-ubuntu/debian/cupsys.postinst	(original)
+++ cupsys/branches/cups-1.2-ubuntu/debian/cupsys.postinst	Mon Aug  6 14:29:24 2007
@@ -45,16 +45,6 @@
 	    deluser root lpadmin || true
 	fi
 
-	if [ -d /etc/cups/certs ]; then
-	    rm -rf /etc/cups/certs
-	fi
-	if [ -d /var/spool/cups/certs ]; then
-	    mv /var/spool/cups/certs/* /var/run/cups/certs || true
-	    rm -rf /var/spool/cups/certs
-	fi
-	if [ -d /var/lib/cups/certs ]; then
-	    rm -rf /va/lib/cups/certs
-	fi
 	if [ -L /usr/share/ppd/cups-transitional-dir ]; then
 	    rm -f /usr/share/ppd/cups-transitional-dir
 	fi
@@ -118,7 +108,7 @@
 	done
 	IFS=$save_IFS
         db_fset cupsys/backend changed false
-
+        
         # In cupsys 1.2.8-0ubuntu3 the defaults for the active backends
         # changed. snmp, scsi, and serial got added. So activate these
         # backends.
@@ -133,88 +123,28 @@
         list=`( cd /usr/lib/cups/backend && for f in ipp lpd parallel scsi serial socket usb snmp; do [ -e $f ] && echo -n "$f, "; done ) | sed -e 's/, $//'`
         db_set cupsys/backend $list;
 
-
-	# Create password file for Digest authentication
-        # (removed: Debian CUPS uses PAM and basic authentication)
-	#db_get cupsys/adminpassword
-        #VAL=$(echo -n "root:CUPS:$RET" | md5sum | cut -d' ' -f1)
-	#if [ -f /etc/cups/passwd.md5 ]; then
-        #  if [ "$(grep "^root:" /etc/cups/passwd.md5)" ]; then
-	#    sed -e "s/^root:lpadmin:.*/root:lpadmin:$VAL/" /etc/cups/passwd.md5 > /etc/cups/passwd.md5.$$
-	#    mv /etc/cups/passwd.md5.$$ /etc/cups/passwd.md5
-        #  else
-	#    echo "root:lpadmin:$VAL" >> /etc/cups/passwd.md5
-        #  fi
-	#else
-	#  echo "root:lpadmin:$VAL" > /etc/cups/passwd.md5
-	#  chown root:nogroup /etc/cups/passwd.md5
-	#  chmod 600 /etc/cups/passwd.md5
-	#fi
-
-	# Revert to single file
-	if [ $(dpkg --compare-versions "$2" gt 1.1.23-12 && dpkg --compare-versions "$2" lt 1.2.1-3 && echo "yes") ]; then
-	  if [ -f /etc/cups/cups.d/ports.conf -o -f /etc/cups/cups.d/browse.conf ]; then
-	    perl -e 'sub readfile { local($_) = @_; open(F, $_); while (<F>) { print; } }; while (<STDIN>) { s#^Include\s+(/etc/cups/cups.d/(?:ports.conf|browse.conf))#&readfile($1)#ei; print;}' < /etc/cups/cupsd.conf > /etc/cups/cupsd.conf.$$
-	    mv /etc/cups/cupsd.conf.$$ /etc/cups/cupsd.conf
-	    rm -f /etc/cups/cups.d/ports.conf /etc/cups/cups.d/browse.conf
-	    rmdir /etc/cups/cups.d 2>/dev/null || /bin/true
-	  fi
-	fi
-	#
-	# Create /etc/cups/cups.d/ports.conf and /etc/cups/cups.d/browse.conf
-	#db_get cupsys/ports
-	#VAL=$(echo "$RET" | perl -e '$ret = ""; while (<STDIN>) { chomp;
-	#    @values = split(/\s+/);
-	#    foreach(@values) {
-	#      if (/^\d+$/ && $_ >= 0 && $_ < 65536) {
-	#        # PORT
-	#        $ret .= "Port $_\\n";
-	#      } elsif (/^\d+\.\d+\.\d+\.\d+$/ || /^\d+\.\d+\.\d+\.\d+:\d+$/) {
-	#        # IP
-	#        $ret .= "Listen $_\\n";
-	#      } elsif (/^[a-zA-Z0-9-_.*]+$/ || /^[a-zA-Z0-9-_.*]+:\d+$/) {
-	#        my($tmp) = $_;
-	#        if (/^[a-zA-Z0-9-_.*]+:(\d+)$/) {
-	#          if ($1 < 0 || $1 > 65535) {
-	#            # ERROR
-	#            $ret = "";
-	#            last;
-	#          }
-	#        }
-	#        # HOSTNAME
-	#        $ret .= "Listen $_\\n";
-	#      } elsif (/^\//) {
-	#        # domain socket
-	#        $ret .= "Listen $_\\n";
-	#      } else {
-	#        # ERROR
-	#        $ret = "";
-	#        last;
-	#      }
-	#    }
-	#    print $ret;
-	#  }')
-
-	#if [ -z "$VAL" ]; then
-	#  echo "Error: debconf has an invalid value. Run 'dpkg-reconfigure cupsys' again."
-	#  return 1
-	#else
-	#  /bin/echo -e -n "$VAL" > /etc/cups/cups.d/ports.conf
-	#fi
-
-	#db_get cupsys/browse
-	#if [ "$RET" = "true" ]; then
-	#  /bin/echo "Browsing on" > /etc/cups/cups.d/browse.conf
-	#else
-	#  /bin/echo "Browsing off" > /etc/cups/cups.d/browse.conf
-	#fi
-
 	if [ -f /etc/cups/classes.conf ]; then
 	  chown root:lp /etc/cups/classes.conf ; chmod 600 /etc/cups/classes.conf
 	fi
 	if [ -f /etc/cups/printers.conf ]; then
 	  chown root:lp /etc/cups/printers.conf ; chmod 600 /etc/cups/printers.conf
 	fi
+
+        # Revert to single file
+        if [ $(dpkg --compare-versions "$2" gt 1.1.23-12 && dpkg --compare-versions "$2" lt 1.2.1-3 && echo "yes") ]; then
+          if [ -f /etc/cups/cups.d/ports.conf -o -f /etc/cups/cups.d/browse.conf ]; then
+            perl -e 'sub readfile { local($_) = @_; open(F, $_); while (<F>) { print; } }; while (<STDIN>) { s#^Include\s+(/etc/cups/cups.d/(?:ports.conf|browse.conf))#&readfile($1)#ei; print;}' < /etc/cups/cupsd.conf > /etc/cups/cupsd.conf.$$
+            mv /etc/cups/cupsd.conf.$$ /etc/cups/cupsd.conf
+            rm -f /etc/cups/cups.d/ports.conf /etc/cups/cups.d/browse.conf
+            rmdir /etc/cups/cups.d 2>/dev/null || /bin/true
+          fi
+        fi
+
+        # Remove shutdown and reboot links; this init script does not need them.
+        if dpkg --compare-versions "$2" lt "1.2.1-2ubuntu3"; then
+            rm -f /etc/rc0.d/K19cupsys /etc/rc6.d/K19cupsys
+        fi
+
 	# Add symlink to local files required by LSB
 	if [ ! -e /usr/share/ppd/1-local-admin -a ! -L /usr/share/ppd/1-local-admin ]; then
 	  ln -s /usr/local/share/ppd /usr/share/ppd/1-local-admin
@@ -227,18 +157,15 @@
         if [ -e /etc/ssl/certs/ssl-cert-snakeoil.pem -a \
               -e /etc/ssl/private/ssl-cert-snakeoil.key -a \
               -n "`getent group ssl-cert`" -a ! -e /etc/cups/ssl/server.crt -a \
-              ! -e /etc/cups/ssl/server.key ]; then 
+              ! -e /etc/cups/ssl/server.key ]; then
              ln -s /etc/ssl/certs/ssl-cert-snakeoil.pem /etc/cups/ssl/server.crt
              ln -s /etc/ssl/private/ssl-cert-snakeoil.key /etc/cups/ssl/server.key
-        fi
-        
-        # Remove shutdown and reboot links; this init script does not need them.
-        if dpkg --compare-versions "$2" lt "1.2.1-2ubuntu3"; then
-            rm -f /etc/rc0.d/K19cupsys /etc/rc6.d/K19cupsys
-        fi
+        fi 
 
-        # Reload AppArmor profile
-        invoke-rc.d apparmor force-reload || true
+       # Reload AppArmor profile
+       if [ -x /etc/init.d/apparmor ]; then
+           invoke-rc.d apparmor force-reload || true
+       fi
     ;;
 
     abort-upgrade|abort-remove|abort-deconfigure)

Modified: cupsys/branches/cups-1.2-ubuntu/debian/cupsys.preinst
==============================================================================
--- cupsys/branches/cups-1.2-ubuntu/debian/cupsys.preinst	(original)
+++ cupsys/branches/cups-1.2-ubuntu/debian/cupsys.preinst	Mon Aug  6 14:29:24 2007
@@ -16,20 +16,6 @@
     ;;
 
     upgrade)
-	if dpkg --compare-versions "$2" le 1.1.23-6; then
-	  [ -f /etc/cups/printers.conf ] && mv /etc/cups/printers.conf /etc/cups/printers.conf.save
-	  [ -f /etc/cups/classes.conf ] && mv /etc/cups/classes.conf /etc/cups/classes.conf.save
-	fi
-	if [ -e /var/lib/cups/conf -a ! -L /var/lib/cups/conf -a ! -e /etc/cups ]; then
-	    echo -n "Moving configuration files..."
-	    mkdir -p /etc/cups || true
-	    if [ `ls /var/lib/cups/conf | wc -l` -ne "     0" ]; then
-		cp -a /var/lib/cups/conf/* /etc/cups
-	    fi
-	    rm -rf /var/lib/cups/conf
-	    echo "done."
-	fi
-
 	if [ -e /var/lib/cups/ppd -a ! -L /var/lib/cups/ppd -a ! -e /etc/cups/ppd ]; then
 	    echo -n "Moving printer definition files..."
 	    mkdir -p /etc/cups/ppd || true
@@ -49,23 +35,8 @@
 	    rm -f /etc/cups/pdftops.conf
 	fi
 
-	# Remove obsolete /etc/cups/certs
-	[ -L /etc/cups/certs ] && rm -f /etc/cups/certs || true
-
-	# Fix global SSL certificate owner/mode breakage
-	if dpkg --compare-versions "$2" lt-nl '1.2.1-2ubuntu2'; then
-	    if [ -e /etc/ssl/certs/ssl-cert-snakeoil.pem ]; then
-		chown root:root /etc/ssl/certs/ssl-cert-snakeoil.pem
-		chmod 0644 /etc/ssl/certs/ssl-cert-snakeoil.pem
-	    fi
-	    if [ -e /etc/ssl/private/ssl-cert-snakeoil.key ]; then
-		chown root:ssl-cert /etc/ssl/private/ssl-cert-snakeoil.key
-		chmod 0640 /etc/ssl/private/ssl-cert-snakeoil.key
-	    fi
-	fi
-
         # fix 'cupsys' -> 'root' file owner mode transition
-	if dpkg --compare-versions "$2" lt-nl '1.2.12-1ubuntu2'; then
+	if dpkg --compare-versions "$2" lt-nl '1.2.12-2'; then
             chown -R root /etc/cups /var/log/cups /var/run/cups /var/cache/cups /var/spool/cups
         fi
     ;;

Added: cupsys/branches/cups-1.2-ubuntu/debian/local/oopstops.convs
==============================================================================
--- (empty file)
+++ cupsys/branches/cups-1.2-ubuntu/debian/local/oopstops.convs	Mon Aug  6 14:29:24 2007
@@ -0,0 +1 @@
+application/openofficeps application/postscript 33 oopstops

Added: cupsys/branches/cups-1.2-ubuntu/debian/local/oopstops.pl
==============================================================================
--- (empty file)
+++ cupsys/branches/cups-1.2-ubuntu/debian/local/oopstops.pl	Mon Aug  6 14:29:24 2007
@@ -0,0 +1,184 @@
+#!/usr/bin/perl -w
+# ===============================================================================
+# oopstops	prefilter to sanitize PostScript jobs generated by OpenOffice 2.x
+# -------------------------------------------------------------------------------
+# 1.00 - 2007-03-17/Bl
+#	First implementation
+#
+#  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; either version 2 of the License, or (at your
+#  option) any later version.
+#
+#  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.
+#
+# Description:
+# ------------
+#	OpenOffice as of version 2.x has built-in CUPS support, parses
+#	the user selectable options in the printer's PPD and inserts the respecitve
+#	PostScript code into the PostScript job. However, it does not insert all 
+#	defined defaults nor the JCL settings, but it does honour the JobPatchFile
+#	keyword. In addition, if a default setting in the PPD does not correspond
+#	to one of the choices listed in the respective UI block, OpenOffice silently 
+#	selects the first choice (NOTE: this cannot be corrected by this filter).
+#	Moreover, the page related features are inserted into the page setup section
+#	of the first page. This violates the page independence and prohibits successful
+#	working of job attivutes like number-up or same-up.
+#
+#	We therefore modify the PostScript job as follows:
+#	- any JobPatchFile features are discaarded, as they are re-inserted by the 
+#	  pstops filter.
+#	- the first page's page setup is moved to the end of the general setup section
+#	  (in fact, the respective comments are moved instead).
+
+
+
+use IO::Handle;
+
+#
+# Check the arguments
+#
+die ("ERROR: wrong number of arguments\n") if (scalar @ARGV < 5);
+
+$jobid = $username = $title = $copies = $options = undef;
+$jobid = shift;				# Job ID
+$username = shift;			# Job requesting user name
+$title = shift;				# Job title
+$copies = shift;			# Number of requested copies
+$options = shift;			# Textual representation of job attributes
+$psfile = shift;			# read from file ?
+
+
+#
+# Normalize options string
+#
+$options =~ s/^\s+//;
+$options =~ s/\s+$//;
+$options = ' ' . $options . ' ';
+
+#
+# Check from where to read
+#
+if (defined $psfile)
+{
+	open (FILI, "<$psfile") || die ("ERROR: $psfile: $!\n");
+}
+else
+{
+	open (FILI, "<&STDIN") || die ("ERROR: STDIN: $!\n");
+}
+
+# STDOUT->autoflush (1);
+
+#
+# Parse the input until and including the page setup of the first page
+# and relocate the setup features to the end of the setup section.
+#
+ at feature = ();
+$within_feature = 0;
+$feature_name = '';
+$saw_page = 0;
+ at pagehead = ();
+
+while (<FILI>)
+{
+	if (/^\[\{/)
+	{
+		push (@feature, $_);
+		$_ = <FILI>;
+		if (/^%%BeginFeature:\s+\*(\S+)\s+/)
+		{
+			$feature_name = $1;
+			push (@feature, $_);
+			$within_feature = 1;
+			next;
+		}
+		else
+		{
+			print STDOUT shift @feature;
+			print STDOUT;
+		}
+		next;
+	}
+	if (/^%%EndFeature/)
+	{
+		if ($within_feature)
+		{
+			push (@feature, $_);
+			$_ = <FILI>;
+			if (/^\}\s+stopped\s+cleartomark/)
+			{
+				push (@feature, $_);
+			}
+			else
+			{
+				$next_line = $_;
+			}
+			if ($feature_name eq 'JobPatchFile')
+			{
+				@feature = ();		# discard the job patch file(s)
+			}
+			$within_feature = 0;
+			print STDOUT $next_line if (defined $next_line && $next_line);
+		}
+		else
+		{
+			print STDOUT;
+		}
+		next;
+	}
+	next if (/^%%EndSetup/);
+	if (/^%%Page:/)
+	{
+		$saw_page = 1;
+		push (@pagehead, $_);
+		next;
+	}
+	if (/^%%EndPageSetup/)
+	{
+		push (@pagehead, $_);
+		if (scalar @feature > 0)
+		{
+			while (my $line = shift @feature)
+			{
+				print STDOUT $line;
+			}
+			$feature_name = '';
+		}
+		print STDOUT "%%EndSetup\n";
+		while (my $line = shift @pagehead)
+		{
+			print STDOUT $line;
+		}
+		$saw_page = 0;
+		last;
+	}
+	next if (/^<< \/NumCopies null /);		# skip the copies hack because of Ghostscript quirks
+	if ($within_feature)
+	{
+		push (@feature, $_);
+	}
+	elsif ($saw_page)
+	{
+		push (@pagehead, $_);
+	}
+	else
+	{
+		print STDOUT;
+	}
+}
+
+#
+# Now copy the rest without further interpretation
+#
+while (<FILI>)
+{
+	print STDOUT;
+}
+
+close (FILI) if (defined $psfile);
+
+

Added: cupsys/branches/cups-1.2-ubuntu/debian/local/textonly.filter
==============================================================================
--- (empty file)
+++ cupsys/branches/cups-1.2-ubuntu/debian/local/textonly.filter	Mon Aug  6 14:29:24 2007
@@ -0,0 +1,124 @@
+#!/bin/bash
+## Copyright (C) 2003-2006 Red Hat, Inc.
+## Copyright (C) 2003-2006 Tim Waugh <twaugh at redhat.com>
+## Changed on 2007/05/17, Opher Shachar, LADPC Ltd.
+##     Added support for page-ranges option.
+##     Added page accounting.
+
+## 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; either version 2 of the License, or
+## (at your option) any later version.
+
+## 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.
+
+if [ $# == 0 ]; then
+  echo >&2 "ERROR: $0 job-id user title copies options [file]"
+  exit 1
+fi
+
+# Extract the papersize
+SENDFF=`grep '^\*DefaultSendFF' "$PPD" | cut -d\  -f2`
+COPIES=1
+if [ $# -ge 4 ]; then
+  COPIES="$4"
+fi
+
+if [ "$COPIES" -gt 1 ] && [ $# -lt 6 ]; then
+  unset TMPFILE
+  trap -- 'rm -f "$TMPFILE"' EXIT
+  TMPFILE=$(mktemp ${TMPDIR:-/tmp}/textonly.XXXXXX)
+  cat > "$TMPFILE"
+else
+  TMPFILE="$6"
+fi
+
+PR=${5#*page-ranges=}
+# Do options specify page-ranges?
+if [[ "$PR" != "$5" ]]; then
+  PR=${PR%% *}
+else
+  #unset PR
+  PR=1-999999
+fi
+
+if [[ "$PR" ]]; then
+  TMPFILE2=$(mktemp ${TMPDIR:-/tmp}/textonly2.XXXXXX)
+  pagenum=0
+  EOF=
+  { 
+  while [[ "$PR" ]]; do
+    pl=${PR%%,*}		;# take first subrange
+    PR=${PR#$pl};PR=${PR#,}	;# remove from range list
+    pu=${pl#*-}			;# extract upper and lower
+    pl=${pl%-*}			;# pages of subrange
+    # Allows interpreting 0-5,3-10 as 1-5,6-10 rejects 5-1 or 1-
+    (( pagenum >= pl )) && pl=$(( pagenum + 1 ))
+    (( pl > pu )) && continue
+    
+    # Loop reading pages until at or over lower page of subrange.
+    while read -d `echo -ne '\f'` -r; do
+      (( pagenum++ ))
+      (( pagenum == pl )) && break
+    done
+    # Did we reach lower page of subrange or EOF?
+    if (( pagenum < pl )); then
+      [[ ! "$REPLY" ]] && break		;# empty last page - we're done.
+      (( pagenum++ ))
+      EOF=y
+    fi
+    # Output page and report to page log
+    if (( pagenum == pl )); then
+      echo -n "${REPLY}" >>"$TMPFILE2"
+      # If EOF then page has no final FF
+      [[ ! "$EOF" ]] && echo -ne '\f' >>"$TMPFILE2"
+      echo "PAGE: $pagenum $COPIES" >&2
+    fi
+    [[ "$EOF" ]] && break
+    # Is the current subrange a single page?
+    (( pagenum == pu )) && continue
+    while read -d `echo -ne '\f'` -r; do
+      (( pagenum++ ))
+      echo -ne "${REPLY}\f" >>"$TMPFILE2"
+      echo "PAGE: $pagenum $COPIES" >&2
+      (( pagenum == pu )) && break
+    done
+    # Could be that we reached EOF before page boundry
+    if (( pagenum < pu )); then
+      if [[ "$REPLY" ]]; then
+        (( pagenum++ ))
+        echo -n "${REPLY}" >>"$TMPFILE2"
+        echo "PAGE: $pagenum $COPIES" >&2
+      fi
+      break
+    fi
+  done
+  } <"$TMPFILE"
+else
+  TMPFILE2="$TMPFILE"
+  pc=$(grep -co `echo -ne '\f'` "$TMPFILE2")
+  pc=$(( pc * $COPIES ))
+  echo "PAGE: $pc" >&2
+fi
+
+while [ "$COPIES" -gt 0 ]; do
+  # Just translate LF->CRLF at the moment, until the PPD has options added.
+  sed -e 's/$/'`echo -ne '\r'`'/g' "$TMPFILE2"
+
+  if [ "$SENDFF" == "True" ]
+    then
+    echo -ne \\14
+  fi
+
+  COPIES=$(($COPIES - 1))
+done
+# Cleanup
+[[ "$TMPFILE" != "$TMPFILE2" ]] && rm -f "$TMPFILE2"
+exit 0

Added: cupsys/branches/cups-1.2-ubuntu/debian/local/textonly.ppd
==============================================================================
--- (empty file)
+++ cupsys/branches/cups-1.2-ubuntu/debian/local/textonly.ppd	Mon Aug  6 14:29:24 2007
@@ -0,0 +1,47 @@
+*PPD-Adobe: "4.3"
+*%
+*% Text-only printer definition
+*%
+*FormatVersion:	"4.3"
+*FileVersion:	"1.1"
+*LanguageVersion: English
+*LanguageEncoding: ISOLatin1
+*PCFileName:	"TEXTONLY.PPD"
+*Manufacturer:	"Generic"
+*Product:	"(Generic)"
+*cupsVersion:   1.0
+*cupsManualCopies: True
+*cupsModelNumber:  2
+*cupsFilter:    "text/plain 0 textonly"
+*ModelName:     "Generic text-only printer"
+*ShortNickName: "Generic text-only printer"
+*NickName:      "Generic text-only printer"
+*PSVersion:	"(2017.000) 0"
+*LanguageLevel:	"2"
+*ColorDevice:	False
+*DefaultColorSpace: Gray
+*FileSystem:	False
+*Throughput:	"8"
+*LandscapeOrientation: Plus90
+*VariablePaperSize: False
+*TTRasterizer:	Type42
+*DefaultImageableArea: Letter
+*ImageableArea Letter/US Letter:	"18 36 594 756"
+*DefaultPaperDimension: Letter
+*PaperDimension Letter/Letter:		"612 792"
+*OpenUI *PageSize/Media Size: PickOne
+*OrderDependency: 10 AnySetup *PageSize
+*DefaultPageSize: Letter
+*PageSize Letter/Letter:	"<</PageSize[612 792]/ImagingBBox null>>setpagedevice"
+*CloseUI: *PageSize
+*OpenUI *PageRegion: PickOne
+*OrderDependency: 10 AnySetup *PageRegion
+*DefaultPageRegion: Letter
+*PageRegion Letter/Letter:	"<</PageSize[612 792]/ImagingBBox null>>setpagedevice"
+*CloseUI: *PageRegion
+
+*OpenUI *SendFF: Boolean
+*DefaultSendFF: False
+*SendFF True/True:        ""
+*SendFF False/False:   ""
+*CloseUI: *SendFF

Modified: cupsys/branches/cups-1.2-ubuntu/debian/patches/00list
==============================================================================
--- cupsys/branches/cups-1.2-ubuntu/debian/patches/00list	(original)
+++ cupsys/branches/cups-1.2-ubuntu/debian/patches/00list	Mon Aug  6 14:29:24 2007
@@ -1,6 +1,5 @@
 02_configure.dpatch
 04_freebsd.dpatch
-#05_avoidunknowngroup.dpatch
 07_removecvstag.dpatch
 11_pam.dpatch
 12_quiesce_ipp_logging.dpatch

Modified: cupsys/branches/cups-1.2-ubuntu/debian/patches/47_pid.dpatch
==============================================================================
--- cupsys/branches/cups-1.2-ubuntu/debian/patches/47_pid.dpatch	(original)
+++ cupsys/branches/cups-1.2-ubuntu/debian/patches/47_pid.dpatch	Mon Aug  6 14:29:24 2007
@@ -2,7 +2,7 @@
 ## 47_pid.dpatch by Kenshi Muto <kmuto at debian.org>
 ##
 ## All lines beginning with `## DP:' are a description of the patch.
-## DP: No description.
+## DP: Forwarded upstream: http://www.cups.org/str.php?L2465
 
 @DPATCH@
 diff -urNad cupsys-1.2.6~/scheduler/conf.c cupsys-1.2.6/scheduler/conf.c

Modified: cupsys/branches/cups-1.2-ubuntu/debian/rules
==============================================================================
--- cupsys/branches/cups-1.2-ubuntu/debian/rules	(original)
+++ cupsys/branches/cups-1.2-ubuntu/debian/rules	Mon Aug  6 14:29:24 2007
@@ -41,15 +41,6 @@
 	(cd $(DEB_DESTDIR)/../cupsys/usr/share/doc/cupsys && ln -sf ../../cups/doc-root online-docs)
 	#(cd $(DEB_DESTDIR)/../cupsys/usr/share/man && mv man1/backend.1 man1/cups-backend.1 && mv man1/filter.1 man1/cups-filter.1)
 	(install -m 755 -o root -g root $(DEB_DESTDIR)/../pdftops $(DEB_DESTDIR)/../cupsys/usr/lib/cups/filter/)
-
-	# Helge Blischke's oopstops filter to work around bugs in
-	# OpenOffice.org's PostScript output from
-	# http://www.srz.de/Members/bla/cups/filter/oopstops
-	(install -m 755 -o root -g root $(DEB_DESTDIR)/../oopstops.pl $(DEB_DESTDIR)/../cupsys/usr/lib/cups/filter/oopstops)
-	install -d $(DEB_DESTDIR)/../cupsys/usr/share/cups/mime/
-	(install -m 644 -o root -g root $(DEB_DESTDIR)/../oopstops.types $(DEB_DESTDIR)/../cupsys/usr/share/cups/mime/)
-	(install -m 644 -o root -g root $(DEB_DESTDIR)/../oopstops.convs $(DEB_DESTDIR)/../cupsys/usr/share/cups/mime/)
-
 	install -o root -g root -m 644 debian/cupsys.default debian/cupsys/etc/default/cupsys
 	install -m 755 debian/local/browsing_status debian/local/enable_browsing debian/local/sharing_status debian/local/enable_sharing $(DEB_DESTDIR)/../cupsys/usr/share/cups
 
@@ -71,8 +62,16 @@
 	install -D -m 644 packaging/cups-dbus.conf $(DEB_DESTDIR)/../cupsys/etc/dbus-1/system.d/cups.conf
 
 	# Install driver and PPD for text-only printers
-	install -D -m 644 debian/textonly.ppd $(DEB_DESTDIR)/../cupsys/usr/share/ppd/cups-included/textonly.ppd
-	install -D -m 755 debian/textonly.filter $(DEB_DESTDIR)/../cupsys/usr/lib/cups/filter/textonly
+	install -D -m 644 debian/local/textonly.ppd $(DEB_DESTDIR)/../cupsys/usr/share/ppd/cups-included/textonly.ppd
+	install -D -m 755 debian/local/textonly.filter $(DEB_DESTDIR)/../cupsys/usr/lib/cups/filter/textonly
+
+	# Helge Blischke's oopstops filter to work around bugs in
+	# OpenOffice.org's PostScript output from
+	# http://www.srz.de/Members/bla/cups/filter/oopstops
+	install -m 755 -o root -g root debian/local/oopstops.pl $(DEB_DESTDIR)/../cupsys/usr/lib/cups/filter/oopstops
+	install -d $(DEB_DESTDIR)/../cupsys/usr/share/cups/mime/
+	install -m 644 -o root -g root debian/local/oopstops.types $(DEB_DESTDIR)/../cupsys/usr/share/cups/mime/
+	install -m 644 -o root -g root debian/local/oopstops.convs $(DEB_DESTDIR)/../cupsys/usr/share/cups/mime/
 
 	# install AppArmor profile
 	install -D -m 644 debian/local/apparmor-profile $(DEB_DESTDIR)/../cupsys/etc/apparmor.d/usr.sbin.cupsd
@@ -80,9 +79,6 @@
 binary-post-install/libcupsimage2-dev::
 	rm -r debian/libcupsimage2-dev/usr/share/doc/libcupsimage2-dev
 	ln -s libcupsimage2 debian/libcupsimage2-dev/usr/share/doc/libcupsimage2-dev
-#binary-post-install/libcupsys2-gnutls10::
-#	rm -r debian/libcupsys2-gnutls10/usr/share/doc/libcupsys2-gnutls10
-#	ln -s libcupsys2 debian/libcupsys2-gnutls10/usr/share/doc/libcupsys2-gnutls10
 binary-post-install/cupsys-bsd::
 	rm -r debian/cupsys-bsd/usr/share/doc/cupsys-bsd
 	ln -s libcupsys2 debian/cupsys-bsd/usr/share/doc/cupsys-bsd



More information about the Pkg-cups-devel mailing list