Bug#457067: Patch for symbols support

2008-01-02 Thread Russ Allbery
Raphael Hertzog [EMAIL PROTECTED] writes:

 Attached is a patch adding support for the checks that I requested. I'd
 appreciate if it could be integrated quickly. Some review is welcome. It
 worked quite well on the test package that I used:
 http://ftp.debian.org/debian/pool/main/t/tokyocabinet/libtokyocabinet1_1.1.4-1_i386.deb

Thanks, committed.

-- 
Russ Allbery ([EMAIL PROTECTED])   http://www.eyrie.org/~eagle/



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



Bug#457067: Patch for symbols support

2007-12-27 Thread Raphael Hertzog
tags 457067 + patch
thanks

Hi,

Attached is a patch adding support for the checks that I requested. I'd
appreciate if it could be integrated quickly. Some review is welcome. It
worked quite well on the test package that I used:
http://ftp.debian.org/debian/pool/main/t/tokyocabinet/libtokyocabinet1_1.1.4-1_i386.deb

$ lintian libtokyocabinet1_1.1.4-1_i386.deb
E: libtokyocabinet1: symbols-file-contains-current-version-with-debian-revision 
on symbol [EMAIL PROTECTED] and 3 others
W: libtokyocabinet1: symbols-file-contains-debian-revision on symbol [EMAIL 
PROTECTED] and 321 others

Cheers,
-- 
Raphaël Hertzog

Le best-seller français mis à jour pour Debian Etch :
http://www.ouaza.com/livre/admin-debian/
diff -Nru /tmp/Yq0Lbe3ntH/lintian-1.23.41/checks/control-files /tmp/3p28KrBmDX/lintian-1.23.41/checks/control-files
--- /tmp/Yq0Lbe3ntH/lintian-1.23.41/checks/control-files	2007-11-21 00:12:21.0 +0100
+++ /tmp/3p28KrBmDX/lintian-1.23.41/checks/control-files	2007-12-27 19:21:22.0 +0100
@@ -107,8 +107,48 @@
 }
 close IN;
 
+if (-e control/symbols) {
+my $version = getfield(version);
+my $version_wo_rev = $version;
+$version_wo_rev =~ s/(.+)-(.+)/$1/;
+my ($full_version_count, $full_version_sym) = (0, undef);
+my ($debian_revision_count, $debian_revision_sym) = (0, undef);
+open(IN, , control/symbols);
+while (IN) {
+	next if not /^\s+(\S+)\s(\S+)(?:\s(\d+))?/;
+	my ($sym, $v, $dep_order) = ($1, $2, $3);
+	if (($v eq $version) and ($version =~ /-/)) {
+	$full_version_sym ||= $sym;
+	$full_version_count++;
+	}
+	if (($v =~ /-/) and (not $v =~ /~$/) and ($v ne $version_wo_rev)) {
+	$debian_revision_sym ||= $sym;
+	$debian_revision_count++;
+	}
+}
+close IN;
+if ($full_version_count) {
+	$full_version_count--;
+	tag symbols-file-contains-current-version-with-debian-revision,
+	on symbol $full_version_sym and $full_version_count others;
+}
+if ($debian_revision_count) {
+	$debian_revision_count--;
+	tag symbols-file-contains-debian-revision,
+	on symbol $debian_revision_sym and $debian_revision_count others;
+}
+}
+
 } # /run
 
+sub getfield {
+return undef if not open (FIELD, '', fields/ . shift);
+my $field = FIELD;
+close FIELD;
+$field =~ s/\n$//;
+return $field;
+}
+
 1;
 
 # vim: syntax=perl sw=4 ts=8
diff -Nru /tmp/Yq0Lbe3ntH/lintian-1.23.41/checks/control-files.desc /tmp/3p28KrBmDX/lintian-1.23.41/checks/control-files.desc
--- /tmp/Yq0Lbe3ntH/lintian-1.23.41/checks/control-files.desc	2007-12-07 05:39:02.0 +0100
+++ /tmp/3p28KrBmDX/lintian-1.23.41/checks/control-files.desc	2007-12-27 19:32:16.0 +0100
@@ -26,3 +26,28 @@
 Tag: control-file-has-bad-owner
 Type: error
 Info: All control files should be owned by root/root.
+
+Tag: symbols-file-contains-current-version-with-debian-revision
+Type: error
+Info: By default, dpkg-gensymbols uses the full version number for the
+ dependency associated to any new symbol that it detects. But this
+ shouldn't happen as the maintainer should have updated before-hand the
+ debian/lt;packagegt;.symbols file by adding the new symbols with the
+ corresponding upstream version. 
+ .
+ Debian revisions should be stripped from symbols files because not doing
+ it leads to dependencies unsatisfiable by backports (1.0-1~bpo lt;lt; 1.0-1
+ while 1.0-1~bpo gt;= 1.0). If the debian revision can't be stripped because
+ the symbol really appearead between two specific revisions, then you
+ should postfix the version with a single ~ (example: 1.0-3~ if the
+ symbol appeared in 1.0-3).
+
+Tag: symbols-file-contains-debian-revision
+Type: warning
+Info: Debian revisions should be stripped from symbols files because not doing 
+ it leads to dependencies unsatisfiable by backports (1.0-1~bpo lt;lt; 1.0-1
+ while 1.0-1~bpo gt;= 1.0). If the debian revision can't be stripped because
+ the symbol really appearead between two specific revisions, then you
+ should postfix the version with a single ~ (example: 1.0-3~ if the
+ symbol appeared in 1.0-3).
+
diff -Nru /tmp/Yq0Lbe3ntH/lintian-1.23.41/debian/changelog /tmp/3p28KrBmDX/lintian-1.23.41/debian/changelog
--- /tmp/Yq0Lbe3ntH/lintian-1.23.41/debian/changelog	2007-12-10 05:03:03.0 +0100
+++ /tmp/3p28KrBmDX/lintian-1.23.41/debian/changelog	2007-12-27 19:36:29.0 +0100
@@ -1,3 +1,10 @@
+lintian (1.23.41-0.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Add checks on symbols files. Closes: #457067
+
+ -- Raphael Hertzog [EMAIL PROTECTED]  Mon, 24 Dec 2007 10:31:34 +0100
+
 lintian (1.23.41) unstable; urgency=low
 
   The it would be lovely if there were an actual desktop file standard