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

[SCM] Debian package checker branch, master, updated. 2.5.10-13-gc07403e



The following commit has been merged in the master branch:
commit c07403e1e7beee59236ae2c3c992e6b7ec70f994
Author: Niels Thykier <niels@thykier.net>
Date:   Wed Jul 11 14:49:01 2012 +0200

    c/version-substvars: Extend foreign pkg check to all relations
    
    Signed-off-by: Niels Thykier <niels@thykier.net>

diff --git a/checks/version-substvars b/checks/version-substvars
index 30564ba..a7de75c 100644
--- a/checks/version-substvars
+++ b/checks/version-substvars
@@ -38,6 +38,7 @@ package Lintian::version_substvars;
 use strict;
 use warnings;
 
+use Lintian::Relation qw(:constants);
 use Lintian::Tags qw(tag);
 
 sub run {
@@ -50,17 +51,31 @@ 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);
+foreach my $pkg1 (sort keys %$binpkgs) {
+    my ($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;
-        }
+        next unless $info->binary_field ($pkg1, $field);
+        my $rel = $info->binary_relation ($pkg1, $field);
+        my $svid = 0;
+        my $visitor = sub {
+            if (m/\${Source-Version}/o and not $svid) {
+                $svid++;
+                tag 'substvar-source-version-is-deprecated', $pkg1;
+            }
+            if (m/(\S+)\s*\(\s*[\>\<]?[=\>\<]\s*\${(?:Source-|source:|binary:)Version}/x) {
+                my $other = $1;
+                # 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.
+                tag 'version-substvar-for-external-package', "$pkg1 -> $other"
+                    unless $info->binary_field ($other, 'architecture') or
+                           $other =~ /\$\{\S+\}/;
+            }
+        };
+        $rel->visit ($visitor, VISIT_PRED_FULL);
     }
 
     foreach (split (m/,/, ($info->binary_field($pkg1, 'pre-depends', '').', '.
@@ -71,12 +86,8 @@ foreach (keys %$binpkgs) {
         $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+\}/);
+            # external relation or subst var package - either way, handled above.
             next;
         }
         $pkg2_is_any = ($info->binary_field($pkg2, 'architecture', '') ne 'all');
diff --git a/checks/version-substvars.desc b/checks/version-substvars.desc
index 1f65c8b..a771298 100644
--- a/checks/version-substvars.desc
+++ b/checks/version-substvars.desc
@@ -43,10 +43,11 @@ Info: The package is not safely binNMUable because an arch:all package
 Tag: version-substvar-for-external-package
 Severity: important
 Certainty: certain
-Info: The first package has a dependency on the second package that uses
- (= ${binary:Version}), (= ${source:Version}), or (= ${Source-Version}),
- but the second package is not built from this source package.  Usually
- this means there is a mistake in the package name in this dependency.
+Info: The first package has a relation on the second package using a
+ dpkg-control substitution variable to generate the versioned part of
+ the relation.  However the second package is not built from this
+ source package.  Usually this means there is a mistake in the package
+ name in this dependency.
 
 Tag: substvar-source-version-is-deprecated
 Severity: normal
diff --git a/debian/changelog b/debian/changelog
index 4fa2a86..8099c99 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -28,6 +28,10 @@ lintian (2.5.11) UNRELEASED; urgency=low
   * checks/source-copyright{,.desc}:
     + [NT] Check for possible misspellings of known field
       names.  (Closes: #678639)
+  * checks/version-substvars{,.desc}:
+    + [JW,NT] Extend version-substvar-for-external-package to
+      all relations.  Previously it was only triggered for
+      strong dependnecy relations.  (Closes: #658474)
 
   * collection/objdump-info{-helper,.desc}:
     + [NT] Change the output format for the collection and
diff --git a/t/tests/control-file-library-dev/debian/debian/control.in b/t/tests/control-file-library-dev/debian/debian/control.in
index c2376bb..80c756a 100644
--- a/t/tests/control-file-library-dev/debian/debian/control.in
+++ b/t/tests/control-file-library-dev/debian/debian/control.in
@@ -70,9 +70,9 @@ Section: libdevel
 Architecture: {$architecture}
 Depends: $\{shlibs:Depends\}, $\{misc:Depends\},
  libcontrol-file-foo1 (<= $\{source:Upstream-Version\}-99)
- | libcontrol-file-other-foo1 (<= $\{source:Upstream-Version\}-99),
+ | libcontrol-file-baz9-4 (<= $\{source:Upstream-Version\}-99),
  libcontrol-file-foo1 (>= $\{binary:Version\})
- | libcontrol-file-other-foo1 (>= $\{binary:Version\})
+ | libcontrol-file-baz9-4 (>= $\{binary:Version\})
 Description: {$description} (dev package with version)
  Dev package containing a number.
  .
diff --git a/t/tests/version-substvars-general/debian/debian/control.in b/t/tests/version-substvars-general/debian/debian/control.in
index c5f7454..b7e2740 100644
--- a/t/tests/version-substvars-general/debian/debian/control.in
+++ b/t/tests/version-substvars-general/debian/debian/control.in
@@ -20,6 +20,7 @@ Package: program-data
 Architecture: all
 Depends: $\{shlibs:Depends\}, $\{misc:Depends\},
          foreign-pkg (= $\{Source-Version\})
+Replaces: other-foreign-pkg (<< $\{binary:Version\})
 Description: {$description} - data
  This is a test package designed to exercise some feature or tag of
  Lintian.  It is part of the Lintian test suite and may do very odd
diff --git a/t/tests/version-substvars-general/tags b/t/tests/version-substvars-general/tags
index 1c00296..d1a6efa 100644
--- a/t/tests/version-substvars-general/tags
+++ b/t/tests/version-substvars-general/tags
@@ -3,4 +3,5 @@ E: version-substvars-general source: not-binnmuable-any-depends-all program-bin
 E: version-substvars-general source: not-binnmuable-any-depends-all program-utils -> program-data
 E: version-substvars-general source: not-binnmuable-any-depends-any program-utils -> program-bin
 E: version-substvars-general source: version-substvar-for-external-package program-data -> foreign-pkg
+E: version-substvars-general source: version-substvar-for-external-package program-data -> other-foreign-pkg
 W: version-substvars-general source: substvar-source-version-is-deprecated program-data

-- 
Debian package checker


Reply to: