[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#647536: splix: Please replace the postinst with a ppd-updater trigger



Package: splix
Version: 2.0.0+svn293-1
Severity: normal
Tags: patch

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hi, 

for some time now (in fact, since its 1.5.0-3 version), cups offers a way to
trigger for driver updates on package upgrade, by "simply" putting a file
under /usr/share/cups/ppd-updaters/. Cups will then "watch" for this file and
trigger a driver update.

Replacing your postinst by a ppd-updater file will reduce code duplication
and put the code responsability on cups' shoulders (which is logical as the
postinst updates cups' stuff.)

A debdiff with the proposed change is attached.

Cheers,

OdyX

P.S. Thare are various improvements that could be done in the packaging, such
as "not shipping the PPD files, but only the .drv files if splix is only
to be used with cups", "if shipping the PPD files, compress them with
dh_pyppd", etc.

- -- System Information:
Debian Release: wheezy/sid
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'unstable'), (500, 'testing'), (500, 'stable'), (150, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.0.0-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=fr_CH.UTF-8, LC_CTYPE=fr_CH.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages splix depends on:
ii  printer-driver-splix  2.0.0+svn293-1.1

splix recommends no packages.

splix suggests no packages.

- -- no debconf information

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQGcBAEBCAAGBQJOssiBAAoJEIvPpx7KFjRVexcL/jMLA+is2lbWQpc4XLGI6GUs
+LAUuTPcC9RbK/iQHU0AXHJEXwt5aV9UedIepEHAgMBIdCrf+bzbH/WDaDCfM7oa
AJ9u95xaemGxTqVSJ5TnF2DxFHdzPJ+4Ouio3JmSUOpKKZu0wcApubkBEVNNTBe1
zMOTUtn3Cxs4F8MjeKAgemsrEuQZjEojavx6QGVQWSPa/eFF9o85ijv6QIqbnrBC
/BFfsehD8iSsVrlkO+GZUICEVgponZtmNv5OPp9CMn0n81Ea3z6tUggjjze0MYmi
Es9PsGGZGmqsc3yJe9l6+BZN97uKKL1lrZGwCbE8MskSD/IiXgugAHma8Z5XAt4F
8SG8BHG9FeaX8s6YBsqq08Rmp3pnWjvKlwBGHPKAGEAIs3iwnhHhPqN8BHJ7gKwF
7P0Ctb2A0LYsyDEfw5txbq9McAC3g5txro6ZVWFmK85GiejOWzHlxw/jkekXr3GL
CDyqm6tCuO4xgXIefC1k/BW0IxrI+RY9EacRf1lhZw==
=YGXL
-----END PGP SIGNATURE-----
diff -Nru splix-2.0.0+svn293/debian/changelog splix-2.0.0+svn293/debian/changelog
--- splix-2.0.0+svn293/debian/changelog	2011-06-19 17:46:59.000000000 +0200
+++ splix-2.0.0+svn293/debian/changelog	2011-11-03 17:55:00.000000000 +0100
@@ -1,3 +1,10 @@
+splix (2.0.0+svn293-1.ppdupdater0) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Replace the postinst with a Cups ppd-updater trigger.
+
+ -- Didier Raboud <odyx@debian.org>  Thu, 03 Nov 2011 17:54:27 +0100
+
 splix (2.0.0+svn293-1) unstable; urgency=low
 
   * Start tracking SVN trunk. (Closes: #594466)
diff -Nru splix-2.0.0+svn293/debian/control splix-2.0.0+svn293/debian/control
--- splix-2.0.0+svn293/debian/control	2011-06-19 17:46:59.000000000 +0200
+++ splix-2.0.0+svn293/debian/control	2011-11-03 17:55:28.000000000 +0100
@@ -8,7 +8,7 @@
 
 Package: splix
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, cups, cups-client, ghostscript-cups
+Depends: ${shlibs:Depends}, ${misc:Depends}, cups (>= 1.5.0-3~), cups-client, ghostscript-cups
 Description: Driver for Samsung's SPL2 (bw) and SPLc (color) laser printers
  Support for printing to SPL2- and SPLc-based printers. These are most
  of the cheaper Samsung laser printers which do not understand standard
diff -Nru splix-2.0.0+svn293/debian/rules splix-2.0.0+svn293/debian/rules
--- splix-2.0.0+svn293/debian/rules	2011-06-19 17:46:59.000000000 +0200
+++ splix-2.0.0+svn293/debian/rules	2011-11-03 17:56:57.000000000 +0100
@@ -29,6 +29,7 @@
 	dh_prep
 	dh_installdirs
 	$(MAKE) DESTDIR=$(CURDIR)/debian/splix CUPSPPD=/usr/share/ppd/splix DISABLE_JBIG=1 install
+	install -D --mode=644 debian/splix.ppd-updater $(CURDIR)/debian/splix/usr/share/ppd-updaters/splix.ppd-updater
 
 # Build architecture-dependent files here.
 binary-arch: install
diff -Nru splix-2.0.0+svn293/debian/splix.postinst splix-2.0.0+svn293/debian/splix.postinst
--- splix-2.0.0+svn293/debian/splix.postinst	2011-06-19 17:46:59.000000000 +0200
+++ splix-2.0.0+svn293/debian/splix.postinst	1970-01-01 01:00:00.000000000 +0100
@@ -1,78 +0,0 @@
-#!/bin/bash
-# postinst script for splix
-#
-# see: dh_installdeb(1)
-
-set -e
-
-# summary of how this script can be called:
-#        * <postinst> `configure' <most-recently-configured-version>
-#        * <old-postinst> `abort-upgrade' <new version>
-#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
-#          <new-version>
-#        * <postinst> `abort-remove'
-#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
-#          <failed-install-package> <version> `removing'
-#          <conflicting-package> <version>
-# for details, see http://www.debian.org/doc/debian-policy/ or
-# the debian-policy package
-
-
-case "$1" in
-    configure)
-        # Do the following only if CUPS is running and the needed CUPS tools
-        # are available
-        if which lpstat > /dev/null 2>&1 && \
-            which lpinfo > /dev/null 2>&1 && \
-            which lpadmin > /dev/null 2>&1 && \
-            lpstat -r > /dev/null 2>&1; then
-            # Update the PPD files of all already installed print queues
-            driverregexp='lsb/usr/splix/'
-            gennicknameregexp='s/,(\s*SpliX|)(\s*V\.?|)\s*[\d\.]*$//i'
-            [ ! -z "$gennicknameregexp" ] && \
-                gennicknameregexp="; $gennicknameregexp"
-            gennicknameregexp='s/\s*\(recommended\)//'"$gennicknameregexp"
-            tempfiles=
-            trap 'rm -f $tempfiles; exit 0' 0 1 2 13 15
-            tmpfile1=`mktemp -t updateppds.XXXXXX`
-            tempfiles="$tempfiles $tmpfile1"
-            lpinfo -m | grep -E $driverregexp > $tmpfile1
-            cd /etc/cups/ppd
-            for ppd in *.ppd; do
-                [ -r "$ppd" ] || continue
-	        queue=${ppd%.ppd}
-                lpstat -p "$queue" >/dev/null 2>&1 || continue
-                nickname=`grep '\*NickName:' "$ppd" | cut -d '"' -f 2 | perl -p -e 's/\n$//' | perl -p -e "$gennicknameregexp" | perl -p -e 's/(\W)/\\\\$1/g'`
-                lang=`grep '\*LanguageVersion:' "$ppd" | cut -d ' ' -f 2 | perl -e 'print lc(<>)' | perl -p -e 's/[\r\n]//gs'`
-                ppdfound="0"
-                englishppduri=""
-                tmpfile2=`mktemp -t updateppds.XXXXXX`
-                tempfiles="$tempfiles $tmpfile2"
-                cat $tmpfile1 | perl -p -e "$gennicknameregexp" | grep -E '^\S+\s+.*'"$nickname"'$' | cut -d ' ' -f 1 > $tmpfile2
-                while read newppduri; do
-                    [ "$ppdfound" = "0" ] && lpadmin -p "$queue" -m $newppduri 2>/dev/null || continue
-                    newlang=`grep '\*LanguageVersion:' "$ppd" | cut -d ' ' -f 2 | perl -e 'print lc(<>)' | perl -p -e 's/[\r\n]//gs'`
-                    [ "$newlang" = "$lang" ] && ppdfound="1"
-                    [ "$newlang" = "english" ] && englishppduri="$newppduri"
-                done < $tmpfile2
-                [ "$ppdfound" = "0" ] && [ ! -z "$englishppduri" ] && lpadmin -p "$queue" -m $englishppduri 2>/dev/null && ppdfound="1"
-                [ "$ppdfound" = "1" ] && echo PPD for printer $queue updated >&2
-            done
-        fi
-    ;;
-
-    abort-upgrade|abort-remove|abort-deconfigure)
-    ;;
-
-    *)
-        echo "postinst called with unknown argument \`$1'" >&2
-        exit 1
-    ;;
-esac
-
-# dh_installdeb will replace this with shell code automatically
-# generated by other debhelper scripts.
-
-#DEBHELPER#
-
-exit 0
diff -Nru splix-2.0.0+svn293/debian/splix.ppd-updater splix-2.0.0+svn293/debian/splix.ppd-updater
--- splix-2.0.0+svn293/debian/splix.ppd-updater	1970-01-01 01:00:00.000000000 +0100
+++ splix-2.0.0+svn293/debian/splix.ppd-updater	2011-11-03 17:53:35.000000000 +0100
@@ -0,0 +1,2 @@
+DRIVER_REGEXP='lsb/usr/splix/'
+GENNICKNAME_REGEXP='s/,(\s*SpliX|)(\s*V\.?|)\s*[\d\.]*$//i'

Reply to: