Hi Paul, > lintian: check for patches present in debian/patches/ but missing > from the series file
WIP patch attached: commit db15e28b88b6b3ab66a18cbafb2492c8568a7444 Author: Chris Lamb <la...@debian.org> Date: Sat Jan 20 21:14:59 2018 +1100 * checks/patch-systems.{desc,pm}: Check patch files under the debian/patches that are not mentioned in any series file. Thanks to Paul Wise. (Closes: #887817) checks/patch-systems.desc | 8 ++++++++ checks/patch-systems.pm | 12 ++++++++++++ debian/changelog | 3 +++ t/tests/legacy-scripts/desc | 1 + t/tests/legacy-scripts/tags | 1 + t/tests/patch-systems-dpatch-description/desc | 1 + t/tests/patch-systems-dpatch-description/tags | 1 + t/tests/patch-systems-quilt-general/desc | 1 + t/tests/patch-systems-quilt-general/tags | 2 ++ 9 files changed, 30 insertions(+) Best wishes, -- ,''`. : :' : Chris Lamb `. `'` la...@debian.org / chris-lamb.co.uk `-
>From db15e28b88b6b3ab66a18cbafb2492c8568a7444 Mon Sep 17 00:00:00 2001 From: Chris Lamb <la...@debian.org> Date: Sat, 20 Jan 2018 21:14:59 +1100 Subject: [PATCH] * checks/patch-systems.{desc,pm}: Check patch files under the debian/patches that are not mentioned in any series file. Thanks to Paul Wise, (Closes: #887817) --- checks/patch-systems.desc | 8 ++++++++ checks/patch-systems.pm | 12 ++++++++++++ debian/changelog | 3 +++ t/tests/legacy-scripts/desc | 1 + t/tests/legacy-scripts/tags | 1 + t/tests/patch-systems-dpatch-description/desc | 1 + t/tests/patch-systems-dpatch-description/tags | 1 + t/tests/patch-systems-quilt-general/desc | 1 + t/tests/patch-systems-quilt-general/tags | 2 ++ 9 files changed, 30 insertions(+) diff --git a/checks/patch-systems.desc b/checks/patch-systems.desc index 475355496..9f387f99d 100644 --- a/checks/patch-systems.desc +++ b/checks/patch-systems.desc @@ -194,3 +194,11 @@ Info: This package build-depends on a patch system such as dpatch or can refer to <tt>/usr/share/doc/dpatch/README.source.gz</tt> for dpatch. Ref: policy 4.14 +Tag: patch-file-present-but-not-mentioned-in-series +Severity: normal +Certainty: certain +Info: The specified patch is present under the <tt>debian/patches<tt> + directory but is not mentioned in any "series" file. + . + This may mean that a patch was created with the intention of modifying + the package but is not being applied diff --git a/checks/patch-systems.pm b/checks/patch-systems.pm index 24cc2b6c8..7a4464990 100644 --- a/checks/patch-systems.pm +++ b/checks/patch-systems.pm @@ -48,6 +48,7 @@ sub run { return if not $droot; my $dpdir = $droot->resolve_path('patches'); my $patch_series; + my %patches_seen; # Find debian/patches/series, assuming debian/patches is a (symlink to a) # dir. There are cases, where it is a file (ctwm: #778556) @@ -99,6 +100,7 @@ sub run { # Check each patch. foreach my $patch_name (@patches) { + $patches_seen{$patch_name}++; my $patch_file = $dpdir->child($patch_name); $patch_file = $dpdir->child("${patch_name}.dpatch") if not $patch_file; @@ -164,6 +166,7 @@ sub run { # Check each patch. foreach my $patch_filename (@patches) { + $patches_seen{$patch_filename}++; my $patch = $dpdir->resolve_path($patch_filename); if (not $patch or not $patch->is_file) { tag 'quilt-series-references-non-existent-patch', @@ -244,6 +247,15 @@ sub run { tag 'direct-changes-in-diff-but-no-patch-system', $files if (not $uses_patch_system); } + + foreach my $file ($info->sorted_index) { + next if $file =~ m{/\.?series$}; + next if $file =~ m{/00(list|options)(\..+)?$}; + next unless $file->is_file; + next unless $file =~ m{^debian/patches/(?<name>.+)$}; + next if defined $patches_seen{$+{name}}; + tag 'patch-file-present-but-not-mentioned-in-series', $+{name}; + } return; } diff --git a/debian/changelog b/debian/changelog index 18d0afe61..08ef651ca 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,9 @@ lintian (2.5.71) UNRELEASED; urgency=medium * checks/files.pm: + [CL] Ignore Rust .rs files in extra-license-file. (Closes: #887715) + * checks/patch-systems.{desc,pm}: + + [CL] Check patch files under the debian/patches that are not + mentioned in any series file. Thanks to Paul Wise, (Closes: #887817) * checks/python.{desc,pm}: + [CL] Don't emit "python-package-missing-depends-on-python" for debug packages diff --git a/t/tests/legacy-scripts/desc b/t/tests/legacy-scripts/desc index 3a241c965..e91ece10a 100644 --- a/t/tests/legacy-scripts/desc +++ b/t/tests/legacy-scripts/desc @@ -53,6 +53,7 @@ Test-For: package-installs-python-bytecode package-uses-debhelper-but-lacks-build-depends package-uses-deprecated-debhelper-compat-version + patch-file-present-but-not-mentioned-in-series patch-system-but-no-source-readme php-script-but-no-php-cli-dep php-script-with-unusual-interpreter diff --git a/t/tests/legacy-scripts/tags b/t/tests/legacy-scripts/tags index aba9fddf1..6f63d5edd 100644 --- a/t/tests/legacy-scripts/tags +++ b/t/tests/legacy-scripts/tags @@ -50,6 +50,7 @@ W: scripts source: debian-watch-file-should-use-sf-redirector line 8 W: scripts source: debian-watch-file-specifies-old-upstream-version 5 line 8 W: scripts source: debian-watch-file-uses-deprecated-sf-redirector-method line 5 W: scripts source: package-uses-deprecated-debhelper-compat-version 1 +W: scripts source: patch-file-present-but-not-mentioned-in-series 03_specified_without_dpatch.dpatch W: scripts source: patch-system-but-no-source-readme W: scripts source: source-nmu-has-incorrect-version-number 6ds-1ubuntu0.5.10.1 W: scripts: binary-without-manpage usr/bin/envfoo diff --git a/t/tests/patch-systems-dpatch-description/desc b/t/tests/patch-systems-dpatch-description/desc index dab83a64c..48e8ed016 100644 --- a/t/tests/patch-systems-dpatch-description/desc +++ b/t/tests/patch-systems-dpatch-description/desc @@ -5,3 +5,4 @@ Extra-Build-Depends: dpatch Test-For: dpatch-index-references-non-existent-patch dpatch-missing-description + patch-file-present-but-not-mentioned-in-series diff --git a/t/tests/patch-systems-dpatch-description/tags b/t/tests/patch-systems-dpatch-description/tags index 518f640c9..d2e60e8b2 100644 --- a/t/tests/patch-systems-dpatch-description/tags +++ b/t/tests/patch-systems-dpatch-description/tags @@ -3,3 +3,4 @@ E: patch-systems-dpatch-description source: dpatch-index-references-non-existent E: patch-systems-dpatch-description source: dpatch-index-references-non-existent-patch 01_some_other_patch_thats_not_in_the_package.dpatch I: patch-systems-dpatch-description source: dpatch-missing-description 02_i_dont_have_a_description.patch I: patch-systems-dpatch-description source: dpatch-missing-description 04_i_dont_have_a_description_either.patch +W: patch-systems-dpatch-description source: patch-file-present-but-not-mentioned-in-series 03_specified_without_dpatch.dpatch diff --git a/t/tests/patch-systems-quilt-general/desc b/t/tests/patch-systems-quilt-general/desc index e50984249..b002a8a1e 100644 --- a/t/tests/patch-systems-quilt-general/desc +++ b/t/tests/patch-systems-quilt-general/desc @@ -10,3 +10,4 @@ Test-For: patch-system-but-direct-changes-in-diff quilt-patch-with-non-standard-options quilt-series-references-non-existent-patch + patch-file-present-but-not-mentioned-in-series diff --git a/t/tests/patch-systems-quilt-general/tags b/t/tests/patch-systems-quilt-general/tags index 257cee662..da539386a 100644 --- a/t/tests/patch-systems-quilt-general/tags +++ b/t/tests/patch-systems-quilt-general/tags @@ -4,5 +4,7 @@ E: patch-systems-quilt-general source: quilt-series-references-non-existent-patc E: patch-systems-quilt-general source: quilt-series-references-non-existent-patch some-nonexistent-patch W: patch-systems-quilt-general source: dpatch-build-dep-but-no-patch-list W: patch-systems-quilt-general source: more-than-one-patch-system +W: patch-systems-quilt-general source: patch-file-present-but-not-mentioned-in-series file-not-referenced-in-series +W: patch-systems-quilt-general source: patch-file-present-but-not-mentioned-in-series subdir/file-not-referenced-in-series W: patch-systems-quilt-general source: patch-system-but-direct-changes-in-diff README W: patch-systems-quilt-general source: quilt-patch-with-non-standard-options some-other-file -- 2.15.1