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

Bug#458785: [checks/fields] *-dbg packages should not have empty dependencies



tags 458785 +patch
kthxbye

A patch (with testcases) is attached, which checks for a dependency on a
non-dbg equivalent package. It does not check whether the dependency is
versioned at all.

The case where "Depends:" is empty is caught, along with the case where
"libfoo0-dbg" depends on "libfoo" (it was not necessary to modify the
testcase input for this). This latter case may even be wrong; I'm not sure.


Regards,

-- 
Chris Lamb, UK                                       chris@chris-lamb.co.uk
                                                            GPG: 0x634F9A20
Index: checks/fields
===================================================================
--- checks/fields	(revision 1122)
+++ checks/fields	(working copy)
@@ -408,6 +408,14 @@
 }
 if (($type eq "binary") || ($type eq 'udeb')) {
 	my (%deps, %fields, %parsed);
+
+	my $non_dbg_variant_check = 0;
+	my $non_dbg_variant = "";
+	if ($pkg =~ m/(.+)\-dbg$/) {
+		$non_dbg_variant_check = 1;
+		$non_dbg_variant = $1;
+	}
+
 	for my $field (qw(depends pre-depends recommends suggests conflicts provides replaces)) {
 		if (open(FH, '<', "fields/$field")) {
 			#Get data and clean it
@@ -453,6 +461,11 @@
 						push @{$deps{$d_pkg}}, [$field, $d_version];
 					}
 
+					# We have found a Depends: on our non-dbg equivalent
+					if ($non_dbg_variant_check && $field eq "depends" && $d_pkg eq $non_dbg_variant) {
+						$non_dbg_variant = "";
+					}
+
 					tag "versioned-provides", "$part_d_orig"
 					    if ($field eq "provides" && $d_version->[0]);
 
@@ -513,6 +526,9 @@
 		}
 	}
 
+	tag "foo-dbg-package-missing-depends-on-foo", "missing $non_dbg_variant"
+		if ($non_dbg_variant_check && $non_dbg_variant ne "");
+
 	# If Conflicts is set, make sure it's not inconsistent with the other
 	# dependency fields.
 	if ($fields{conflicts}) {
Index: checks/fields.desc
===================================================================
--- checks/fields.desc	(revision 1122)
+++ checks/fields.desc	(working copy)
@@ -706,3 +706,9 @@
 Info: This package has a name suggesting that it contains detached
  debugging symbols.  If so, it should have priority "extra" since users
  normally do not need such packages.
+
+Tag: foo-dbg-package-missing-depends-on-foo
+Type: warning
+Info: This package has a name in the form of "foo-dbg" which suggests that
+ it contains detached debugging symbols. If so, it should depend on the
+ corresponding "foo" package.
Index: testset/tags.debug
===================================================================
--- testset/tags.debug	(revision 1122)
+++ testset/tags.debug	(working copy)
@@ -9,6 +9,8 @@
 W: debug source: changelog-should-not-mention-nmu
 W: debug source: debian-rules-sets-DH_COMPAT line 5
 W: debug source: out-of-date-standards-version 3.7.0 (current is 3.7.3)
+W: hello-dbg: foo-dbg-package-missing-depends-on-foo missing hello
 W: hello: binary-without-manpage usr/bin/hello
 W: hello: binary-without-manpage usr/bin/hello.dbg
+W: libhello0-dbg: foo-dbg-package-missing-depends-on-foo missing libhello0
 W: libhello0-dbg: shared-lib-without-dependency-information ./usr/lib/libhello.so.dbg
Index: testset/debug/debian/control
===================================================================
--- testset/debug/debian/control	(revision 1122)
+++ testset/debug/debian/control	(working copy)
@@ -15,7 +15,7 @@
 Package: hello-dbg
 Priority: extra
 Architecture: alpha amd64 arm hppa hurd-i386 i386 ia64 kfreebsd-i386 m68k mips mipsel powerpc ppc64 s390 sparc
-Depends: hello (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
+Depends:
 Description: Test for external debugging information
  lintian regression test for external debugging file handling.
 

Attachment: signature.asc
Description: PGP signature


Reply to: