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

[SCM] Debian package checker branch, master, updated. 1.24.4-116-g35bb1ea



The following commit has been merged in the master branch:
commit b6a0495e99756e03a4e842da07531770b1eaf7a0
Author: Niko Tyni <ntyni@debian.org>
Date:   Wed Sep 10 20:53:00 2008 +0300

    Check for unnecessary versioned dependencies on Perl core modules. (Closes: #497887)
    
    Add a warning about unnecessary versioned dependencies on packages
    also provided by the perl core packages at a recent enough version.
    
    In the case of alternate dependencies, only the first alternative is
    examined. This allows the recommended idiom of specifying the perl core
    package as the preferred alternative and the versioned dependency on
    the real package as a secondary one.

diff --git a/checks/fields b/checks/fields
index a67bf6a..07895be 100644
--- a/checks/fields
+++ b/checks/fields
@@ -117,6 +117,9 @@ my @global_clean_bypass = (
 	'^\s+dh\s+'
 );
 
+# Load package versions provided by the Perl core modules
+my $perl_core_provides = Lintian::Data->new ('fields/perl-provides', '\s+');
+
 sub run {
 
 my $pkg = shift;
@@ -518,6 +521,11 @@ if (($type eq "binary") || ($type eq 'udeb')) {
 					    if ($d_pkg eq 'python' && $d_version->[0] eq '<<' && &$is_dep_field($field)
 						&& $arch_indep && $pkg =~ /^python-/ && ! defined $info->field('python-version'));
 
+					# only trigger this for the the preferred alternative
+					tag "versioned-dependency-satisfied-by-perl", "$field: $part_d_orig"
+						if $alternatives[0][-1] eq $part_d_orig
+						&& perl_core_has_version($d_pkg, $d_version->[0], $d_version->[1]);
+
 					tag "depends-exclusively-on-makedev", "$field",
 					    if ($field eq 'depends' && $d_pkg eq 'makedev' && @alternatives == 1);
 				}
@@ -699,6 +707,11 @@ if ($type eq "source") {
 
 					tag "bad-relation", "$field: $part_d_orig"
 					    if $rest;
+
+					# only trigger this for the the preferred alternative
+					tag "versioned-dependency-satisfied-by-perl", "$field: $part_d_orig"
+						if $alternatives[0][-1] eq $part_d_orig
+						&& perl_core_has_version($d_pkg, $d_version->[0], $d_version->[1]);
 				}
 
 				for my $pkg (@seen_obsolete_packages) {
@@ -930,6 +943,15 @@ sub _valid_version {
 	}
 }
 
+sub perl_core_has_version {
+	my ($package, $op, $version) = @_;
+	my $core_version = $perl_core_provides->value($package);
+	return 0 if !defined $core_version;
+	my @version = _valid_version($version);
+	return 0 if !@version;
+	return Dep::get_version_cmp($core_version, $op, $version);
+}
+
 sub unfold {
 	my $field = shift;
 	my $line = shift;
diff --git a/checks/fields.desc b/checks/fields.desc
index 9be226b..54b18e5 100644
--- a/checks/fields.desc
+++ b/checks/fields.desc
@@ -993,3 +993,24 @@ Info: The maintainer value also appears on the <tt>Uploaders</tt> field.
  first introduced, but those have long-since been fixed and there is no
  longer any need to list the maintainer in Uploaders.  The duplicate
  information should probably be removed.
+
+Tag: versioned-dependency-satisfied-by-perl
+Type: warning
+Severity: normal
+Certainty: certain
+Info: This package declares an unnecessary versioned dependency
+ on a package that is also provided by one of the Perl core packages
+ (perl, perl-base, perl-modules) with at least the required version.
+ .
+ As versioned dependencies are not satisfied by provided packages,
+ this unnecessarily pulls in a separately packaged newer version
+ of the module.
+ .
+ The recommended way to express the dependency without needless
+ complications on backporting packages is to use alternative dependencies.
+ The Perl core package should be the preferred alternative and the
+ versioned dependency a secondary one.
+ .
+ Example: perl-modules (&gt;= 5.10.0) | libmodule-build-perl (&gt;= 0.26)
+Ref: policy 7.5
+

-- 
Debian package checker


Reply to: