/usr/share/lintian/checks/version-substvars is in lintian 2.5.6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | # version-substvars -- lintian check script -*- perl -*-
#
# Copyright (C) 2006 Adeodato Simó
#
# 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, you can find it on the World Wide
# Web at http://www.gnu.org/copyleft/gpl.html, or write to the Free
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
# MA 02110-1301, USA.
# SUMMARY
# =======
#
# What breaks
# -----------
#
# (b1) any -> any (= ${source:Version}) -> use b:V
# (b2) any -> all (= ${binary:Version}) [or S-V] -> use s:V
# (b3) all -> any (= ${either-of-them}) -> use (>= ${s:V}),
# optionally (<< ${s:V}.1~)
#
# Note (b2) also breaks if (>= ${binary:Version}) [or S-V] is used.
#
# Always warn on ${Source-Version} even if it doesn't break since the substvar
# is now considered deprecated.
package Lintian::version_substvars;
use strict;
use warnings;
use Util;
use Lintian::Tags qw(tag);
sub run {
my $pkg = shift;
my $type = shift;
my $info = shift;
my $binpkgs = $info->binaries;
my @dep_fields = qw(depends pre-depends recommends suggests conflicts replaces);
foreach (keys %$binpkgs) {
my ($pkg1, $pkg1_is_any, $pkg2, $pkg2_is_any, $substvar_strips_binNMU);
$pkg1 = $_;
$pkg1_is_any = (($info->binary_field($pkg1, 'architecture')//'') ne 'all');
foreach my $field (@dep_fields) {
next unless $info->binary_field($pkg1, $field);
if ($info->binary_field($pkg1, $field) =~ m/\${Source-Version}/) {
tag 'substvar-source-version-is-deprecated', $pkg1;
}
}
foreach (split(m/,/, ($info->binary_field($pkg1, 'pre-depends')//'').', '.
($info->binary_field($pkg1, 'depends')//''))) {
next unless m/(\S+)\s*\(\s*(\>)?=\s*\${((?:Source-|source:|binary:)Version)}/x;
my $gt = $2//'';
$pkg2 = $1;
$substvar_strips_binNMU = ($3 eq 'source:Version');
# We can't test dependencies on packages whose names are
# formed via substvars expanded during the build. Assume
# those maintainers know what they're doing.
if (not $info->binary_field($pkg2, 'architecture')) {
tag 'version-substvar-for-external-package', "$pkg1 -> $pkg2"
unless ($pkg2 =~ /\$\{\S+\}/);
next;
}
$pkg2_is_any = (($info->binary_field($pkg2, 'architecture')//'') ne 'all');
if ($pkg1_is_any) {
if ($pkg2_is_any and $substvar_strips_binNMU) {
unless ($gt) {
# (b1) any -> any (= ${source:Version})
tag 'not-binnmuable-any-depends-any', "$pkg1 -> $pkg2";
} else {
# any -> any (= ${source:Version})
# technically this can be "binNMU'ed", though it is
# a bit weird.
1;
}
} elsif (not $pkg2_is_any and not $substvar_strips_binNMU) {
# (b2) any -> all ( = ${binary:Version}) [or S-V]
# or -- same -- (>= ${binary:Version}) [or S-V]
tag 'not-binnmuable-any-depends-all', "$pkg1 -> $pkg2";
}
} elsif ($pkg2_is_any && !$gt) {
# (b3) all -> any (= ${either-of-them})
tag 'not-binnmuable-all-depends-any', "$pkg1 -> $pkg2";
}
}
}
}
1;
# Local Variables:
# indent-tabs-mode: nil
# cperl-indent-level: 4
# End:
# vim: syntax=perl sw=4 sts=4 sr et
|