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

[lintian] 02/02: Warn about packages that have a relationship with a mail-transport-agent but do not specify default-mta and mail-transport-agent as alternatives. (Closes: #892144)



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

lamby pushed a commit to branch master
in repository lintian.

commit cd9d71418586c50247ed02752b5cfe42a0dd0de4
Author: Chris Lamb <lamby@debian.org>
Date:   Fri Mar 9 20:56:34 2018 -0800

    Warn about packages that have a relationship with a mail-transport-agent but do not specify default-mta and mail-transport-agent as alternatives. (Closes: #892144)
---
 checks/fields.desc                          | 10 ++++
 checks/fields.pm                            |  6 +++
 data/fields/mail-transport-agents           | 17 +++++++
 debian/changelog                            |  4 ++
 private/refresh-mail-transport-agents       | 79 +++++++++++++++++++++++++++++
 t/tests/fields-mua/debian/debian/control.in |  2 +-
 t/tests/fields-mua/desc                     |  1 +
 t/tests/fields-mua/tags                     |  5 +-
 8 files changed, 122 insertions(+), 2 deletions(-)

diff --git a/checks/fields.desc b/checks/fields.desc
index 596fae1..0630fb7 100644
--- a/checks/fields.desc
+++ b/checks/fields.desc
@@ -1486,3 +1486,13 @@ Info: This package has a relationship with the mail-transport-agent
  .
  Please rearrange the dependencies such that default-mta is listed
  first.
+
+Tag: depends-on-mail-transport-agent-without-alternatives
+Severity: normal
+Certainty: certain
+Info: This package has a relationship with a mail-transport-agent but
+ does not specify default-mta and mail-transport-agent as alternatives.
+ .
+ Please change the dependency to:
+ .
+  default-mta | pkgname | mail-transport-agent
diff --git a/checks/fields.pm b/checks/fields.pm
index a5cb6f3..c183b5a 100644
--- a/checks/fields.pm
+++ b/checks/fields.pm
@@ -230,6 +230,7 @@ our $OBSOLETE_PACKAGES
   = Lintian::Data->new('fields/obsolete-packages',qr/\s*=>\s*/);
 our $VIRTUAL_PACKAGES   = Lintian::Data->new('fields/virtual-packages');
 our $SOURCE_FIELDS      = Lintian::Data->new('common/source-fields');
+our $MAIL_TRANSPORT_AGENTS= Lintian::Data->new('fields/mail-transport-agents');
 
 sub run {
     my ($pkg, $type, $info, $proc, $group) = @_;
@@ -781,6 +782,11 @@ sub run {
                   if ( &$is_dep_field($field)
                     && $known_obsolete_emacs{$alternatives[0][0]});
 
+                tag 'depends-on-mail-transport-agent-without-alternatives',
+                  $dep
+                  if &$is_dep_field($field)
+                  and $MAIL_TRANSPORT_AGENTS->known($dep);
+
                 for my $part_d (@alternatives) {
                     my ($d_pkg, undef, $d_version, undef, undef, $rest,
                         $part_d_orig)
diff --git a/data/fields/mail-transport-agents b/data/fields/mail-transport-agents
new file mode 100644
index 0000000..b26300e
--- /dev/null
+++ b/data/fields/mail-transport-agents
@@ -0,0 +1,17 @@
+# Packages that provide mail-transport-agent
+#
+citadel-server
+courier-mta
+dma
+esmtp-run
+exim4
+exim4-daemon-heavy
+exim4-daemon-light
+masqmail
+msmtp-mta
+nullmailer
+opensmtpd
+postfix
+qmail-run
+sendmail-bin
+ssmtp
diff --git a/debian/changelog b/debian/changelog
index 131bb11..d79a9a2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -23,6 +23,10 @@ lintian (2.5.79) UNRELEASED; urgency=medium
       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)
+    + [CL] Warn about packages that have a relationship with a
+      mail-transport-agent but do not specify default-mta and
+      mail-transport-agent as alternatives.  (Closes: #892144)
+
   * checks/obsolete-sites.pm:
     + [CL] Emit a warning if a package uses a deprecated FTP package
       download location.  (Closes: #892249)
diff --git a/private/refresh-mail-transport-agents b/private/refresh-mail-transport-agents
new file mode 100755
index 0000000..a2f7344
--- /dev/null
+++ b/private/refresh-mail-transport-agents
@@ -0,0 +1,79 @@
+#!/usr/bin/perl -w
+use strict;
+use warnings;
+
+# Generate a list of packages that provide mail-transport-agent
+
+# Copyright (C) 2008 Niko Tyni
+# Copyright (C) 2018 Chris Lamb <lamby@debian.org>
+#
+# 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, see <http://www.gnu.org/licenses/>.
+
+# from /usr/share/doc/libapt-pkg-perl/examples/apt-cache
+use AptPkg::Config '$_config';
+use AptPkg::System '$_system';
+use AptPkg::Cache;
+use List::MoreUtils qw(none uniq);
+
+# initialise the global config object with the default values and
+# setup the $_system object
+$_config->init;
+$_system = $_config->system;
+
+# suppress cache building messages
+$_config->{quiet} = 2;
+
+# set up the cache
+my $cache = AptPkg::Cache->new;
+# end from /usr/share/doc/libapt-pkg-perl/examples/apt-cache
+
+# check we have a cache of Debian sid packages available
+warn(
+    join(q{ },
+        'Warning: this list should only be updated on a system',
+        'with an up to date APT cache of the Debian unstable distribution'))
+  if (
+    none {
+             defined $_->{Origin}
+          && defined $_->{Archive}
+          && $_->{Origin} eq 'Debian'
+          && $_->{Archive} eq 'unstable';
+    }
+    @{$cache->files});
+
+my $versions = $cache->{'mail-transport-agent'}
+  or die('no mail-transport-agent packages found in the APT cache');
+
+my @packages = (
+    'exim4', # Provided by exim4-daemon-{light, heavy}
+);
+
+for my $provides (@{$versions->{ProvidesList}}) {
+    push @packages, $provides->{OwnerPkg}->{Name};
+}
+
+print <<EOF;
+# Packages that provide mail-transport-agent
+#
+EOF
+
+for my $pkg (sort(uniq(@packages))) {
+    print "$pkg\n";
+}
+
+# Local Variables:
+# indent-tabs-mode: nil
+# cperl-indent-level: 4
+# End:
+# vim: syntax=perl sw=4 sts=4 sr et
diff --git a/t/tests/fields-mua/debian/debian/control.in b/t/tests/fields-mua/debian/debian/control.in
index 35bd961..a0a8455 100644
--- a/t/tests/fields-mua/debian/debian/control.in
+++ b/t/tests/fields-mua/debian/debian/control.in
@@ -13,7 +13,7 @@ Homepage: http://lintian.debian.org/
 Package: {$source}-bad-1
 Architecture: all
 # default-mta missing mail-transport-agent
-Depends: $\{misc:Depends\}, default-mta,
+Depends: $\{misc:Depends\}, default-mta, exim4, nullmailer
 Pre-Depends: mail-transport-agent
 Recommends: default-mta, mail-transport-agent
 Suggests: exim4 | mail-transport-agent
diff --git a/t/tests/fields-mua/desc b/t/tests/fields-mua/desc
index 5354f01..ceae026 100644
--- a/t/tests/fields-mua/desc
+++ b/t/tests/fields-mua/desc
@@ -5,3 +5,4 @@ Test-For:
  default-mta-dependency-does-not-specify-mail-transport-agent
  mail-transport-agent-dependency-does-not-specify-default-mta
  default-mta-dependency-not-listed-first
+ depends-on-mail-transport-agent-without-alternatives
diff --git a/t/tests/fields-mua/tags b/t/tests/fields-mua/tags
index 9322ea8..da02c88 100644
--- a/t/tests/fields-mua/tags
+++ b/t/tests/fields-mua/tags
@@ -1,12 +1,15 @@
 W: fields-mua source: default-mta-dependency-does-not-specify-mail-transport-agent build-depends: debhelper (>= 11), default-mta
 W: fields-mua source: default-mta-dependency-not-listed-first build-depends: debhelper (>= 11), default-mta
 W: fields-mua source: stronger-dependency-implies-weaker fields-mua-bad-1 depends -> recommends default-mta
+W: fields-mua source: stronger-dependency-implies-weaker fields-mua-bad-1 depends -> suggests exim4 | mail-transport-agent
 W: fields-mua source: stronger-dependency-implies-weaker fields-mua-bad-1 pre-depends -> recommends mail-transport-agent
 W: fields-mua source: stronger-dependency-implies-weaker fields-mua-bad-1 pre-depends -> suggests exim4 | mail-transport-agent
 W: fields-mua source: stronger-dependency-implies-weaker fields-mua-bad-1 recommends -> suggests exim4 | mail-transport-agent
 W: fields-mua source: stronger-dependency-implies-weaker fields-mua-good-1 depends -> recommends default-mta | mail-transport-agent | exim4
 W: fields-mua source: stronger-dependency-implies-weaker fields-mua-good-1 pre-depends -> recommends default-mta | mail-transport-agent | exim4
-W: fields-mua-bad-1: default-mta-dependency-does-not-specify-mail-transport-agent depends: default-mta
+W: fields-mua-bad-1: default-mta-dependency-does-not-specify-mail-transport-agent depends: default-mta, exim4, nullmailer
+W: fields-mua-bad-1: depends-on-mail-transport-agent-without-alternatives exim4
+W: fields-mua-bad-1: depends-on-mail-transport-agent-without-alternatives nullmailer
 W: fields-mua-bad-1: mail-transport-agent-dependency-does-not-specify-default-mta pre-depends: mail-transport-agent
 W: fields-mua-bad-1: virtual-package-depends-without-real-package-depends pre-depends: mail-transport-agent
 W: fields-mua-bad-2: default-mta-dependency-not-listed-first pre-depends: exim4 | default-mta | mail-transport-agent

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


Reply to: