Author: rra
Date: 2006-04-04 10:19:21 +0200 (Tue, 04 Apr 2006)
New Revision: 607

Modified:
   trunk/checks/fields
   trunk/checks/fields.desc
   trunk/debian/changelog
   trunk/testset/tags.relations
Log:
  + [RA] Check for conflicting with dependencies and build-conflicting
    with build dependencies.  (Closes: #122760)

Modified: trunk/checks/fields
===================================================================
--- trunk/checks/fields 2006-04-04 06:34:33 UTC (rev 606)
+++ trunk/checks/fields 2006-04-04 08:19:21 UTC (rev 607)
@@ -310,13 +310,14 @@
        close IN;
 }
 if (($type eq "binary") || ($type eq 'udeb')) {
-       my %deps;
+       my (%deps, %fields);
        for my $field (qw(depends pre-depends recommends suggests conflicts 
provides replaces)) {
                if (open(FH, "fields/$field")) {
                        #Get data and clean it
                        my $data = <FH>;
                        unfold($field, \$data);
                        $data =~ s/^\s*(.+?)\s*$/$1/;
+                       $fields{$field} = $data;
 
                        my (@seen_libstdcs, @seen_tcls, @seen_tclxs, @seen_tks, 
@seen_tkxs, @seen_libpngs);
 
@@ -401,6 +402,19 @@
                }
        }
 
+       # If Conflicts is set, make sure it's not inconsistent with the other
+       # dependency fields.
+       if ($fields{conflicts}) {
+               for my $field (qw(depends pre-depends recommends suggests)) {
+                       next unless $fields{$field};
+                       my $depend = Dep::parse($fields{$field});
+                       for my $conflict (split /\s*,\s*/, $fields{conflicts}) {
+                               tag "conflicts-with-dependency", $conflict
+                                   if Dep::implies($depend, 
Dep::parse($conflict));
+                       }
+               }
+       }
+
        for my $d_pkg_name (keys %deps) {
                my $d_pkg = $deps{$d_pkg_name};
                if (scalar @$d_pkg > 1) {
@@ -500,7 +514,7 @@
                        my $data = <FH>;
                        unfold($field, \$data);
                        $data =~ s/^\s*(.+?)\s*$/$1/;
-                       $depend{$field} = Dep::parse($data);
+                       $depend{$field} = $data;
 
                        for my $dep (split /\s*,\s*/, $data) {
                                my @alternatives;
@@ -537,9 +551,20 @@
                        }
                }
        }
-       $depend{'build-depends'} ||= Dep::parse('');
-       $depend{'build-depends-indep'} ||= Dep::parse('');
+       $depend{'build-depends'} = Dep::parse($depend{'build-depends'} || '');
+       $depend{'build-depends-indep'} = 
Dep::parse($depend{'build-depends-indep'} || '');
 
+       # Make sure build dependencies and conflicts are consistent.
+       for ($depend{'build-conflicts'}, $depend{'build-conflicts-indep'}) {
+               next unless $_;
+               for my $conflict (split /\s*,\s*/, $_) {
+                       if (Dep::implies($depend{'build-depends'}, 
Dep::parse($conflict))
+                           || Dep::implies($depend{'build-depends-indep'}, 
Dep::parse($conflict))) {
+                               tag "build-conflicts-with-build-dependency", 
$conflict;
+                       }
+               }
+       }
+
        # Make sure that all the required build dependencies are there.  Don't
        # issue missing-build-dependency errors for debhelper, since there's
        # another test that does that and it would just be a duplicate.

Modified: trunk/checks/fields.desc
===================================================================
--- trunk/checks/fields.desc    2006-04-04 06:34:33 UTC (rev 606)
+++ trunk/checks/fields.desc    2006-04-04 08:19:21 UTC (rev 607)
@@ -474,6 +474,12 @@
  using dh_python must build-depend on python, even if they don't otherwise
  need Python to build.
 
+Tag: build-conflicts-with-build-dependency
+Type: error
+Ref: policy 7.6
+Info: The package build-conflicts with a package that it also
+ build-depends on.
+
 Tag: package-has-a-duplicate-relation
 Type: warning
 Info: The package seems to declare a relation on another package which is
@@ -535,6 +541,12 @@
  glibc 2.0 or 2.1. There is intentionally no corresponding development
  package. Do not link new applications against this library!
 
+Tag: conflicts-with-dependency
+Type: error
+Ref: 7.3
+Info: The package seems to conflict with one of its dependencies,
+ recommendations, or suggestions.
+
 Tag: bad-menu-item
 Type: error
 Info: The field Installer-Menu-Item should only contain positive integer

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog      2006-04-04 06:34:33 UTC (rev 606)
+++ trunk/debian/changelog      2006-04-04 08:19:21 UTC (rev 607)
@@ -28,6 +28,8 @@
       because of the clean target, and make sure users of dh_python
       build-depend on python.  yada is no longer a special case.
       (Closes: #242789, #278290)
+    + [RA] Check for conflicting with dependencies and build-conflicting
+      with build dependencies.  (Closes: #122760)
   * checks/manpages:
     + [RA] Use system_env instead of system and sanitize the environment
       before running man -l out of caution and to avoid extraneous output

Modified: trunk/testset/tags.relations
===================================================================
--- trunk/testset/tags.relations        2006-04-04 06:34:33 UTC (rev 606)
+++ trunk/testset/tags.relations        2006-04-04 08:19:21 UTC (rev 607)
@@ -1,3 +1,5 @@
+E: relations source: build-conflicts-with-build-dependency bar [alpha test]
+E: relations source: build-conflicts-with-build-dependency foo [amd64 i386]
 E: relations source: build-depends-on-essential-package-without-using-version 
build-depends-indep: bash
 E: relations source: build-depends-on-essential-package-without-using-version 
build-depends: findutils
 E: relations source: build-depends-on-obsolete-package build-depends-indep: 
debmake
@@ -13,6 +15,8 @@
 E: relations-multiple-libs: package-depends-on-multiple-tkx-versions tkx8.2 
tkx8.3
 E: relations-multiple-libs: usr-doc-symlink-without-dependency relations
 E: relations: bad-version-in-relation conflicts: foobar (<< 5&5)
+E: relations: conflicts-with-dependency foo
+E: relations: conflicts-with-dependency relations
 E: relations: depends-on-essential-package-without-using-version depends: dpkg
 E: relations: needlessly-depends-on-awk depends
 E: relations: no-copyright-file


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to