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

Bug#561756: lintian: [new check] Architecture dependent packages without architecture dependent files



Package: lintian
Version: 2.2.17
Severity: wishlist
Tags: patch

per policy 5.6.8 Architecture: all must be used if package doesn't
contain arch depentent files. I dont know how common this error is
(noticed the error in the iwatch package). I though that this might be
useful for lintian to catch, so I've tried to write a simple check for
this.
I don't know how many false positives it will generate, as it mearly
checks if "file -i" says if the mime major is not "text".

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'stable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.30-1-686 (SMP w/1 CPU core)
Locale: LANG=sv_SE.UTF-8, LC_CTYPE=sv_SE.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to sv_SE.UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages lintian depends on:
ii  binutils               2.20-1            The GNU assembler, linker and bina
ii  diffstat               1.47-1            produces graph of changes introduc
ii  dpkg-dev               1.15.4.1          Debian package development tools
ii  file                   5.03-2            Determines file type using "magic"
ii  gettext                0.17-8            GNU Internationalization utilities
ii  intltool-debian        0.35.0+20060710.1 Help i18n of RFC822 compliant conf
ii  libapt-pkg-perl        0.1.24            Perl interface to libapt-pkg
ii  libclass-accessor-perl 0.34-1            Perl module that automatically gen
ii  libipc-run-perl        0.84-1            Perl module for running processes
ii  libparse-debianchangel 1.1.1-2           parse Debian changelogs and output
ii  libtimedate-perl       1.1900-1          Time and date functions for Perl
ii  liburi-perl            1.37+dfsg-1       Manipulates and accesses URI strin
ii  man-db                 2.5.6-3           on-line manual pager
ii  perl [libdigest-sha-pe 5.10.1-8          Larry Wall's Practical Extraction 

lintian recommends no packages.

Versions of packages lintian suggests:
ii  binutils-multiarch            2.20-1     Binary utilities that support mult
ii  libtext-template-perl         1.45-1     Text::Template perl module
ii  man-db                        2.5.6-3    on-line manual pager

-- no debconf information
diff --git a/checks/arch-not-all b/checks/arch-not-all
new file mode 100644
index 0000000..bb45a1a
--- /dev/null
+++ b/checks/arch-not-all
@@ -0,0 +1,54 @@
+# binaries -- lintian check script -*- perl -*-
+
+# Copyright (C) 2009 Carl Fürstenberg
+#
+# 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., 51 Franklin St, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
+package Lintian::arch_any;
+use strict;
+use Tags;
+
+sub run {
+
+    my $pkg = shift;
+    my $type = shift;
+    my $info = shift;
+
+    $arch = $info->field('architecture') || '';
+
+    return 0 if $arch eq 'all';
+
+    my $got_arch_dependent_file = 0;
+    foreach my $entry (`find unpacked -type f -exec file --mime-type \\{\\} \\;`) {
+
+        my($file, $major, $minor) = $entry =~ /(.*?):\s*(.*?)\/(.*)/;
+        if( $major ne 'text' ) { # XXX will that have too many false positives?
+            $got_arch_dependent_file = 1;
+            last;
+        }
+    }
+
+    tag "non-arch-all-package-doesnt-contain-any-arch-dependent-file" unless $got_arch_dependent_file;
+}
+
+1;
+
+# Local Variables:
+# indent-tabs-mode: t
+# cperl-indent-level: 4
+# End:
+# vim: syntax=perl ts=8 sw=4
diff --git a/checks/arch-not-all.desc b/checks/arch-not-all.desc
new file mode 100644
index 0000000..35495fc
--- /dev/null
+++ b/checks/arch-not-all.desc
@@ -0,0 +1,16 @@
+Check-Script: arch-non-all
+Author: Carl Fürstenberg <azatoth@gamil.com>
+Abbrev: ana
+Type: binary, udeb
+Unpack-Level: 2
+Info: This script checks whether an architecture-dependent package actually has any architecture
+ dependent code.
+
+Tag: non-arch-all-package-doesnt-contain-any-arch-dependent-file
+Severity: serious
+Certainty: possible
+Info: The package is marked as architecture dependent in control file,
+ but all files shipped with the package is architecture independent and
+ should therefor in the control file be marked as "Architecture: all" instead.
+Ref: policy 5.6.8
+

Reply to: