Author: rra
Date: 2006-11-11 04:02:50 +0100 (Sat, 11 Nov 2006)
New Revision: 765

Modified:
   trunk/checks/control-file
   trunk/checks/control-file.desc
   trunk/debian/changelog
   trunk/testset/relations/debian/control
   trunk/testset/tags.non-us
   trunk/testset/tags.relations
Log:
* checks/control-file{.desc,}:
  + [RA] Diagnose a control file that creates binary packages in a
    different archive category from the source package or the other
    binary packages.  Idea from Yann Dirson.  (Closes: #394720)

Modified: trunk/checks/control-file
===================================================================
--- trunk/checks/control-file   2006-11-11 02:31:47 UTC (rev 764)
+++ trunk/checks/control-file   2006-11-11 03:02:50 UTC (rev 765)
@@ -1,7 +1,7 @@
 # control-file -- lintian check script -*- perl -*-
 #
 # Copyright (C) 2004 Marc Brockschmidt
-# 
+#
 # 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
@@ -53,7 +53,7 @@
                if ($seen_fields->{$field}) {
                        tag "debian-control-with-duplicate-fields", "$field: 
$$seen_fields{$field}, $.";
                }
-               $seen_fields->{$field} = $.; 
+               $seen_fields->{$field} = $.;
        }
 }
 close CONTROL;
@@ -66,8 +66,37 @@
                $binary_control->{"build-conflicts"} || 
$binary_control->{"build-conflicts-indep"});
 }
 
+# Check that every package is in the same archive category.  The source
+# package may or may not have a section specified; if it doesn't, derive the
+# expected archive category from the first binary package by leaving $category
+# undefined until parsing the first binary section.  Missing sections will be
+# caught by other checks.
+my $category;
+if ($header->{'section'}) {
+       if ($header->{'section'} =~ m%^([^/]+)/%) {
+               $category = $1;
+       } else {
+               $category = '';
+       }
 }
+for my $binary_control (@binary_controls) {
+       next unless $binary_control->{'section'};
+       if (!defined ($category)) {
+               if ($binary_control->{'section'} =~ m%^([^/]+)/%) {
+                       $category = $1;
+               } else {
+                       $category = '';
+               }
+               next;
+       }
+       tag "section-category-mismatch", "Package " . 
$binary_control->{'package'}
+               if ($category && $binary_control->{'section'} !~ 
m%^$category/%);
+       tag "section-category-mismatch", "Package " . 
$binary_control->{'package'}
+               if (!$category && $binary_control->{'section'} =~ m%^[^/]+/%);
+}
 
+}
+
 1;
 
 # vim: syntax=perl sw=4 ts=4 noet shiftround

Modified: trunk/checks/control-file.desc
===================================================================
--- trunk/checks/control-file.desc      2006-11-11 02:31:47 UTC (rev 764)
+++ trunk/checks/control-file.desc      2006-11-11 03:02:50 UTC (rev 765)
@@ -39,3 +39,13 @@
  makes package checking and manipulation more difficult. If the control
  file should be available in the source package under multiple names, make
  <tt>debian/control</tt> the real file and the other names symlinks to it.
+
+Tag: section-category-mismatch
+Type: error
+Info: The <tt>debian/control</tt> file places the indicated binary package
+ in a different archive category (main, contrib, non-free) than its source
+ package or other binary packages built from the same source package.  The
+ source package and any binary packages it builds must be in the same
+ category of the archive.  A source package in main may only build binary
+ packages in main, a source package in non-free may only build binary
+ packages in non-free, and so forth.

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog      2006-11-11 02:31:47 UTC (rev 764)
+++ trunk/debian/changelog      2006-11-11 03:02:50 UTC (rev 765)
@@ -3,6 +3,10 @@
   * checks/binaries.desc:
     + [RA] Add a policy reference for unstripped-binary-or-object.
       Thanks, Bas Wijnen.  (Closes: #394419)
+  * checks/control-file{.desc,}:
+    + [RA] Diagnose a control file that creates binary packages in a
+      different archive category from the source package or the other
+      binary packages.  Idea from Yann Dirson.  (Closes: #394720)
   * checks/fields{.desc,}:
     + [RA] Clarify in missing-build-dependency why lintian does not take
       into account transitive build dependencies.  (Closes: #393975)
@@ -12,7 +16,7 @@
     + [RA] Remove stray commas in Ref strings since the reporting code
       considers commas to be separating two different references.
 
- -- Russ Allbery <[EMAIL PROTECTED]>  Fri, 10 Nov 2006 18:31:32 -0800
+ -- Russ Allbery <[EMAIL PROTECTED]>  Fri, 10 Nov 2006 19:00:34 -0800
 
 lintian (1.23.25) unstable; urgency=low
 

Modified: trunk/testset/relations/debian/control
===================================================================
--- trunk/testset/relations/debian/control      2006-11-11 02:31:47 UTC (rev 
764)
+++ trunk/testset/relations/debian/control      2006-11-11 03:02:50 UTC (rev 
765)
@@ -31,6 +31,7 @@
 
 Package: relations-multiple-libs
 Architecture: all
+Section: non-free/misc
 Depends: libstdc++2.10, libstdc++2.10-glibc2.2, libstdc++3.0, tk8.2, tk8.3, 
tcl8.0, tcl8.2, tkx8.2, tkx8.3, tclx8.2, libpng2, libpng3, xorg
 Provides: awk
 Provides: awk

Modified: trunk/testset/tags.non-us
===================================================================
--- trunk/testset/tags.non-us   2006-11-11 02:31:47 UTC (rev 764)
+++ trunk/testset/tags.non-us   2006-11-11 03:02:50 UTC (rev 765)
@@ -1,5 +1,7 @@
 E: broken-crypto: no-copyright-file
 E: crypto-app: no-copyright-file
+E: non-us source: section-category-mismatch Package broken-crypto
+E: non-us source: section-category-mismatch Package nonfree-crypto-app
 E: nonfree-crypto-app: no-copyright-file
 E: patented-app: no-copyright-file
 I: patented-app: non-us-spelling

Modified: trunk/testset/tags.relations
===================================================================
--- trunk/testset/tags.relations        2006-11-11 02:31:47 UTC (rev 764)
+++ trunk/testset/tags.relations        2006-11-11 03:02:50 UTC (rev 765)
@@ -4,10 +4,11 @@
 E: relations source: build-depends-on-essential-package-without-using-version 
build-depends-indep: bash
 E: relations source: build-depends-on-essential-package-without-using-version 
build-depends: findutils
 E: relations source: build-depends-on-obsolete-package build-depends-indep: 
debmake
-E: relations source: debian-control-with-duplicate-fields provides: 35, 36
+E: relations source: debian-control-with-duplicate-fields provides: 36, 37
 E: relations source: depends-on-build-essential-package-without-using-version 
libc6-dev [build-depends: libc6-dev]
 E: relations source: depends-on-build-essential-package-without-using-version 
make [build-depends-indep: make]
 E: relations source: invalid-arch-string-in-source-relation test 
[build-conflicts: bar [alpha test]]
+E: relations source: section-category-mismatch Package relations-multiple-libs
 E: relations-multiple-libs: description-synopsis-is-duplicated
 E: relations-multiple-libs: package-depends-on-multiple-libpng-versions 
libpng2 libpng3
 E: relations-multiple-libs: package-depends-on-multiple-libstdc-versions 
libstdc++2.10 libstdc++2.10-glibc2.2 libstdc++3.0


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to