lintian: r608 - in trunk: debian lib testset testset/relations/debian
Author: rra
Date: 2006-04-04 11:50:54 +0200 (Tue, 04 Apr 2006)
New Revision: 608
Modified:
trunk/debian/changelog
trunk/lib/Dep.pm
trunk/testset/relations/debian/control
trunk/testset/tags.relations
Log:
* lib/Dep.pm:
+ [RA] Add initial support for analyzing architecture information in
dependencies instead of ignoring it.
Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog 2006-04-04 08:19:21 UTC (rev 607)
+++ trunk/debian/changelog 2006-04-04 09:50:54 UTC (rev 608)
@@ -57,10 +57,13 @@
the user's environment.
+ [RA] Run readelf -l to collect interpreter information.
+ * lib/Dep.pm:
+ + [RA] Add initial support for analyzing architecture information in
+ dependencies instead of ignoring it.
* lib/Util.pm:
+ [RA] Add system_env, like system but sanitizing the environment.
- -- Russ Allbery <rra@debian.org> Sun, 2 Apr 2006 22:32:37 -0700
+ -- Russ Allbery <rra@debian.org> Tue, 4 Apr 2006 02:49:20 -0700
lintian (1.23.16) unstable; urgency=low
Modified: trunk/lib/Dep.pm
===================================================================
--- trunk/lib/Dep.pm 2006-04-04 08:19:21 UTC (rev 607)
+++ trunk/lib/Dep.pm 2006-04-04 09:50:54 UTC (rev 608)
@@ -36,15 +36,20 @@
\s* (.*?) # do not attempt to parse version
\s* \) # closing parenthesis
)? # end of optional part
+ (?: # start of optional architecture
+ \s* \[ # open bracket for architecture
+ \s* (.*?) # don't parse architectures now
+ \s* \] # closing bracket
+ )? # end of optional architecture
/x;
- return ['PRED', $1] if not defined $2;
+ return ['PRED', $1, undef, undef, $4] if not defined $2;
my $two = $2;
if ($two eq '<') {
$two = '<<';
} elsif ($two eq '>') {
$two = '>>';
}
- return ['PRED', $1, $two, $3];
+ return ['PRED', $1, $two, $3, $4];
}
sub Or { return ['OR', @_]; }
@@ -180,10 +185,71 @@
# If the names don't match, there is no relationship between them.
return undef if $$p[1] ne $$q[1];
- # If the names match, then the only difference is in the version clauses.
- # The implication is true if p's clause is stronger than q's, or is
- # equivalent.
+ # If the names match, then the only difference is in the architecture or
+ # version clauses. First, check architecture. The architectures for p
+ # must be a superset of the architectures for q.
+ my @p_arches = split(' ', $$p[4] || '');
+ my @q_arches = split(' ', $$q[4] || '');
+ if (@p_arches || @q_arches) {
+ my $p_arch_neg = @p_arches && $p_arches[0] =~ /^!/;
+ my $q_arch_neg = @q_arches && $q_arches[0] =~ /^!/;
+ # If p has no arches, it is a superset of q and we should fall through
+ # to the version check.
+ if (not @p_arches) {
+ # nothing
+ }
+
+ # If q has no arches, it is a superset of p and there are no useful
+ # implications.
+ elsif (not @q_arches) {
+ return undef;
+ }
+
+ # Both have arches. If neither are negated, we know nothing useful
+ # unless q is a subset of p.
+ elsif (not $p_arch_neg and not $q_arch_neg) {
+ my %p_arches = map { $_ => 1 } @p_arches;
+ my $subset = 1;
+ for my $arch (@q_arches) {
+ $subset = 0 unless $p_arches{$arch};
+ }
+ return undef unless $subset;
+ }
+
+ # If both are negated, we know nothing useful unless p is a subset of
+ # q (and therefore has fewer things excluded, and therefore is more
+ # general).
+ elsif ($p_arch_neg and $q_arch_neg) {
+ my %q_arches = map { $_ => 1 } @q_arches;
+ my $subset = 1;
+ for my $arch (@p_arches) {
+ $subset = 0 unless $q_arches{$arch};
+ }
+ return undef unless $subset;
+ }
+
+ # If q is negated and p isn't, we'd need to know the full list of
+ # arches to know if there's any relationship, so bail.
+ elsif (not $p_arch_neg and $q_arch_neg) {
+ return undef;
+ }
+
+ # If p is negated and q isn't, q is a subset of p iff none of the
+ # negated arches in p are present in q.
+ elsif ($p_arch_neg and not $q_arch_neg) {
+ my %q_arches = map { $_ => 1 } @q_arches;
+ my $subset = 1;
+ for my $arch (@p_arches) {
+ $subset = 0 if $q_arches{substr($arch, 1)};
+ }
+ return undef unless $subset;
+ }
+ }
+
+ # Now, down to version. The implication is true if p's clause is stronger
+ # than q's, or is equivalent.
+
# If q has no version clause, then p's clause is always stronger.
return 1 if not defined $$q[2];
Modified: trunk/testset/relations/debian/control
===================================================================
--- trunk/testset/relations/debian/control 2006-04-04 08:19:21 UTC (rev 607)
+++ trunk/testset/relations/debian/control 2006-04-04 09:50:54 UTC (rev 608)
@@ -1,9 +1,10 @@
Source: relations
Section: misc
Priority: optional
-Build-Depends: mail-transport-agent, libc6-dev, findutils, foo (>> 2), bar
+Build-Depends: mail-transport-agent, libc6-dev, findutils, foo (>> 2) [!amd64 !i386], bar, arch-test1 [i386], arch-test2 [!i386]
Build-Depends-Indep: make, bash, debmake
-Build-Conflicts: foo [amd64 i386], bar [alpha test], xlibs-dev
+Build-Conflicts: foo [amd64 i386], bar [alpha test], xlibs-dev, arch-test1 [powerpc], arch-test2 [!sparc]
+Build-Conflicts-Indep: debmake [!powerpc]
Maintainer: Debian QA Group <packages@qa.debian.org>
Standards-Version: 3.1.1
Origin: Debian
Modified: trunk/testset/tags.relations
===================================================================
--- trunk/testset/tags.relations 2006-04-04 08:19:21 UTC (rev 607)
+++ trunk/testset/tags.relations 2006-04-04 09:50:54 UTC (rev 608)
@@ -1,9 +1,9 @@
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-conflicts-with-build-dependency debmake [!powerpc]
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
-E: relations source: debian-control-with-duplicate-fields provides: 31, 32
+E: relations source: debian-control-with-duplicate-fields provides: 32, 33
E: relations source: depends-on-build-essential-package-without-using-version libc6-dev [build-depends: libc6-dev]
E: relations source: depends-on-build-essential-package-without-using-version make [build-depends-indep: make]
E: relations source: invalid-arch-string-in-source-relation test [build-conflicts: bar [alpha test]]
@@ -22,6 +22,7 @@
E: relations: no-copyright-file
E: relations: obsolete-field optional
I: relations source: non-standard-arch-in-source-relation amd64 [build-conflicts: foo [amd64 i386]]
+I: relations source: non-standard-arch-in-source-relation amd64 [build-depends: foo (>> 2) [!amd64 !i386]]
I: relations-multiple-libs: unknown-field-in-control bugs
I: relations-multiple-libs: unknown-field-in-control origin
I: relations: unknown-field-in-control bugs
Reply to: