Subject: [PATCH] Detect some non-free flash files

From: Raphael Geissert <[email-masked]>
Date: Fri, 1 May 2009 21:27:30 -0500

Check based on Paul Wise's analysis, thanks
---
 checks/files                                       |   17 +++++++++++++
 checks/files.desc                                  |    6 ++++
 .../files-flash-non-free/debian/debian/control.in  |   26 ++++++++++++++++++++
 .../debian/files-flash-non-free-non-free.install   |    2 +
 .../debian/debian/files-flash-non-free.install     |    2 +
 t/tests/files-flash-non-free/desc                  |    5 ++++
 t/tests/files-flash-non-free/tags                  |    3 ++
 7 files changed, 61 insertions(+), 0 deletions(-)
 create mode 100644 t/tests/files-flash-non-free/debian/debian/control.in
 create mode 100644 t/tests/files-flash-non-free/debian/debian/files-flash-non-free-non-free.install
 create mode 100644 t/tests/files-flash-non-free/debian/debian/files-flash-non-free.install
 create mode 100644 t/tests/files-flash-non-free/debian/dewplayer-slim.swf
 create mode 100644 t/tests/files-flash-non-free/debian/dewplayer.swf
 create mode 100644 t/tests/files-flash-non-free/debian/flvplayer.swf
 create mode 100644 t/tests/files-flash-non-free/debian/mp3player.swf
 create mode 100644 t/tests/files-flash-non-free/desc
 create mode 100644 t/tests/files-flash-non-free/tags

diff --git a/checks/files b/checks/files
index 897c965..e69076c 100644
--- a/checks/files
+++ b/checks/files
@@ -104,6 +104,15 @@ our @phplibraries = (
 #    [ qr,(?i)(class\.)?kses\.php$, => 'libphp-kses' ],
 );
 
+# A list of known non-free flash executables
+our @flash_nonfree = (
+    qr<(?i)dewplayer(?:-\w+)?\.swf$>,
+    qr<(?i)(?:mp3|flv)player\.swf$>,
+# Situation needs to be clarified:
+#    qr,(?i)multipleUpload\.swf$,
+#    qr,(?i)xspf_jukebox\.swf$,
+);
+
 sub run {
 
 my $pkg = shift;
@@ -760,6 +769,14 @@ foreach my $file (sort keys %{$info->index}) {
 	    }
 	}
 
+	# ---------------- non-free .swf files
+	foreach my $flash (@flash_nonfree) {
+	    last if ($pkg_section =~ m,^non-free/,);
+	    if ($file =~ m,/$flash,) {
+		tag "non-free-flash", $file;
+	    }
+	}
+
 	# ---------------- .gz files
 	if ($file =~ m/\.gz$/) {
 	    my $info = $info->file_info->{$file} || '';
diff --git a/checks/files.desc b/checks/files.desc
index e914d34..f4fa60f 100644
--- a/checks/files.desc
+++ b/checks/files.desc
@@ -970,3 +970,9 @@ Info: The given file ends with <tt>.gz</tt>, which normally indicates it
  gzip-compressed file.  gzip will fail with an error on such files.
  Normally this indicates a mistake in the installation process of the
  package.
+
+Tag: non-free-flash
+Severity: serious
+Certainty: possible
+Info: The given flash file appears to be a known non-free file.
+
diff --git a/t/tests/files-flash-non-free/debian/debian/control.in b/t/tests/files-flash-non-free/debian/debian/control.in
new file mode 100644
index 0000000..688fd94
--- /dev/null
+++ b/t/tests/files-flash-non-free/debian/debian/control.in
@@ -0,0 +1,26 @@
+Source: {$srcpkg}
+Priority: extra
+Section: {$section}
+Maintainer: {$author}
+Standards-Version: {$standards_version}
+Build-Depends: debhelper (>= 7)
+Homepage: http://lintian.debian.org/
+
+Package: {$srcpkg}
+Architecture: {$architecture}
+Depends: $\{misc:Depends\}
+Description: {$description}
+ This is a test package designed to exercise some feature or tag of
+ Lintian.  It is part of the Lintian test suite and may do very odd
+ things.  It should not be installed like a regular package.
+
+Package: {$srcpkg}-non-free
+Section: non-free/{$section}
+Architecture: {$architecture}
+Depends: $\{misc:Depends\}
+Description: {$description} (okay)
+ non-free in non-free, nice.
+ .
+ This is a test package designed to exercise some feature or tag of
+ Lintian.  It is part of the Lintian test suite and may do very odd
+ things.  It should not be installed like a regular package.
diff --git a/t/tests/files-flash-non-free/debian/debian/files-flash-non-free-non-free.install b/t/tests/files-flash-non-free/debian/debian/files-flash-non-free-non-free.install
new file mode 100644
index 0000000..f7644c9
--- /dev/null
+++ b/t/tests/files-flash-non-free/debian/debian/files-flash-non-free-non-free.install
@@ -0,0 +1,2 @@
+dewplayer.swf usr/share/foo/
+dewplayer-slim.swf usr/share/foo/
diff --git a/t/tests/files-flash-non-free/debian/debian/files-flash-non-free.install b/t/tests/files-flash-non-free/debian/debian/files-flash-non-free.install
new file mode 100644
index 0000000..f7bf9ba
--- /dev/null
+++ b/t/tests/files-flash-non-free/debian/debian/files-flash-non-free.install
@@ -0,0 +1,2 @@
+flvplayer.swf usr/share/foo/
+mp3player.swf usr/share/foo/
diff --git a/t/tests/files-flash-non-free/debian/dewplayer-slim.swf b/t/tests/files-flash-non-free/debian/dewplayer-slim.swf
new file mode 100644
index 0000000..e69de29
diff --git a/t/tests/files-flash-non-free/debian/dewplayer.swf b/t/tests/files-flash-non-free/debian/dewplayer.swf
new file mode 100644
index 0000000..e69de29
diff --git a/t/tests/files-flash-non-free/debian/flvplayer.swf b/t/tests/files-flash-non-free/debian/flvplayer.swf
new file mode 100644
index 0000000..e69de29
diff --git a/t/tests/files-flash-non-free/debian/mp3player.swf b/t/tests/files-flash-non-free/debian/mp3player.swf
new file mode 100644
index 0000000..e69de29
diff --git a/t/tests/files-flash-non-free/desc b/t/tests/files-flash-non-free/desc
new file mode 100644
index 0000000..fc5d7dd
--- /dev/null
+++ b/t/tests/files-flash-non-free/desc
@@ -0,0 +1,5 @@
+Testname: files-flash-non-free
+Sequence: 6000
+Version: 1.0
+Description: non-free flash files
+Test-For: non-free-flash
diff --git a/t/tests/files-flash-non-free/tags b/t/tests/files-flash-non-free/tags
new file mode 100644
index 0000000..812bdca
--- /dev/null
+++ b/t/tests/files-flash-non-free/tags
@@ -0,0 +1,3 @@
+E: files-flash-non-free source: section-category-mismatch Package files-flash-non-free-non-free
+E: files-flash-non-free: non-free-flash usr/share/foo/flvplayer.swf
+E: files-flash-non-free: non-free-flash usr/share/foo/mp3player.swf