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

[lintian] 02/02: Warn about packages that have either have dependency on default-mta but do not specify mail-transport-agent, have a mail-transport-agent dependency but do not specify default-mta and packages that do not specify default-mta first in their alternatives. (Closes: #892143)



This is an automated email from the git hooks/post-receive script.

lamby pushed a commit to branch 892144-check-for-relationships-with-packages-that-provide-mail-transport-agent-but-dont-use-m-t-a
in repository lintian.

commit 1d7678bdc67792cfdc9ae5aa82d15daee37cf3d5
Author: Chris Lamb <lamby@debian.org>
Date:   Thu Mar 8 22:35:25 2018 -0800

    Warn about packages that have either have dependency on default-mta but do not specify mail-transport-agent, have a mail-transport-agent dependency but do not specify default-mta and packages that do not specify default-mta first in their alternatives. (Closes: #892143)
---
 checks/fields.desc | 40 ++++++++++++++++++++++++++++++++++++++++
 checks/fields.pm   | 24 ++++++++++++++++++++++++
 debian/changelog   |  6 ++++++
 3 files changed, 70 insertions(+)

diff --git a/checks/fields.desc b/checks/fields.desc
index 60181ab..3a61a03 100644
--- a/checks/fields.desc
+++ b/checks/fields.desc
@@ -1446,3 +1446,43 @@ Info: A Vcs-* field in this package is pointing to a repository that
  unnecessary and time-consuming clones of the repository.
  .
  Please add a suitable Vcs-Browser field to the package.
+
+Tag: default-mta-dependency-does-not-specify-mail-transport-agent
+Severity: normal
+Certainty: certain
+Info: This package has a relationship with the default-mta virtual
+ package but does not specify the mail-transport-agent as an
+ alternative.
+ .
+ default-mta and mail-transport-agent should only ever be in a set of
+ alternatives together, with default-mta listed first.
+ .
+ Please add a "or" depedency on mail-transport-agent after
+ default-mta.
+
+Tag: mail-transport-agent-dependency-does-not-specify-default-mta
+Severity: normal
+Certainty: certain
+Info: This package has a relationship with the mail-transport-argent
+ virtual package but does not specify the default-mta as an
+ alternative.
+ .
+ default-mta and mail-transport-agent should only ever be in a set of
+ alternatives together, with default-mta listed first.
+ .
+ Please add a "or" depedency on default-mta before
+ mail-transport-agent.
+
+Tag: default-mta-dependency-not-listed-first
+Severity: normal
+Certainty: certain
+Info: This package has a relationship with the mail-transport-argent
+ or default-mta packages but does not specify the default-mta as an
+ first option.
+ .
+ default-mta and mail-transport-agent should only ever be in a set of
+ alternatives together, with default-mta listed in the primary
+ position.
+ .
+ Please rearrange the dependencies such that default-mta is listed
+ first.
diff --git a/checks/fields.pm b/checks/fields.pm
index 82866cb..a5cb6f3 100644
--- a/checks/fields.pm
+++ b/checks/fields.pm
@@ -743,6 +743,7 @@ sub run {
 
             tag 'alternates-not-allowed', $field
               if ($data =~ /\|/ && !&$is_dep_field($field));
+            check_field($info, $field, $data);
 
             for my $dep (split /\s*,\s*/, $data) {
                 my (@alternatives, @seen_obsolete_packages);
@@ -1042,6 +1043,7 @@ sub run {
                 #Get data and clean it
                 my $data = $info->field($field);
                 unfold($field, \$data);
+                check_field($info, $field, $data);
                 $depend{$field} = $data;
 
                 for my $dep (split /\s*,\s*/, $data) {
@@ -1491,6 +1493,28 @@ sub unfold {
     return;
 }
 
+sub check_field {
+    my ($info, $field, $data) = @_;
+    my @seen;
+    $info->relation($field)->visit(sub { push @seen, $_; }, VISIT_PRED_NAME);
+
+    my $has_default_mta = any { $_ eq 'default-mta' } @seen;
+    my $has_mail_transport_agent = any { $_ eq 'mail-transport-agent' } @seen;
+
+    if ($has_default_mta) {
+        tag 'default-mta-dependency-not-listed-first',"$field: $data"
+          if $seen[0] ne 'default-mta';
+        tag 'default-mta-dependency-does-not-specify-mail-transport-agent',
+          "$field: $data"
+          unless $has_mail_transport_agent;
+    } elsif ($has_mail_transport_agent) {
+        tag 'mail-transport-agent-dependency-does-not-specify-default-mta',
+          "$field: $data"
+          unless $has_default_mta;
+    }
+    return;
+}
+
 1;
 
 # Local Variables:
diff --git a/debian/changelog b/debian/changelog
index 45a450d..a7ced3c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -17,6 +17,12 @@ lintian (2.5.79) UNRELEASED; urgency=medium
   * checks/cruft.pm:
     + [CL] Check all subdirectories under /usr/share/doc/foo to test
       whether we ship example files, not just /usr/share/doc/foo/examples/.
+  * checks/fields.{desc,pm}:
+    + [CL] Warn about packages that have either have dependency on
+      default-mta but do not specify mail-transport-agent, have a
+      mail-transport-agent dependency but do not specify default-mta and
+      packages that do not specify default-mta first in their alternatives.
+      Thanks to Paul Wise for the report.  (Closes: #892143)
 
   * data/fields/obsolete-packages:
     + [PW] Add exim and apache, replaced by exim4 and apache2

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git


Reply to: