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

Bug#493156: Detect embedded copies of Mark Pilgrim's "feedparser.py"



Package: lintian
Version: 1.24.2
Severity: wishlist
Tags: patch

Lintian should emit a warning when a package installs an embedded copy of
Mark Pilgrim's Universal Feed Parser.

(Debian's copy--available in the python-feedparser package--contains a
growing number of patches to fix various issues and packages that embed a
copy from elsewhere are not picking these up.)

Patch (with testcases) attached.


Regards,

-- 
Chris Lamb, UK                                       chris@chris-lamb.co.uk
                                                            GPG: 0x634F9A20
From a96e0017cde39a9537e32a6571b2ee4a3dc4fd3e Mon Sep 17 00:00:00 2001
From: Chris Lamb <chris@chris-lamb.co.uk>
Date: Thu, 31 Jul 2008 19:41:01 +0100
Subject: [PATCH] Emit a warning when a package embeds Mark Pilgrim's feedparser.py.

We check the contents of the file first to avoid some false positives,
particularly /usr/lib/python2.5/email/feedparser.py.
---
 checks/files                          |   12 ++++++++++++
 checks/files.desc                     |    7 +++++++
 testset/filenames/files/feedparser.py |   16 ++++++++++++++++
 testset/tags.filenames                |    3 +++
 4 files changed, 38 insertions(+), 0 deletions(-)
 create mode 100644 testset/filenames/files/feedparser.py

diff --git a/checks/files b/checks/files
index 64b6ce3..46f40c2 100644
--- a/checks/files
+++ b/checks/files
@@ -647,6 +647,18 @@ while (<IN>) {
 	    tag "embedded-javascript-library", "$file";
 	}
 
+	# ---------------- embedded Feedparser library
+	if ($file =~ m,/feedparser\.py$, and $pkg ne "python-feedparser") {
+	    open(FEEDPARSER, "unpacked/$file") or fail("cannot open feedparser.py file: $!");
+	    while (<FEEDPARSER>) {
+		if (m,Universal feed parser,) {
+		    tag "embedded-feedparser-library", "$file";
+		    last;
+		}
+	    }
+	    close(FEEDPARSER);
+	}
+
 	# ---------------- general: setuid/setgid files!
 	if ($perm =~ m/s/) {
 	    my ($setuid, $setgid) = ("","");
diff --git a/checks/files.desc b/checks/files.desc
index 519b0ed..326f29d 100644
--- a/checks/files.desc
+++ b/checks/files.desc
@@ -768,3 +768,10 @@ Info: This package contains an embedded copy of the JQuery, Prototype,
  own packages. Please depend on the appropriate package and symlink the
  library into the appropriate location.
 Ref: policy 4.13
+
+Tag: embedded-feedparser-library
+Type: warning
+Info: This package contains an embedded copy of Mark Pilgrim's Universal
+ Feed Parser. Please depend on the "python-feedparser" package and symlink
+ the library into the appropriate location.
+Ref: policy 4.13
diff --git a/testset/filenames/files/feedparser.py b/testset/filenames/files/feedparser.py
new file mode 100644
index 0000000..78f0866
--- /dev/null
+++ b/testset/filenames/files/feedparser.py
@@ -0,0 +1,16 @@
+#!/usr/bin/env python
+"""Universal feed parser
+
+Handles RSS 0.9x, RSS 1.0, RSS 2.0, CDF, Atom 0.3, and Atom 1.0 feeds
+
+Visit http://feedparser.org/ for the latest version
+Visit http://feedparser.org/docs/ for the latest documentation
+
+Required: Python 2.1 or later
+Recommended: Python 2.3 or later
+Recommended: CJKCodecs and iconv_codec <http://cjkpython.i18n.org/>
+"""
+
+__version__ = "4.1"# + "$Revision: 1.92 $"[11:15] + "-cvs"
+
+# (snip)
diff --git a/testset/tags.filenames b/testset/tags.filenames
index 88e5325..892bf19 100644
--- a/testset/tags.filenames
+++ b/testset/tags.filenames
@@ -61,6 +61,7 @@ W: filenames: binary-without-manpage usr/bin/X11/testxbin
 W: filenames: binary-without-manpage usr/bin/mh/read
 W: filenames: debian-news-file-not-compressed usr/share/doc/filenames/NEWS.Debian
 W: filenames: desktop-file-in-wrong-dir usr/share/gnome/apps/System/foo.desktop
+W: filenames: embedded-feedparser-library files/feedparser.py
 W: filenames: embedded-javascript-library usr/share/filenames/jquery.js
 W: filenames: embedded-javascript-library usr/share/filenames/jquery.lite.js
 W: filenames: embedded-javascript-library usr/share/filenames/jquery.min.js
@@ -84,6 +85,7 @@ W: filenames: file-in-unusual-dir files/.cvsignore
 W: filenames: file-in-unusual-dir files/Maelstrom Sounce.r121
 W: filenames: file-in-unusual-dir files/Maelstrom Sound
 W: filenames: file-in-unusual-dir files/Maelstrom Sound.mine
+W: filenames: file-in-unusual-dir files/feedparser.py
 W: filenames: file-in-unusual-dir files/svk-commitsEr9P.tmp
 W: filenames: file-in-unusual-dir files/svn-commit.tmp
 W: filenames: file-in-unusual-dir srv/foo/bar
@@ -121,6 +123,7 @@ W: filenames: package-contains-vcs-control-file usr/lib/perl5/foo/.hgtags
 W: filenames: package-installs-into-etc-gconf-schemas etc/gconf/schemas/test.schema
 W: filenames: package-installs-nonbinary-perl-in-usr-lib-perl5 usr/lib/perl5/foo/ancient.pm
 W: filenames: package-installs-nonbinary-perl-in-usr-lib-perl5 usr/lib/perl5/foo/bar.pm
+W: filenames: script-not-executable ./files/feedparser.py
 W: filenames: svk-commit-file-in-package files/svk-commitsEr9P.tmp
 W: filenames: svn-commit-file-in-package files/svn-commit.tmp
 W: filenames: symlink-is-self-recursive usr/lib/filenames/symlink10wrong ../../..
-- 
1.5.6.3

Attachment: signature.asc
Description: PGP signature


Reply to: