Bug#648777: lintian: Generalize distribution check
November 14th, 2011 - 06:20 pm ET by Daniel Dehennin | Report spam
Package: lintian
Version: 2.5.3
Severity: wishlist
Dear Maintainer,
I propose a patch to generalize the distribution check, permitting to
easily configure the list of allowed distributions.
The idea here is to add a file under 'data/changelog-file/' with a name
ending in '-dists'.
This file contains regular expressions to test against the distribution
name.
git pull git://git.baby-gnu.net/lintian dad/generalize-distribution-check
I attach the patches for review.
Regards.
filename 01-Generaliste-distribution-name-check.patch
From 8cfbd1853607d9e171d9dde2fca4837f3f24c2ed Mon Sep 17 00:00:00 2001
From: Daniel Dehennin <daniel.dehennin@baby-gnu.org>
Date: Mon, 14 Nov 2011 23:57:36 +0100
Subject: [PATCH] Generaliste distribution name check.
This patch allow to create a new data/changelog-file/<something>-dists
file to add new valid distribution regexps.
* checks/changes-file: Build an array of distribution regexp and test
distribution fiedl against each one.
* data/changelog-file/debian-dists: Define full regexp instead of only
base distribution.
* data/changelog-file/ubuntu-dists: Ditoo.
checks/changes-file | 41 ++++++++++++++++++-
data/changelog-file/debian-dists | 18 ++++++++--
data/changelog-file/ubuntu-dists | 16 +++++++-
3 files changed, 37 insertions(+), 38 deletions(-)
diff --git a/checks/changes-file b/checks/changes-file
index 5192130..0091860 100644
a/checks/changes-file
+++ b/checks/changes-file
@@ -26,12 +26,17 @@ use Util;
use Lintian::Tags qw(tag);
use Lintian::Check qw(check_maintainer);
-my $DEBIAN_DISTS = Lintian::Data->new ('changelog-file/debian-dists');
-my $UBUNTU_REGEX;
+use Path::Class;
+
+my @DISTRIBUTION_REGEX;
{
- my $ubuntu_dists = Lintian::Data->new ('changelog-file/ubuntu-dists');
- my $reg_str = join('|', $ubuntu_dists->all);
- $UBUNTU_REGEX = qr/$reg_str/o;
+ my $changelog_dir = dir($ENV{LINTIAN_ROOT}, 'data', 'changelog-file');
+ while (my $filename = $changelog_dir->next()) {
+ next if $filename->is_dir() or $filename !~ m/.*-dists$/;
+ my $distrib_dists = Lintian::Data->new(file('changelog-file', $filename->basename));
+ my $reg_str = join('|', $distrib_dists->all);
+ push @DISTRIBUTION_REGEX, qr/$reg_str/;
+ }
}
sub run {
@@ -57,22 +62,16 @@ if (!$info->field('description') && $info->field('architecture') ne 'source') {
if (defined $info->field('distribution')) {
my @distributions = split /\s+/o, $info->field('distribution');
for my $distribution (@distributions) {
- if ($distribution eq 'UNRELEASED') {
- # ignore
- } elsif ($info->field('version') =~ m/ubuntu|$UBUNTU_REGEX/o
- or $distribution =~ m/$UBUNTU_REGEX/o) {
- if ($distribution !~ m/^(?:$UBUNTU_REGEX)(?:-(?:proposed|updates|backports|security))?$/o ) {
- tag 'bad-ubuntu-distribution-in-changes-file',
- $distribution;
- }
- } elsif (! ($DEBIAN_DISTS->known ($distribution)
- or ($distribution =~ /^\w+-backports$/)
- or ($distribution =~ /^\w+-proposed-updates$/)
- or ($distribution =~ /^\w+-security$/)
- or ($distribution =~ /^\w+-volatile$/))
- ) {
- # bad distribution entry
- tag 'bad-distribution-in-changes-file', $distribution;
+ next if ($distribution eq 'UNRELEASED');
+ my $bad = 1;
+ foreach my $dist_regex (@DISTRIBUTION_REGEX) {
+ if ($distribution =~ m/$dist_regex/) {
+ $bad=0;
+ last;
+ }
+ }
+ if ($bad) {
+ tag 'bad-ubuntu-distribution-in-changes-file', $distribution;
}
}
diff --git a/data/changelog-file/debian-dists b/data/changelog-file/debian-dists
index 589df1c..499b962 100644
a/data/changelog-file/debian-dists
+++ b/data/changelog-file/debian-dists
@@ -2,15 +2,15 @@
# aliases
# Codenames
-lenny
-squeeze
-wheezy
-sid
+lenny(?:(?:-)(?:backports|proposed-updates|security|volatile))?
+squeeze(?:(?:-)(?:backports|proposed-updates|security|volatile))?
+wheezy(?:(?:-)(?:backports|proposed-updates|security|volatile))?
+sid(?:(?:-)(?:backports|proposed-updates|security|volatile))?
# Aliases
-oldstable
-stable
-testing
-unstable
-experimental
+oldstable(?:(?:-)(?:backports|proposed-updates|security|volatile))?
+stable(?:(?:-)(?:backports|proposed-updates|security|volatile))?
+testing(?:(?:-)(?:backports|proposed-updates|security|volatile))?
+unstable(?:(?:-)(?:backports|proposed-updates|security|volatile))?
+experimental(?:(?:-)(?:backports|proposed-updates|security|volatile))?
diff --git a/data/changelog-file/ubuntu-dists b/data/changelog-file/ubuntu-dists
index 0948ec9..e1517c9 100644
a/data/changelog-file/ubuntu-dists
+++ b/data/changelog-file/ubuntu-dists
@@ -1,11 +1,11 @@
# A list of Ubuntu distributions, used to suppress some checks for Ubuntu
# packages and to validate Ubuntu distributions.
-dapper
-hardy
-karmic
-lucid
-maverick
-natty
-oneiric
-precise
+dapper(?:-(?:proposed|updates|backports|security))?
+hardy(?:-(?:proposed|updates|backports|security))?
+karmic(?:-(?:proposed|updates|backports|security))?
+lucid(?:-(?:proposed|updates|backports|security))?
+maverick(?:-(?:proposed|updates|backports|security))?
+natty(?:-(?:proposed|updates|backports|security))?
+oneiric(?:-(?:proposed|updates|backports|security))?
+precise(?:-(?:proposed|updates|backports|security))?
1.7.7.2
Debian Release: wheezy/sid
APT prefers unstable
APT policy: (500, 'unstable'), (90, 'experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 3.0.0-rc5+hati.1 (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages lintian depends on:
ii binutils 2.21.90.20111025-1
ii bzip2 1.0.5-7
ii diffstat 1.54-1
ii file 5.09-2
ii gettext 0.18.1.1-5
ii intltool-debian 0.35.0+20060710.1
ii libapt-pkg-perl 0.1.25
ii libclass-accessor-perl 0.34-1
ii libdpkg-perl 1.16.1.1
ii libemail-valid-perl 0.185-1
ii libipc-run-perl 0.90-1
ii libparse-debianchangelog-perl 1.2.0-1
ii libtimedate-perl 1.2000-1
ii liburi-perl 1.59-1
ii locales 2.13-21
ii man-db 2.6.0.2-3
ii patchutils 0.3.2-1
ii perl [libdigest-sha-perl] 5.12.4-6
ii unzip 6.0-5
lintian recommends no packages.
Versions of packages lintian suggests:
ii binutils-multiarch <none>
ii dpkg-dev 1.16.1.1
ii libhtml-parser-perl 3.69-1
ii libtext-template-perl <none>
ii man-db 2.6.0.2-3
ii xz-utils 5.1.1alpha+20110809-3
Daniel Dehennin
Récupérer ma clef GPG:
gpg --keyserver pgp.mit.edu --recv-keys 0x6A2540D1
To UNSUBSCRIBE, email to debian-bugs-dist-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Similar topics
- Bug#693442: wrong lintian check 'maintainer-script-removes-device-files'
- Bug#709365: lintian: check for standard license short names
- Bug#687667: lintian: check dpkg version for "-Sextreme" option
- Bug#697916: lintian: Add a check for menu referencing icon by relative path
- Bug#676803: lintian: Please add a sanity check for .pc-introduced flags
- Bug#673276: lintian: please add check to detect incompatible java bytecode versions
- Bug#702545: lintian: add check for broken gzip compressed files
- Bug#672664: lintian: Please add a check on udeb non-emptiness
- Bug#673734: lintian: python-script-but-no-python-dep check should not check python3 directories
- Bug#673112: lintian: hardening-no-stackprotector check has many false positives
Make your own search :
Tags
Create a new topic
Follow the discussion
2 replies
Make a reply
May 24th, 2013 - 2:51 AM ET
Join now


Replies