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

[SCM] Debian package checker branch, master, updated. 2.2.18-62-gbabdc55



The following commit has been merged in the master branch:
commit 9453d8d7e979518c5052e6ba0ddf14a7de201af7
Author: Russ Allbery <rra@debian.org>
Date:   Thu Dec 24 20:47:11 2009 -0800

    Update OCaml checks for current standards
    
    Tweak the coding style a bit, add some markup to the descriptions, lower
    the priority of one from normal to minor based on the tag description,
    and add a test suite.

diff --git a/checks/ocaml b/checks/ocaml
index 2c62817..59af636 100644
--- a/checks/ocaml
+++ b/checks/ocaml
@@ -19,9 +19,16 @@
 # MA 02110-1301, USA.
 
 package Lintian::ocaml;
+
 use strict;
-use Tags;
+
 use File::Basename;
+use Lintian::Collect::Binary ();
+use Lintian::Tags qw(tag);
+use Lintian::Relation ();
+
+# The maximum number of *.cmi files to show individually.
+our $MAX_CMI = 3;
 
 sub run {
 
@@ -61,9 +68,8 @@ if ($pkg =~ /(-dev|^camlp[45](-extra)?|^ocaml(-nox|-interp|-compiler-libs)?)$/)
 my $outside_number = 0;
 my $outside_prefix;
 
-# dangling .cmi files (we show only $max_cmi of them)
+# dangling .cmi files (we show only $MAX_CMI of them)
 my $cmi_number = 0;
-my $max_cmi = 3;
 
 # dev files in nondev package
 my $dev_number = 0;
@@ -108,7 +114,7 @@ foreach my $file (sort keys %{$info->file_info}) {
         && !(exists $info->file_info->{"${_}i"})
         && !(exists $info->file_info->{$_})) {
         $cmi_number++;
-        if ($cmi_number <= $max_cmi) {
+        if ($cmi_number <= $MAX_CMI) {
             tag "ocaml-dangling-cmi", $file;
         }
     }
@@ -140,37 +146,36 @@ foreach my $file (sort keys %{$info->file_info}) {
         }
     }
 
-    # if there is a META file, ocaml-findlib should be at least
-    # suggested
-    $has_meta = 1 if $file =~ m@/META(\..*)?$@;
-
+    # If there is a META file, ocaml-findlib should be at least suggested.
+    $has_meta = 1 if $file =~ m@^usr/lib/ocaml/(.+/)?META(\..*)?$@;
 }
 
 if ($is_dev_package) {
     # summary about .cmi files
-    if ($cmi_number > $max_cmi) {
-        tag "ocaml-dangling-cmi", ($cmi_number-$max_cmi), "more file(s) not shown";
+    if ($cmi_number > $MAX_CMI) {
+        my $plural = ($cmi_number - $MAX_CMI == 1) ? '' : 's';
+        tag "ocaml-dangling-cmi", ($cmi_number - $MAX_CMI),
+            "more file$plural not shown";
     }
     # summary about /usr/lib/ocaml
     if ($outside_number) {
         $outside_prefix = dirname($outside_prefix);
-        tag "ocaml-dev-file-not-in-usr-lib-ocaml", "$outside_number file(s) in /$outside_prefix";
+        my $plural = ($outside_number == 1) ? '' : 's';
+        tag "ocaml-dev-file-not-in-usr-lib-ocaml",
+            "$outside_number file$plural in /$outside_prefix";
     }
     if ($has_meta) {
-        my $findlib = 0;
-        for my $field (qw(depends recommends suggests)) {
-            if (defined $info->field($field)) {
-                $_ = $info->field($field);
-                $findlib = 1 if /ocaml-findlib/;
-            }
-        }
-        tag "ocaml-meta-without-suggestion-to-findlib" unless $findlib;
+        my $depends = $info->relation('all');
+        tag 'ocaml-meta-without-suggesting-findlib'
+            unless $depends->implies('ocaml-findlib');
     }
 } else {
     # summary about dev files
     if ($dev_number > 0) {
         $dev_prefix = dirname($dev_prefix);
-        tag "ocaml-dev-file-in-nondev-package", "$dev_number file(s) in /$dev_prefix";
+        my $plural = ($dev_number == 1) ? '' : 's';
+        tag "ocaml-dev-file-in-nondev-package",
+            "$dev_number file$plural in /$dev_prefix";
     }
 }
 
diff --git a/checks/ocaml.desc b/checks/ocaml.desc
index 8d21a50..151b832 100644
--- a/checks/ocaml.desc
+++ b/checks/ocaml.desc
@@ -9,57 +9,59 @@ Needs-Info: file-info, ar-info
 Tag: ocaml-dangling-cmxa
 Severity: serious
 Certainty: certain
-Info: This package provides a .cmxa library without its implementation
- (.a static library).
+Info: This package provides a <tt>.cmxa</tt> library without its
+ implementation (<tt>.a</tt> static library).
 
 Tag: ocaml-dangling-cmx
 Severity: serious
 Certainty: certain
-Info: This package provides a .cmx module without its implementation
- (.o object file which may be embedded in a .a static library
- installed in the same directory).
+Info: This package provides a <tt>.cmx</tt> module without its
+ implementation (<tt>.o</tt> object file which may be embedded in a
+ <tt>.a</tt> static library installed in the same directory).
 
 Tag: ocaml-dangling-cmxs
 Severity: normal
 Certainty: possible
-Info: This package seems to be a library package, and provides a
- native plugin (.cmxs). If the plugin is meant to be used as a
- library for other plugins, it should be shipped as bytecode
- (.cma or .cmo) as well.
+Info: This package seems to be a library package, and provides a native
+ plugin (<tt>.cmxs</tt>).  If the plugin is meant to be used as a library
+ for other plugins, it should be shipped as bytecode (<tt>.cma</tt> or
+ <tt>.cmo</tt>) as well.
 
 Tag: ocaml-dev-file-not-in-usr-lib-ocaml
 Severity: pedantic
 Certainty: possible
-Info: This development package installs OCaml development files (.cmi,
- .cmx or .cmxa) outside /usr/lib/ocaml. Such files are used only by
- compilation and should be in a subdirectory of OCaml standard library
- path.
+Info: This development package installs OCaml development files
+ (<tt>.cmi</tt>, <tt>.cmx</tt> or <tt>.cmxa</tt>) outside
+ <tt>/usr/lib/ocaml</tt>.  Such files are used only by compilation and
+ should be in a subdirectory of OCaml standard library path.
 
 Tag: ocaml-stray-cmo
-Severity: normal
+Severity: minor
 Certainty: wild-guess
-Info: This package installs a .cma file and a .cmo file with the same
- base name. Most of the time, the module provided by the .cmo file is
- also linked in the .cma file, so the .cmo file is useless.
+Info: This package installs a <tt>.cma</tt> file and a <tt>.cmo</tt> file
+ with the same base name.  Most of the time, the module provided by the
+ <tt>.cmo</tt> file is  also linked in the <tt>.cma</tt> file, so the
+ <tt>.cmo</tt> file is useless.
 
 Tag: ocaml-dangling-cmi
 Severity: wishlist
 Certainty: possible
-Info: This package installs a compiled interface (.cmi) without its
- text version (.mli). The text version should also be installed for
- documentation purpose. If the module involved doesn't have a .mli,
- its source code (.ml) should be installed instead.
+Info: This package installs a compiled interface (<tt>.cmi</tt>) without
+ its text version (<tt>.mli</tt>).  The text version should also be
+ installed for documentation purpose.  If the module involved doesn't have
+ a <tt>.mli</tt>, its source code (<tt>.ml</tt>) should be installed
+ instead.
 
 Tag: ocaml-dev-file-in-nondev-package
 Severity: pedantic
 Certainty: possible
 Info: This package doesn't appear to be a development package, but
- installs OCaml development files (.cmi, .cmx or .cmxa). These files
- should be moved to a development package.
+ installs OCaml development files (<tt>.cmi</tt>, <tt>.cmx</tt> or
+ <tt>.cmxa</tt>).  These files should be moved to a development package.
 
-Tag: ocaml-meta-without-suggestion-to-findlib
+Tag: ocaml-meta-without-suggesting-findlib
 Severity: pedantic
 Certainty: certain
-Info: This development package installs a META file, but doesn't
- depend on ocaml-findlib. Libraries with META file are easier to use
- with findlib; the package should at least suggest ocaml-findlib.
+Info: This development package installs a META file but doesn't depend on
+ ocaml-findlib.  Libraries with META file are easier to use with findlib.
+ The package should at least suggest ocaml-findlib.
diff --git a/debian/changelog b/debian/changelog
index 4e4f71c..8fbfc05 100755
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,14 @@ lintian (2.3.0) UNRELEASED; urgency=low
       - init.d-script-missing-dependency-on-local_fs (experimental)
       - init.d-script-missing-dependency-on-remote_fs (experimental)
       - obsolete-relation-form-in-source
+      - ocaml-dangling-cmi
+      - ocaml-dangling-cmx
+      - ocaml-dangling-cmxa
+      - ocaml-dangling-cmxs
+      - ocaml-dev-file-in-nondev-package (pedantic)
+      - ocaml-dev-file-not-in-usr-lib-ocaml (pedantic)
+      - ocaml-meta-without-suggesting-findlib (pedantic)
+      - ocaml-stray-cmo
     + Removed:
       - build-depends-without-arch-dep
 
@@ -48,6 +56,9 @@ lintian (2.3.0) UNRELEASED; urgency=low
       Note that Debian groff is currently patched to avoid this problem,
       but hopefully that divergence can be removed.  Reference
       groff-base's README.Debian for more information.  (Closes: #548844)
+  * checks/ocaml{,.desc}:
+    + [RA] New checks for OCaml packaging.  Contributed by Stéphane
+      Glondu.  (Closes: #528367)
   * checks/rules{,.desc}:
     + [RA] Remove build-depends-without-arch-dep.  If the package only
       builds architecture-independent packages, the distinction between
@@ -130,6 +141,7 @@ lintian (2.3.0) UNRELEASED; urgency=low
     + [RA] Document --suppress-tags and --suppress-tags-from-file.
     + [RA] Document format of --tags-from-file.
     + [RA] Document -F (--ftp-master-rejects).
+    + [RA] Add ocaml checker script.
 
   * private/refresh-ftp-master-tags:
     + [RA] Script to refresh data about automatic package rejects.
diff --git a/debian/copyright b/debian/copyright
index 50c36e1..bb95801 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -42,6 +42,7 @@ Portions Copyright (C) 2008 Patrick Schoenfeld
 Portions Copyright (C) 2008 Niko Tyni
 Portions Copyright (C) 2008-2009 Raphael Geissert
 Portions Copyright (C) 2008-2009 Adam D. Barratt
+Portions Copyright (C) 2009 Stéphane Glondu
 
 This program is free software; you may redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
diff --git a/man/lintian.1 b/man/lintian.1
index f3cd58d..4465996 100644
--- a/man/lintian.1
+++ b/man/lintian.1
@@ -559,6 +559,11 @@ Checks whether the package is consistent as to whether it
 is an NMU.
 
 .TP
+.B ocaml (ocaml)
+Checks various things related to packaging of OCaml libraries and other
+software.
+
+.TP
 .B patch\-systems (pat)
 Check source package use of patch systems.
 
diff --git a/t/tests/ocaml-general/debian/Makefile b/t/tests/ocaml-general/debian/Makefile
new file mode 100644
index 0000000..24fe22c
--- /dev/null
+++ b/t/tests/ocaml-general/debian/Makefile
@@ -0,0 +1,9 @@
+# A simple makefile to build a *.o file and a *.a file to install to test
+# the OCaml checks for dangling *.cmx files.
+all: symbol.a
+
+symbol.a: symbol.o
+	ar rv symbol.a symbol.o
+
+symbol.o: symbol.c
+	cc -c symbol.c
diff --git a/t/tests/fields-essential/debian/debian/control.in b/t/tests/ocaml-general/debian/debian/control.in
similarity index 63%
copy from t/tests/fields-essential/debian/debian/control.in
copy to t/tests/ocaml-general/debian/debian/control.in
index 11f1cd0..4b3ab65 100644
--- a/t/tests/fields-essential/debian/debian/control.in
+++ b/t/tests/ocaml-general/debian/debian/control.in
@@ -3,23 +3,24 @@ Priority: extra
 Section: {$section}
 Maintainer: {$author}
 Standards-Version: {$standards_version}
-XS-Essential: no
-Build-Depends: debhelper (>= 7)
+Build-Depends: debhelper (>= 7.0.50~)
 
-Package: {$srcpkg}
-Essential: yes
+Package: libocaml-general-ocaml
 Architecture: {$architecture}
 Depends: $\{shlibs:Depends\}, $\{misc:Depends\}
-Description: {$description}
+Description: OCaml library package for tests
  This is a test package designed to exercise some feature or tag of
  Lintian.  It is part of the Lintian test suite and may do very odd
  things.  It should not be installed like a regular package.
+ .
+ A library package for OCaml checks.
 
-Package: {$srcpkg}2
-Essential: maybe
+Package: libocaml-general-ocaml-dev
 Architecture: {$architecture}
 Depends: $\{shlibs:Depends\}, $\{misc:Depends\}
-Description: {$description} -- maybe
- This is another test package designed to exercise some feature or tag of
+Description: OCaml dev package for tests
+ This is a test package designed to exercise some feature or tag of
  Lintian.  It is part of the Lintian test suite and may do very odd
  things.  It should not be installed like a regular package.
+ .
+ A development package for OCaml checks.
diff --git a/t/tests/ocaml-general/debian/debian/libocaml-general-ocaml-dev.dirs b/t/tests/ocaml-general/debian/debian/libocaml-general-ocaml-dev.dirs
new file mode 100644
index 0000000..00a96ae
--- /dev/null
+++ b/t/tests/ocaml-general/debian/debian/libocaml-general-ocaml-dev.dirs
@@ -0,0 +1 @@
+usr/lib/ocaml
diff --git a/t/tests/ocaml-general/debian/debian/libocaml-general-ocaml-dev.install b/t/tests/ocaml-general/debian/debian/libocaml-general-ocaml-dev.install
new file mode 100644
index 0000000..5a1e87a
--- /dev/null
+++ b/t/tests/ocaml-general/debian/debian/libocaml-general-ocaml-dev.install
@@ -0,0 +1 @@
+symbol.a usr/lib/ocaml
diff --git a/t/tests/ocaml-general/debian/debian/libocaml-general-ocaml.dirs b/t/tests/ocaml-general/debian/debian/libocaml-general-ocaml.dirs
new file mode 100644
index 0000000..00a96ae
--- /dev/null
+++ b/t/tests/ocaml-general/debian/debian/libocaml-general-ocaml.dirs
@@ -0,0 +1 @@
+usr/lib/ocaml
diff --git a/t/tests/ocaml-general/debian/debian/rules b/t/tests/ocaml-general/debian/debian/rules
new file mode 100755
index 0000000..ff1fef5
--- /dev/null
+++ b/t/tests/ocaml-general/debian/debian/rules
@@ -0,0 +1,21 @@
+#!/usr/bin/make -f
+export DH_VERBOSE=1
+
+%:
+	dh $@
+
+override_dh_installdirs:
+	dh_installdirs
+	touch debian/libocaml-general-ocaml/usr/lib/ocaml/foo.cmxa
+	touch debian/libocaml-general-ocaml/usr/lib/ocaml/bar.cmxs
+	touch debian/libocaml-general-ocaml/usr/lib/ocaml/symbol.cmx
+	touch debian/libocaml-general-ocaml-dev/usr/lib/ocaml/foo.cmi
+	touch debian/libocaml-general-ocaml-dev/usr/lib/ocaml/bar.cmi
+	touch debian/libocaml-general-ocaml-dev/usr/lib/ocaml/baz.cmi
+	touch debian/libocaml-general-ocaml-dev/usr/lib/ocaml/boo.cmi
+	touch debian/libocaml-general-ocaml-dev/usr/lib/ocaml/symbol.cmx
+	touch debian/libocaml-general-ocaml-dev/usr/lib/ocaml/symbol2.cmx
+	touch debian/libocaml-general-ocaml-dev/usr/lib/ocaml/bleh.cmo
+	touch debian/libocaml-general-ocaml-dev/usr/lib/ocaml/bleh.cma
+	touch debian/libocaml-general-ocaml-dev/usr/lib/ocaml/META
+	touch debian/libocaml-general-ocaml-dev/usr/lib/foo.cmi
diff --git a/t/tests/ocaml-general/debian/symbol.c b/t/tests/ocaml-general/debian/symbol.c
new file mode 100644
index 0000000..79a896f
--- /dev/null
+++ b/t/tests/ocaml-general/debian/symbol.c
@@ -0,0 +1,5 @@
+int
+symbol(void)
+{
+    return 42;
+}
diff --git a/t/tests/ocaml-general/desc b/t/tests/ocaml-general/desc
new file mode 100644
index 0000000..1eb4aa0
--- /dev/null
+++ b/t/tests/ocaml-general/desc
@@ -0,0 +1,17 @@
+Testname: ocaml-general
+Sequence: 6000
+Version: 1.0
+Skeleton: pedantic
+Options: -I -E --pedantic
+Architecture: any
+Section: ocaml
+Description: Test the OCaml-related tags
+Test-For:
+ ocaml-dev-file-in-nondev-package
+ ocaml-dev-file-not-in-usr-lib-ocaml
+ ocaml-dangling-cmi
+ ocaml-dangling-cmx
+ ocaml-dangling-cmxa
+ ocaml-dangling-cmxs
+ ocaml-meta-without-suggesting-findlib
+ ocaml-stray-cmo
diff --git a/t/tests/ocaml-general/tags b/t/tests/ocaml-general/tags
new file mode 100644
index 0000000..896b51a
--- /dev/null
+++ b/t/tests/ocaml-general/tags
@@ -0,0 +1,12 @@
+E: libocaml-general-ocaml-dev: ocaml-dangling-cmx usr/lib/ocaml/symbol2.cmx
+E: libocaml-general-ocaml: ocaml-dangling-cmx usr/lib/ocaml/symbol.cmx
+E: libocaml-general-ocaml: ocaml-dangling-cmxa usr/lib/ocaml/foo.cmxa
+I: libocaml-general-ocaml-dev: ocaml-dangling-cmi 2 more files not shown
+I: libocaml-general-ocaml-dev: ocaml-dangling-cmi usr/lib/foo.cmi
+I: libocaml-general-ocaml-dev: ocaml-dangling-cmi usr/lib/ocaml/bar.cmi
+I: libocaml-general-ocaml-dev: ocaml-dangling-cmi usr/lib/ocaml/baz.cmi
+I: libocaml-general-ocaml-dev: ocaml-stray-cmo usr/lib/ocaml/bleh.cma
+P: libocaml-general-ocaml-dev: ocaml-dev-file-not-in-usr-lib-ocaml 1 file in /usr/lib
+P: libocaml-general-ocaml-dev: ocaml-meta-without-suggesting-findlib
+P: libocaml-general-ocaml: ocaml-dev-file-in-nondev-package 2 files in /usr/lib
+W: libocaml-general-ocaml: ocaml-dangling-cmxs usr/lib/ocaml/bar.cmxs

-- 
Debian package checker


Reply to: