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

lintian: r77 - in trunk: checks debian testset testset/binary/debian



Author: jeroen
Date: 2004-02-27 15:04:16 +0100 (Fri, 27 Feb 2004)
New Revision: 77

Added:
   trunk/checks/huge-usr-share
   trunk/checks/huge-usr-share.desc
Modified:
   trunk/debian/changelog
   trunk/testset/binary/debian/changelog
   trunk/testset/binary/debian/rules
   trunk/testset/info_tags.binary
   trunk/testset/tags.binary
Log:
checks/huge-usr-share:
+ Check for a big /usr/share (currently 250kB) in arch-dependent
  packages (Closes: #232849)
  Thanks Steve McIntyre for the idea

Not sure what the treshold should be, and maybe make it also dependent on the
.deb size? I.e., a 100MB deb with 300kB /usr/share is maybe not that bad...


Added: trunk/checks/huge-usr-share
===================================================================
--- trunk/checks/huge-usr-share	2004-02-27 02:22:28 UTC (rev 76)
+++ trunk/checks/huge-usr-share	2004-02-27 14:04:16 UTC (rev 77)
@@ -0,0 +1,69 @@
+#!/usr/bin/perl -w
+# binaries -- lintian check script
+
+# Copyright (C) 1998 Christian Schwarz and Richard Braakman
+#
+# 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, you can find it on the World Wide
+# Web at http://www.gnu.org/copyleft/gpl.html, or write to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
+
+use strict;
+
+($#ARGV == 1) or fail("syntax: huge-usr-share <pkg> <type>");
+my $pkg = shift;
+my $type = shift;
+
+# Treshold in kB of /usr/share to trigger this warning
+# Consider that the changelog alone can be quite big, and cannot be moved away
+my $TRESHOLD = 250;
+
+my $arch;
+
+# read architecture file
+if (open(IN,"fields/architecture")) {
+    chop($arch = <IN>);
+    close(IN);
+}
+
+# If this is a arch-independent package, this test doesn't apply
+exit 0 if $arch eq 'all';
+
+my $size = `du -ks unpacked`;
+$size =~ s/\t.*//;
+$size = int $size;
+
+my $size_usrshare = `du -ks unpacked/usr/share`;
+$size_usrshare =~ s/\t.*//;
+$size_usrshare = int $size_usrshare;
+
+if ($size_usrshare > $TRESHOLD) {
+	my $perc = int (100 * $size_usrshare / $size);
+	print "W: $pkg $type: arch-dep-package-has-big-usr-share ${size_usrshare}kB $perc%\n";
+}
+
+exit 0;
+
+# -----------------------------------
+
+sub fail {
+    if ($_[0]) {
+	warn "internal error: $_[0]\n";
+    } elsif ($!) {
+	warn "internal error: $!\n";
+    } else {
+	warn "internal error.\n";
+    }
+    exit 1;
+}


Property changes on: trunk/checks/huge-usr-share
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/checks/huge-usr-share.desc
===================================================================
--- trunk/checks/huge-usr-share.desc	2004-02-27 02:22:28 UTC (rev 76)
+++ trunk/checks/huge-usr-share.desc	2004-02-27 14:04:16 UTC (rev 77)
@@ -0,0 +1,22 @@
+Check-Script: huge-usr-share
+Author: Jeroen van Wolffelaar <jeroen@wolffelaar.nl>
+Abbrev: hus
+Standards-Version: 3.6.1
+Type: binary
+Unpack-Level: 2
+Info: This script checks whether an architecture-dependent package doesn't
+ have a significantly big /usr/share
+
+Tag: arch-dep-package-has-big-usr-share
+Type: warning
+Info: The package has a significant amount of architecture-independent data in
+ /usr/share, while it is an architecture-dependent package.
+ This is wasteful of mirror space and bandwidth, as we then end up with
+ multiple copies of this data, one for each architecture.
+ .
+ If the data in /usr/share is not architecture-independent, it is a policy
+ violation, and in this case, you should move that data elsewhere.
+ .
+ See also: http://www.debian.org/doc/developers-reference/ch-best-pkging-practices#s-bpp-archindepdata
+
+

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2004-02-27 02:22:28 UTC (rev 76)
+++ trunk/debian/changelog	2004-02-27 14:04:16 UTC (rev 77)
@@ -58,6 +58,10 @@
     + Check whether files listed in debian/po/POTFILES.in actually exist,
       and only positively detect po-debconf usage if dependency is there.
       (Patch by Denis Barbier <barbier@debian.org>, only minimally modified)
+  * checks/huge-usr-share:
+    + Check for a big /usr/share (currently 250kB) in arch-dependent
+      packages (Closes: #232849)
+      Thanks Steve McIntyre for the idea
 
  -- Frank Lichtenheld <djpig@debian.org>  Thu, 26 Feb 2004 21:52:14 +0100
 

Modified: trunk/testset/binary/debian/changelog
===================================================================
--- trunk/testset/binary/debian/changelog	2004-02-27 02:22:28 UTC (rev 76)
+++ trunk/testset/binary/debian/changelog	2004-02-27 14:04:16 UTC (rev 77)
@@ -1,3 +1,9 @@
+binary (4) unstable; urgency=low
+
+  * Add big file to /usr/share to trigger the big-usr-share check
+
+ -- Jeroen van Wolffelaar <jeroen@wolffelaar.nl>  Fri, 27 Feb 2004 10:15:59 +0100
+
 binary (3) unstable; urgency=unlimited
 
   * Add some bogus menu entries using su-to-root in a bogus way

Modified: trunk/testset/binary/debian/rules
===================================================================
--- trunk/testset/binary/debian/rules	2004-02-27 02:22:28 UTC (rev 76)
+++ trunk/testset/binary/debian/rules	2004-02-27 14:04:16 UTC (rev 77)
@@ -16,6 +16,7 @@
 	install -d $(tmp)/usr/share/doc/binary
 	install -m 644 INSTALL $(tmp)/usr/share/doc/binary
 	install -d $(tmp)/usr/lib/menu
+	install -d $(tmp)/usr/share/binary
 	install -m 644 debian/menu $(tmp)/usr/lib/menu/binary
 	install -m 644 debian/README.Debian $(tmp)/usr/share/doc/binary
 	install -m 644 debian/copyright $(tmp)/usr/share/doc/binary
@@ -24,6 +25,8 @@
 	install -d $(tmp)/DEBIAN
 	install -m 755 debian/postinst $(tmp)/DEBIAN
 
+	dd if=/dev/zero of=$(tmp)/usr/share/binary/largefile count=500
+
 	dpkg-shlibdeps $(tmp)/usr/bin/hello
 	dpkg-gencontrol -isp
 	dpkg --build debian/tmp ..

Modified: trunk/testset/info_tags.binary
===================================================================
--- trunk/testset/info_tags.binary	2004-02-27 02:22:28 UTC (rev 76)
+++ trunk/testset/info_tags.binary	2004-02-27 14:04:16 UTC (rev 77)
@@ -23,6 +23,21 @@
 N:   Refer to Policy Manual, section 12.1 for details.
 N:
 E: binary: binary-without-manpage hello-static
+W: binary: arch-dep-package-has-big-usr-share 292kB 39%
+N:
+N:   The package has a significant amount of architecture-independent data
+N:   in /usr/share, while it is an architecture-dependent package. This is
+N:   wasteful of mirror space and bandwidth, as we then end up with
+N:   multiple copies of this data, one for each architecture.
+N:   
+N:   If the data in /usr/share is not architecture-independent, it is a
+N:   policy violation, and in this case, you should move that data
+N:   elsewhere.
+N:   
+N:   See also:
+N:   http://www.debian.org/doc/developers-reference/ch-best-pkging-practice
+N:   s#s-bpp-archindepdata
+N:
 W: binary: package-contains-upstream-install-documentation usr/share/doc/binary/INSTALL
 N:
 N:   Binary packages do not need to contain the instructions for building

Modified: trunk/testset/tags.binary
===================================================================
--- trunk/testset/tags.binary	2004-02-27 02:22:28 UTC (rev 76)
+++ trunk/testset/tags.binary	2004-02-27 14:04:16 UTC (rev 77)
@@ -1,6 +1,7 @@
 W: binary source: ancient-standards-version 3.2.1
 E: binary: binary-without-manpage hello
 E: binary: binary-without-manpage hello-static
+W: binary: arch-dep-package-has-big-usr-share 292kB 39%
 W: binary: package-contains-upstream-install-documentation usr/share/doc/binary/INSTALL
 E: binary: postinst-does-not-call-updatemenus usr/lib/menu/binary
 E: binary: postrm-does-not-call-updatemenus usr/lib/menu/binary



Reply to: