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

Bug#512196: lintian: Please shout on people hardcoding libc6 in their debian/control file



tags 512196 patch
thanks

On Sun, 18 Jan 2009 15:01:51 +0100 Cyril Brulebois wrote:

> Evgeni's currently looking into writing the test. ;)

Okay, attached is a first patch against lintian git that does what you
want. Let's see if you like it.

Regards
Evgeni

-- 
Bruce Schneier Fact Number 170:
Bruce Schneier's abs are NP-hard.
>From 90ed079b26e8d78a6aa814d60d7545d89cb270c9 Mon Sep 17 00:00:00 2001
From: Evgeni Golov <sargentd@die-welt.net>
Date: Sun, 18 Jan 2009 18:58:04 +0100
Subject: [PATCH] shout on people hardcoding libc6 in their debian/control file

One should not hardcode a Depends on libc6 in debian/control,
but use ${shlibs:Depends} for that.
Warn about that.
Closes: #512196
---
 checks/control-file      |   15 +++++++++++++++
 checks/control-file.desc |    7 +++++++
 2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/checks/control-file b/checks/control-file
index 019bf79..c8ba92a 100644
--- a/checks/control-file
+++ b/checks/control-file
@@ -122,6 +122,21 @@ for my $control (@binary_controls) {
 	}
 }
 
+# Check that packages do not hardcode a depend on any variant of libc
+@dep_fields = qw(pre-depends depends);
+my @libcs = qw(libc6 libc6.1 libc0.1 libc0.3);
+for my $control (@binary_controls) {
+	for my $field (0 .. ($#dep_fields)) {
+		next unless $control->{$dep_fields[$field]};
+		my $parsed = Dep::parse ($control->{$dep_fields[$field]});
+		for my $libc (@libcs) {
+			tag "packages-depends-on-hardcoded-libc", $control->{package}, $dep_fields[$field], $libc
+				if Dep::implies($parsed, Dep::parse($libc));
+		}
+		
+	}
+}
+
 # Check that every package is in the same archive category, except that
 # sources in main can deliver both main and contrib packages.  The source
 # package may or may not have a section specified; if it doesn't, derive the
diff --git a/checks/control-file.desc b/checks/control-file.desc
index c57db3c..2a162ca 100644
--- a/checks/control-file.desc
+++ b/checks/control-file.desc
@@ -132,3 +132,10 @@ Info: The given field in the <tt>debian/control</tt> file has a substvar
  syntactically valid, but as soon as the variable has a non-empty value,
  the control file will have a syntax error.  You probably meant to put a
  comma after the substvar expansion.
+
+Tag: packages-depends-on-hardcoded-libc
+Severity: normal
+Certainty: certain
+Info: The given package declares a dependency on libc directly instead
+ of using ${shlibs:Depends} in its <tt>debian/control</tt> stanza.
+
-- 
1.5.6.5

Attachment: pgpzanRTKMQE0.pgp
Description: PGP signature


Reply to: