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

Bug#928126: Check for source in main with only binaries in contrib



package: lintian
tags: patch

Hi,

Please add a check for a source in main which has only binaries in contrib.
Sources in main can have binaries in contrib, but only if they also have
binaries in main.

When debugging #824169, I noticed that the handling of this case in dak is
inconsistent. Rather than fixing that, it might be better to add a check for
this case, as it isn't allowed anyway.

The attached patch has an attempt to implement this, by emitting the
section-area-mismatch in this case. It also updates the description of this
tag to clarify this case.

Thanks,

Ivo

commit 716a666eef1af720c6893cdf4d42b7bc31dc2be7
Author: Ivo De Decker <ivodd@debian.org>
Date:   Sun Apr 28 18:17:01 2019 +0200

    Check for source in main with only binaries in contrib

diff --git a/checks/control-file.desc b/checks/control-file.desc
index 16e20ce53..08f9d6fb3 100644
--- a/checks/control-file.desc
+++ b/checks/control-file.desc
@@ -103,7 +103,8 @@ Info: The <tt>debian/control</tt> file places the indicated binary package
  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
  area of the archive, with the single exception that source packages in
- main may also build binary packages in contrib.
+ main may also build binary packages in contrib if they build binary packages
+ in main.
 
 Tag: xs-vcs-field-in-debian-control
 Severity: wishlist
diff --git a/checks/control-file.pm b/checks/control-file.pm
index 0287d9691..e9686b269 100644
--- a/checks/control-file.pm
+++ b/checks/control-file.pm
@@ -278,6 +278,8 @@ sub run {
         tag 'no-section-field-for-source';
     }
     my @descriptions;
+    my $bininmain = 0;
+    my $binincontrib = 0;
     foreach my $bin (@package_names) {
 
         # Accumulate the description.
@@ -295,6 +297,7 @@ sub run {
 
         # Check mismatches in archive area.
         $bin_area = $info->binary_field($bin, 'section');
+        $bininmain = 1 if (!$bin_area and $area eq "main");
         next unless $area && $bin_area;
 
         if ($bin_area =~ m%^([^/]+)/%) {
@@ -302,12 +305,17 @@ sub run {
         } else {
             $bin_area = 'main';
         }
+        $bininmain = 1 if ($bin_area eq 'main');
+        $binincontrib = 1 if ($bin_area eq 'contrib');
         next
           if $area eq $bin_area
           or ($area eq 'main' and $bin_area eq 'contrib');
 
         tag 'section-area-mismatch', 'Package', $bin;
     }
+    if ($binincontrib and !$bininmain and $area eq "main") {
+        tag 'section-area-mismatch';
+    }
 
     # Check for duplicate descriptions.
     my (%seen_short, %seen_long);

Reply to: