[lintian] 03/06: Check for upstream tarballs that ship examples but none is installed in any binary package. (Closes: #539326)
This is an automated email from the git hooks/post-receive script.
lamby pushed a commit to branch master
in repository lintian.
commit 86ea33e221ee682f40cb3451378d7d34993fcfb7
Author: Chris Lamb <lamby@debian.org>
Date: Mon Jan 29 23:19:08 2018 +0000
Check for upstream tarballs that ship examples but none is installed in any binary package. (Closes: #539326)
---
checks/cruft.desc | 10 ++++++++++
checks/cruft.pm | 21 ++++++++++++++++++---
debian/changelog | 4 +++-
.../debian/debian/examples | 1 +
.../debian/examples/testsuite | 1 +
.../desc | 7 +++++++
.../tags | 0
.../debian/examples/testsuite | 1 +
.../cruft-package-does-not-install-examples/desc | 7 +++++++
.../cruft-package-does-not-install-examples/tags | 1 +
10 files changed, 49 insertions(+), 4 deletions(-)
diff --git a/checks/cruft.desc b/checks/cruft.desc
index 59e7de8..40c6cae 100644
--- a/checks/cruft.desc
+++ b/checks/cruft.desc
@@ -924,3 +924,13 @@ Info: The package appears to use <tt>AC_PATH_PROG</tt> to discover the
A better way would be to use the <tt>PKG_PROG_PKG_CONFIG</tt> macro from
<tt>pkg.m4</tt> and then using the <tt>$PKG_CONFIG</tt> shell variable.
Ref: #884798
+
+Tag: package-does-not-install-examples
+Severity: pedantic
+Certainty: possible
+Info: The original source tarball contains the specified examples
+ directory. However, no examples are installed in any binary packages.
+ .
+ Please use <tt>dh_installexamples</tt> to install these to the most
+ relevant package.
+Ref: dh_installexamples(1)
diff --git a/checks/cruft.pm b/checks/cruft.pm
index 0beda52..7eb7116 100644
--- a/checks/cruft.pm
+++ b/checks/cruft.pm
@@ -40,6 +40,7 @@ use constant INSANE_LINE_LENGTH => 512;
use constant SAFE_LINE_LENGTH => 256;
use File::Basename qw(basename);
+use List::MoreUtils qw(any);
use Lintian::Data;
use Lintian::Relation ();
@@ -335,7 +336,7 @@ our @TRAILING_WHITESPACE_FILES = (
);
sub run {
- my (undef, undef, $info, $proc) = @_;
+ my (undef, undef, $info, $proc, $group) = @_;
my $source_pkg = $proc->pkg_src;
my $d_files = $info->index_resolved_path('debian/files');
@@ -372,7 +373,7 @@ sub run {
}elsif (not $info->native) {
check_diffstat($info->diffstat, \%warned);
}
- find_cruft($source_pkg, $info, \%warned, $ltinbd);
+ find_cruft($source_pkg, $info, \%warned, $ltinbd, $group);
for my $file (@EOL_TERMINATORS_FILES) {
my $path = $info->index_resolved_path("debian/$file");
@@ -564,7 +565,7 @@ sub istestset {
# "source-contains" tag. The tag isn't entirely accurate, but it's better
# than creating yet a third set of tags, and this gets the severity right.
sub find_cruft {
- my ($source_pkg, $info, $warned, $ltinbd) = @_;
+ my ($source_pkg, $info, $warned, $ltinbd, $group) = @_;
my $prefix = ($info->native ? 'diff-contains' : 'source-contains');
my @worklist;
@@ -604,6 +605,8 @@ sub find_cruft {
last;
}
}
+ tag 'package-does-not-install-examples', $entry
+ if $basename eq 'examples' and not _ships_examples($group);
}
push(@worklist, $entry->children);
@@ -1550,6 +1553,18 @@ sub _license_check {
return $ret;
}
+sub _ships_examples {
+ my ($group) = @_;
+ my @procs = $group->get_processables('binary');
+ return if not @procs;
+ foreach my $binpkg (@procs) {
+ my $name = $binpkg->pkg_name;
+ my @files = $binpkg->info->sorted_index;
+ return 1 if any { m{^usr/share/doc/$name/examples/$} } @files;
+ }
+ return;
+}
+
1;
# Local Variables:
diff --git a/debian/changelog b/debian/changelog
index a3035f2..9996324 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,9 +2,11 @@ lintian (2.5.73) UNRELEASED; urgency=medium
XXX: generate tag summary
- * checks/cruft.pm:
+ * checks/cruft.{desc,pm}:
+ [CL] When looking for the source of "build/foo/bar.min.js", also
check "src/foo/bar.js". (Closes: #832027)
+ + [CL] Check for upstream tarballs that ship examples but none is
+ installed in any binary package. (Closes: #539326)
* checks/debian-source-dir.desc:
+ [CL] Upgrade severity of missing-debian-source-format from wishlist
("I") to normal ("W"). (Closes: #702671)
diff --git a/t/tests/cruft-package-does-not-install-examples-unrel/debian/debian/examples b/t/tests/cruft-package-does-not-install-examples-unrel/debian/debian/examples
new file mode 100644
index 0000000..e39721e
--- /dev/null
+++ b/t/tests/cruft-package-does-not-install-examples-unrel/debian/debian/examples
@@ -0,0 +1 @@
+examples/*
diff --git a/t/tests/cruft-package-does-not-install-examples-unrel/debian/examples/testsuite b/t/tests/cruft-package-does-not-install-examples-unrel/debian/examples/testsuite
new file mode 100644
index 0000000..345e6ae
--- /dev/null
+++ b/t/tests/cruft-package-does-not-install-examples-unrel/debian/examples/testsuite
@@ -0,0 +1 @@
+Test
diff --git a/t/tests/cruft-package-does-not-install-examples-unrel/desc b/t/tests/cruft-package-does-not-install-examples-unrel/desc
new file mode 100644
index 0000000..5f4eec0
--- /dev/null
+++ b/t/tests/cruft-package-does-not-install-examples-unrel/desc
@@ -0,0 +1,7 @@
+Testname: cruft-package-does-not-install-examples-unrel
+Version: 1.0
+Description: Detect uninstalled examples (false positibe)
+Options: -I --pedantic
+Skeleton: pedantic
+Test-Against:
+ package-does-not-install-examples
diff --git a/t/tests/cruft-package-does-not-install-examples-unrel/tags b/t/tests/cruft-package-does-not-install-examples-unrel/tags
new file mode 100644
index 0000000..e69de29
diff --git a/t/tests/cruft-package-does-not-install-examples/debian/examples/testsuite b/t/tests/cruft-package-does-not-install-examples/debian/examples/testsuite
new file mode 100644
index 0000000..345e6ae
--- /dev/null
+++ b/t/tests/cruft-package-does-not-install-examples/debian/examples/testsuite
@@ -0,0 +1 @@
+Test
diff --git a/t/tests/cruft-package-does-not-install-examples/desc b/t/tests/cruft-package-does-not-install-examples/desc
new file mode 100644
index 0000000..ed711ba
--- /dev/null
+++ b/t/tests/cruft-package-does-not-install-examples/desc
@@ -0,0 +1,7 @@
+Testname: cruft-package-does-not-install-examples
+Version: 1.0
+Description: Detect uninstalled examples
+Options: -I --pedantic
+Skeleton: pedantic
+Test-For:
+ package-does-not-install-examples
diff --git a/t/tests/cruft-package-does-not-install-examples/tags b/t/tests/cruft-package-does-not-install-examples/tags
new file mode 100644
index 0000000..6e5a34c
--- /dev/null
+++ b/t/tests/cruft-package-does-not-install-examples/tags
@@ -0,0 +1 @@
+P: cruft-package-does-not-install-examples source: package-does-not-install-examples examples/
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git
Reply to: