Skip to content
Commits on Source (29)
  • Chris Lamb's avatar
    Open new changelog entry. · d51ac081
    Chris Lamb authored
    Gbp-Dch: ignore
    d51ac081
  • Chris Lamb's avatar
    Allow the lowercase version of "UNRELEASED" changelog entries in various tags.... · cddc69a4
    Chris Lamb authored
    Allow the lowercase version of "UNRELEASED" changelog entries in various tags. This is a convention used in the Debian ports archive. (Closes: #940877)
    cddc69a4
  • Chris Lamb's avatar
    Drop matching for Source-Version substvars; they are not supported by dpkg-dev... · b8fa1e05
    Chris Lamb authored
    Drop matching for Source-Version substvars; they are not supported by dpkg-dev anymore and results in us accidentally matching an incorrect "Source-:Upstream-Version" variable. (Closes: #940878)
    b8fa1e05
  • Chris Lamb's avatar
    Correct logic of debian-news-entry-has-strange-distribution. · 382a9d1a
    Chris Lamb authored
    Re. cddc69a4
    
    Gbp-Dch: ignore
    382a9d1a
  • Chris Lamb's avatar
    Bump severity of script-uses-unversioned-python-in-shebang (ie.... · e2c33779
    Chris Lamb authored
    Bump severity of script-uses-unversioned-python-in-shebang (ie. "#!/usr/bin/env python") from classification to "pedantic" severity for now. (Closes: #934853)
    e2c33779
  • Chris Lamb's avatar
    Update test output now that we specify --pedantic. · 97b85e49
    Chris Lamb authored
    Gbp-Dch: ignore
    97b85e49
  • Chris Lamb's avatar
    Release lintian/2.23.0 into unstable. · f779fe28
    Chris Lamb authored
    f779fe28
  • Chris Lamb's avatar
    Open new changelog entry. · 6b64cbaa
    Chris Lamb authored
    Gbp-Dch: ignore
    6b64cbaa
  • Felix Lechner's avatar
    Update centralized version parser to include backports. · 2d29518c
    Felix Lechner authored
    There are several ways to parse the backports. A decision was made to
    incorporate them here. The advantage is that the check looks a lot
    more logical, at least to the author.
    
    At the same time, the additional complexity in the parser isn't great.
    Perhaps the parsing could be structured better in the future by
    wrapping the version components for versions without backports in
    another Lintian::Info::Changelog::Version.
    
    The point is to standardize version processing and hide the details.
    Both should work to reduce potential bugs.
    
    Gbp-Dch: ignore
    2d29518c
  • Felix Lechner's avatar
    Do not emit changelog-file-missing-explicit-entry when maintainer revision is 0. (Closes #940994) · e8a5ad1d
    Felix Lechner authored
    Thanks to Simon McVittie for pointing it out, and for proposing a
    great solution as well!
    
    The tag was previously only issued for native packages, when it
    related to NMUs (and not backports).  It is now also issued when NMUs
    do not have a proper prior version for non-native packages.
    
    The latter seemed like a reasonable enhancement of functionality. It
    was not based on the bug report.
    e8a5ad1d
  • Felix Lechner's avatar
    Add a test for false positive. · 636c8c35
    Felix Lechner authored
    This tests specifically for Simon McVittie's situation in Bug#940994,
    which should now be fixed.
    
    Gbp-Dch: ignore
    636c8c35
  • Felix Lechner's avatar
    Fix literal tests for lack of proper prior versions for non-native NMUs. · 67e781e8
    Felix Lechner authored
    The tag changelog-file-missing-explicit-entry was previously only
    issued for native packages when related to NMUs (and not backports).
    The new check also issues the tag for non-native packages.
    
    Several literal tests contain such a non-native NMU without proper
    prior version.  The newly appearing tags are added here.
    
    Gbp-Dch: ignore
    67e781e8
  • Felix Lechner's avatar
    In Lintian::Collect, cache result of method unfolded_fields; prevents duplicate tags. · 69ce6c43
    Felix Lechner authored
    The method unfolded_field could previously not be called multiple
    times because it can trigger a tag. That tag could then appear
    multiple times.
    
    This adds caching to the method. The tag is only emitted when the
    value is added to the cache, i.e. in the first invocation. There no
    longer a risk of duplicate tags.
    
    The method can now be invoked multiple times in one check or even in
    multiple checks.
    
    Gbp-Dch: ignore
    69ce6c43
  • Felix Lechner's avatar
    Split check/fields.pm into smaller components; invoke parts through old script. · 14fa5a80
    Felix Lechner authored
    This is the first step to divide the massive check 'fields' into
    smaller components. They are invoked from the original script, meaning
    they are not independent checks, in Lintian terminology.
    
    Splitting the tests and the tags will take place later after it is
    clear that no subchecks or tags need to be assigned to different
    components. Then a '*.desc' file can be added, and the new check will
    stand on its own.
    
    This pattern may also be used for other large checks, such as files.
    14fa5a80
  • Felix Lechner's avatar
    Adjust literal tests for new tag output order. · 1d40cf38
    Felix Lechner authored
    In Lintian's output, tags appear in the order they are emitted.
    Adjusts literal tests for changes is check execution order.
    
    This commit contains no substantive changes.
    
    Gbp-Dch: ignore
    1d40cf38
  • Felix Lechner's avatar
    Fix t/bin/tagadjust to only remove tags in tagdiff once. · 33710119
    Felix Lechner authored
    The previous algorithm removed all duplicates of a tag instead of only
    one occurrence. Now removes only the first occurrence of a tag.
    
    Gbp-Dch: ignore
    33710119
  • Felix Lechner's avatar
    In checks/debian/changelog.pm, move all version-dependent tags to the source segment. · aea28785
    Felix Lechner authored
    Parsing version requires the native or non-native status, which can
    only be determined from a source package.
    
    Moves the version related tags to the source facet of the check.
    aea28785
  • Felix Lechner's avatar
    In checks/fields/version, move two tags relying on native detection to the source segment. · 31f63d62
    Felix Lechner authored
    The two tags 'rc-version-greater-than-expected-version' and
    'version-refers to distribution' depend on whether a package is
    native. That detection is only reliable for source packages. The
    Lintian facilities for binary packages will soon cease to offer it.
    
    Going forward, the two tags will only be issued for source packages.
    31f63d62
  • Felix Lechner's avatar
    Transfer binary heuristics for native status into checks/debian/changelog.pm. · 24efa9c6
    Felix Lechner authored
    The check debian/changelog depends in its binary segment on a
    rudimentary form of native detection. The information is used to check
    the installation paths for upstream and Debian changelogs, but not to
    parse version numbers.
    
    These checks cannot be be performed in source packages, and while they
    should perhaps be part of the testsuite for dpkg-buildpackage instead,
    it seemed unnecessary to lose this functionality right now.
    
    Transfers the rudimentary native/non-native detection based on version
    numbers out of Lintian::Collect::Binary, so it can be deleted from
    there.
    
    Gbp-Dch: ignore
    24efa9c6
  • Felix Lechner's avatar
    In tests, update expected tags for checks restricted or transferred to source packages only. · 72ff6754
    Felix Lechner authored
    Some tags switched from binary to source, and some tags moved. Some
    checks related to the native detection of packages can only be
    performed on source packages.
    
    Gbp-Dch: ignore
    72ff6754
  • Felix Lechner's avatar
    Remove support for native heuristics from Lintian facilities for installation (binary) packages. · 8e834147
    Felix Lechner authored
    There are many hints that a package is native, but the one that is
    reliable only works for source packages. This removes from Lintian the
    native detection facilities for installation (so-called binary)
    packages.
    
    There is history of inferring a native or non-native status for
    installation (binary) packages from version numbers, but that
    mechanism does not work all the time. There is also no reason why such
    origin should matter for an installation package.
    
    In Debian, a version string can only be parsed after the native or
    non-native status was determined separately (which is no problem for
    source packages). As a result of this requirement, many version
    related tags can only issued for source packages.
    8e834147
  • Felix Lechner's avatar
    Remove duplicate test 'fields-version-bad' after moving check for... · 212087c5
    Felix Lechner authored
    Remove duplicate test 'fields-version-bad' after moving check for rc-version-greater-than-expected-version.
    
    The test case already exists for check debian/changelog. Removes the
    copy for check fields, which is no longer needed once the related
    check is moved.
    
    The related check will be moved in the near future.
    
    Gbp-Dch: ignore
    212087c5
  • Felix Lechner's avatar
    Move check for tag 'rc-version-greater-than-expected-version' to check... · 43bf358b
    Felix Lechner authored
    Move check for tag 'rc-version-greater-than-expected-version' to check debian/changelog from fields/version.
    
    This commit is a possible precursor to resolving Bug#782717. That fix
    will require access to the previous changelog version, which is
    available in the new location.
    
    The mechanism to handle native package is slightly different because
    the version parser in Lintian::Info::Changelog::Version returns native
    package versions in the method maintainer_revision (but strips any
    indicator for source NMUs).
    
    The Dpkg parser, on the other hand, returned native package versions
    in the same place as it would return an upstream version for a
    non-native package.
    
    Does not add back the regex string 'dev' that was removed in
    Bug#732246.
    43bf358b
  • Felix Lechner's avatar
    Associate tag 'rc-version-greater-than-expected-version' with check... · ca455155
    Felix Lechner authored
    Associate tag 'rc-version-greater-than-expected-version' with check debian/changelog; fix description
    
    The check for this tag was transferred to debian/changelog. Associates
    the tag with that check.
    
    Also fixes the tag description. The tag applies to both native and
    non-native packages.
    ca455155
  • Felix Lechner's avatar
    In test 'fields-version-bad-rc', add expected tags after a check was moved. · d25e4c02
    Felix Lechner authored
    This test already existed for debian/changelog. Adds a tag that
    appeared after a check was transferred.
    
    Gbp-Dch: ignore
    d25e4c02
  • Felix Lechner's avatar
    In check fields, sort list of submodules before execution to avoid test errors... · 249259ae
    Felix Lechner authored
    In check fields, sort list of submodules before execution to avoid test errors related to tag order.
    249259ae
  • Chris Lamb's avatar
    Release lintian/2.24.0 into unstable. · f5ce33c7
    Chris Lamb authored
    f5ce33c7
  • Chris Lamb's avatar
    Merge tag '2.24.0' into buster-backports · 94878c96
    Chris Lamb authored
    
    
    Release lintian/2.24.0 into unstable.
    
    Format: 1.8
    Date: Fri, 27 Sep 2019 08:15:59 +0000
    Source: lintian
    Architecture: source
    Version: 2.24.0
    Distribution: unstable
    Urgency: medium
    Maintainer: Debian Lintian Maintainers <lintian-maint@debian.org>
    Changed-By: Chris Lamb's avatarChris Lamb <lamby@debian.org>
    Closes: 940994
    Changes:
     lintian (2.24.0) unstable; urgency=medium
     .
       [ Felix Lechner ]
       * Do not emit changelog-file-missing-explicit-entry when maintainer
         revision is 0 (eg. 1.2.5-0+deb10u1). (Closes: #940994)
       * Remove internal support for checking whether binary packages are
         "native".
       * Various code cleanups, splitting checks/fields.pm into smaller
         components, moving numerous tags, etc.
    Checksums-Sha1:
     428e4598ae5e1c20f9d3326630b37e03f9ea9284 3037 lintian_2.24.0.dsc
     cc6bb3903d283714fc38201ee043fbaa6b7919aa 1765164 lintian_2.24.0.tar.xz
     7e58c3ae3e76b229e388f41ece62beb89878a3e2 15668 lintian_2.24.0_amd64.buildinfo
    Checksums-Sha256:
     8342fbcf5cf9bcbba05d0612f0025d04e09df07723be355220f6beafd7a78eee 3037 lintian_2.24.0.dsc
     52d562c45ea8038f8a6716b634e5372dcaa768c9cc64064cddc39957d497e850 1765164 lintian_2.24.0.tar.xz
     fd7c8bf12a245aa51ece46ade0bd6ab1739db98ae40f5c4071b7ec0a93eb505d 15668 lintian_2.24.0_amd64.buildinfo
    Files:
     e41d21dea3799699265ab55961447009 3037 devel optional lintian_2.24.0.dsc
     5da45313c9d16c67cc315337db16d1c8 1765164 devel optional lintian_2.24.0.tar.xz
     f43ba17becaa11a680390783907c9964 15668 devel optional lintian_2.24.0_amd64.buildinfo
    
    * tag '2.24.0': (27 commits)
      Release lintian/2.24.0 into unstable.
      In check fields, sort list of submodules before execution to avoid test errors related to tag order.
      In test 'fields-version-bad-rc', add expected tags after a check was moved.
      Associate tag 'rc-version-greater-than-expected-version' with check debian/changelog; fix description
      Move check for tag 'rc-version-greater-than-expected-version' to check debian/changelog from fields/version.
      Remove duplicate test 'fields-version-bad' after moving check for rc-version-greater-than-expected-version.
      Remove support for native heuristics from Lintian facilities for installation (binary) packages.
      In tests, update expected tags for checks restricted or transferred to source packages only.
      Transfer binary heuristics for native status into checks/debian/changelog.pm.
      In checks/fields/version, move two tags relying on native detection to the source segment.
      In checks/debian/changelog.pm, move all version-dependent tags to the source segment.
      Fix t/bin/tagadjust to only remove tags in tagdiff once.
      Adjust literal tests for new tag output order.
      Split check/fields.pm into smaller components; invoke parts through old script.
      In Lintian::Collect, cache result of method unfolded_fields; prevents duplicate tags.
      Fix literal tests for lack of proper prior versions for non-native NMUs.
      Add a test for false positive.
      Do not emit changelog-file-missing-explicit-entry when maintainer revision is 0. (Closes #940994)
      Update centralized version parser to include backports.
      Open new changelog entry.
      ...
    94878c96
  • Chris Lamb's avatar
    Rebuild for buster-backports. · a29130b8
    Chris Lamb authored
    a29130b8
......@@ -71,7 +71,7 @@ sub source {
if ($contents =~ qr/BEGIN PGP SIGNATURE.*END PGP SIGNATURE/ms) {
tag 'unreleased-changelog-distribution'
if lc($latest_entry->Distribution) eq 'unreleased';
if $latest_entry->Distribution eq 'UNRELEASED';
}
}
......@@ -81,6 +81,51 @@ sub source {
tag 'hyphen-in-upstream-part-of-debian-changelog-version',
$latest_version->upstream
if !$info->native && $latest_version->upstream =~ qr/-/;
# unstable, testing, and stable shouldn't be used in Debian
# version numbers. unstable should get a normal version
# increment and testing and stable should get suite-specific
# versions.
#
# NMUs get a free pass because they need to work with the
# version number that was already there.
unless (length $latest_version->source_nmu) {
my $revision = $latest_version->maintainer_revision;
my $distribution = $latest_entry->Distribution;
tag 'version-refers-to-distribution',$latest_version->literal
if ($revision =~ /testing|(?:un)?stable/i)
|| (
($distribution eq 'unstable'|| $distribution eq 'experimental')
&& $revision
=~ /woody|sarge|etch|lenny|squeeze|stretch|buster/);
}
my $examine = $latest_version->maintainer_revision;
$examine = $latest_version->upstream
unless $info->native;
my $candidate_pattern = qr/rc|alpha|beta|pre(?:view|release)?/;
my $increment_pattern = qr/[^a-z].*|\Z/;
my ($candidate_string, $increment_string)
= ($examine =~ m/[^~a-z]($candidate_pattern)($increment_pattern)/sm);
if (length $candidate_string && !length $latest_version->source_nmu) {
my $increment_string //= EMPTY;
# remove rc-part and any preceding symbol
my $expected = $examine;
$expected =~ s/[\.\+\-\:]?\Q$candidate_string\E.*//;
my $suggestion = "$expected~$candidate_string$increment_string";
tag 'rc-version-greater-than-expected-version',
$examine, '>',$expected, "(consider using $suggestion)",
if $latest_version->maintainer_revision eq '1'
|| $latest_version->maintainer_revision=~ m,^0(?:\.1|ubuntu1)?$,
|| $info->native;
}
}
if (@entries > 1) {
......@@ -138,15 +183,21 @@ sub source {
or $latest_entry->Distribution =~ /-security$/i
or $latest_entry->Source ne $previous_entry->Source;
if ($latest_version->literal=~ /([+~]deb\d+u1|\+nmu1)$/) {
my $expected= substr($latest_version->literal, 0, -length($1));
my $expected_previous = $previous_version->literal;
$expected_previous = $latest_version->without_backport
if $latest_version->backport_release
&& $latest_version->backport_revision
&& $latest_version->debian_without_backport ne '0';
$expected_previous = $latest_version->without_source_nmu
if $latest_version->source_nmu;
tag 'changelog-file-missing-explicit-entry',
$previous_version->literal
. " -> $expected (missing) -> "
. " -> $expected_previous (missing) -> "
. $latest_version->literal
unless $previous_version->literal eq $expected
unless $previous_version->literal eq $expected_previous
|| $latest_entry->Distribution =~ /-security$/i;
}
if ( $latest_version->epoch eq $previous_version->epoch
&& $latest_version->upstream eq$previous_version->upstream
......@@ -278,7 +329,7 @@ sub binary {
# Some checks on the most recent entry.
if ($changelog->entries && defined @{$changelog->entries}[0]) {
($news) = @{$changelog->entries};
if ($news->Distribution && $news->Distribution =~ /unreleased/i) {
if ($news->Distribution && $news->Distribution eq 'UNRELEASED') {
tag 'debian-news-entry-has-strange-distribution',
$news->Distribution;
}
......@@ -297,8 +348,21 @@ sub binary {
# is this a native Debian package?
# If the version is missing, we assume it to be non-native
# as it is the most likely case.
my $version = $info->field('version', '0-1');
$native_pkg = $info->native;
my $source = $info->field('source');
my $version;
if (defined $source && $source =~ m/\((.*)\)/) {
$version = $1;
} else {
$version = $info->field('version');
}
if (defined $version) {
$native_pkg = ($version !~ m/-/);
} else {
# We do not know, but assume it to non-native as it is
# the most likely case.
$native_pkg = 0;
}
$version = $info->field('version', '0-1');
$foreign_pkg = (!$native_pkg && $version !~ m/-0\./);
# A version of 1.2.3-0.1 could be either, so in that
# case, both vars are false
......@@ -460,7 +524,7 @@ sub binary {
if ($latest_timestamp && $previous_timestamp) {
tag 'latest-changelog-entry-without-new-date'
unless (($latest_timestamp - $previous_timestamp) > 0
or lc($latest_entry->Distribution) eq 'unreleased');
or $latest_entry->Distribution eq 'UNRELEASED');
}
my $latest_dist = lc $latest_entry->Distribution;
......@@ -546,38 +610,6 @@ sub binary {
|| $bug > $BUGS_NUMBER->value('max-bug');
}
# unstable, testing, and stable shouldn't be used in Debian
# version numbers. unstable should get a normal version
# increment and testing and stable should get suite-specific
# versions.
#
# NMUs get a free pass because they need to work with the
# version number that was already there.
my $changelog_version;
if ($info->native) {
$changelog_version = $latest_entry->Version || EMPTY;
} else {
if ($latest_entry->Version) {
($changelog_version)
= (split('-', $latest_entry->Version))[-1];
} else {
$changelog_version = EMPTY;
}
}
unless (not $info->native and $changelog_version =~ /\./) {
if ( $info->native
and $changelog_version =~ /testing|(?:un)?stable/i) {
tag 'version-refers-to-distribution', $latest_entry->Version;
} elsif ($changelog_version =~ /woody|sarge|etch|lenny|squeeze/) {
my %unreleased_dists
= map { $_ => 1 } qw(unstable experimental);
if (exists($unreleased_dists{$latest_entry->Distribution})) {
tag 'version-refers-to-distribution',
$latest_entry->Version;
}
}
}
# Compare against NEWS.Debian if available.
if ($news and $news->Version) {
if ($latest_entry->Version eq $news->Version) {
......
......@@ -78,7 +78,7 @@ sub source {
if (
m/^($PKGNAME_REGEX)(?: :[-a-z0-9]+)? \s* # pkg-name $1
\(\s*[\>\<]?[=\>\<]\s* # REL
(\$[{](?:Source-|source:|binary:)(?:Upstream-)?Version[}]) # {subvar}
(\$[{](?:source:|binary:)(?:Upstream-)?Version[}]) # {subvar}
/x
) {
my $other = $1;
......
This diff is collapsed.
# fields/architecture -- lintian check script (rewrite) -*- perl -*-
#
# Copyright (C) 2004 Marc Brockschmidt
#
# Parts of the code were taken from the old check script, which
# was Copyright (C) 1998 Richard Braakman (also licensed under the
# GPL 2 or higher)
#
# 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.
package Lintian::fields::architecture;
use strict;
use warnings;
use autodie;
use Lintian::Architecture qw(:all);
use Lintian::Tags qw(tag);
sub binary {
my ($pkg, undef, $info, undef, undef) = @_;
my $unsplit = $info->unfolded_field('architecture');
return
unless defined $unsplit;
my @list = split(m/ /o, $unsplit);
return
unless @list;
for my $architecture (@list) {
tag 'arch-wildcard-in-binary-package', $architecture
if is_arch_wildcard($architecture);
}
tag 'too-many-architectures'
if @list > 1;
my $architecture = $list[0];
return
if $architecture eq 'all';
tag 'aspell-package-not-arch-all'
if $pkg =~ /^aspell-[a-z]{2}(?:-.*)?$/;
tag 'documentation-package-not-architecture-independent'
if $pkg =~ /-docs?$/;
if ($pkg =~ /^r-(?:cran|bioc|other)-/) {
for my $file ($info->sorted_index) {
next
if $file->is_dir;
next
unless $file =~ m,^usr/lib/R/.*/DESCRIPTION,;
tag 'r-package-not-arch-all'
if $file->file_contents =~ m/NeedsCompilation: no/m;
last;
}
}
return;
}
sub always {
my (undef, $type, $info, undef, undef) = @_;
my $architecture = $info->unfolded_field('architecture');
unless (defined $architecture) {
tag 'no-architecture-field';
return;
}
my @list = split(m/ /o, $architecture);
for my $arch (@list) {
tag 'unknown-architecture', $arch
unless is_arch_or_wildcard($arch);
}
if (@list > 1) { # Check for magic architecture combinations.
my %archmap;
my $magic = 0;
$archmap{$_}++ for (@list);
$magic++
if $type ne 'source' && $archmap{'all'};
if ($archmap{'any'}) {
delete $archmap{'any'};
# Allow 'all' to be present in source packages as well
# (#626775)
delete $archmap{'all'}
if $type eq 'source';
$magic++
if %archmap;
}
tag 'magic-arch-in-arch-list'
if $magic;
}
# Used for later tests.
my $arch_indep = 0;
$arch_indep = 1
if @list == 1 && $list[0] eq 'all';
return;
}
1;
# Local Variables:
# indent-tabs-mode: nil
# cperl-indent-level: 4
# End:
# vim: syntax=perl sw=4 sts=4 sr et
# fields/bugs -- lintian check script (rewrite) -*- perl -*-
#
# Copyright (C) 2004 Marc Brockschmidt
#
# Parts of the code were taken from the old check script, which
# was Copyright (C) 1998 Richard Braakman (also licensed under the
# GPL 2 or higher)
#
# 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.
package Lintian::fields::bugs;
use strict;
use warnings;
use autodie;
use Lintian::Tags qw(tag);
sub always {
my ($pkg, undef, $info, undef, undef) = @_;
my $bugs = $info->unfolded_field('bugs');
return
unless defined $bugs;
tag 'redundant-bugs-field'
if $bugs =~ m,^debbugs://bugs.debian.org/?$,i;
tag 'bugs-field-does-not-refer-to-debian-infrastructure', $bugs
unless $bugs =~ m,\.debian\.org, or $pkg =~ /[-]dbgsym$/;
return;
}
1;
# Local Variables:
# indent-tabs-mode: nil
# cperl-indent-level: 4
# End:
# vim: syntax=perl sw=4 sts=4 sr et
# fields/built-using -- lintian check script (rewrite) -*- perl -*-
#
# Copyright (C) 2004 Marc Brockschmidt
#
# Parts of the code were taken from the old check script, which
# was Copyright (C) 1998 Richard Braakman (also licensed under the
# GPL 2 or higher)
#
# 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.
package Lintian::fields::built_using;
use strict;
use warnings;
use autodie;
use Lintian::Relation qw(:constants);
use Lintian::Tags qw(tag);
use Lintian::Util qw($PKGNAME_REGEX $PKGVERSION_REGEX);
use constant {
BUILT_USING_REGEX => qr/^$PKGNAME_REGEX \(= $PKGVERSION_REGEX\)$/o,
};
sub always {
my (undef, undef, $info, undef, undef) = @_;
my $built_using = $info->field('built-using');
return
unless defined $built_using;
my $built_using_rel = Lintian::Relation->new($built_using);
$built_using_rel->visit(
sub {
if ($_ !~ BUILT_USING_REGEX) {
tag 'invalid-value-in-built-using-field', $_;
return 1;
}
return 0;
},
VISIT_OR_CLAUSE_FULL | VISIT_STOP_FIRST_MATCH
);
return;
}
1;
# Local Variables:
# indent-tabs-mode: nil
# cperl-indent-level: 4
# End:
# vim: syntax=perl sw=4 sts=4 sr et
# fields/checksums -- lintian check script (rewrite) -*- perl -*-
#
# Copyright (C) 2004 Marc Brockschmidt
#
# Parts of the code were taken from the old check script, which
# was Copyright (C) 1998 Richard Braakman (also licensed under the
# GPL 2 or higher)
#
# 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.
package Lintian::fields::checksums;
use strict;
use warnings;
use autodie;
use Lintian::Tags qw(tag);
sub source {
my (undef, undef, $info, undef, undef) = @_;
tag 'no-strong-digests-in-dsc'
unless $info->field('checksums-sha256');
return;
}
1;
# Local Variables:
# indent-tabs-mode: nil
# cperl-indent-level: 4
# End:
# vim: syntax=perl sw=4 sts=4 sr et
# fields/derivatives -- lintian check script (rewrite) -*- perl -*-
#
# Copyright (C) 2004 Marc Brockschmidt
#
# Parts of the code were taken from the old check script, which
# was Copyright (C) 1998 Richard Braakman (also licensed under the
# GPL 2 or higher)
#
# 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.
package Lintian::fields::derivatives;
use strict;
use warnings;
use autodie;
use Lintian::Data ();
use Lintian::Tags qw(tag);
my $DERIVATIVE_FIELDS = Lintian::Data->new(
'fields/derivative-fields',
qr/\s*\~\~\s*/,
sub {
my ($regexp, $explanation) = split(/\s*\~\~\s*/, $_[1], 2);
return {
'regexp' => qr/$regexp/,
'explanation' => $explanation,
};
});
sub source {
my (undef, undef, $info, undef, undef) = @_;
foreach my $field ($DERIVATIVE_FIELDS->all) {
my $val = $info->field($field, '-');
my $data = $DERIVATIVE_FIELDS->value($field);
tag 'invalid-field-for-derivative',
"$field: $val ($data->{'explanation'})"
if $val !~ m/$data->{'regexp'}/;
}
return;
}
1;
# Local Variables:
# indent-tabs-mode: nil
# cperl-indent-level: 4
# End:
# vim: syntax=perl sw=4 sts=4 sr et
# fields/dm-upload-allowed -- lintian check script (rewrite) -*- perl -*-
#
# Copyright (C) 2004 Marc Brockschmidt
#
# Parts of the code were taken from the old check script, which
# was Copyright (C) 1998 Richard Braakman (also licensed under the
# GPL 2 or higher)
#
# 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.
package Lintian::fields::dm_upload_allowed;
use strict;
use warnings;
use autodie;
use Lintian::Tags qw(tag);
sub always {
my (undef, undef, $info, undef, undef) = @_;
my $dmupload = $info->unfolded_field('dm-upload-allowed');
return
unless defined $dmupload;
tag 'dm-upload-allowed-is-obsolete';
tag 'malformed-dm-upload-allowed', $dmupload
unless $dmupload eq 'yes';
return;
}
1;
# Local Variables:
# indent-tabs-mode: nil
# cperl-indent-level: 4
# End:
# vim: syntax=perl sw=4 sts=4 sr et
# fields/essential -- lintian check script (rewrite) -*- perl -*-
#
# Copyright (C) 2004 Marc Brockschmidt
#
# Parts of the code were taken from the old check script, which
# was Copyright (C) 1998 Richard Braakman (also licensed under the
# GPL 2 or higher)
#
# 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.
package Lintian::fields::essential;
use strict;
use warnings;
use autodie;
use Lintian::Data ();
use Lintian::Tags qw(tag);
our $KNOWN_ESSENTIAL = Lintian::Data->new('fields/essential');
sub source {
my (undef, undef, $info, undef, undef) = @_;
my $essential = $info->unfolded_field('essential');
return
unless defined $essential;
tag 'essential-in-source-package';
return;
}
sub always {
my ($pkg, undef, $info, undef, undef) = @_;
my $essential = $info->unfolded_field('essential');
return
unless defined $essential;
unless ($essential eq 'yes' || $essential eq 'no') {
tag 'unknown-essential-value';
return;
}
tag 'essential-no-not-needed'
if $essential eq 'no';
tag 'new-essential-package'
if $essential eq 'yes' && !$KNOWN_ESSENTIAL->known($pkg);
return;
}
1;
# Local Variables:
# indent-tabs-mode: nil
# cperl-indent-level: 4
# End:
# vim: syntax=perl sw=4 sts=4 sr et
# fields/format -- lintian check script (rewrite) -*- perl -*-
#
# Copyright (C) 2004 Marc Brockschmidt
#
# Parts of the code were taken from the old check script, which
# was Copyright (C) 1998 Richard Braakman (also licensed under the
# GPL 2 or higher)
#
# 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.
package Lintian::fields::format;
use strict;
use warnings;
use autodie;
use Lintian::Tags qw(tag);
our @supported_source_formats = (qr/1\.0/, qr/3\.0\s*\((quilt|native)\)/);
sub source {
my (undef, undef, $info, undef, undef) = @_;
my $format = $info->unfolded_field('format');
return
unless defined $format;
my $supported = 0;
foreach my $f (@supported_source_formats){
$supported = 1
if $format =~ /^\s*$f\s*\z/;
}
tag 'unsupported-source-format', $format
unless $supported;
return;
}
1;
# Local Variables:
# indent-tabs-mode: nil
# cperl-indent-level: 4
# End:
# vim: syntax=perl sw=4 sts=4 sr et
# fields/homepage -- lintian check script (rewrite) -*- perl -*-
#
# Copyright (C) 2004 Marc Brockschmidt
#
# Parts of the code were taken from the old check script, which
# was Copyright (C) 1998 Richard Braakman (also licensed under the
# GPL 2 or higher)
#
# 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.
package Lintian::fields::homepage;
use strict;
use warnings;
use autodie;
use Lintian::Data ();
use Lintian::Tags qw(tag);
my $KNOWN_INSECURE_HOMEPAGE_URIS
= Lintian::Data->new('fields/insecure-homepage-uris');
sub source {
my (undef, undef, $info, undef, undef) = @_;
my $homepage = $info->unfolded_field('homepage');
unless (defined $homepage) {
return
if $info->native;
my $binary_has_homepage_field = 0;
for my $binary ($info->binaries) {
if (defined $info->binary_field($binary, 'homepage')) {
$binary_has_homepage_field = 1;
last;
}
}
if ($binary_has_homepage_field) {
tag 'homepage-in-binary-package';
} else {
tag 'no-homepage-field';
}
return;
}
return;
}
sub always {
my (undef, undef, $info, undef, undef) = @_;
my $homepage = $info->unfolded_field('homepage');
return
unless defined $homepage;
my $orig = $info->field('homepage');
if ($homepage =~ /^<(?:UR[LI]:)?.*>$/i) {
tag 'superfluous-clutter-in-homepage', $orig;
$homepage = substr($homepage, 1, length($homepage) - 2);
}
require URI;
my $uri = URI->new($homepage);
# not an absolute URI or (most likely) an invalid protocol
tag 'bad-homepage', $orig
unless $uri->scheme && $uri->scheme =~ m/^(?:ftp|https?|gopher)$/o;
tag 'homepage-for-cpan-package-contains-version', $orig
if $homepage=~ m,/(?:search\.cpan\.org|metacpan\.org)/.*-[0-9._]+/*$,;
tag 'homepage-for-cran-package-not-canonical', $orig
if $homepage=~ m,/cran\.r-project\.org/web/packages/.+,;
tag 'homepage-for-bioconductor-package-not-canonical', $orig
if $homepage=~ m,bioconductor\.org/packages/.*/bioc/html/.*\.html*$,;
tag 'homepage-field-uses-insecure-uri', $orig
if $KNOWN_INSECURE_HOMEPAGE_URIS->matches_any($homepage);
tag 'homepage-refers-to-obsolete-debian-infrastructure', $orig
if $homepage =~ m,alioth\.debian\.org,;
return;
}
1;
# Local Variables:
# indent-tabs-mode: nil
# cperl-indent-level: 4
# End:
# vim: syntax=perl sw=4 sts=4 sr et
# fields/installer-menu-item -- lintian check script (rewrite) -*- perl -*-
#
# Copyright (C) 2004 Marc Brockschmidt
#
# Parts of the code were taken from the old check script, which
# was Copyright (C) 1998 Richard Braakman (also licensed under the
# GPL 2 or higher)
#
# 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.
package Lintian::fields::installer_menu_item;
use strict;
use warnings;
use autodie;
use Lintian::Tags qw(tag);
sub always {
my (undef, undef, $info, undef, undef) = @_;
#---- Installer-Menu-Item (udeb)
my $menu_item = $info->unfolded_field('installer-menu-item');
return
unless defined $menu_item;
tag 'bad-menu-item', $menu_item
unless $menu_item =~ /^\d+$/;
return;
}
1;
# Local Variables:
# indent-tabs-mode: nil
# cperl-indent-level: 4
# End:
# vim: syntax=perl sw=4 sts=4 sr et
# fields/maintainer -- lintian check script (rewrite) -*- perl -*-
#
# Copyright (C) 2004 Marc Brockschmidt
#
# Parts of the code were taken from the old check script, which
# was Copyright (C) 1998 Richard Braakman (also licensed under the
# GPL 2 or higher)
#
# 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.
package Lintian::fields::maintainer;
use strict;
use warnings;
use autodie;
use Lintian::Check qw(check_maintainer);
use Lintian::Tags qw(tag);
sub source {
my (undef, undef, $info, undef, undef) = @_;
my $maintainer = $info->unfolded_field('maintainer');
return
unless defined $maintainer;
my $is_list = $maintainer =~ /\@lists(?:\.alioth)?\.debian\.org\b/;
tag 'no-human-maintainers'
if $is_list && !defined $info->field('uploaders');
return;
}
sub always {
my (undef, undef, $info, undef, undef) = @_;
my $maintainer = $info->unfolded_field('maintainer');
unless (defined $maintainer) {
tag 'no-maintainer-field';
return;
}
check_maintainer($maintainer, 'maintainer');
return;
}
1;
# Local Variables:
# indent-tabs-mode: nil
# cperl-indent-level: 4
# End:
# vim: syntax=perl sw=4 sts=4 sr et
# fields/multi-arch -- lintian check script (rewrite) -*- perl -*-
#
# Copyright (C) 2004 Marc Brockschmidt
#
# Parts of the code were taken from the old check script, which
# was Copyright (C) 1998 Richard Braakman (also licensed under the
# GPL 2 or higher)
#
# 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.
package Lintian::fields::multi_arch;
use strict;
use warnings;
use autodie;
use List::MoreUtils qw(uniq);
use Lintian::Tags qw(tag);
use Lintian::Util qw(safe_qx);
use constant EMPTY => q{};
use constant SPACE => q{ };
sub source {
my ($pkg, undef, $info, undef, undef) = @_;
for my $bin ($info->binaries) {
next
unless $info->binary_field($bin, 'multi-arch', EMPTY) eq 'same';
my $wildcard = $info->binary_field($bin, 'architecture');
my @arches = split(
SPACE,
safe_qx(
'dpkg-architecture', '--match-wildcard',
$wildcard, '--list-known'
));
# include original wildcard
push(@arches, $wildcard);
foreach my $arch (uniq @arches) {
my $specific = "debian/$bin.lintian-overrides.$arch";
tag 'multi-arch-same-package-has-arch-specific-overrides',
$specific
if $info->index_resolved_path($specific);
}
}
return;
}
sub binary {
my ($pkg, undef, $info, undef, undef) = @_;
if ($pkg =~ /^x?fonts-/) {
tag 'font-package-not-multi-arch-foreign'
unless $info->field('multi-arch', 'no') =~m/^(?:foreign|allowed)$/o;
}
my $multi = $info->unfolded_field('multi-arch');
return
unless defined $multi;
my $architecture = $info->unfolded_field('architecture');
if (defined $architecture) {
tag 'illegal-multi-arch-value', $architecture, $multi
if $architecture eq 'all' && $multi eq 'same';
}
return;
}
sub always {
my ($pkg, undef, $info, undef, undef) = @_;
my $multi = $info->unfolded_field('multi-arch');
return
unless defined $multi;
tag 'unknown-multi-arch-value', $pkg, $multi
unless $multi =~ m/^(?:no|foreign|allowed|same)$/o;
return;
}
1;
# Local Variables:
# indent-tabs-mode: nil
# cperl-indent-level: 4
# End:
# vim: syntax=perl sw=4 sts=4 sr et
# fields/origin -- lintian check script (rewrite) -*- perl -*-
#
# Copyright (C) 2004 Marc Brockschmidt
#
# Parts of the code were taken from the old check script, which
# was Copyright (C) 1998 Richard Braakman (also licensed under the
# GPL 2 or higher)
#
# 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.
package Lintian::fields::origin;
use strict;
use warnings;
use autodie;
use Lintian::Tags qw(tag);
sub always {
my (undef, undef, $info, $proc, undef) = @_;
my $origin = $info->unfolded_field('origin');
return
unless defined $origin;
tag 'redundant-origin-field'
if lc($origin) eq 'debian';
return;
}
1;
# Local Variables:
# indent-tabs-mode: nil
# cperl-indent-level: 4
# End:
# vim: syntax=perl sw=4 sts=4 sr et
This diff is collapsed.
# fields/package -- lintian check script (rewrite) -*- perl -*-
#
# Copyright (C) 2004 Marc Brockschmidt
#
# Parts of the code were taken from the old check script, which
# was Copyright (C) 1998 Richard Braakman (also licensed under the
# GPL 2 or higher)
#
# 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.
package Lintian::fields::package;
use strict;
use warnings;
use autodie;
use Lintian::Tags qw(tag);
use Lintian::Util qw($PKGNAME_REGEX);
sub binary {
my (undef, undef, $info, undef, undef) = @_;
my $name = $info->unfolded_field('package');
unless (defined $name) {
tag 'no-package-name';
return;
}
tag 'bad-package-name'
unless $name =~ /^$PKGNAME_REGEX$/i;
tag 'package-not-lowercase'
if $name =~ /[A-Z]/;
tag 'unusual-documentation-package-name'
if $name =~ /-docs$/;
return;
}
1;
# Local Variables:
# indent-tabs-mode: nil
# cperl-indent-level: 4
# End:
# vim: syntax=perl sw=4 sts=4 sr et
# fields/priority -- lintian check script (rewrite) -*- perl -*-
#
# Copyright (C) 2004 Marc Brockschmidt
#
# Parts of the code were taken from the old check script, which
# was Copyright (C) 1998 Richard Braakman (also licensed under the
# GPL 2 or higher)
#
# 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.
package Lintian::fields::priority;
use strict;
use warnings;
use autodie;
use List::MoreUtils qw(any);
use Lintian::Data ();
use Lintian::Tags qw(tag);
my $KNOWN_PRIOS = Lintian::Data->new('fields/priorities');
sub binary {
my (undef, undef, $info, undef, undef) = @_;
my $priority = $info->unfolded_field('priority');
unless (defined $priority) {
tag 'no-priority-field';
return;
}
}
sub always {
my ($pkg, $type, $info, undef, undef) = @_;
my $priority = $info->unfolded_field('priority');
return
unless defined $priority;
if ($type eq 'source' || !$info->is_pkg_class('auto-generated')) {
tag 'priority-extra-is-replaced-by-priority-optional'
if $priority eq 'extra';
# Re-map to optional to avoid an additional warning from
# lintian
$priority = 'optional'
if $priority eq 'extra';
}
tag 'unknown-priority', $priority
unless $KNOWN_PRIOS->known($priority);
tag 'excessive-priority-for-library-package', $priority
if $pkg =~ m/^lib/o
&& $pkg !~ m/-bin$/o
&& $pkg !~ m/^libc[0-9.]+$/o
&& (any { $_ eq $info->field('section', '') } qw(libdevel libs))
&& (any { $_ eq $priority } qw(required important standard));
return;
}
1;
# Local Variables:
# indent-tabs-mode: nil
# cperl-indent-level: 4
# End:
# vim: syntax=perl sw=4 sts=4 sr et
# fields/section -- lintian check script (rewrite) -*- perl -*-
#
# Copyright (C) 2004 Marc Brockschmidt
#
# Parts of the code were taken from the old check script, which
# was Copyright (C) 1998 Richard Braakman (also licensed under the
# GPL 2 or higher)
#
# 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.
package Lintian::fields::section;
use strict;
use warnings;
use autodie;
use Lintian::Data ();
use Lintian::Tags qw(tag);
use constant EMPTY => q{};
our $KNOWN_SECTIONS = Lintian::Data->new('fields/archive-sections');
# Mapping of package names to section names
my $NAME_SECTION_MAPPINGS = Lintian::Data->new(
'fields/name_section_mappings',
qr/\s*=>\s*/,
sub {
return {'regex' => qr/$_[0]/x, 'section' => $_[1]};
});
our %KNOWN_ARCHIVE_PARTS = map { $_ => 1 } ('non-free', 'contrib');
sub binary {
my ($pkg, $type, $info, undef, undef) = @_;
my $section = $info->unfolded_field('section');
unless (defined $section) {
tag 'no-section-field';
return;
}
return;
}
sub udeb {
my (undef, undef, $info, undef, undef) = @_;
my $section = $info->unfolded_field('section');
return
unless defined $section;
tag 'wrong-section-for-udeb', $section
unless $section eq 'debian-installer';
return;
}
sub always {
my ($pkg, $type, $info, undef, undef) = @_;
my $section = $info->unfolded_field('section');
return
unless defined $section;
if ($section eq EMPTY) {
tag 'empty-section-field';
return;
}
return
if $type eq 'udeb';
my @parts = split(m{/}, $section, 2);
my $division;
$division = $parts[0]
if @parts > 1;
my $group = $parts[-1];
if (defined $division) {
tag 'unknown-section', $section
unless $KNOWN_ARCHIVE_PARTS{$division};
}
if ($group eq 'unknown' && !length $division) {
tag 'section-is-dh_make-template';
} else {
tag 'unknown-section', $section
unless $KNOWN_SECTIONS->known($group);
}
# Check package name <-> section. oldlibs is a special case; let
# anything go there.
if ($group ne 'oldlibs') {
foreach my $name_section ($NAME_SECTION_MAPPINGS->all()) {
my $regex= $NAME_SECTION_MAPPINGS->value($name_section)->{'regex'};
my $section
= $NAME_SECTION_MAPPINGS->value($name_section)->{'section'};
next
unless ($pkg =~ m{$regex});
unless ($group eq $section) {
my $better
= (defined $division ? "$division/" : EMPTY) . $section;
tag 'wrong-section-according-to-package-name',
"$pkg => $better";
}
last;
}
}
if ($group eq 'debug') {
tag 'wrong-section-according-to-package-name',"$pkg"
if $pkg !~ /-dbg(?:sym)?$/;
}
if ($info->is_pkg_class('transitional')) {
my $priority = $info->unfolded_field('priority') // EMPTY;
tag 'transitional-package-should-be-oldlibs-optional',
"$group/$priority"
unless $priority eq 'optional' && $group eq 'oldlibs';
}
return;
}
1;
# Local Variables:
# indent-tabs-mode: nil
# cperl-indent-level: 4
# End:
# vim: syntax=perl sw=4 sts=4 sr et