Author: rra Date: 2008-03-03 07:03:37 +0100 (Mon, 03 Mar 2008) New Revision: 1237
Added: trunk/testset/dh-test/debian/postinst Modified: trunk/checks/scripts trunk/checks/scripts.desc trunk/debian/changelog trunk/testset/maintainer-scripts/debian/preinst trunk/testset/tags.dh-test trunk/testset/tags.maintainer-scripts Log: * checks/scripts{.desc,}: + [RA] Add warnings for dpkg --assert* flags for features that have been guaranteed for nearly a decade. Thanks, Bernhard R. Link. (Closes: #467642) Also enhance maintainer-script-empty to catch scripts that contain only boilerplate for option parsing. Modified: trunk/checks/scripts =================================================================== --- trunk/checks/scripts 2008-03-03 05:38:12 UTC (rev 1236) +++ trunk/checks/scripts 2008-03-03 06:03:37 UTC (rev 1237) @@ -470,11 +470,6 @@ } } -# the control-files check already has an unknown-control-file error -# so there's no need for anything like this here: -# my %maintainer_scripts = map { $_ => 1 } qw(preinst postinst prerm postrm config); -# print "E: something" unless exists $maintainer_scripts{$file} - # now scan the file contents themselves open (C, '<', "$filename") or fail("cannot open maintainer script $filename for reading: $!"); @@ -489,9 +484,16 @@ s/\#.*$//; # eat comments chomp(); + # Don't consider the standard dh-make boilerplate to be code. This + # means ignoring the framework of a case statement, the labels, the + # echo complaining about unknown arguments, and an exit. unless ($has_code + || m/^\s*set\s+-\w+\s*$/ + || m/^\s*case\s+\"?\$1\"?\s+in\s*$/ + || m/^\s*(?:[a-z|-]+|\*)\)\s*$/ || m/^\s*[:;]+\s*$/ - || m/^\s*set\s+-\w+\s*$/ + || m/^\s*echo\s+\"[^\"]+\"(?:\s*>&2)?\s*$/ + || m/^\s*esac\s*$/ || m/^\s*exit\s+\d+\s*$/) { $has_code = 1; } @@ -655,6 +657,20 @@ tag "maintainer-script-modifies-inetd-conf", "$file:$." unless Dep::implies($deps{provides}, Dep::parse('inet-superserver')); } + + # Ancient dpkg feature tests. + if (m/^\s*dpkg\s+--assert-support-predepends\b/) { + tag "ancient-dpkg-predepends-check", "$file:$."; + } + if (m/^\s*dpkg\s+--assert-working-epoch\b/) { + tag "ancient-dpkg-epoch-check", "$file:$."; + } + if (m/^dpkg\s+--assert-long-filenames\b/) { + tag "ancient-dpkg-long-filenames-check", "$file:$."; + } + if (m/^dpkg\s+--assert-multi-conrep\b/) { + tag "ancient-dpkg-multi-conrep-check", "$file:$."; + } } } if (m,\bsuidregister\b,) { Modified: trunk/checks/scripts.desc =================================================================== --- trunk/checks/scripts.desc 2008-03-03 05:38:12 UTC (rev 1236) +++ trunk/checks/scripts.desc 2008-03-03 06:03:37 UTC (rev 1237) @@ -391,7 +391,36 @@ Tag: maintainer-script-empty Type: warning -Info: The maintainer script doesn't seem to contain any code. While this - is harmless in most cases it is probably not what you wanted and may even - lead to problems in rare situations where dpkg would fail if no maintainer - script was present. +Info: The maintainer script doesn't seem to contain any code other than + comments and boilerplate (set -e, exit statements, and the case statement + to parse options). While this is harmless in most cases, it is probably + not what you wanted, may mean the package will leave unnecessary files + behind until purged, and may even lead to problems in rare situations + where dpkg would fail if no maintainer script was present. + . + If the package currently doesn't need to do anything in this maintainer + script, it shouldn't be included in the package. + +Tag: ancient-dpkg-predepends-check +Type: warning +Info: The package calls dpkg --assert-support-predepends in a maintainer + script. This check is obsolete and has always returned true since dpkg + 1.1.0, released 1996-02-11. + +Tag: ancient-dpkg-epoch-check +Type: warning +Info: The package calls dpkg --assert-working-epoch in a maintainer + script. This check is obsolete and has always returned true since dpkg + 1.4.0.7, released 1997-01-25. + +Tag: ancient-dpkg-long-filenames-check +Type: warning +Info: The package calls dpkg --assert-long-filenames in a maintainer + script. This check is obsolete and has always returned true since dpkg + 1.4.1.17, released 1999-10-21. + +Tag: ancient-dpkg-multi-conrep-check +Type: warning +Info: The package calls dpkg --assert-multi-conrep in a maintainer + script. This check is obsolete and has always returned true since dpkg + 1.4.1.19, released 1999-10-30. Modified: trunk/debian/changelog =================================================================== --- trunk/debian/changelog 2008-03-03 05:38:12 UTC (rev 1236) +++ trunk/debian/changelog 2008-03-03 06:03:37 UTC (rev 1237) @@ -60,6 +60,9 @@ + [RA] Allow zsh-beta as an alternative to zsh. Thanks, Joost van Baal. (Closes: #468362) + [RA] Add yorick. Thanks, Thibaut Paumard. (Closes: #468370) + + [RA] Add warnings for dpkg --assert* flags for features that have + been guaranteed for nearly a decade. Thanks, Bernhard R. Link. + (Closes: #467642) * frontend/lintian: + [CW] Make the presence of an Ubuntu release name in the version number Added: trunk/testset/dh-test/debian/postinst =================================================================== --- trunk/testset/dh-test/debian/postinst (rev 0) +++ trunk/testset/dh-test/debian/postinst 2008-03-03 06:03:37 UTC (rev 1237) @@ -0,0 +1,41 @@ +#!/bin/sh +# postinst script for #PACKAGE# +# +# 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) + ;; + + 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 + + Modified: trunk/testset/maintainer-scripts/debian/preinst =================================================================== --- trunk/testset/maintainer-scripts/debian/preinst 2008-03-03 05:38:12 UTC (rev 1236) +++ trunk/testset/maintainer-scripts/debian/preinst 2008-03-03 06:03:37 UTC (rev 1237) @@ -2,3 +2,9 @@ update-rc.d foo remove update-rc.d bar defaults + +# Obsolete dpkg assertions. +dpkg --assert-support-predepends || exit 1 +dpkg --assert-working-epoch || exit 1 +dpkg --assert-long-filenames || exit 1 +dpkg --assert-multi-conrep || exit 1 Modified: trunk/testset/tags.dh-test =================================================================== --- trunk/testset/tags.dh-test 2008-03-03 05:38:12 UTC (rev 1236) +++ trunk/testset/tags.dh-test 2008-03-03 06:03:37 UTC (rev 1237) @@ -9,6 +9,7 @@ W: dh-test source: out-of-date-standards-version 3.6.2 (current is 3.7.3) W: dh-test source: package-uses-deprecated-debhelper-compat-version 3 W: dh-test: copyright-without-copyright-notice +W: dh-test: maintainer-script-empty postinst W: dh-test: new-package-should-close-itp-bug W: dh-test: readme-debian-contains-debmake-template W: dh-test: wrong-bug-number-in-closes l3:#nnnn Modified: trunk/testset/tags.maintainer-scripts =================================================================== --- trunk/testset/tags.maintainer-scripts 2008-03-03 05:38:12 UTC (rev 1236) +++ trunk/testset/tags.maintainer-scripts 2008-03-03 06:03:37 UTC (rev 1237) @@ -32,6 +32,10 @@ W: maintainer-scripts source: changelog-should-mention-qa W: maintainer-scripts source: package-uses-deprecated-debhelper-compat-version 1 W: maintainer-scripts source: qa-upload-has-incorrect-version-number 7-0.1 +W: maintainer-scripts: ancient-dpkg-epoch-check preinst:8 +W: maintainer-scripts: ancient-dpkg-long-filenames-check preinst:9 +W: maintainer-scripts: ancient-dpkg-multi-conrep-check preinst:10 +W: maintainer-scripts: ancient-dpkg-predepends-check preinst:7 W: maintainer-scripts: config-does-not-load-confmodule W: maintainer-scripts: deprecated-chown-usage postinst:33 'chown root.root' W: maintainer-scripts: gconftool-used-in-maintainer-script postinst:68 -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]